[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 07/14] vga: Remove rgb_to_pixel indirection
From: |
Benjamin Herrenschmidt |
Subject: |
[Qemu-devel] [RFC 07/14] vga: Remove rgb_to_pixel indirection |
Date: |
Tue, 24 Jun 2014 09:11:01 +1000 |
We always use rgb_to_pixel32 nowadays.
Signed-off-by: Benjamin Herrenschmidt <address@hidden>
---
hw/display/cirrus_vga.c | 15 +++++++++------
hw/display/vga.c | 31 ++++++++++---------------------
hw/display/vga_int.h | 2 --
3 files changed, 19 insertions(+), 29 deletions(-)
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 6fbe39d..ec465e3 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -29,6 +29,7 @@
#include "hw/hw.h"
#include "hw/pci/pci.h"
#include "ui/console.h"
+#include "ui/pixel_ops.h"
#include "vga_int.h"
#include "hw/loader.h"
@@ -2212,6 +2213,8 @@ static void cirrus_cursor_draw_line(VGACommonState *s1,
uint8_t *d1, int scr_y)
} else {
src += (s->vga.sr[0x13] & 0x3f) * 256;
src += (scr_y - s->hw_cursor_y) * 4;
+
+
poffset = 128;
content = ((uint32_t *)src)[0] |
((uint32_t *)(src + 128))[0];
@@ -2229,12 +2232,12 @@ static void cirrus_cursor_draw_line(VGACommonState *s1,
uint8_t *d1, int scr_y)
x2 = s->vga.last_scr_width;
w = x2 - x1;
palette = s->cirrus_hidden_palette;
- color0 = s->vga.rgb_to_pixel(c6_to_8(palette[0x0 * 3]),
- c6_to_8(palette[0x0 * 3 + 1]),
- c6_to_8(palette[0x0 * 3 + 2]));
- color1 = s->vga.rgb_to_pixel(c6_to_8(palette[0xf * 3]),
- c6_to_8(palette[0xf * 3 + 1]),
- c6_to_8(palette[0xf * 3 + 2]));
+ color0 = rgb_to_pixel32(c6_to_8(palette[0x0 * 3]),
+ c6_to_8(palette[0x0 * 3 + 1]),
+ c6_to_8(palette[0x0 * 3 + 2]));
+ color1 = rgb_to_pixel32(c6_to_8(palette[0xf * 3]),
+ c6_to_8(palette[0xf * 3 + 1]),
+ c6_to_8(palette[0xf * 3 + 2]));
bpp = surface_bytes_per_pixel(surface);
d1 += x1 * bpp;
switch (surface_bits_per_pixel(surface)) {
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 198e192..70405e6 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -979,13 +979,6 @@ typedef void vga_draw_line_func(VGACommonState *s1,
uint8_t *d,
#include "vga_template.h"
-static unsigned int rgb_to_pixel32_dup(unsigned int r, unsigned int g,
unsigned b)
-{
- unsigned int col;
- col = rgb_to_pixel32(r, g, b);
- return col;
-}
-
/* return true if the palette was modified */
static int update_palette16(VGACommonState *s)
{
@@ -1002,9 +995,9 @@ static int update_palette16(VGACommonState *s)
v = ((s->ar[VGA_ATC_COLOR_PAGE] & 0xc) << 4) | (v & 0x3f);
}
v = v * 3;
- col = s->rgb_to_pixel(c6_to_8(s->palette[v]),
- c6_to_8(s->palette[v + 1]),
- c6_to_8(s->palette[v + 2]));
+ col = rgb_to_pixel32(c6_to_8(s->palette[v]),
+ c6_to_8(s->palette[v + 1]),
+ c6_to_8(s->palette[v + 2]));
if (col != palette[i]) {
full_update = 1;
palette[i] = col;
@@ -1024,13 +1017,13 @@ static int update_palette256(VGACommonState *s)
v = 0;
for(i = 0; i < 256; i++) {
if (s->dac_8bit) {
- col = s->rgb_to_pixel(s->palette[v],
- s->palette[v + 1],
- s->palette[v + 2]);
+ col = rgb_to_pixel32(s->palette[v],
+ s->palette[v + 1],
+ s->palette[v + 2]);
} else {
- col = s->rgb_to_pixel(c6_to_8(s->palette[v]),
- c6_to_8(s->palette[v + 1]),
- c6_to_8(s->palette[v + 2]));
+ col = rgb_to_pixel32(c6_to_8(s->palette[v]),
+ c6_to_8(s->palette[v + 1]),
+ c6_to_8(s->palette[v + 2]));
}
if (col != palette[i]) {
full_update = 1;
@@ -1213,7 +1206,6 @@ static void vga_draw_text(VGACommonState *s, int
full_update)
s->last_cw = cw;
full_update = 1;
}
- s->rgb_to_pixel = rgb_to_pixel32_dup;
full_update |= update_palette16(s);
palette = s->last_palette;
x_incr = cw * surface_bytes_per_pixel(surface);
@@ -1505,8 +1497,6 @@ static void vga_draw_graphic(VGACommonState *s, int
full_update)
dpy_gfx_replace_surface(s->con, surface);
}
- s->rgb_to_pixel = rgb_to_pixel32_dup;
-
if (shift_control == 0) {
full_update |= update_palette16(s);
if (s->sr[VGA_SEQ_CLOCK_MODE] & 8) {
@@ -1657,9 +1647,8 @@ static void vga_draw_blank(VGACommonState *s, int
full_update)
if (s->last_scr_width <= 0 || s->last_scr_height <= 0)
return;
- s->rgb_to_pixel = rgb_to_pixel32_dup;
if (surface_bits_per_pixel(surface) == 8) {
- val = s->rgb_to_pixel(0, 0, 0);
+ val = rgb_to_pixel32(0, 0, 0);
} else {
val = 0;
}
diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
index 5320abd..14e777a 100644
--- a/hw/display/vga_int.h
+++ b/hw/display/vga_int.h
@@ -152,8 +152,6 @@ typedef struct VGACommonState {
bool cursor_visible_phase;
int64_t cursor_blink_time;
uint32_t cursor_offset;
- unsigned int (*rgb_to_pixel)(unsigned int r,
- unsigned int g, unsigned b);
const GraphicHwOps *hw_ops;
bool full_update_text;
bool full_update_gfx;
--
1.9.1
- [Qemu-devel] [RFC 00/14] VGA cleanups and endian control, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 09/14] cirrus: Remove non-32bpp cursor drawing, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 01/14] vga: Create direct sufaces for depth 24 too, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 04/14] vga: Remove remainder of old conversion cruft, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 06/14] vga: 15 and 16bpp draw functions are "swapping" only, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 03/14] vga: Start cutting out non-32bpp conversion support, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 08/14] vga: Simplify vga_draw_blank() a bit, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 10/14] vga: Remove some "should be done in BIOS" comments, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 07/14] vga: Remove rgb_to_pixel indirection,
Benjamin Herrenschmidt <=
- [Qemu-devel] [RFC 13/14] vga: Add endian control register, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 12/14] vga: Rename vga_template.h to vga-helpers.h, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 05/14] vga: Remove unused vga_draw_line24() and vga_draw_line32(), Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 11/14] vga: Make fb endian a common state variable, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 14/14] ppc/spapr/vga: Switch VGA endian on H_SET_MODE, Benjamin Herrenschmidt, 2014/06/23