Skip to contentSkip to conversation

ATI R300 emulated graphics card

RFC In review [email protected] 2 participants 11 messages Nov 26, 2019

lore
Share & tools
lore
#0 lore raw

cover ATI R300 emulated graphics card

From: Aaron Dominick <[email protected]>

Hello,
I thought of working on an emulated R300 GPU for QEMU video acceleration on vintage operating systems (Windows 9x-XP) The following patch series contains the initial QEMU device and some register read/write operations. Testing it on an OpenSUSE Linux guest and the kernel correctly detects the card and loads the radeon DRM driver. It gets as far as the CRTC probing before crashing with an error that there is not enough bandwidth. I know next to nothing about hardware emulation and would like to know if what I have got so far is on the right track.

Aaron Dominick (8):
Add Radeon kernel headers. Will clean up later
Fix MC STATUS resgister
R300 fixes
Got GPU init working. Stops at probing display
Add Radeon kernel headers. Will clean up later
Fix MC STATUS resgister
R300 fixes
Got GPU init working. Stops at probing display

Signature · 1 line
2.24.0
#1 lore raw

RFC 1/8 Add Radeon kernel headers. Will clean up later

From: Aaron Dominick <[email protected]>

---
 hw/display/Kconfig                  |    9 +
 hw/display/Makefile.objs            |    1 +
 hw/display/ObjectID.h               |  736 +++
 hw/display/atom-bits.h              |   48 +
 hw/display/atom-names.h             |  100 +
 hw/display/atom-types.h             |   42 +
 hw/display/atom.h                   |  160 +
 hw/display/atombios.h               | 7981 +++++++++++++++++++++++++++
 hw/display/avivod.h                 |   62 +
 hw/display/btc_dpm.h                |   62 +
 hw/display/btcd.h                   |  185 +
 hw/display/cayman_blit_shaders.h    |   35 +
 hw/display/ci_dpm.h                 |  341 ++
 hw/display/cik_blit_shaders.h       |   32 +
 hw/display/cik_reg.h                |  241 +
 hw/display/cikd.h                   | 2172 ++++++++
 hw/display/clearstate_cayman.h      | 1083 ++++
 hw/display/clearstate_ci.h          |  946 ++++
 hw/display/clearstate_defs.h        |   44 +
 hw/display/clearstate_evergreen.h   | 1080 ++++
 hw/display/clearstate_si.h          |  943 ++++
 hw/display/cypress_dpm.h            |  160 +
 hw/display/evergreen_blit_shaders.h |   35 +
 hw/display/evergreen_reg.h          |  315 ++
 hw/display/evergreen_smc.h          |   67 +
 hw/display/evergreend.h             | 2628 +++++++++
 hw/display/kv_dpm.h                 |  200 +
 hw/display/ni_dpm.h                 |  250 +
 hw/display/ni_reg.h                 |  132 +
 hw/display/nid.h                    | 1369 +++++
 hw/display/nislands_smc.h           |  329 ++
 hw/display/ppsmc.h                  |  191 +
 hw/display/pptable.h                |  690 +++
 hw/display/r100_track.h             |  100 +
 hw/display/r100d.h                  |  869 +++
 hw/display/r300.c                   | 1009 ++++
 hw/display/r300.h                   |  173 +
 hw/display/r300_2d.c                |  190 +
 hw/display/r300_debug.c             |  272 +
 hw/display/r300_drm.c               | 1599 ++++++
 hw/display/r300_reg.h               | 1789 ++++++
 hw/display/r300d.h                  |  343 ++
 hw/display/r420d.h                  |  249 +
 hw/display/r500_reg.h               |  801 +++
 hw/display/r520d.h                  |  187 +
 hw/display/r600_blit_shaders.h      |   38 +
 hw/display/r600_dpm.h               |  238 +
 hw/display/r600_reg.h               |  201 +
 hw/display/r600d.h                  | 2370 ++++++++
 hw/display/radeon.h                 | 2967 ++++++++++
 hw/display/radeon_acpi.h            |  456 ++
 hw/display/radeon_asic.h            |  986 ++++
 hw/display/radeon_audio.h           |   84 +
 hw/display/radeon_drv.h             |  121 +
 hw/display/radeon_family.h          |  122 +
 hw/display/radeon_mode.h            | 1002 ++++
 hw/display/radeon_object.h          |  197 +
 hw/display/radeon_reg.h             | 3725 +++++++++++++
 hw/display/radeon_trace.h           |  209 +
 hw/display/radeon_ucode.h           |  227 +
 hw/display/rs100d.h                 |   40 +
 hw/display/rs400d.h                 |  160 +
 hw/display/rs600d.h                 |  685 +++
 hw/display/rs690d.h                 |  313 ++
 hw/display/rs780_dpm.h              |  109 +
 hw/display/rs780d.h                 |  171 +
 hw/display/rv200d.h                 |   36 +
 hw/display/rv250d.h                 |  123 +
 hw/display/rv350d.h                 |   52 +
 hw/display/rv515d.h                 |  638 +++
 hw/display/rv6xx_dpm.h              |   95 +
 hw/display/rv6xxd.h                 |  246 +
 hw/display/rv730d.h                 |  165 +
 hw/display/rv740d.h                 |  117 +
 hw/display/rv770_dpm.h              |  285 +
 hw/display/rv770_smc.h              |  207 +
 hw/display/rv770d.h                 | 1015 ++++
 hw/display/si_blit_shaders.h        |   32 +
 hw/display/si_dpm.h                 |  238 +
 hw/display/si_reg.h                 |  105 +
 hw/display/sid.h                    | 1956 +++++++
 hw/display/sislands_smc.h           |  424 ++
 hw/display/smu7.h                   |  170 +
 hw/display/smu7_discrete.h          |  514 ++
 hw/display/smu7_fusion.h            |  300 +
 hw/display/sumo_dpm.h               |  221 +
 hw/display/sumod.h                  |  372 ++
 hw/display/trinity_dpm.h            |  134 +
 hw/display/trinityd.h               |  228 +
 89 files changed, 52344 insertions(+)
 create mode 100644 hw/display/ObjectID.h
 create mode 100644 hw/display/atom-bits.h
 create mode 100644 hw/display/atom-names.h
 create mode 100644 hw/display/atom-types.h
 create mode 100644 hw/display/atom.h
 create mode 100644 hw/display/atombios.h
 create mode 100644 hw/display/avivod.h
 create mode 100644 hw/display/btc_dpm.h
 create mode 100644 hw/display/btcd.h
 create mode 100644 hw/display/cayman_blit_shaders.h
 create mode 100644 hw/display/ci_dpm.h
 create mode 100644 hw/display/cik_blit_shaders.h
 create mode 100644 hw/display/cik_reg.h
 create mode 100644 hw/display/cikd.h
 create mode 100644 hw/display/clearstate_cayman.h
 create mode 100644 hw/display/clearstate_ci.h
 create mode 100644 hw/display/clearstate_defs.h
 create mode 100644 hw/display/clearstate_evergreen.h
 create mode 100644 hw/display/clearstate_si.h
 create mode 100644 hw/display/cypress_dpm.h
 create mode 100644 hw/display/evergreen_blit_shaders.h
 create mode 100644 hw/display/evergreen_reg.h
 create mode 100644 hw/display/evergreen_smc.h
 create mode 100644 hw/display/evergreend.h
 create mode 100644 hw/display/kv_dpm.h
 create mode 100644 hw/display/ni_dpm.h
 create mode 100644 hw/display/ni_reg.h
 create mode 100644 hw/display/nid.h
 create mode 100644 hw/display/nislands_smc.h
 create mode 100644 hw/display/ppsmc.h
 create mode 100644 hw/display/pptable.h
 create mode 100644 hw/display/r100_track.h
 create mode 100644 hw/display/r100d.h
 create mode 100644 hw/display/r300.c
 create mode 100644 hw/display/r300.h
 create mode 100644 hw/display/r300_2d.c
 create mode 100644 hw/display/r300_debug.c
 create mode 100644 hw/display/r300_drm.c
 create mode 100644 hw/display/r300_reg.h
 create mode 100644 hw/display/r300d.h
 create mode 100644 hw/display/r420d.h
 create mode 100644 hw/display/r500_reg.h
 create mode 100644 hw/display/r520d.h
 create mode 100644 hw/display/r600_blit_shaders.h
 create mode 100644 hw/display/r600_dpm.h
 create mode 100644 hw/display/r600_reg.h
 create mode 100644 hw/display/r600d.h
 create mode 100644 hw/display/radeon.h
 create mode 100644 hw/display/radeon_acpi.h
 create mode 100644 hw/display/radeon_asic.h
 create mode 100644 hw/display/radeon_audio.h
 create mode 100644 hw/display/radeon_drv.h
 create mode 100644 hw/display/radeon_family.h
 create mode 100644 hw/display/radeon_mode.h
 create mode 100644 hw/display/radeon_object.h
 create mode 100644 hw/display/radeon_reg.h
 create mode 100644 hw/display/radeon_trace.h
 create mode 100644 hw/display/radeon_ucode.h
 create mode 100644 hw/display/rs100d.h
 create mode 100644 hw/display/rs400d.h
 create mode 100644 hw/display/rs600d.h
 create mode 100644 hw/display/rs690d.h
 create mode 100644 hw/display/rs780_dpm.h
 create mode 100644 hw/display/rs780d.h
 create mode 100644 hw/display/rv200d.h
 create mode 100644 hw/display/rv250d.h
 create mode 100644 hw/display/rv350d.h
 create mode 100644 hw/display/rv515d.h
 create mode 100644 hw/display/rv6xx_dpm.h
 create mode 100644 hw/display/rv6xxd.h
 create mode 100644 hw/display/rv730d.h
 create mode 100644 hw/display/rv740d.h
 create mode 100644 hw/display/rv770_dpm.h
 create mode 100644 hw/display/rv770_smc.h
 create mode 100644 hw/display/rv770d.h
 create mode 100644 hw/display/si_blit_shaders.h
 create mode 100644 hw/display/si_dpm.h
 create mode 100644 hw/display/si_reg.h
 create mode 100644 hw/display/sid.h
 create mode 100644 hw/display/sislands_smc.h
 create mode 100644 hw/display/smu7.h
 create mode 100644 hw/display/smu7_discrete.h
 create mode 100644 hw/display/smu7_fusion.h
 create mode 100644 hw/display/sumo_dpm.h
 create mode 100644 hw/display/sumod.h
 create mode 100644 hw/display/trinity_dpm.h
 create mode 100644 hw/display/trinityd.h
hw/display/Kconfig +9 -0
index c500d1fc6d..3d7346f902 100644
@@ -133,6 +133,15 @@ config ATI_VGA
     select BITBANG_I2C
     select DDC
 
+config RAD_VGA
+    bool
+    default y if PCI_DEVICES
+    depends on PCI
+    select VGA
+    select BITBANG_I2C
+    select DDC
+
+
 config MACFB
     bool
     select FRAMEBUFFER
hw/display/Makefile.objs +1 -0
index f2182e3bef..e9f6f0194b 100644
@@ -59,3 +59,4 @@ common-obj-$(CONFIG_DPCD) += dpcd.o
 common-obj-$(CONFIG_XLNX_ZYNQMP_ARM) += xlnx_dp.o
 
 common-obj-$(CONFIG_ATI_VGA) += ati.o ati_2d.o ati_dbg.o
+common-obj-$(CONFIG_RAD_VGA) += r300.o r300_2d.o r300_debug.o
hw/display/ObjectID.h new file +736 -0

736 lines not on this page · raw message

hw/display/atom-bits.h new file +48 -0

48 lines not on this page · raw message

hw/display/atom-names.h new file +100 -0

100 lines not on this page · raw message

hw/display/atom-types.h new file +42 -0

42 lines not on this page · raw message

hw/display/atom.h new file +160 -0

160 lines not on this page · raw message

hw/display/atombios.h new file +7981 -0

1,895 lines not on this page · raw message

hw/display/avivod.h new file +62 -0

62 lines not on this page · raw message

hw/display/btc_dpm.h new file +62 -0

62 lines not on this page · raw message

hw/display/btcd.h new file +185 -0

185 lines not on this page · raw message

hw/display/cayman_blit_shaders.h new file +35 -0
new file mode 100644
index 0000000000..f5d0e9a602

Lines of this file are not shown. View the raw message.

hw/display/ci_dpm.h new file +341 -0

341 lines not on this page · raw message

hw/display/cik_blit_shaders.h new file +32 -0
new file mode 100644
index 0000000000..dfe7314f9f

Lines of this file are not shown. View the raw message.

hw/display/cik_reg.h new file +241 -0

241 lines not on this page · raw message

hw/display/cikd.h new file +2172 -0

2,172 lines not on this page · raw message

hw/display/clearstate_cayman.h new file +1083 -0

1,083 lines not on this page · raw message

hw/display/clearstate_ci.h new file +946 -0

946 lines not on this page · raw message

hw/display/clearstate_defs.h new file +44 -0

44 lines not on this page · raw message

hw/display/clearstate_evergreen.h new file +1080 -0

1,080 lines not on this page · raw message

hw/display/clearstate_si.h new file +943 -0

943 lines not on this page · raw message

hw/display/cypress_dpm.h new file +160 -0

160 lines not on this page · raw message

hw/display/evergreen_blit_shaders.h new file +35 -0
new file mode 100644
index 0000000000..bb8d6c7515

Lines of this file are not shown. View the raw message.

hw/display/evergreen_reg.h new file +315 -0

315 lines not on this page · raw message

hw/display/evergreen_smc.h new file +67 -0

67 lines not on this page · raw message

hw/display/evergreend.h new file +2628 -0

2,628 lines not on this page · raw message

hw/display/kv_dpm.h new file +200 -0

200 lines not on this page · raw message

hw/display/ni_dpm.h new file +250 -0

250 lines not on this page · raw message

hw/display/ni_reg.h new file +132 -0

132 lines not on this page · raw message

hw/display/nid.h new file +1369 -0

1,369 lines not on this page · raw message

hw/display/nislands_smc.h new file +329 -0

329 lines not on this page · raw message

hw/display/ppsmc.h new file +191 -0

191 lines not on this page · raw message

hw/display/pptable.h new file +690 -0

690 lines not on this page · raw message

hw/display/r100_track.h new file +100 -0

100 lines not on this page · raw message

hw/display/r100d.h new file +869 -0

869 lines not on this page · raw message

hw/display/r300.c new file +1009 -0

1,009 lines not on this page · raw message

hw/display/r300.h new file +173 -0

173 lines not on this page · raw message

hw/display/r300_2d.c new file +190 -0

190 lines not on this page · raw message

hw/display/r300_debug.c new file +272 -0

272 lines not on this page · raw message

hw/display/r300_drm.c new file +1599 -0

1,599 lines not on this page · raw message

hw/display/r300_reg.h new file +1789 -0

1,789 lines not on this page · raw message

hw/display/r300d.h new file +343 -0

343 lines not on this page · raw message

hw/display/r420d.h new file +249 -0

249 lines not on this page · raw message

hw/display/r500_reg.h new file +801 -0

801 lines not on this page · raw message

hw/display/r520d.h new file +187 -0

187 lines not on this page · raw message

hw/display/r600_blit_shaders.h new file +38 -0
new file mode 100644
index 0000000000..f437d36dd9

Lines of this file are not shown. View the raw message.

hw/display/r600_dpm.h new file +238 -0

238 lines not on this page · raw message

hw/display/r600_reg.h new file +201 -0

201 lines not on this page · raw message

hw/display/r600d.h new file +2370 -0

2,370 lines not on this page · raw message

hw/display/radeon.h new file +2967 -0

2,967 lines not on this page · raw message

hw/display/radeon_acpi.h new file +456 -0

456 lines not on this page · raw message

hw/display/radeon_asic.h new file +986 -0

986 lines not on this page · raw message

hw/display/radeon_audio.h new file +84 -0

84 lines not on this page · raw message

hw/display/radeon_drv.h new file +121 -0

121 lines not on this page · raw message

hw/display/radeon_family.h new file +122 -0

122 lines not on this page · raw message

hw/display/radeon_mode.h new file +1002 -0

1,002 lines not on this page · raw message

hw/display/radeon_object.h new file +197 -0

197 lines not on this page · raw message

hw/display/radeon_reg.h new file +3725 -0

3,725 lines not on this page · raw message

hw/display/radeon_trace.h new file +209 -0

209 lines not on this page · raw message

hw/display/radeon_ucode.h new file +227 -0

227 lines not on this page · raw message

hw/display/rs100d.h new file +40 -0
new file mode 100644
index 0000000000..48a913a06c

Lines of this file are not shown. View the raw message.

hw/display/rs400d.h new file +160 -0

160 lines not on this page · raw message

hw/display/rs600d.h new file +685 -0

685 lines not on this page · raw message

hw/display/rs690d.h new file +313 -0

313 lines not on this page · raw message

hw/display/rs780_dpm.h new file +109 -0

109 lines not on this page · raw message

hw/display/rs780d.h new file +171 -0

171 lines not on this page · raw message

hw/display/rv200d.h new file +36 -0
new file mode 100644
index 0000000000..c5b398330c

Lines of this file are not shown. View the raw message.

hw/display/rv250d.h new file +123 -0

123 lines not on this page · raw message

hw/display/rv350d.h new file +52 -0

52 lines not on this page · raw message

hw/display/rv515d.h new file +638 -0

638 lines not on this page · raw message

hw/display/rv6xx_dpm.h new file +95 -0

95 lines not on this page · raw message

hw/display/rv6xxd.h new file +246 -0

246 lines not on this page · raw message

hw/display/rv730d.h new file +165 -0

165 lines not on this page · raw message

hw/display/rv740d.h new file +117 -0

117 lines not on this page · raw message

hw/display/rv770_dpm.h new file +285 -0

285 lines not on this page · raw message

hw/display/rv770_smc.h new file +207 -0

207 lines not on this page · raw message

hw/display/rv770d.h new file +1015 -0

1,015 lines not on this page · raw message

hw/display/si_blit_shaders.h new file +32 -0
new file mode 100644
index 0000000000..c739e51e39

Lines of this file are not shown. View the raw message.

hw/display/si_dpm.h new file +238 -0

238 lines not on this page · raw message

hw/display/si_reg.h new file +105 -0

105 lines not on this page · raw message

hw/display/sid.h new file +1956 -0

1,956 lines not on this page · raw message

hw/display/sislands_smc.h new file +424 -0

424 lines not on this page · raw message

hw/display/smu7.h new file +170 -0

170 lines not on this page · raw message

hw/display/smu7_discrete.h new file +514 -0

514 lines not on this page · raw message

hw/display/smu7_fusion.h new file +300 -0

300 lines not on this page · raw message

hw/display/sumo_dpm.h new file +221 -0

221 lines not on this page · raw message

hw/display/sumod.h new file +372 -0

372 lines not on this page · raw message

hw/display/trinity_dpm.h new file +134 -0

134 lines not on this page · raw message

hw/display/trinityd.h new file +228 -0

228 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.24.0

Part of the diff is not shown here. View the raw message.

#2 lore raw

RFC 2/8 Fix MC STATUS resgister

In reply to [email protected]

From: Aaron Dominick <[email protected]>

---
 hw/display/r300.c | 15 ++++++++++++---
 hw/display/r300.h |  1 +
 2 files changed, 13 insertions(+), 3 deletions(-)
hw/display/r300.c +12 -3
index 94e90b7a95..653474c3aa 100644
@@ -278,6 +278,10 @@ static uint64_t r300_mm_read(void *opaque, hwaddr addr, unsigned int size)
     uint64_t val = 0;
 
     switch (addr) {
+    case RADEON_MC_STATUS:
+        val = s->regs.mc_status;
+        break;
+
     case RADEON_MM_INDEX:
         val = s->regs.mm_index;
         break;
@@ -358,9 +362,9 @@ static uint64_t r300_mm_read(void *opaque, hwaddr addr, unsigned int size)
     case RADEON_CONFIG_REG_APER_SIZE:
         val = memory_region_size(&s->mm);
         break;
-    case RADEON_MC_STATUS:
-        val = 5;
-        break;
+    // case RADEON_MC_STATUS:
+    //     val = 5;
+    //     break;
     case RADEON_RBBM_STATUS:
         val = 64; /* free CMDFIFO entries */
         break;
@@ -512,6 +516,10 @@ static void r300_mm_write(void *opaque, hwaddr addr,
         trace_ati_mm_write(size, addr, r300_reg_name(addr & ~3ULL), data);
     }
     switch (addr) {
+      case RADEON_MC_STATUS:
+        s->regs.mc_status = R300_MC_IDLE;
+        s->regs.mc_status = data;
+        break;
       case RADEON_RBBM_STATUS:
         s->regs.rbbm_status = data|= RADEON_RBBM_FIFOCNT_MASK;
         break;
@@ -946,6 +954,7 @@ static void r300_vga_realize(PCIDevice *dev, Error **errp)
 static void r300_vga_reset(DeviceState *dev)
 {
     RADVGAState *s = RAD_VGA(dev);
+    s->regs.mc_status = R300_MC_IDLE;
 
     timer_del(&s->vblank_timer);
     r300_vga_update_irq(s);
hw/display/r300.h +1 -0
index 60f572647f..a9e1db32be 100644
@@ -81,6 +81,7 @@ typedef struct RADVGARegs{
   uint32_t default_pitch;
   uint32_t default_tile;
   uint32_t default_sc_bottom_right;
+  uint32_t mc_status;
 
 //Color Buffer RB3D
   uint32_t r300_rb3d_aaresolve_ctl;
Signature · 1 line
2.24.0
#3 lore raw

RFC 3/8 R300 fixes

In reply to [email protected]

From: Aaron Dominick <[email protected]>

---
 hw/display/r300.c | 9 +++++++++
 hw/display/r300.h | 6 ++++++
 2 files changed, 15 insertions(+)
hw/display/r300.c +9 -0
index 653474c3aa..074dbf5b2d 100644
@@ -878,6 +878,15 @@ static void r300_mm_write(void *opaque, hwaddr addr,
     case RADEON_DEFAULT_SC_BOTTOM_RIGHT:
         s->regs.default_sc_bottom_right = data & 0x3fff3fff;
         break;
+    case R300_GB_ENABLE:
+        s->regs.r300_gb_enable = data;
+        break;
+    case R300_GB_TILE_CONFIG:
+            s->regs.r300_gb_tile_config = data;
+            break;
+    case R300_GB_FIFO_SIZE:
+            s->regs.r300_gb_fifo_size = data;
+            break;
     default:
         break;
     }
hw/display/r300.h +6 -0
index a9e1db32be..19e3d97f8a 100644
@@ -83,6 +83,12 @@ typedef struct RADVGARegs{
   uint32_t default_sc_bottom_right;
   uint32_t mc_status;
 
+  //R300 GB Registers
+  uint32_t r300_gb_enable;
+  uint32_t r300_gb_tile_config;
+  uint32_t r300_gb_fifo_size;
+
+
 //Color Buffer RB3D
   uint32_t r300_rb3d_aaresolve_ctl;
   uint32_t r300_rb3d_aaresolve_offset;
Signature · 1 line
2.24.0
#4 lore raw

RFC 4/8 Got GPU init working. Stops at probing display

In reply to [email protected]

From: Aaron Dominick <[email protected]>

---
 hw/display/ati.c  |   9 +-
 hw/display/r300.c | 571 +++++++++++++++++++++++++++++++++++++---------
 hw/display/r300.h |  77 ++++++-
 3 files changed, 544 insertions(+), 113 deletions(-)
hw/display/ati.c +5 -4
index db3b254316..1d36233163 100644
@@ -44,7 +44,7 @@ enum { VGA_MODE, EXT_MODE };
 
 static void ati_vga_switch_mode(ATIVGAState *s)
 {
-    DPRINTF("%d -> %d\n",
+    qemu_log("%d -> %d\n",
             s->mode, !!(s->regs.crtc_gen_cntl & CRTC2_EXT_DISP_EN));
     if (s->regs.crtc_gen_cntl & CRTC2_EXT_DISP_EN) {
         /* Extended mode enabled */
@@ -88,7 +88,7 @@ static void ati_vga_switch_mode(ATIVGAState *s)
                 qemu_log_mask(LOG_UNIMP, "Unsupported bpp value\n");
             }
             assert(bpp != 0);
-            DPRINTF("Switching to %dx%d %d %d @ %x\n", h, v, stride, bpp, offs);
+            qemu_log("Switching to %dx%d %d %d @ %x\n", h, v, stride, bpp, offs);
             vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_ENABLE);
             vbe_ioport_write_data(&s->vga, 0, VBE_DISPI_DISABLED);
             s->vga.big_endian_fb = (s->regs.config_cntl & APER_0_ENDIAN ||
@@ -111,14 +111,14 @@ static void ati_vga_switch_mode(ATIVGAState *s)
                 vbe_ioport_write_data(&s->vga, 0, stride);
                 stride *= bypp;
                 if (offs % stride) {
-                    DPRINTF("CRTC offset is not multiple of pitch\n");
+                    qemu_log("CRTC offset is not multiple of pitch\n");
                     vbe_ioport_write_index(&s->vga, 0,
                                            VBE_DISPI_INDEX_X_OFFSET);
                     vbe_ioport_write_data(&s->vga, 0, offs % stride / bypp);
                 }
                 vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_Y_OFFSET);
                 vbe_ioport_write_data(&s->vga, 0, offs / stride);
-                DPRINTF("VBE offset (%d,%d), vbe_start_addr=%x\n",
+                qemu_log("VBE offset (%d,%d), vbe_start_addr=%x\n",
                         s->vga.vbe_regs[VBE_DISPI_INDEX_X_OFFSET],
                         s->vga.vbe_regs[VBE_DISPI_INDEX_Y_OFFSET],
                         s->vga.vbe_start_addr);
@@ -129,6 +129,7 @@ static void ati_vga_switch_mode(ATIVGAState *s)
         s->mode = VGA_MODE;
         vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_ENABLE);
         vbe_ioport_write_data(&s->vga, 0, VBE_DISPI_DISABLED);
+        qemu_log("VGA MODE %d \n",s->mode);
     }
 }
 
hw/display/r300.c +463 -108

840 lines not on this page · raw message

hw/display/r300.h +76 -1

107 lines not on this page · raw message

Signature · 1 line
2.24.0
#5 lore raw

RFC 5/8 Add Radeon kernel headers. Will clean up later

In reply to [email protected]

From: Aaron Dominick <[email protected]>

---
 hw/display/Kconfig                  |    9 +
 hw/display/Makefile.objs            |    1 +
 hw/display/ObjectID.h               |  736 +++
 hw/display/atom-bits.h              |   48 +
 hw/display/atom-names.h             |  100 +
 hw/display/atom-types.h             |   42 +
 hw/display/atom.h                   |  160 +
 hw/display/atombios.h               | 7981 +++++++++++++++++++++++++++
 hw/display/avivod.h                 |   62 +
 hw/display/btc_dpm.h                |   62 +
 hw/display/btcd.h                   |  185 +
 hw/display/cayman_blit_shaders.h    |   35 +
 hw/display/ci_dpm.h                 |  341 ++
 hw/display/cik_blit_shaders.h       |   32 +
 hw/display/cik_reg.h                |  241 +
 hw/display/cikd.h                   | 2172 ++++++++
 hw/display/clearstate_cayman.h      | 1083 ++++
 hw/display/clearstate_ci.h          |  946 ++++
 hw/display/clearstate_defs.h        |   44 +
 hw/display/clearstate_evergreen.h   | 1080 ++++
 hw/display/clearstate_si.h          |  943 ++++
 hw/display/cypress_dpm.h            |  160 +
 hw/display/evergreen_blit_shaders.h |   35 +
 hw/display/evergreen_reg.h          |  315 ++
 hw/display/evergreen_smc.h          |   67 +
 hw/display/evergreend.h             | 2628 +++++++++
 hw/display/kv_dpm.h                 |  200 +
 hw/display/ni_dpm.h                 |  250 +
 hw/display/ni_reg.h                 |  132 +
 hw/display/nid.h                    | 1369 +++++
 hw/display/nislands_smc.h           |  329 ++
 hw/display/ppsmc.h                  |  191 +
 hw/display/pptable.h                |  690 +++
 hw/display/r100_track.h             |  100 +
 hw/display/r100d.h                  |  869 +++
 hw/display/r300.c                   | 1009 ++++
 hw/display/r300.h                   |  173 +
 hw/display/r300_2d.c                |  190 +
 hw/display/r300_debug.c             |  272 +
 hw/display/r300_drm.c               | 1599 ++++++
 hw/display/r300_reg.h               | 1789 ++++++
 hw/display/r300d.h                  |  343 ++
 hw/display/r420d.h                  |  249 +
 hw/display/r500_reg.h               |  801 +++
 hw/display/r520d.h                  |  187 +
 hw/display/r600_blit_shaders.h      |   38 +
 hw/display/r600_dpm.h               |  238 +
 hw/display/r600_reg.h               |  201 +
 hw/display/r600d.h                  | 2370 ++++++++
 hw/display/radeon.h                 | 2967 ++++++++++
 hw/display/radeon_acpi.h            |  456 ++
 hw/display/radeon_asic.h            |  986 ++++
 hw/display/radeon_audio.h           |   84 +
 hw/display/radeon_drv.h             |  121 +
 hw/display/radeon_family.h          |  122 +
 hw/display/radeon_mode.h            | 1002 ++++
 hw/display/radeon_object.h          |  197 +
 hw/display/radeon_reg.h             | 3725 +++++++++++++
 hw/display/radeon_trace.h           |  209 +
 hw/display/radeon_ucode.h           |  227 +
 hw/display/rs100d.h                 |   40 +
 hw/display/rs400d.h                 |  160 +
 hw/display/rs600d.h                 |  685 +++
 hw/display/rs690d.h                 |  313 ++
 hw/display/rs780_dpm.h              |  109 +
 hw/display/rs780d.h                 |  171 +
 hw/display/rv200d.h                 |   36 +
 hw/display/rv250d.h                 |  123 +
 hw/display/rv350d.h                 |   52 +
 hw/display/rv515d.h                 |  638 +++
 hw/display/rv6xx_dpm.h              |   95 +
 hw/display/rv6xxd.h                 |  246 +
 hw/display/rv730d.h                 |  165 +
 hw/display/rv740d.h                 |  117 +
 hw/display/rv770_dpm.h              |  285 +
 hw/display/rv770_smc.h              |  207 +
 hw/display/rv770d.h                 | 1015 ++++
 hw/display/si_blit_shaders.h        |   32 +
 hw/display/si_dpm.h                 |  238 +
 hw/display/si_reg.h                 |  105 +
 hw/display/sid.h                    | 1956 +++++++
 hw/display/sislands_smc.h           |  424 ++
 hw/display/smu7.h                   |  170 +
 hw/display/smu7_discrete.h          |  514 ++
 hw/display/smu7_fusion.h            |  300 +
 hw/display/sumo_dpm.h               |  221 +
 hw/display/sumod.h                  |  372 ++
 hw/display/trinity_dpm.h            |  134 +
 hw/display/trinityd.h               |  228 +
 89 files changed, 52344 insertions(+)
 create mode 100644 hw/display/ObjectID.h
 create mode 100644 hw/display/atom-bits.h
 create mode 100644 hw/display/atom-names.h
 create mode 100644 hw/display/atom-types.h
 create mode 100644 hw/display/atom.h
 create mode 100644 hw/display/atombios.h
 create mode 100644 hw/display/avivod.h
 create mode 100644 hw/display/btc_dpm.h
 create mode 100644 hw/display/btcd.h
 create mode 100644 hw/display/cayman_blit_shaders.h
 create mode 100644 hw/display/ci_dpm.h
 create mode 100644 hw/display/cik_blit_shaders.h
 create mode 100644 hw/display/cik_reg.h
 create mode 100644 hw/display/cikd.h
 create mode 100644 hw/display/clearstate_cayman.h
 create mode 100644 hw/display/clearstate_ci.h
 create mode 100644 hw/display/clearstate_defs.h
 create mode 100644 hw/display/clearstate_evergreen.h
 create mode 100644 hw/display/clearstate_si.h
 create mode 100644 hw/display/cypress_dpm.h
 create mode 100644 hw/display/evergreen_blit_shaders.h
 create mode 100644 hw/display/evergreen_reg.h
 create mode 100644 hw/display/evergreen_smc.h
 create mode 100644 hw/display/evergreend.h
 create mode 100644 hw/display/kv_dpm.h
 create mode 100644 hw/display/ni_dpm.h
 create mode 100644 hw/display/ni_reg.h
 create mode 100644 hw/display/nid.h
 create mode 100644 hw/display/nislands_smc.h
 create mode 100644 hw/display/ppsmc.h
 create mode 100644 hw/display/pptable.h
 create mode 100644 hw/display/r100_track.h
 create mode 100644 hw/display/r100d.h
 create mode 100644 hw/display/r300.c
 create mode 100644 hw/display/r300.h
 create mode 100644 hw/display/r300_2d.c
 create mode 100644 hw/display/r300_debug.c
 create mode 100644 hw/display/r300_drm.c
 create mode 100644 hw/display/r300_reg.h
 create mode 100644 hw/display/r300d.h
 create mode 100644 hw/display/r420d.h
 create mode 100644 hw/display/r500_reg.h
 create mode 100644 hw/display/r520d.h
 create mode 100644 hw/display/r600_blit_shaders.h
 create mode 100644 hw/display/r600_dpm.h
 create mode 100644 hw/display/r600_reg.h
 create mode 100644 hw/display/r600d.h
 create mode 100644 hw/display/radeon.h
 create mode 100644 hw/display/radeon_acpi.h
 create mode 100644 hw/display/radeon_asic.h
 create mode 100644 hw/display/radeon_audio.h
 create mode 100644 hw/display/radeon_drv.h
 create mode 100644 hw/display/radeon_family.h
 create mode 100644 hw/display/radeon_mode.h
 create mode 100644 hw/display/radeon_object.h
 create mode 100644 hw/display/radeon_reg.h
 create mode 100644 hw/display/radeon_trace.h
 create mode 100644 hw/display/radeon_ucode.h
 create mode 100644 hw/display/rs100d.h
 create mode 100644 hw/display/rs400d.h
 create mode 100644 hw/display/rs600d.h
 create mode 100644 hw/display/rs690d.h
 create mode 100644 hw/display/rs780_dpm.h
 create mode 100644 hw/display/rs780d.h
 create mode 100644 hw/display/rv200d.h
 create mode 100644 hw/display/rv250d.h
 create mode 100644 hw/display/rv350d.h
 create mode 100644 hw/display/rv515d.h
 create mode 100644 hw/display/rv6xx_dpm.h
 create mode 100644 hw/display/rv6xxd.h
 create mode 100644 hw/display/rv730d.h
 create mode 100644 hw/display/rv740d.h
 create mode 100644 hw/display/rv770_dpm.h
 create mode 100644 hw/display/rv770_smc.h
 create mode 100644 hw/display/rv770d.h
 create mode 100644 hw/display/si_blit_shaders.h
 create mode 100644 hw/display/si_dpm.h
 create mode 100644 hw/display/si_reg.h
 create mode 100644 hw/display/sid.h
 create mode 100644 hw/display/sislands_smc.h
 create mode 100644 hw/display/smu7.h
 create mode 100644 hw/display/smu7_discrete.h
 create mode 100644 hw/display/smu7_fusion.h
 create mode 100644 hw/display/sumo_dpm.h
 create mode 100644 hw/display/sumod.h
 create mode 100644 hw/display/trinity_dpm.h
 create mode 100644 hw/display/trinityd.h
hw/display/Kconfig +9 -0
index c500d1fc6d..3d7346f902 100644
@@ -133,6 +133,15 @@ config ATI_VGA
     select BITBANG_I2C
     select DDC
 
+config RAD_VGA
+    bool
+    default y if PCI_DEVICES
+    depends on PCI
+    select VGA
+    select BITBANG_I2C
+    select DDC
+
+
 config MACFB
     bool
     select FRAMEBUFFER
hw/display/Makefile.objs +1 -0
index f2182e3bef..e9f6f0194b 100644
@@ -59,3 +59,4 @@ common-obj-$(CONFIG_DPCD) += dpcd.o
 common-obj-$(CONFIG_XLNX_ZYNQMP_ARM) += xlnx_dp.o
 
 common-obj-$(CONFIG_ATI_VGA) += ati.o ati_2d.o ati_dbg.o
+common-obj-$(CONFIG_RAD_VGA) += r300.o r300_2d.o r300_debug.o
hw/display/ObjectID.h new file +736 -0

736 lines not on this page · raw message

hw/display/atom-bits.h new file +48 -0

48 lines not on this page · raw message

hw/display/atom-names.h new file +100 -0

100 lines not on this page · raw message

hw/display/atom-types.h new file +42 -0

42 lines not on this page · raw message

hw/display/atom.h new file +160 -0

160 lines not on this page · raw message

hw/display/atombios.h new file +7981 -0

1,895 lines not on this page · raw message

hw/display/avivod.h new file +62 -0

62 lines not on this page · raw message

hw/display/btc_dpm.h new file +62 -0

62 lines not on this page · raw message

hw/display/btcd.h new file +185 -0

185 lines not on this page · raw message

hw/display/cayman_blit_shaders.h new file +35 -0
new file mode 100644
index 0000000000..f5d0e9a602

Lines of this file are not shown. View the raw message.

hw/display/ci_dpm.h new file +341 -0

341 lines not on this page · raw message

hw/display/cik_blit_shaders.h new file +32 -0
new file mode 100644
index 0000000000..dfe7314f9f

Lines of this file are not shown. View the raw message.

hw/display/cik_reg.h new file +241 -0

241 lines not on this page · raw message

hw/display/cikd.h new file +2172 -0

2,172 lines not on this page · raw message

hw/display/clearstate_cayman.h new file +1083 -0

1,083 lines not on this page · raw message

hw/display/clearstate_ci.h new file +946 -0

946 lines not on this page · raw message

hw/display/clearstate_defs.h new file +44 -0

44 lines not on this page · raw message

hw/display/clearstate_evergreen.h new file +1080 -0

1,080 lines not on this page · raw message

hw/display/clearstate_si.h new file +943 -0

943 lines not on this page · raw message

hw/display/cypress_dpm.h new file +160 -0

160 lines not on this page · raw message

hw/display/evergreen_blit_shaders.h new file +35 -0
new file mode 100644
index 0000000000..bb8d6c7515

Lines of this file are not shown. View the raw message.

hw/display/evergreen_reg.h new file +315 -0

315 lines not on this page · raw message

hw/display/evergreen_smc.h new file +67 -0

67 lines not on this page · raw message

hw/display/evergreend.h new file +2628 -0

2,628 lines not on this page · raw message

hw/display/kv_dpm.h new file +200 -0

200 lines not on this page · raw message

hw/display/ni_dpm.h new file +250 -0

250 lines not on this page · raw message

hw/display/ni_reg.h new file +132 -0

132 lines not on this page · raw message

hw/display/nid.h new file +1369 -0

1,369 lines not on this page · raw message

hw/display/nislands_smc.h new file +329 -0

329 lines not on this page · raw message

hw/display/ppsmc.h new file +191 -0

191 lines not on this page · raw message

hw/display/pptable.h new file +690 -0

690 lines not on this page · raw message

hw/display/r100_track.h new file +100 -0

100 lines not on this page · raw message

hw/display/r100d.h new file +869 -0

869 lines not on this page · raw message

hw/display/r300.c new file +1009 -0

1,009 lines not on this page · raw message

hw/display/r300.h new file +173 -0

173 lines not on this page · raw message

hw/display/r300_2d.c new file +190 -0

190 lines not on this page · raw message

hw/display/r300_debug.c new file +272 -0

272 lines not on this page · raw message

hw/display/r300_drm.c new file +1599 -0

1,599 lines not on this page · raw message

hw/display/r300_reg.h new file +1789 -0

1,789 lines not on this page · raw message

hw/display/r300d.h new file +343 -0

343 lines not on this page · raw message

hw/display/r420d.h new file +249 -0

249 lines not on this page · raw message

hw/display/r500_reg.h new file +801 -0

801 lines not on this page · raw message

hw/display/r520d.h new file +187 -0

187 lines not on this page · raw message

hw/display/r600_blit_shaders.h new file +38 -0
new file mode 100644
index 0000000000..f437d36dd9

Lines of this file are not shown. View the raw message.

hw/display/r600_dpm.h new file +238 -0

238 lines not on this page · raw message

hw/display/r600_reg.h new file +201 -0

201 lines not on this page · raw message

hw/display/r600d.h new file +2370 -0

2,370 lines not on this page · raw message

hw/display/radeon.h new file +2967 -0

2,967 lines not on this page · raw message

hw/display/radeon_acpi.h new file +456 -0

456 lines not on this page · raw message

hw/display/radeon_asic.h new file +986 -0

986 lines not on this page · raw message

hw/display/radeon_audio.h new file +84 -0

84 lines not on this page · raw message

hw/display/radeon_drv.h new file +121 -0

121 lines not on this page · raw message

hw/display/radeon_family.h new file +122 -0

122 lines not on this page · raw message

hw/display/radeon_mode.h new file +1002 -0

1,002 lines not on this page · raw message

hw/display/radeon_object.h new file +197 -0

197 lines not on this page · raw message

hw/display/radeon_reg.h new file +3725 -0

3,725 lines not on this page · raw message

hw/display/radeon_trace.h new file +209 -0

209 lines not on this page · raw message

hw/display/radeon_ucode.h new file +227 -0

227 lines not on this page · raw message

hw/display/rs100d.h new file +40 -0
new file mode 100644
index 0000000000..48a913a06c

Lines of this file are not shown. View the raw message.

hw/display/rs400d.h new file +160 -0

160 lines not on this page · raw message

hw/display/rs600d.h new file +685 -0

685 lines not on this page · raw message

hw/display/rs690d.h new file +313 -0

313 lines not on this page · raw message

hw/display/rs780_dpm.h new file +109 -0

109 lines not on this page · raw message

hw/display/rs780d.h new file +171 -0

171 lines not on this page · raw message

hw/display/rv200d.h new file +36 -0
new file mode 100644
index 0000000000..c5b398330c

Lines of this file are not shown. View the raw message.

hw/display/rv250d.h new file +123 -0

123 lines not on this page · raw message

hw/display/rv350d.h new file +52 -0

52 lines not on this page · raw message

hw/display/rv515d.h new file +638 -0

638 lines not on this page · raw message

hw/display/rv6xx_dpm.h new file +95 -0

95 lines not on this page · raw message

hw/display/rv6xxd.h new file +246 -0

246 lines not on this page · raw message

hw/display/rv730d.h new file +165 -0

165 lines not on this page · raw message

hw/display/rv740d.h new file +117 -0

117 lines not on this page · raw message

hw/display/rv770_dpm.h new file +285 -0

285 lines not on this page · raw message

hw/display/rv770_smc.h new file +207 -0

207 lines not on this page · raw message

hw/display/rv770d.h new file +1015 -0

1,015 lines not on this page · raw message

hw/display/si_blit_shaders.h new file +32 -0
new file mode 100644
index 0000000000..c739e51e39

Lines of this file are not shown. View the raw message.

hw/display/si_dpm.h new file +238 -0

238 lines not on this page · raw message

hw/display/si_reg.h new file +105 -0

105 lines not on this page · raw message

hw/display/sid.h new file +1956 -0

1,956 lines not on this page · raw message

hw/display/sislands_smc.h new file +424 -0

424 lines not on this page · raw message

hw/display/smu7.h new file +170 -0

170 lines not on this page · raw message

hw/display/smu7_discrete.h new file +514 -0

514 lines not on this page · raw message

hw/display/smu7_fusion.h new file +300 -0

300 lines not on this page · raw message

hw/display/sumo_dpm.h new file +221 -0

221 lines not on this page · raw message

hw/display/sumod.h new file +372 -0

372 lines not on this page · raw message

hw/display/trinity_dpm.h new file +134 -0

134 lines not on this page · raw message

hw/display/trinityd.h new file +228 -0

228 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.24.0

Part of the diff is not shown here. View the raw message.

#6 lore raw

RFC 6/8 Fix MC STATUS resgister

In reply to [email protected]

From: Aaron Dominick <[email protected]>

---
 hw/display/r300.c | 15 ++++++++++++---
 hw/display/r300.h |  1 +
 2 files changed, 13 insertions(+), 3 deletions(-)
hw/display/r300.c +12 -3
index 94e90b7a95..653474c3aa 100644
@@ -278,6 +278,10 @@ static uint64_t r300_mm_read(void *opaque, hwaddr addr, unsigned int size)
     uint64_t val = 0;
 
     switch (addr) {
+    case RADEON_MC_STATUS:
+        val = s->regs.mc_status;
+        break;
+
     case RADEON_MM_INDEX:
         val = s->regs.mm_index;
         break;
@@ -358,9 +362,9 @@ static uint64_t r300_mm_read(void *opaque, hwaddr addr, unsigned int size)
     case RADEON_CONFIG_REG_APER_SIZE:
         val = memory_region_size(&s->mm);
         break;
-    case RADEON_MC_STATUS:
-        val = 5;
-        break;
+    // case RADEON_MC_STATUS:
+    //     val = 5;
+    //     break;
     case RADEON_RBBM_STATUS:
         val = 64; /* free CMDFIFO entries */
         break;
@@ -512,6 +516,10 @@ static void r300_mm_write(void *opaque, hwaddr addr,
         trace_ati_mm_write(size, addr, r300_reg_name(addr & ~3ULL), data);
     }
     switch (addr) {
+      case RADEON_MC_STATUS:
+        s->regs.mc_status = R300_MC_IDLE;
+        s->regs.mc_status = data;
+        break;
       case RADEON_RBBM_STATUS:
         s->regs.rbbm_status = data|= RADEON_RBBM_FIFOCNT_MASK;
         break;
@@ -946,6 +954,7 @@ static void r300_vga_realize(PCIDevice *dev, Error **errp)
 static void r300_vga_reset(DeviceState *dev)
 {
     RADVGAState *s = RAD_VGA(dev);
+    s->regs.mc_status = R300_MC_IDLE;
 
     timer_del(&s->vblank_timer);
     r300_vga_update_irq(s);
hw/display/r300.h +1 -0
index 60f572647f..a9e1db32be 100644
@@ -81,6 +81,7 @@ typedef struct RADVGARegs{
   uint32_t default_pitch;
   uint32_t default_tile;
   uint32_t default_sc_bottom_right;
+  uint32_t mc_status;
 
 //Color Buffer RB3D
   uint32_t r300_rb3d_aaresolve_ctl;
Signature · 1 line
2.24.0
#7 lore raw

RFC 7/8 R300 fixes

In reply to [email protected]

From: Aaron Dominick <[email protected]>

---
 hw/display/r300.c | 9 +++++++++
 hw/display/r300.h | 6 ++++++
 2 files changed, 15 insertions(+)
hw/display/r300.c +9 -0
index 653474c3aa..074dbf5b2d 100644
@@ -878,6 +878,15 @@ static void r300_mm_write(void *opaque, hwaddr addr,
     case RADEON_DEFAULT_SC_BOTTOM_RIGHT:
         s->regs.default_sc_bottom_right = data & 0x3fff3fff;
         break;
+    case R300_GB_ENABLE:
+        s->regs.r300_gb_enable = data;
+        break;
+    case R300_GB_TILE_CONFIG:
+            s->regs.r300_gb_tile_config = data;
+            break;
+    case R300_GB_FIFO_SIZE:
+            s->regs.r300_gb_fifo_size = data;
+            break;
     default:
         break;
     }
hw/display/r300.h +6 -0
index a9e1db32be..19e3d97f8a 100644
@@ -83,6 +83,12 @@ typedef struct RADVGARegs{
   uint32_t default_sc_bottom_right;
   uint32_t mc_status;
 
+  //R300 GB Registers
+  uint32_t r300_gb_enable;
+  uint32_t r300_gb_tile_config;
+  uint32_t r300_gb_fifo_size;
+
+
 //Color Buffer RB3D
   uint32_t r300_rb3d_aaresolve_ctl;
   uint32_t r300_rb3d_aaresolve_offset;
Signature · 1 line
2.24.0
#8 lore raw

RFC 8/8 Got GPU init working. Stops at probing display

In reply to [email protected]

From: Aaron Dominick <[email protected]>

---
 hw/display/ati.c  |   9 +-
 hw/display/r300.c | 571 +++++++++++++++++++++++++++++++++++++---------
 hw/display/r300.h |  77 ++++++-
 3 files changed, 544 insertions(+), 113 deletions(-)
hw/display/ati.c +5 -4
index db3b254316..1d36233163 100644
@@ -44,7 +44,7 @@ enum { VGA_MODE, EXT_MODE };
 
 static void ati_vga_switch_mode(ATIVGAState *s)
 {
-    DPRINTF("%d -> %d\n",
+    qemu_log("%d -> %d\n",
             s->mode, !!(s->regs.crtc_gen_cntl & CRTC2_EXT_DISP_EN));
     if (s->regs.crtc_gen_cntl & CRTC2_EXT_DISP_EN) {
         /* Extended mode enabled */
@@ -88,7 +88,7 @@ static void ati_vga_switch_mode(ATIVGAState *s)
                 qemu_log_mask(LOG_UNIMP, "Unsupported bpp value\n");
             }
             assert(bpp != 0);
-            DPRINTF("Switching to %dx%d %d %d @ %x\n", h, v, stride, bpp, offs);
+            qemu_log("Switching to %dx%d %d %d @ %x\n", h, v, stride, bpp, offs);
             vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_ENABLE);
             vbe_ioport_write_data(&s->vga, 0, VBE_DISPI_DISABLED);
             s->vga.big_endian_fb = (s->regs.config_cntl & APER_0_ENDIAN ||
@@ -111,14 +111,14 @@ static void ati_vga_switch_mode(ATIVGAState *s)
                 vbe_ioport_write_data(&s->vga, 0, stride);
                 stride *= bypp;
                 if (offs % stride) {
-                    DPRINTF("CRTC offset is not multiple of pitch\n");
+                    qemu_log("CRTC offset is not multiple of pitch\n");
                     vbe_ioport_write_index(&s->vga, 0,
                                            VBE_DISPI_INDEX_X_OFFSET);
                     vbe_ioport_write_data(&s->vga, 0, offs % stride / bypp);
                 }
                 vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_Y_OFFSET);
                 vbe_ioport_write_data(&s->vga, 0, offs / stride);
-                DPRINTF("VBE offset (%d,%d), vbe_start_addr=%x\n",
+                qemu_log("VBE offset (%d,%d), vbe_start_addr=%x\n",
                         s->vga.vbe_regs[VBE_DISPI_INDEX_X_OFFSET],
                         s->vga.vbe_regs[VBE_DISPI_INDEX_Y_OFFSET],
                         s->vga.vbe_start_addr);
@@ -129,6 +129,7 @@ static void ati_vga_switch_mode(ATIVGAState *s)
         s->mode = VGA_MODE;
         vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_ENABLE);
         vbe_ioport_write_data(&s->vga, 0, VBE_DISPI_DISABLED);
+        qemu_log("VGA MODE %d \n",s->mode);
     }
 }
 
hw/display/r300.c +463 -108

840 lines not on this page · raw message

hw/display/r300.h +76 -1

107 lines not on this page · raw message

Signature · 1 line
2.24.0
#9 lore raw
In reply to [email protected]

Hello,

Quoted 4 lines · On Tue, 26 Nov 2019, [email protected] wrote:

From: Aaron Dominick <[email protected]>

Hello,
I thought of working on an emulated R300 GPU for QEMU video acceleration on vintage operating systems (Windows 9x-XP)

Good idea, :-) I very welcome any contribution to this.

Quoted 1 line

The following patch series contains the initial QEMU device and some register read/write operations.

At first look you have pathces twice in the series (so each patch appears twice, I haven't checked if they are identical or different) and also the first (and 5th) patch adds a lot of probably unused files which makes review difficult. Could you please fix these and resend with only adding the headers really needed and each patch only once so we know what are the actual changes that are relevant?

Also is it possible to keep everything in ati-vga only adding another device model there rather than fully duplicating it as r300* ? Although for development it's probably OK to keep it separate but unless there are enough differences having a single file at the end may be better. (Also changes are clearer that way but if you have a patch only copying ati-vga files first then separate patches that changes it can be reviewed that way too.)

In short I think this series needs some cleanup first for us to be able to revies it better.

Quoted 1 line

Testing it on an OpenSUSE Linux guest and the kernel correctly detects the card and loads the radeon DRM driver.

So I think this gets a bit further than my ati-vga rv100 which does not work with DRM yet. I've thought about targeting RV100 first then moving on to later radeons as those probably have more features and differences from R128 which is the starting point for ati-vga but if you need R300 for some reason specifically targeting that is OK too.

Quoted 1 line

It gets as far as the CRTC probing before crashing with an error that there is not enough bandwidth.

Getting DRM to load is one thing but likely you'll need to implement microengine/command processor (also referred to as PM4 or programming mode 4 sometimes) to get it fully working as that's how DRM and Windows ATI drivers likely send commands to the card. I've looked at it but couldn't find documentation on how the microengine works. We get a microcode uploaded by no idea how to run that. If we can't figure out how the microengine works anther approach could be what xenia.jp XBox 360 emulator does and directly parse the packets not using the microcode. It could be possible to copy code from Xenia for that but we need to convert C++ to C. The difficult part is probably figuring out how to run it in a different thread so the device emulation does not block the machine and it works in parallel like real hardware does.

Quoted 1 line

I know next to nothing about hardware emulation and would like to know if what I have got so far is on the right track.

Are you aware of my project page for ATI VGA emulation here:

https://osdn.net/projects/qmiga/wiki/SubprojectAti

where I have collected some knowledge that I could gather so far? I have some experience in implementing devices in QEMU but know next to nothing about GPUs so hopefully you know more about those which is more needed for ati-vga. The QEMU knowledge can be picked up by looking at existing devices and asking here or on IRC (if you prefer that, I don't use it but I know some do).

Regards,
BALATON Zoltan

#10 lore raw

Yeah sorry about the double patches. That was because of a botched rebase. It applied my commits twice.
I am working on cleaning up the header files and other fixes.

Quoted 1 line

Are you aware of my project page for ATI VGA emulation here:

Yes I am. Your code got me through the initial setup.

Quoted 75 lines · BALATON Zoltan

Hello,

Quoted 4 lines · On Tue, 26 Nov 2019, [email protected] wrote:

From: Aaron Dominick <[email protected]>

Hello,
I thought of working on an emulated R300 GPU for QEMU video acceleration

on vintage operating systems (Windows 9x-XP)

Good idea, :-) I very welcome any contribution to this.

Quoted 1 line

The following patch series contains the initial QEMU device and some

register read/write operations.

At first look you have pathces twice in the series (so each patch appears twice, I haven't checked if they are identical or different) and also the first (and 5th) patch adds a lot of probably unused files which makes review difficult. Could you please fix these and resend with only adding the headers really needed and each patch only once so we know what are the actual changes that are relevant?

Also is it possible to keep everything in ati-vga only adding another device model there rather than fully duplicating it as r300* ? Although for development it's probably OK to keep it separate but unless there are enough differences having a single file at the end may be better. (Also changes are clearer that way but if you have a patch only copying ati-vga files first then separate patches that changes it can be reviewed that way too.)

In short I think this series needs some cleanup first for us to be able to revies it better.

Quoted 1 line

Testing it on an OpenSUSE Linux guest and the kernel correctly detects

the card and loads the radeon DRM driver.

So I think this gets a bit further than my ati-vga rv100 which does not work with DRM yet. I've thought about targeting RV100 first then moving on to later radeons as those probably have more features and differences from R128 which is the starting point for ati-vga but if you need R300 for some reason specifically targeting that is OK too.

Quoted 1 line

It gets as far as the CRTC probing before crashing with an error that

there is not enough bandwidth.

Getting DRM to load is one thing but likely you'll need to implement microengine/command processor (also referred to as PM4 or programming mode 4 sometimes) to get it fully working as that's how DRM and Windows ATI drivers likely send commands to the card. I've looked at it but couldn't find documentation on how the microengine works. We get a microcode uploaded by no idea how to run that. If we can't figure out how the microengine works anther approach could be what xenia.jp XBox 360 emulator
does and directly parse the packets not using the microcode. It could be possible to copy code from Xenia for that but we need to convert C++ to C. The difficult part is probably figuring out how to run it in a different thread so the device emulation does not block the machine and it works in parallel like real hardware does.

Quoted 1 line

I know next to nothing about hardware emulation and would like to know

if what I have got so far is on the right track.

Are you aware of my project page for ATI VGA emulation here:

https://osdn.net/projects/qmiga/wiki/SubprojectAti

where I have collected some knowledge that I could gather so far? I have some experience in implementing devices in QEMU but know next to nothing about GPUs so hopefully you know more about those which is more needed for ati-vga. The QEMU knowledge can be picked up by looking at existing devices and asking here or on IRC (if you prefer that, I don't use it but I know some do).

Regards,
BALATON Zoltan