[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] ioemu: improve colordepth negotiation



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1204637407 0
# Node ID 2909b03e05de48c39defaf05e4555f29a3e454e2
# Parent  166995f1d5881fbbf435716de207763ba76dfef9
ioemu: improve colordepth negotiation

By moving the colourdepth callback a bit earlier, we can let the
display decide the actual depth to be used before the draw and whether
sharing is possible or not.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
 tools/ioemu/hw/vga.c   |   39 +++++++++++++++++++++++----------------
 tools/ioemu/hw/xenfb.c |   14 +++++++++++---
 2 files changed, 34 insertions(+), 19 deletions(-)

diff -r 166995f1d588 -r 2909b03e05de tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c      Tue Mar 04 13:29:36 2008 +0000
+++ b/tools/ioemu/hw/vga.c      Tue Mar 04 13:30:07 2008 +0000
@@ -1061,6 +1061,10 @@ static const uint8_t cursor_glyph[32 * 4
     0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
 };    
 
+typedef unsigned int rgb_to_pixel_dup_func(unsigned int r, unsigned int g, 
unsigned b);
+
+static rgb_to_pixel_dup_func *rgb_to_pixel_dup_table[NB_DEPTHS];
+
 /* 
  * Text mode update 
  * Missing:
@@ -1081,6 +1085,12 @@ static void vga_draw_text(VGAState *s, i
     uint32_t *ch_attr_ptr;
     vga_draw_glyph8_func *vga_draw_glyph8;
     vga_draw_glyph9_func *vga_draw_glyph9;
+
+    depth = s->get_bpp(s);
+    if (s->ds->dpy_colourdepth != NULL && s->ds->depth != depth)
+        s->ds->dpy_colourdepth(s->ds, depth);
+    s->rgb_to_pixel = 
+        rgb_to_pixel_dup_table[get_depth_index(s->ds)];
 
     full_update |= update_palette16(s);
     palette = s->last_palette;
@@ -1134,9 +1144,6 @@ static void vga_draw_text(VGAState *s, i
         return;
     }
 
-    depth = s->get_bpp(s);
-    if (s->ds->dpy_colourdepth != NULL && s->ds->depth != depth)
-        s->ds->dpy_colourdepth(s->ds, depth);
     if (width != s->last_width || height != s->last_height ||
         cw != s->last_cw || cheight != s->last_ch) {
         s->last_scr_width = width * cw;
@@ -1319,8 +1326,6 @@ static vga_draw_line_func *vga_draw_line
     vga_draw_line32_32bgr,
 };
 
-typedef unsigned int rgb_to_pixel_dup_func(unsigned int r, unsigned int g, 
unsigned b);
-
 static rgb_to_pixel_dup_func *rgb_to_pixel_dup_table[NB_DEPTHS] = {
     rgb_to_pixel8_dup,
     rgb_to_pixel15_dup,
@@ -1494,6 +1499,16 @@ static void vga_draw_graphic(VGAState *s
     s->get_resolution(s, &width, &height);
     disp_width = width;
 
+    changed_flag = 0;
+    depth = s->get_bpp(s);
+    if (s->ds->dpy_colourdepth != NULL && 
+            (s->ds->depth != depth || !s->ds->shared_buf)) {
+        s->ds->dpy_colourdepth(s->ds, depth);
+        changed_flag = 1;
+    }
+    s->rgb_to_pixel = 
+        rgb_to_pixel_dup_table[get_depth_index(s->ds)];
+
     shift_control = (s->gr[0x05] >> 5) & 3;
     double_scan = (s->cr[0x09] >> 7);
     if (shift_control != 1) {
@@ -1552,15 +1567,8 @@ static void vga_draw_graphic(VGAState *s
             break;
         }
     }
+
     vga_draw_line = vga_draw_line_table[v * NB_DEPTHS + 
get_depth_index(s->ds)];
-
-    changed_flag = 0;
-    depth = s->get_bpp(s);
-    if (s->ds->dpy_colourdepth != NULL && 
-            (s->ds->depth != depth || !s->ds->shared_buf)) {
-        s->ds->dpy_colourdepth(s->ds, depth);
-        changed_flag = 1;
-    }
     if (disp_width != s->last_width ||
         height != s->last_height) {
         dpy_resize(s->ds, disp_width, height);
@@ -1673,6 +1681,8 @@ static void vga_draw_blank(VGAState *s, 
         return;
     if (s->last_scr_width <= 0 || s->last_scr_height <= 0)
         return;
+    s->rgb_to_pixel = 
+        rgb_to_pixel_dup_table[get_depth_index(s->ds)];
     if (s->ds->depth == 8) 
         val = s->rgb_to_pixel(0, 0, 0);
     else
@@ -1699,9 +1709,6 @@ static void vga_update_display(void *opa
     if (s->ds->depth == 0) {
         /* nothing to do */
     } else {
-        s->rgb_to_pixel = 
-            rgb_to_pixel_dup_table[get_depth_index(s->ds)];
-        
         full_update = 0;
         if (!(s->ar_index & 0x20)) {
             graphic_mode = GMODE_BLANK;
diff -r 166995f1d588 -r 2909b03e05de tools/ioemu/hw/xenfb.c
--- a/tools/ioemu/hw/xenfb.c    Tue Mar 04 13:29:36 2008 +0000
+++ b/tools/ioemu/hw/xenfb.c    Tue Mar 04 13:30:07 2008 +0000
@@ -1238,10 +1238,16 @@ static void xenfb_pv_resize(DisplayState
     fbfront_update(fb_dev, 0, 0, WIDTH, HEIGHT);
 }
 
-static void xenfb_pv_colourdepth(DisplayState *s, int depth)
+static void xenfb_pv_colourdepth(DisplayState *ds, int depth)
 {
     /* TODO: send redepth event if supported */
-    fprintf(stderr,"redepth to %d required\n", depth);
+    static int lastdepth = -1;
+    if (depth != lastdepth) {
+        fprintf(stderr,"redepth to %d required\n", depth);
+        lastdepth = depth;
+    }
+    /* We can't redepth for now */
+    ds->depth = DEPTH;
 }
 
 static void xenfb_kbd_handler(void *opaque)
@@ -1334,6 +1340,8 @@ static void xenfb_kbd_handler(void *opaq
 
 static void xenfb_pv_refresh(DisplayState *ds)
 {
+    /* always request negociation */
+    ds->depth = -1;
     vga_hw_update();
 }
 
@@ -1387,7 +1395,7 @@ int xenfb_pv_display_init(DisplayState *
     ds->height = HEIGHT;
     ds->dpy_update = xenfb_pv_update;
     ds->dpy_resize = xenfb_pv_resize;
-    ds->dpy_colourdepth = NULL; //xenfb_pv_colourdepth;
+    ds->dpy_colourdepth = xenfb_pv_colourdepth;
     ds->dpy_refresh = xenfb_pv_refresh;
     ds->opaque = fb_dev;
     return 0;

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.