Basic ATI VGA emulation
cover Basic ATI VGA emulation
Hello,
This is the latest version of the ati-vga patch, now also including the mips_fulong2e patch in a series so both can be merged together via the UI tree as agreed before to avoid needing to sync two maintainers.
That's probably all I can do before the freeze but the rest can be considered bugfixes (or given that there's nothing to regress from yet anything can be considered bugfix at this stage) so we may have some more chance to improve it before the release if it's merged now.
At least Linux console and fulong2e PMON firmware should work but I wasn't able to completely find out how 2D accel should work so it still gives some garbled output for guests using it but I won't have time to figure this out before the freeze. I could take some help in this from someone knowing this hardware and pixman better than me. (Pixman not having any documentation does not help.)
Please let me know if there's anything that needs to be fixed for it to be merged now. I can probably make another version before the freeze with those changes but not much more at the moment.
Regards,
BALATON Zoltan
BALATON Zoltan (2):
hw/display: Add basic ATI VGA emulation
mips_fulong2e: Add on-board graphics chip
default-configs/pci.mak | 1 + hw/display/Makefile.objs | 2 + hw/display/ati.c | 786 +++++++++++++++++++++++++++++++++++++++++++++++ hw/display/ati_2d.c | 167 ++++++++++ hw/display/ati_dbg.c | 259 ++++++++++++++++ hw/display/ati_int.h | 93 ++++++ hw/display/ati_regs.h | 461 +++++++++++++++++++++++++++ hw/display/trace-events | 4 + hw/mips/mips_fulong2e.c | 6 + vl.c | 1 + 10 files changed, 1780 insertions(+) create mode 100644 hw/display/ati.c create mode 100644 hw/display/ati_2d.c create mode 100644 hw/display/ati_dbg.c create mode 100644 hw/display/ati_int.h create mode 100644 hw/display/ati_regs.h
Signature · 1 line
2.13.7
PATCH 2/2 mips_fulong2e: Add on-board graphics chip
Add (partial) emulation of the on-board GPU of the machine. This allows the PMON2000 firmware to run and should also work with Linux console but probably not with X yet.
--- hw/mips/mips_fulong2e.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/mips/mips_fulong2e.c +6 -0
@@ -287,6 +287,7 @@ static void mips_fulong2e_init(MachineState *machine)I2CBus *smbus;MIPSCPU *cpu;CPUMIPSState *env; +DeviceState *dev;/* init CPUs */ cpu =MIPS_CPU (cpu_create (machine->cpu_type));
@@ -347,6 +348,11 @@ static void mips_fulong2e_init(MachineState *machine)vt82c686b_southbridge_init (pci_bus,FULONG2E_VIA_SLOT , env->irq[5 ], &smbus, &isa_bus); +/* GPU */ + dev =DEVICE (pci_create (pci_bus,-1 ,"ati-vga" )); +qdev_prop_set_uint16 (dev,"x-device-id" ,0x5159 ); +qdev_init_nofail (dev); +/* Populate SPD eeprom data */ spd_data =spd_data_generate (DDR , ram_size, &err);if (err) {
Signature · 1 line
2.13.7
PATCH 1/2 hw/display: Add basic ATI VGA emulation
In reply to BALATON ZoltanAt least two machines, the PPC mac99 and MIPS fulong2e, have an ATI gfx chip by default (Rage 128 Pro and M6/RV100 respectively) and guests running on these and the PMON2000 firmware of the fulong2e expect this to be available. Fortunately these are very similar chips so they can be mostly emulated in the same device model. This patch adds basic emulation of these ATI VGA chips.
While this is incomplete and currently only enough to run the MIPS firmware and get framebuffer output with Linux, it allows the fulong2e board to work more like the real hardware and having it in QEMU in this state provides a way to experiment with it and allows others to contribute to improve it. It is compiled for all archs but only the fulong2e (which currently has no display output at all) is set to use it by default (in a separate patch).
---
v5:
- review suggestions: add const to model aliases, \n to log, %u in trace
- implemented hardware cursor support
v4:
- fix mingw build (from Gerd)
- set dev_id in realize to allow pci_patch_ids to change bios rom
- add model aliases to select device variant by name instead of id
- misc mode switch and 2d fixes (better but still not quite right)
v3:
- add to default-configs/pci.mak instead of mips64el and ppc only
- rename device_id property to x-device-id
- use extract32/deposit32 in *_offs functions
- add ati-vga to vl.c default_list[]
v2:
- Extended debug logs
- Fix mode switching and some registers
- Fixes to 2D functions
default-configs/pci.mak | 1 + hw/display/Makefile.objs | 2 + hw/display/ati.c | 786 +++++++++++++++++++++++++++++++++++++++++++++++ hw/display/ati_2d.c | 167 ++++++++++ hw/display/ati_dbg.c | 259 ++++++++++++++++ hw/display/ati_int.h | 93 ++++++ hw/display/ati_regs.h | 461 +++++++++++++++++++++++++++ hw/display/trace-events | 4 + vl.c | 1 + 9 files changed, 1774 insertions(+) create mode 100644 hw/display/ati.c create mode 100644 hw/display/ati_2d.c create mode 100644 hw/display/ati_dbg.c create mode 100644 hw/display/ati_int.h create mode 100644 hw/display/ati_regs.h
default-configs/pci.mak +1 -0
@@ -49,3 +49,4 @@ CONFIG_IVSHMEM_DEVICE=$(CONFIG_IVSHMEM) CONFIG_ROCKER=y CONFIG_VFIO=$(CONFIG_LINUX) CONFIG_VFIO_PCI=y +CONFIG_ATI_VGA=y
hw/display/Makefile.objs +2 -0
@@ -53,3 +53,5 @@ virtio-gpu-3d.o-cflags := $(VIRGL_CFLAGS) virtio-gpu-3d.o-libs += $(VIRGL_LIBS) obj-$(CONFIG_DPCD) += dpcd.o obj-$(CONFIG_XLNX_ZYNQMP_ARM) += xlnx_dp.o + +obj-$(CONFIG_ATI_VGA) += ati.o ati_2d.o ati_dbg.o
hw/display/ati.c new file +786 -0
786 lines not on this page · raw message
hw/display/ati_2d.c new file +167 -0
167 lines not on this page · raw message
hw/display/ati_dbg.c new file +259 -0
259 lines not on this page · raw message
hw/display/ati_int.h new file +93 -0
93 lines not on this page · raw message
hw/display/ati_regs.h new file +461 -0
461 lines not on this page · raw message
hw/display/trace-events +4 -0
@@ -138,3 +138,7 @@ vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset 0x%x, val 0x%x" sii9022_read_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x" sii9022_write_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x" sii9022_switch_mode(const char *mode) "mode: %s" + +# hw/display/ati*.c +ati_mm_read(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s -> 0x%"PRIx64 +ati_mm_write(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s <- 0x%"PRIx64
vl.c +1 -0
@@ -240,6 +240,7 @@ static struct { { .driver = "vmware-svga", .flag = &default_vga }, { .driver = "qxl-vga", .flag = &default_vga }, { .driver = "virtio-vga", .flag = &default_vga }, + { .driver = "ati-vga", .flag = &default_vga }, }; static QemuOptsList qemu_rtc_opts = {
Signature · 1 line
2.13.7
Re: [Qemu-devel] [PATCH v5-resend 2/2] mips_fulong2e: Add on-board graphics chip
In reply to BALATON ZoltanQuoted 7 lines · BALATON Zoltan
Add (partial) emulation of the on-board GPU of the machine. This allows the PMON2000 firmware to run and should also work with Linux console but probably not with X yet.
Signed-off-by BALATON Zoltan <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Mojibaked again :(
Aleksandar, if you take this series, do you mind fixing with:
Thanks!
Phil.
Quoted 30 lines
Reviewed-by Aleksandar Markovic <[email protected]>--- hw/mips/mips_fulong2e.c | 6 ++++++ 1 file changed, 6 insertions(+)hw/mips/mips_fulong2e.c +6
-0@@ -287,6 +287,7 @@ static void mips_fulong2e_init(MachineState *machine)I2CBus *smbus;MIPSCPU *cpu;CPUMIPSState *env; +DeviceState *dev;/* init CPUs */ cpu =MIPS_CPU (cpu_create (machine->cpu_type));@@ -347,6 +348,11 @@ static void mips_fulong2e_init(MachineState *machine)vt82c686b_southbridge_init (pci_bus,FULONG2E_VIA_SLOT , env->irq[5 ], &smbus, &isa_bus); +/* GPU */ + dev =DEVICE (pci_create (pci_bus,-1 ,"ati-vga" )); +qdev_prop_set_uint16 (dev,"x-device-id" ,0x5159 ); +qdev_init_nofail (dev); +/* Populate SPD eeprom data */ spd_data =spd_data_generate (DDR , ram_size, &err);if (err) {
Re: [Qemu-devel] [PATCH v5-resend 2/2] mips_fulong2e: Add on-board graphics chip
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · BALATON Zoltan
Add (partial) emulation of the on-board GPU of the machine. This allows the PMON2000 firmware to run and should also work with Linux console but probably not with X yet.
Signed-off-by BALATON Zoltan <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Mojibaked again :(
Sorry. Looks like my setup just can't handle your encoding. Maybe I need an additional header to specify content encoding? Do you have a git config to tell format-patch to generate that? Or have a way for maintainers to correct this on merging automatically?
Quoted 1 line
Aleksandar, if you take this series, do you mind fixing with:
I think it should go via Gerd's tree together with the other patch.
Regards,
BALATON Zoltan
Quoted 39 lines
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Thanks!
Phil.
Quoted 30 lines
Reviewed-by Aleksandar Markovic <[email protected]>--- hw/mips/mips_fulong2e.c | 6 ++++++ 1 file changed, 6 insertions(+)hw/mips/mips_fulong2e.c +6
-0@@ -287,6 +287,7 @@ static void mips_fulong2e_init(MachineState *machine)I2CBus *smbus;MIPSCPU *cpu;CPUMIPSState *env; +DeviceState *dev;/* init CPUs */ cpu =MIPS_CPU (cpu_create (machine->cpu_type));@@ -347,6 +348,11 @@ static void mips_fulong2e_init(MachineState *machine)vt82c686b_southbridge_init (pci_bus,FULONG2E_VIA_SLOT , env->irq[5 ], &smbus, &isa_bus); +/* GPU */ + dev =DEVICE (pci_create (pci_bus,-1 ,"ati-vga" )); +qdev_prop_set_uint16 (dev,"x-device-id" ,0x5159 ); +qdev_init_nofail (dev); +/* Populate SPD eeprom data */ spd_data =spd_data_generate (DDR , ram_size, &err);if (err) {
Re: [Qemu-devel] [PATCH v5-resend 2/2] mips_fulong2e: Add on-board graphics chip
Quoted 10 lines
From: BALATON Zoltan <[email protected]>
Subject: Re: [PATCH v5-resend 2/2]mips_fulong2e: Add on-board graphics chipQuoted 2 lines · Philippe Mathieu-Daudé
Aleksandar, if you take this series, do you mind fixing with:
I think it should go via Gerd's tree together with the other patch.
Regards,
BALATON Zoltan
Yes, Gerd, should you agree with the patches, let they both go through your tree/pull request, please.
Sincerely,
Aleksandar
Re: [Qemu-devel] [PATCH v5-resend 2/2] mips_fulong2e: Add on-board graphics chip
In reply to Philippe Mathieu-DaudéQuoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · BALATON Zoltan
Add (partial) emulation of the on-board GPU of the machine. This allows the PMON2000 firmware to run and should also work with Linux console but probably not with X yet.
Signed-off-by BALATON Zoltan <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Mojibaked again :(
Mail was sent without Content-Type: header. Both mutt and "git am" on my machine assume utf-8 and everything looks fine. I guess your mail client assumes something else ...
"git send-email" should send the patches with correct headers, it even asks for the charset it should use in case it finds non-ascii characters. So BALATON, could you check your mail client config, or switch over to "git send-email" for submitting patches?
cheers,
Gerd
Re: [Qemu-devel] [PATCH v5-resend 2/2] mips_fulong2e: Add on-board graphics chip
Quoted 10 lines · Gerd Hoffmann
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 7 lines · BALATON Zoltan
Add (partial) emulation of the on-board GPU of the machine. This allows the PMON2000 firmware to run and should also work with Linux console but probably not with X yet.
Signed-off-by BALATON Zoltan <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 5 lines
Quoted 1 line
Mojibaked again :(
Mail was sent without Content-Type: header. Both mutt and "git am" on my machine assume utf-8 and everything looks fine. I guess your mail client assumes something else ...
So it came out good at the end but that depends on what maintainer's config does by default it seems.
Quoted 4 lines
"git send-email" should send the patches with correct headers, it even asks for the charset it should use in case it finds non-ascii characters. So BALATON, could you check your mail client config, or switch over to "git send-email" for submitting patches?
I'm sending what git format-patch is generating and that does not add content type header by default. Is there a config option to enable that? I can't use git send-email because I'm sending from different machine than I use git on.
Regards,
BALATON Zoltan
Re: [Qemu-devel] [PATCH v5-resend 2/2] mips_fulong2e: Add on-board graphics chip
Quoted 25 lines · BALATON Zoltan
Quoted 10 lines · Gerd Hoffmann
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 7 lines · BALATON Zoltan
Add (partial) emulation of the on-board GPU of the machine. This allows the PMON2000 firmware to run and should also work with Linux console but probably not with X yet.
Signed-off-by BALATON Zoltan <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Quoted 5 lines
Quoted 1 line
Mojibaked again :(
Mail was sent without Content-Type: header. Both mutt and "git am" on my machine assume utf-8 and everything looks fine. I guess your mail client assumes something else ...
So it came out good at the end but that depends on what maintainer's config does by default it seems.
Quoted 4 lines
"git send-email" should send the patches with correct headers, it even asks for the charset it should use in case it finds non-ascii characters. So BALATON, could you check your mail client config, or switch over to "git send-email" for submitting patches?
Quoted 4 lines
I'm sending what git format-patch is generating and that does not add content type header by default. Is there a config option to enable that? I can't use git send-email because I'm sending from different machine than I use git on.
On another thread Laurent Vivier found it is a copy/paste problem between an email client and an editor (IIUC):
https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg03669.html
Laurent, if you understood what's wrong, can you add en entry in the wiki so we can refer contributors to it?
Thanks,
Phil.
Re: [Qemu-devel] [PATCH v5-resend 2/2] mips_fulong2e: Add on-board graphics chip
Le 08/03/2019 à 17:35, Philippe Mathieu-Daudé a écrit :
Quoted 31 lines · BALATON Zoltan
Quoted 25 lines · Gerd Hoffmann
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 9 lines · BALATON Zoltan
Quoted 7 lines
Add (partial) emulation of the on-board GPU of the machine. This allows the PMON2000 firmware to run and should also work with Linux console but probably not with X yet.
Signed-off-by BALATON Zoltan <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Quoted 5 lines
Quoted 1 line
Mojibaked again :(
Mail was sent without Content-Type: header. Both mutt and "git am" on my machine assume utf-8 and everything looks fine. I guess your mail client assumes something else ...
So it came out good at the end but that depends on what maintainer's config does by default it seems.
Quoted 4 lines
"git send-email" should send the patches with correct headers, it even asks for the charset it should use in case it finds non-ascii characters. So BALATON, could you check your mail client config, or switch over to "git send-email" for submitting patches?
Quoted 4 lines
I'm sending what git format-patch is generating and that does not add content type header by default. Is there a config option to enable that? I can't use git send-email because I'm sending from different machine than I use git on.
Quoted 6 lines
On another thread Laurent Vivier found it is a copy/paste problem between an email client and an editor (IIUC):
https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg03669.htmlLaurent, if you understood what's wrong, can you add en entry in the wiki so we can refer contributors to it?
No sure. My guess is a cut'n'paste between two windows with different charsets doesn't work because the buffer keeps the char encoding of the first window and put them as raw binaries in the second one, so it encodes something else.
Thanks,
Laurent
Re: [Qemu-devel] [PATCH v5-resend 2/2] mips_fulong2e: Add on-board graphics chip
In reply to BALATON ZoltanHi,
Quoted 9 lines
Quoted 4 lines
"git send-email" should send the patches with correct headers, it even asks for the charset it should use in case it finds non-ascii characters. So BALATON, could you check your mail client config, or switch over to "git send-email" for submitting patches?
I'm sending what git format-patch is generating and that does not add content type header by default. Is there a config option to enable that? I can't use git send-email because I'm sending from different machine than I use git on.
git send-email also accepts files generated by git format-patch, so you can:
(1) "git format-patch master..$branch", on machine A
(2) copy over 000*.patch from machine A to machine B
(3) "git send-email 000*.patch", on machine B
But take care that you don't have old 000*.patch files lying around on machine B ...
HTH,
Gerd