From: Fabrice Bellard <fabrice@bellard.org>
To: Even Rouault <even.rouault@mines-paris.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Experimental initial patch providing accelerated OpenGL for Linux i386 (2nd attempt to post)
Date: Sat, 18 Nov 2006 18:40:51 +0100 [thread overview]
Message-ID: <455F45A3.4010806@bellard.org> (raw)
In-Reply-To: <200611181359.25068.even.rouault@mines-paris.org>
Even Rouault wrote:
> Le Jeudi 16 Novembre 2006 23:41, vous avez écrit :
>
>>My main remark is that the host/guest communication system must be
>>changed and I can help you to implement it. I would prefer to use a PCI
>>device and to avoid any i386 dependent code. For the PCI device, using
>>the Bochs VGA adapter could be a possible idea. All the parameters and
>>data should be transmitted as if the PCI device was doing DMA. A single
>>I/O port could be used to start executing a list of OpenGL commands.
>
>
> Hi,
>
> I would indeed appreciate help, or at least some pointers to start in the
> direction you propose, as I know hardly anything about hardware programming,
> such as PCI, memory mapped region, DMA, etc... So my questions may sound very
> naive.
> As you stated, the current solution is i386 dependent, but this dependancy is
> very thin, so I imagined that it should possible to find equivalent of the
> current int 0x99 trap for other architectures.
> Apart from portability to other architectures, what would be the other
> advantages of a solution based on a PCI device ? Better security ? Better
> performance when KQEMU is enabled ?
The PCI device is not necessarily an advantage is terms of performance
and it will be more complicated to implement on both the host and the
guest. But it is better in terms of security and it avoids adding
unnecessary hacks in the CPU core (for example, I consider the use of
virtual addresses as a hack).
> I've looked at vga.c and I've the feeling that with
> cpu_register_io_memory/cpu_register_physical_memory you can install callback
> functions that will intercept reads/writes to a range of the physical memory
> of the target machine. Am I right ?
Yes.
> But I don't see how the replacement libGL can read/write physical memory from
> a userland process. I suppose it needs some special priviledges to use for
> example a ioctl, or maybe writing a kernel module. So it would become guest
> OS dependant. Furthermore, doesn't this solution imply more memcpy that may
> affect performance ? Currently, if a memory range of a guest process (let's
> say a texture) is by chance mapped contiguously into guest physical memory,
> we don't need to do any copy before passing it to the host libGL, though I've
> not benchmarked if it really improves performance.
You have no choice but adding a kernel module to handle the transfers to
and from the PCI device. Basically you must write a small XFree DRM like
kernel driver. Since the PCI device will only handle physical memory,
the kernel driver will convert the virtual addresses to physical
addresses and ensure that the corresponding pages are not swapped out by
the guest OS. The PCI device must handle lists of physical I/O regions
so that no memcpy will be needed to do the transfers (scatter/gather
DMA). The performance should be the same as your current implementation.
Moreover, your protocol could handle queueing of several OpenGL commands
in a FIFO because "int 0x99" or the equivalent PCI write command takes
some time to execute, especially when using kqemu where an exception is
raised.
Another point is that I fear that your current use of glX is not
portable and can lead to subtle problems. You should rely on SDL/OpenGL
on the host side and leave glX on the guest OS.
All in all, what I propose gets very close to adding something like a
real 3d VGA device in QEMU and a new 3d driver in X11 !
[My intend before your submission was to emulate a recent Intel 3d card
because their protocols are mostly documented now (at least in the X11
source !) and because these recent cards support higher level 3d
operations such as hardware 3d transformations. My guess is that
converting their DMA commands to OpenGL is easy.
As writing an Intel 3d emulation would take time and is likely to be
very complicated to tune for closed source guest OSes, I think it is
safer to begin by improving your proposal.]
Regards,
Fabrice.
next prev parent reply other threads:[~2006-11-18 17:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-16 20:34 [Qemu-devel] [PATCH] Experimental initial patch providing accelerated OpenGL for Linux i386 (2nd attempt to post) Even Rouault
2006-11-16 21:13 ` Even Rouault
2006-11-16 22:41 ` Fabrice Bellard
2006-11-17 1:25 ` Paul Brook
2006-11-18 12:59 ` Even Rouault
2006-11-18 17:40 ` Fabrice Bellard [this message]
2006-11-19 19:01 ` Avi Kivity
2006-11-17 7:16 ` Stefan Kombrink
2006-11-17 7:29 ` Laurent Desnogues
2006-11-20 3:48 ` [Qemu-devel] [PATCH] Experimental initial patch providingaccelerated " Kazu
-- strict thread matches above, loose matches on Subject: below --
2006-11-16 20:36 [Qemu-devel] [PATCH] Experimental initial patch providing accelerated " Even Rouault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=455F45A3.4010806@bellard.org \
--to=fabrice@bellard.org \
--cc=even.rouault@mines-paris.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).