WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] xenfb shared buffer

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] xenfb shared buffer
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Tue, 03 Mar 2009 18:04:04 +0000
Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>
Delivery-date: Tue, 03 Mar 2009 10:04:35 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.14 (X11/20080505)
After the recent DisplayState changes is now possible to share the xenfb
backend buffer with the display frontend (sdl, vnc), avoid a memcpy for
each screen update.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

---

diff -r f73b2e267fa4 hw/xenfb.c
--- a/hw/xenfb.c        Mon Mar 02 16:06:43 2009 +0000
+++ b/hw/xenfb.c        Tue Mar 03 17:53:46 2009 +0000
@@ -595,14 +595,7 @@
 {
     int line;
 
-    /*
-     * TODO: xen's qemu-dm seems to have some patches to
-     *       make the qemu display code avoid unneeded
-     *       work.
-     *        - Port them over.
-     *        - Put ds->shared_buf back into use then.
-     */
-    if (1 /* !xenfb->c.ds->shared_buf */) {
+    if (!is_buffer_shared(xenfb->c.ds->surface)) {
        if (xenfb->depth == ds_get_bits_per_pixel(xenfb->c.ds)) { /* Perfect 
match can use fast path */
            for (line = y ; line < (y+h) ; line++) {
                memcpy(ds_get_data(xenfb->c.ds) + (line * 
ds_get_linesize(xenfb->c.ds)) + (x * ds_get_bytes_per_pixel(xenfb->c.ds)),
@@ -735,10 +728,30 @@
     }
 
     /* resize if needed */
-    if (xenfb->width != ds_get_width(xenfb->c.ds) || xenfb->height != 
ds_get_height(xenfb->c.ds)) {
+    if (xenfb->width != ds_get_width(xenfb->c.ds) ||
+        xenfb->height != ds_get_height(xenfb->c.ds) ||
+        xenfb->depth != ds_get_bits_per_pixel(xenfb->c.ds) ||
+        xenfb->row_stride != ds_get_linesize(xenfb->c.ds) ||
+        xenfb->pixels + xenfb->offset != ds_get_data(xenfb->c.ds)) {
+        switch (xenfb->depth) {
+        case 16:
+        case 32:
+            /* console.c supported depth -> buffer can be used directly */
+            qemu_free_displaysurface(xenfb->c.ds);
+            xenfb->c.ds->surface = qemu_create_displaysurface_from
+                (xenfb->width, xenfb->height, xenfb->depth,
+                 xenfb->row_stride, xenfb->pixels + xenfb->offset);
+            dpy_resize(xenfb->c.ds);
+            break;
+        default:
+            /* we must convert stuff */
+            qemu_resize_displaysurface(xenfb->c.ds,
+                                       xenfb->width, xenfb->height,
+                                       xenfb->depth, xenfb->row_stride);
+            break;
+        }
         xen_be_printf(&xenfb->c.xendev, 1, "update: resizing: %dx%d\n",
                       xenfb->width, xenfb->height);
-        qemu_console_resize(xenfb->c.ds, xenfb->width, xenfb->height);
         xenfb->up_fullscreen = 1;
     }
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>