All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] vnc linesize
Date: Wed, 19 Mar 2008 17:24:34 +0000	[thread overview]
Message-ID: <47E14C52.3040300@eu.citrix.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

Hi all,
the patch I am attaching enables buffer sharing for vnc when the 
linesize != width * depth.

Best Regards,

Stefano Stabellini

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

[-- Attachment #2: linesize.patch --]
[-- Type: text/x-patch, Size: 2677 bytes --]

diff -r d1e91aba2758 tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c	Wed Mar 19 12:41:48 2008 +0000
+++ b/tools/ioemu/hw/vga.c	Wed Mar 19 17:19:18 2008 +0000
@@ -1148,7 +1148,7 @@ static void vga_draw_text(VGAState *s, i
         cw != s->last_cw || cheight != s->last_ch) {
         s->last_scr_width = width * cw;
         s->last_scr_height = height * cheight;
-        dpy_resize(s->ds, s->last_scr_width, s->last_scr_height, s->last_scr_width * (depth / 8));
+        dpy_resize(s->ds, s->last_scr_width, s->last_scr_height, s->last_scr_width * (s->ds->depth / 8));
         s->last_width = width;
         s->last_height = height;
         s->last_ch = cheight;
@@ -1571,7 +1571,7 @@ static void vga_draw_graphic(VGAState *s
     vga_draw_line = vga_draw_line_table[v * NB_DEPTHS + get_depth_index(s->ds)];
     if (disp_width != s->last_width ||
         height != s->last_height) {
-        dpy_resize(s->ds, disp_width, height, disp_width * (depth / 8));
+        dpy_resize(s->ds, disp_width, height, s->line_offset);
         s->last_scr_width = disp_width;
         s->last_scr_height = height;
         s->last_width = disp_width;
diff -r d1e91aba2758 tools/ioemu/vnc.c
--- a/tools/ioemu/vnc.c	Wed Mar 19 12:41:48 2008 +0000
+++ b/tools/ioemu/vnc.c	Wed Mar 19 16:52:29 2008 +0000
@@ -369,20 +369,17 @@ static void vnc_dpy_resize(DisplayState 
     VncState *vs = ds->opaque;
     int o;
 
-    if (linesize != w * vs->depth)
-        ds->shared_buf = 0;
-
     if (!ds->shared_buf) {
         if (allocated)
-            ds->data = realloc(ds->data, w * h * vs->depth);
+            ds->data = realloc(ds->data,  h * linesize);
         else
-            ds->data = malloc(w * h * vs->depth);
+            ds->data = malloc(h * linesize);
         allocated = 1;
     } else if (allocated) {
         free(ds->data);
         allocated = 0;
     }
-    vs->old_data = realloc(vs->old_data, w * h * vs->depth);
+    vs->old_data = realloc(vs->old_data, h * linesize);
     vs->dirty_row = realloc(vs->dirty_row, h * sizeof(vs->dirty_row[0]));
     vs->update_row = realloc(vs->update_row, h * sizeof(vs->dirty_row[0]));
 
@@ -399,7 +396,7 @@ static void vnc_dpy_resize(DisplayState 
     size_changed = ds->width != w || ds->height != h;
     ds->width = w;
     ds->height = h;
-    ds->linesize = w * vs->depth;
+    ds->linesize = linesize;
     if (vs->csock != -1 && vs->has_resize && size_changed) {
         vs->width = ds->width;
         vs->height = ds->height;
@@ -2494,6 +2491,7 @@ void vnc_display_init(DisplayState *ds)
 
     vs->ds->width = 640;
     vs->ds->height = 400;
+    vs->ds->linesize = 640 * 4;
     vnc_dpy_colourdepth(vs->ds, 24);
 }
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

             reply	other threads:[~2008-03-19 17:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-19 17:24 Stefano Stabellini [this message]
2008-03-20 17:31 ` [PATCH] vnc linesize Alex Williamson
2008-03-20 18:06   ` Alex Williamson
2008-03-20 18:16     ` Keir Fraser
2008-03-20 18:14   ` Stefano Stabellini
2008-03-20 18:23     ` Alex Williamson
2008-03-20 18:26       ` Stefano Stabellini
2008-03-20 18:23     ` Keir Fraser

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=47E14C52.3040300@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.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.