qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 18/23] cirrus_vga: rename cirrus_hook_write_palette(


From: Juan Quintela
Subject: [Qemu-devel] [PATCH 18/23] cirrus_vga: rename cirrus_hook_write_palette() cirrus_vga_write_palette()
Date: Mon, 31 Aug 2009 16:07:28 +0200

Simplify the logic to do everything inside the function

Signed-off-by: Juan Quintela <address@hidden>
---
 hw/cirrus_vga.c |   24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index 4c75569..d3dd2ad 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -1436,19 +1436,20 @@ static int cirrus_vga_read_palette(CirrusVGAState * s)
     return val;
 }

-static int cirrus_hook_write_palette(CirrusVGAState * s, int reg_value)
+static void cirrus_vga_write_palette(CirrusVGAState * s, int reg_value)
 {
-    if (!(s->vga.sr[0x12] & CIRRUS_CURSOR_HIDDENPEL))
-       return CIRRUS_HOOK_NOT_HANDLED;
     s->vga.dac_cache[s->vga.dac_sub_index] = reg_value;
     if (++s->vga.dac_sub_index == 3) {
-        memcpy(&s->cirrus_hidden_palette[(s->vga.dac_write_index & 0x0f) * 3],
-               s->vga.dac_cache, 3);
+        if ((s->vga.sr[0x12] & CIRRUS_CURSOR_HIDDENPEL)) {
+            memcpy(&s->cirrus_hidden_palette[(s->vga.dac_write_index & 0x0f) * 
3],
+                   s->vga.dac_cache, 3);
+        } else {
+            memcpy(&s->vga.palette[s->vga.dac_write_index * 3], 
s->vga.dac_cache, 3);
+        }
         /* XXX update cursor */
        s->vga.dac_sub_index = 0;
        s->vga.dac_write_index++;
     }
-    return CIRRUS_HOOK_HANDLED;
 }

 /***************************************
@@ -2824,15 +2825,8 @@ static void cirrus_vga_ioport_write(void *opaque, 
uint32_t addr, uint32_t val)
        s->dac_state = 0;
        break;
     case 0x3c9:
-       if (cirrus_hook_write_palette(c, val))
-           break;
-       s->dac_cache[s->dac_sub_index] = val;
-       if (++s->dac_sub_index == 3) {
-           memcpy(&s->palette[s->dac_write_index * 3], s->dac_cache, 3);
-           s->dac_sub_index = 0;
-           s->dac_write_index++;
-       }
-       break;
+        cirrus_vga_write_palette(c, val);
+        break;
     case 0x3ce:
        s->gr_index = val;
        break;
-- 
1.6.2.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]