summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-15 22:07:16 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-15 22:07:16 +0000
commit8927bcfd339510deedb89ff274ea9cd1d00a2668 (patch)
tree2a23e99e3cc6cdef2f5d2b18f4a35fac44645f73
parent9fd8d8d70db785c7a18fe6788a66dcf1c095a7ad (diff)
downloadqemu-8927bcfd339510deedb89ff274ea9cd1d00a2668.tar.gz
remove bgr (Stefano Stabellini)
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. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6335 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--console.h5
-rw-r--r--hw/musicpal.c2
-rw-r--r--hw/sm501.c21
-rw-r--r--hw/tcx.c23
-rw-r--r--hw/vga.c15
-rw-r--r--sdl.c5
6 files changed, 20 insertions, 51 deletions
diff --git a/console.h b/console.h
index 6ee40cc2a5..9d4edee5c1 100644
--- a/console.h
+++ b/console.h
@@ -139,6 +139,11 @@ static inline int ds_get_bits_per_pixel(DisplayState *ds)
return ds->depth;
}
+static inline int ds_get_bytes_per_pixel(DisplayState *ds)
+{
+ return (ds->depth / 8);
+}
+
typedef unsigned long console_ch_t;
static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
{
diff --git a/hw/musicpal.c b/hw/musicpal.c
index f64bb1c89f..fc4b470808 100644
--- a/hw/musicpal.c
+++ b/hw/musicpal.c
@@ -829,7 +829,7 @@ static void lcd_refresh(void *opaque)
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 --git a/hw/sm501.c b/hw/sm501.c
index 0d6b08b84c..0dfd08a664 100644
--- a/hw/sm501.c
+++ b/hw/sm501.c
@@ -940,25 +940,16 @@ static draw_line_func * draw_line32_funcs[] = {
static inline int get_depth_index(DisplayState *s)
{
- switch(s->depth) {
+ switch(ds_get_bits_per_pixel(s)) {
default:
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;
}
}
@@ -970,7 +961,7 @@ static void sm501_draw_crt(SM501State * s)
uint8_t * src = s->local_mem;
int src_bpp = 0;
- int dst_bpp = s->ds->depth / 8 + (s->ds->depth % 8 ? 1 : 0);
+ int dst_bpp = ds_get_bytes_per_pixel(s->ds) + (ds_get_bits_per_pixel(s->ds) % 8 ? 1 : 0);
uint32_t * palette = (uint32_t *)&s->dc_palette[SM501_DC_CRT_PALETTE
- SM501_DC_PANEL_PALETTE];
int ds_depth_index = get_depth_index(s->ds);
@@ -1024,7 +1015,7 @@ static void sm501_draw_crt(SM501State * s)
/* draw line and change status */
if (update) {
- draw_line(&s->ds->data[y * width * dst_bpp], src, width, palette);
+ draw_line(&(ds_get_data(s->ds)[y * width * dst_bpp]), src, width, palette);
if (y_start < 0)
y_start = y;
if (page0 < page_min)
diff --git a/hw/tcx.c b/hw/tcx.c
index 004685bc2b..4d9f527a2f 100644
--- a/hw/tcx.c
+++ b/hw/tcx.c
@@ -61,22 +61,13 @@ static void update_palette_entries(TCXState *s, int start, int end)
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 @@ static inline void tcx24_draw_line32(TCXState *s1, uint8_t *d,
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 @@ static inline void tcx24_draw_line32(TCXState *s1, uint8_t *d,
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 --git a/hw/vga.c b/hw/vga.c
index bf84c246ed..ce8ca45956 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -1157,20 +1157,11 @@ static inline int get_depth_index(DisplayState *s)
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 --git a/sdl.c b/sdl.c
index 2ce6e81522..67aba76bd7 100644
--- a/sdl.c
+++ b/sdl.c
@@ -100,11 +100,6 @@ static void sdl_resize(DisplayState *ds, int w, int h)
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;
}