All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xenfb shared buffer
@ 2009-03-03 18:04 Stefano Stabellini
  2009-03-04  7:49 ` Gerd Hoffmann
  0 siblings, 1 reply; 4+ messages in thread
From: Stefano Stabellini @ 2009-03-03 18:04 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Gerd Hoffmann

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@eu.citrix.com>

---

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;
     }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-04 12:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-03 18:04 [PATCH] xenfb shared buffer Stefano Stabellini
2009-03-04  7:49 ` Gerd Hoffmann
2009-03-04 12:10   ` Stefano Stabellini
2009-03-04 12:32     ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.