mirror of https://gitee.com/openkylin/qemu.git
cirrus_vga: rename cirrus_hook_read_palette() cirrus_vga_read_palette()
Simplify the logic to do everything inside the function Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
31c63201c9
commit
5deaeee32f
|
@ -1419,18 +1419,21 @@ static void cirrus_write_hidden_dac(CirrusVGAState * s, int reg_value)
|
||||||
*
|
*
|
||||||
***************************************/
|
***************************************/
|
||||||
|
|
||||||
static int cirrus_hook_read_palette(CirrusVGAState * s, int *reg_value)
|
static int cirrus_vga_read_palette(CirrusVGAState * s)
|
||||||
{
|
{
|
||||||
if (!(s->vga.sr[0x12] & CIRRUS_CURSOR_HIDDENPEL))
|
int val;
|
||||||
return CIRRUS_HOOK_NOT_HANDLED;
|
|
||||||
*reg_value =
|
if ((s->vga.sr[0x12] & CIRRUS_CURSOR_HIDDENPEL)) {
|
||||||
s->cirrus_hidden_palette[(s->vga.dac_read_index & 0x0f) * 3 +
|
val = s->cirrus_hidden_palette[(s->vga.dac_read_index & 0x0f) * 3 +
|
||||||
s->vga.dac_sub_index];
|
s->vga.dac_sub_index];
|
||||||
|
} else {
|
||||||
|
val = s->vga.palette[s->vga.dac_read_index * 3 + s->vga.dac_sub_index];
|
||||||
|
}
|
||||||
if (++s->vga.dac_sub_index == 3) {
|
if (++s->vga.dac_sub_index == 3) {
|
||||||
s->vga.dac_sub_index = 0;
|
s->vga.dac_sub_index = 0;
|
||||||
s->vga.dac_read_index++;
|
s->vga.dac_read_index++;
|
||||||
}
|
}
|
||||||
return CIRRUS_HOOK_HANDLED;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cirrus_hook_write_palette(CirrusVGAState * s, int reg_value)
|
static int cirrus_hook_write_palette(CirrusVGAState * s, int reg_value)
|
||||||
|
@ -2698,13 +2701,7 @@ static uint32_t cirrus_vga_ioport_read(void *opaque, uint32_t addr)
|
||||||
c->cirrus_hidden_dac_lockindex = 0;
|
c->cirrus_hidden_dac_lockindex = 0;
|
||||||
break;
|
break;
|
||||||
case 0x3c9:
|
case 0x3c9:
|
||||||
if (cirrus_hook_read_palette(c, &val))
|
val = cirrus_vga_read_palette(c);
|
||||||
break;
|
|
||||||
val = s->palette[s->dac_read_index * 3 + s->dac_sub_index];
|
|
||||||
if (++s->dac_sub_index == 3) {
|
|
||||||
s->dac_sub_index = 0;
|
|
||||||
s->dac_read_index++;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 0x3ca:
|
case 0x3ca:
|
||||||
val = s->fcr;
|
val = s->fcr;
|
||||||
|
|
Loading…
Reference in New Issue