[RFC 0/8] ATI R300 emulated graphics card

aaron.zakhrov@gmail.com posted 8 patches 4 years, 5 months ago
Failed in applying to current master (apply log)
[RFC 0/8] ATI R300 emulated graphics card
Posted by aaron.zakhrov@gmail.com 4 years, 5 months ago
From: Aaron Dominick <aaron.zakhrov@gmail.com>

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

-- 
2.24.0


Re: [RFC 0/8] ATI R300 emulated graphics card
Posted by BALATON Zoltan 4 years, 5 months ago
Hello,

On Tue, 26 Nov 2019, aaron.zakhrov@gmail.com wrote:
> From: Aaron Dominick <aaron.zakhrov@gmail.com>
>
> 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.

> 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.

> 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.

> 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.

> 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

Re: [RFC 0/8] ATI R300 emulated graphics card
Posted by Aaron Zakhrov 4 years, 5 months ago
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.

 > Are you aware of my project page for ATI VGA emulation here:
Yes I am. Your code got me through the initial setup.



On Tue, Nov 26, 2019 at 5:33 PM BALATON Zoltan <balaton@eik.bme.hu> wrote:

> Hello,
>
> On Tue, 26 Nov 2019, aaron.zakhrov@gmail.com wrote:
> > From: Aaron Dominick <aaron.zakhrov@gmail.com>
> >
> > 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.
>
> > 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.
>
> > 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.
>
> > 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.
>
> > 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
>