DP_GUI_MASTER_CNTL aliases several fields from DP_DATATYPE and DP_MIX.
These were being written correctly but not returned on a read of
DP_GUI_MASTER_CNTL.
Signed-off-by: Chad Jablonski <chad@jablonski.xyz>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/display/ati.c | 8 +++++++-
hw/display/ati_regs.h | 5 +++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/hw/display/ati.c b/hw/display/ati.c
index 777a6b0a2e..028efd13e1 100644
--- a/hw/display/ati.c
+++ b/hw/display/ati.c
@@ -460,7 +460,13 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr, unsigned int size)
val = s->regs.dst_y;
break;
case DP_GUI_MASTER_CNTL:
- val = s->regs.dp_gui_master_cntl;
+ /* DP_GUI_MASTER_CNTL aliases fields from DP_MIX and DP_DATATYPE */
+ val = s->regs.dp_gui_master_cntl |
+ ((s->regs.dp_datatype & DP_BRUSH_DATATYPE) >> 4) |
+ ((s->regs.dp_datatype & DP_DST_DATATYPE) << 8) |
+ ((s->regs.dp_datatype & DP_SRC_DATATYPE) >> 4) |
+ (s->regs.dp_mix & DP_ROP3) |
+ ((s->regs.dp_mix & DP_SRC_SOURCE) << 16);
break;
case SRC_OFFSET:
val = s->regs.src_offset;
diff --git a/hw/display/ati_regs.h b/hw/display/ati_regs.h
index d7127748ff..0a0825db04 100644
--- a/hw/display/ati_regs.h
+++ b/hw/display/ati_regs.h
@@ -386,6 +386,9 @@
#define DST_16BPP 0x00000004
#define DST_24BPP 0x00000005
#define DST_32BPP 0x00000006
+#define DP_DST_DATATYPE 0x0000000f
+#define DP_BRUSH_DATATYPE 0x00000f00
+#define DP_SRC_DATATYPE 0x00030000
#define BRUSH_SOLIDCOLOR 0x00000d00
@@ -437,6 +440,8 @@
#define DP_SRC_RECT 0x00000200
#define DP_SRC_HOST 0x00000300
#define DP_SRC_HOST_BYTEALIGN 0x00000400
+#define DP_SRC_SOURCE 0x00000700
+#define DP_ROP3 0x00ff0000
/* LVDS_GEN_CNTL constants */
#define LVDS_BL_MOD_LEVEL_MASK 0x0000ff00
--
2.52.0