diff mbox series

[v2,1/4] ati-vga: Fix aperture sizes

Message ID d077d4f90d19db731df78da6f05058db074cada1.1698871239.git.balaton@eik.bme.hu
State New
Headers show
Series Misc ati-vga patches | expand

Commit Message

BALATON Zoltan Nov. 1, 2023, 8:45 p.m. UTC
Apparently these should be half the memory region sizes confirmed at
least by Radeon FCocde ROM while Rage 128 Pro ROMs don't seem to use
these. Linux r100 DRM driver also checks for a bit in HOST_PATH_CNTL
so we also add that even though the FCode ROM does not seem to set it.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/display/ati.c      | 7 +++++--
 hw/display/ati_dbg.c  | 1 +
 hw/display/ati_regs.h | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

Comments

Michael Tokarev Nov. 7, 2023, 2:51 p.m. UTC | #1
01.11.2023 23:45, BALATON Zoltan:
> Apparently these should be half the memory region sizes confirmed at
> least by Radeon FCocde ROM while Rage 128 Pro ROMs don't seem to use
> these. Linux r100 DRM driver also checks for a bit in HOST_PATH_CNTL
> so we also add that even though the FCode ROM does not seem to set it.

Is it stable-worthy?

Thanks,

/mjt
BALATON Zoltan Nov. 7, 2023, 3:33 p.m. UTC | #2
On Tue, 7 Nov 2023, Michael Tokarev wrote:
> 01.11.2023 23:45, BALATON Zoltan:
>> Apparently these should be half the memory region sizes confirmed at
>> least by Radeon FCocde ROM while Rage 128 Pro ROMs don't seem to use
>> these. Linux r100 DRM driver also checks for a bit in HOST_PATH_CNTL
>> so we also add that even though the FCode ROM does not seem to set it.
>
> Is it stable-worthy?

Not really beacause this is only needed by RV100 drivers but that GPU is 
not emulated enough yet to work so this won't help them. However the last 
patch adding pixman fallbacks to ati_2d.c fixes graphics issues on Apple 
silicon Macs where pixman does not work that happens also with the default 
rage128p emulation so that patch may be useful in stable. It should be 
independent of the other patches in the series so should apply without the 
other patches.

Regards,
BALATON Zoltan
Michael Tokarev Nov. 7, 2023, 5:27 p.m. UTC | #3
07.11.2023 18:33, BALATON Zoltan:
..
>> Is it stable-worthy?
> 
> Not really beacause this is only needed by RV100 drivers but that GPU is not emulated enough yet to work so this won't help them. However the last 
> patch adding pixman fallbacks to ati_2d.c fixes graphics issues on Apple silicon Macs where pixman does not work that happens also with the default 
> rage128p emulation so that patch may be useful in stable. It should be independent of the other patches in the series so should apply without the 
> other patches.

Heh. Interesting.  Thank you for the clarification, I'm picking up 08730ee0cc01
"ati-vga: Implement fallback for pixman routines" instead of aperture sizes fix.


/mjt
diff mbox series

Patch

diff --git a/hw/display/ati.c b/hw/display/ati.c
index c36282c343..ea7ab89a19 100644
--- a/hw/display/ati.c
+++ b/hw/display/ati.c
@@ -349,14 +349,17 @@  static uint64_t ati_mm_read(void *opaque, hwaddr addr, unsigned int size)
                                       PCI_BASE_ADDRESS_0, size) & 0xfffffff0;
         break;
     case CONFIG_APER_SIZE:
-        val = s->vga.vram_size;
+        val = s->vga.vram_size / 2;
         break;
     case CONFIG_REG_1_BASE:
         val = pci_default_read_config(&s->dev,
                                       PCI_BASE_ADDRESS_2, size) & 0xfffffff0;
         break;
     case CONFIG_REG_APER_SIZE:
-        val = memory_region_size(&s->mm);
+        val = memory_region_size(&s->mm) / 2;
+        break;
+    case HOST_PATH_CNTL:
+        val = BIT(23); /* Radeon HDP_APER_CNTL */
         break;
     case MC_STATUS:
         val = 5;
diff --git a/hw/display/ati_dbg.c b/hw/display/ati_dbg.c
index bd0ecd48c7..4aec1c383a 100644
--- a/hw/display/ati_dbg.c
+++ b/hw/display/ati_dbg.c
@@ -38,6 +38,7 @@  static struct ati_regdesc ati_reg_names[] = {
     {"CONFIG_APER_SIZE", 0x0108},
     {"CONFIG_REG_1_BASE", 0x010c},
     {"CONFIG_REG_APER_SIZE", 0x0110},
+    {"HOST_PATH_CNTL", 0x0130},
     {"MEM_CNTL", 0x0140},
     {"MC_FB_LOCATION", 0x0148},
     {"MC_AGP_LOCATION", 0x014C},
diff --git a/hw/display/ati_regs.h b/hw/display/ati_regs.h
index d6282b2ef2..c697b328da 100644
--- a/hw/display/ati_regs.h
+++ b/hw/display/ati_regs.h
@@ -56,6 +56,7 @@ 
 #define CONFIG_APER_SIZE                        0x0108
 #define CONFIG_REG_1_BASE                       0x010c
 #define CONFIG_REG_APER_SIZE                    0x0110
+#define HOST_PATH_CNTL                          0x0130
 #define MEM_CNTL                                0x0140
 #define MC_FB_LOCATION                          0x0148
 #define MC_AGP_LOCATION                         0x014C