All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel <xen-devel@lists.xensource.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH] xenfb shared buffer
Date: Tue, 03 Mar 2009 18:04:04 +0000	[thread overview]
Message-ID: <49AD7114.2080002@eu.citrix.com> (raw)

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

             reply	other threads:[~2009-03-03 18:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-03 18:04 Stefano Stabellini [this message]
2009-03-04  7:49 ` [PATCH] xenfb shared buffer Gerd Hoffmann
2009-03-04 12:10   ` Stefano Stabellini
2009-03-04 12:32     ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49AD7114.2080002@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=kraxel@redhat.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.