qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 2 of 7] [UPDATE]  remove bgr
@ 2008-11-26 17:47 Stefano Stabellini
  2008-12-02 19:26 ` Anthony Liguori
  0 siblings, 1 reply; 3+ messages in thread
From: Stefano Stabellini @ 2008-11-26 17:47 UTC (permalink / raw)
  To: qemu-devel

Do not handle bgr host displays in the backends.

Right now a bgr flag exists so that sdl can set it, if the SDL_Surface
is bgr.
Afterwards the graphic device (e.g. vga.c) does the needed conversion.

With this patch series is sdl that is responsible for rendering the format
provided by the graphic device that must provide a DisplaySurface
(ds->surface) in 16 or 32 bpp, rgb.
Afterwards sdl creates a SDL_Surface from the given DisplaySurface and
blits it into the main SDL_Surface using SDL_BlitSurface.

Everything is handled by sdl transparently, because SDL_BlitSurface is
perfectly capable of handling bgr displays by itself.

Compared to the last version few more "if (bgr)" have been removed in
hw/sm501.c.

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

---

diff -r d73bf25d1d96 hw/musicpal.c
--- a/hw/musicpal.c	Wed Nov 26 16:33:08 2008 +0000
+++ b/hw/musicpal.c	Wed Nov 26 16:34:00 2008 +0000
@@ -835,7 +835,7 @@
         break;
     LCD_REFRESH(8, rgb_to_pixel8)
     LCD_REFRESH(16, rgb_to_pixel16)
-    LCD_REFRESH(32, (s->ds->bgr ? rgb_to_pixel32bgr : rgb_to_pixel32))
+    LCD_REFRESH(32, rgb_to_pixel32)
     default:
         cpu_abort(cpu_single_env, "unsupported colour depth %i\n",
                   ds_get_bits_per_pixel(s->ds));
diff -r d73bf25d1d96 hw/sm501.c
--- a/hw/sm501.c	Wed Nov 26 16:33:08 2008 +0000
+++ b/hw/sm501.c	Wed Nov 26 16:34:00 2008 +0000
@@ -960,20 +960,11 @@
     case 8:
 	return 0;
     case 15:
-	if (s->bgr)
-	    return 5;
-	else
-	    return 1;
+        return 1;
     case 16:
-	if (s->bgr)
-	    return 6;
-	else
-	    return 2;
+        return 2;
     case 32:
-	if (s->bgr)
-	    return 4;
-	else
-	    return 3;
+        return 3;
     }
 }
 
diff -r d73bf25d1d96 hw/tcx.c
--- a/hw/tcx.c	Wed Nov 26 16:33:08 2008 +0000
+++ b/hw/tcx.c	Wed Nov 26 16:34:00 2008 +0000
@@ -61,22 +61,13 @@
             s->palette[i] = rgb_to_pixel8(s->r[i], s->g[i], s->b[i]);
             break;
         case 15:
-            if (s->ds->bgr)
-                s->palette[i] = rgb_to_pixel15bgr(s->r[i], s->g[i], s->b[i]);
-            else
-                s->palette[i] = rgb_to_pixel15(s->r[i], s->g[i], s->b[i]);
+            s->palette[i] = rgb_to_pixel15(s->r[i], s->g[i], s->b[i]);
             break;
         case 16:
-            if (s->ds->bgr)
-                s->palette[i] = rgb_to_pixel16bgr(s->r[i], s->g[i], s->b[i]);
-            else
-                s->palette[i] = rgb_to_pixel16(s->r[i], s->g[i], s->b[i]);
+            s->palette[i] = rgb_to_pixel16(s->r[i], s->g[i], s->b[i]);
             break;
         case 32:
-            if (s->ds->bgr)
-                s->palette[i] = rgb_to_pixel32bgr(s->r[i], s->g[i], s->b[i]);
-            else
-                s->palette[i] = rgb_to_pixel32(s->r[i], s->g[i], s->b[i]);
+            s->palette[i] = rgb_to_pixel32(s->r[i], s->g[i], s->b[i]);
             break;
         }
     }
@@ -134,12 +125,11 @@
                                      const uint32_t *cplane,
                                      const uint32_t *s24)
 {
-    int x, bgr, r, g, b;
+    int x, r, g, b;
     uint8_t val, *p8;
     uint32_t *p = (uint32_t *)d;
     uint32_t dval;
 
-    bgr = s1->ds->bgr;
     for(x = 0; x < width; x++, s++, s24++) {
         if ((be32_to_cpu(*cplane++) & 0xff000000) == 0x03000000) {
             // 24-bit direct, BGR order
@@ -148,10 +138,7 @@
             b = *p8++;
             g = *p8++;
             r = *p8++;
-            if (bgr)
-                dval = rgb_to_pixel32bgr(r, g, b);
-            else
-                dval = rgb_to_pixel32(r, g, b);
+            dval = rgb_to_pixel32(r, g, b);
         } else {
             val = *s;
             dval = s1->palette[val];
diff -r d73bf25d1d96 hw/vga.c
--- a/hw/vga.c	Wed Nov 26 16:33:08 2008 +0000
+++ b/hw/vga.c	Wed Nov 26 16:34:00 2008 +0000
@@ -1157,20 +1157,11 @@
     case 8:
         return 0;
     case 15:
-        if (s->bgr)
-            return 5;
-        else
-            return 1;
+        return 1;
     case 16:
-        if (s->bgr)
-            return 6;
-        else
-            return 2;
+        return 2;
     case 32:
-        if (s->bgr)
-            return 4;
-        else
-            return 3;
+        return 3;
     }
 }
 
diff -r d73bf25d1d96 sdl.c
--- a/sdl.c	Wed Nov 26 16:33:08 2008 +0000
+++ b/sdl.c	Wed Nov 26 16:34:00 2008 +0000
@@ -99,11 +99,6 @@
         mask |= screen->format->Bmask;
         if ((mask & 0x8000) == 0)
             ds->depth = 15;
-    }
-    if (ds->depth == 32 && screen->format->Rshift == 0) {
-        ds->bgr = 1;
-    } else {
-        ds->bgr = 0;
     }
     ds->width = w;
     ds->height = h;

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

* Re: [Qemu-devel] [PATCH 2 of 7] [UPDATE]  remove bgr
  2008-11-26 17:47 [Qemu-devel] [PATCH 2 of 7] [UPDATE] remove bgr Stefano Stabellini
@ 2008-12-02 19:26 ` Anthony Liguori
  2008-12-11 11:20   ` Stefano Stabellini
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony Liguori @ 2008-12-02 19:26 UTC (permalink / raw)
  To: qemu-devel

Stefano Stabellini wrote:
> Do not handle bgr host displays in the backends.
>
> Right now a bgr flag exists so that sdl can set it, if the SDL_Surface
> is bgr.
> Afterwards the graphic device (e.g. vga.c) does the needed conversion.
>
> With this patch series is sdl that is responsible for rendering the format
> provided by the graphic device that must provide a DisplaySurface
> (ds->surface) in 16 or 32 bpp, rgb.
> Afterwards sdl creates a SDL_Surface from the given DisplaySurface and
> blits it into the main SDL_Surface using SDL_BlitSurface.
>
> Everything is handled by sdl transparently, because SDL_BlitSurface is
> perfectly capable of handling bgr displays by itself.
>
> Compared to the last version few more "if (bgr)" have been removed in
> hw/sm501.c.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>   

This breaks bgr support until the additional patches, correct?

Regards,

Anthony Liguori

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

* Re: [Qemu-devel] [PATCH 2 of 7] [UPDATE]  remove bgr
  2008-12-02 19:26 ` Anthony Liguori
@ 2008-12-11 11:20   ` Stefano Stabellini
  0 siblings, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2008-12-11 11:20 UTC (permalink / raw)
  To: qemu-devel

Anthony Liguori wrote

> 
> This breaks bgr support until the additional patches, correct?
> 

Yes.

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

end of thread, other threads:[~2008-12-11 11:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-26 17:47 [Qemu-devel] [PATCH 2 of 7] [UPDATE] remove bgr Stefano Stabellini
2008-12-02 19:26 ` Anthony Liguori
2008-12-11 11:20   ` Stefano Stabellini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).