Skip to content

Commit bf9ac62

Browse files
zbalatonelmarco
authored andcommitted
ati-vga: Add 30 bit palette access register
Radeon cards have a 30 bit DAC and corresponding palette register to access it. We only use 8 bits but let the guests use 10 bit color values for those that access it through this register. Signed-off-by: BALATON Zoltan <[email protected]> Reviewed-by: Marc-André Lureau <[email protected]> Message-ID: <9fa19eec95d1563cc65853cf26912f230c702b32.1698871239.git.balaton@eik.bme.hu>
1 parent e876b34 commit bf9ac62

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

hw/display/ati.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,9 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr, unsigned int size)
339339
case PALETTE_DATA:
340340
val = vga_ioport_read(&s->vga, VGA_PEL_D);
341341
break;
342+
case PALETTE_30_DATA:
343+
val = s->regs.palette[vga_ioport_read(&s->vga, VGA_PEL_IR)];
344+
break;
342345
case CNFG_CNTL:
343346
val = s->regs.config_cntl;
344347
break;
@@ -673,6 +676,12 @@ static void ati_mm_write(void *opaque, hwaddr addr,
673676
data >>= 8;
674677
vga_ioport_write(&s->vga, VGA_PEL_D, data & 0xff);
675678
break;
679+
case PALETTE_30_DATA:
680+
s->regs.palette[vga_ioport_read(&s->vga, VGA_PEL_IW)] = data;
681+
vga_ioport_write(&s->vga, VGA_PEL_D, (data >> 22) & 0xff);
682+
vga_ioport_write(&s->vga, VGA_PEL_D, (data >> 12) & 0xff);
683+
vga_ioport_write(&s->vga, VGA_PEL_D, (data >> 2) & 0xff);
684+
break;
676685
case CNFG_CNTL:
677686
s->regs.config_cntl = data;
678687
break;

hw/display/ati_dbg.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ static struct ati_regdesc ati_reg_names[] = {
3030
{"AMCGPIO_EN_MIR", 0x00a8},
3131
{"PALETTE_INDEX", 0x00b0},
3232
{"PALETTE_DATA", 0x00b4},
33+
{"PALETTE_30_DATA", 0x00b8},
3334
{"CNFG_CNTL", 0x00e0},
3435
{"GEN_RESET_CNTL", 0x00f0},
3536
{"CNFG_MEMSIZE", 0x00f8},

hw/display/ati_int.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ typedef struct ATIVGARegs {
4444
uint32_t gpio_dvi_ddc;
4545
uint32_t gpio_monid;
4646
uint32_t config_cntl;
47+
uint32_t palette[256];
4748
uint32_t crtc_h_total_disp;
4849
uint32_t crtc_h_sync_strt_wid;
4950
uint32_t crtc_v_total_disp;

hw/display/ati_regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#define AMCGPIO_EN_MIR 0x00a8
4949
#define PALETTE_INDEX 0x00b0
5050
#define PALETTE_DATA 0x00b4
51+
#define PALETTE_30_DATA 0x00b8
5152
#define CNFG_CNTL 0x00e0
5253
#define GEN_RESET_CNTL 0x00f0
5354
#define CNFG_MEMSIZE 0x00f8

0 commit comments

Comments
 (0)