qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Dave Airlie <airlied@gmail.com>
Cc: Dave Airlie <airlied@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 1/8] virtio-gpu/2d: add hardware spec include file
Date: Tue, 30 Sep 2014 09:54:41 +0200	[thread overview]
Message-ID: <1412063681.23471.6.camel@nilsson.home.kraxel.org> (raw)
In-Reply-To: <CAPM=9ty3ty4cSEZWGV4Zk7-ZMdsD89wrQkpWPh1K3-QEK4Fd6A@mail.gmail.com>


On Di, 2014-09-30 at 10:27 +1000, Dave Airlie wrote:
> > Triggered by the framebuffer endian issues we have with stdvga I've
> > started to check where we stand with virtio-gpu and whenever we have to
> > fix something in the virtio protocol before setting in stone with the
> > upstream merge.
> 
> Let me start by saying its not that I don't care about endianness, but
> its a mess I had hoped to avoid until someone else care more about it.

Understood.  It's a big mess indeed.

> So before we try fixing things, we probably need to design something
> that defines
> where all the swapping happens, and what formats the virgl "hw" device supports.

2D case is easy.  Everything is little endian.  kernel driver / qemu are
doing the byteswaps for the structs sent over the control pipe.

Problem with 3D is that both qemu and kernel driver passing through data
where they don't even know what is inside, so they can't do the
byteswapping.

> The main problem is getting an efficient solution that avoids double swapping
> of the major items like texture and vertex data if we can in some scenarios.

Yes.

> 
> Currently the virgl "hw" supports little endian defined formats, as
> per the gallium
> interface, i.e. B8G8R8A8 means blue/red/green/alpha,
> 
> http://gallium.readthedocs.org/en/latest/format.html
> is the documentation.

Thanks.

> >> +    VIRTIO_GPU_FORMAT_B5G5R5A1_UNORM  = 5,
> >> +    VIRTIO_GPU_FORMAT_B5G6R5_UNORM    = 7,
> >
> > Do we really wanna go down this route?  I'm inclined to just zap 16bpp
> > support.
> 
> We have to support 16bpp as an OpenGL format no matter what, and this
> is why endianness sucks, we have lots of strange ass formats we need
> to send over the wire, that have no nicely defined endianness, like Z24S8.

Ok.  But for 2D we can just not support it, right?

> > What about 3d mode?  We are passing blobs between virglrenderer and
> > guest driver:  capabilities and gallium 3d command stream.  What happens
> > to them in case host and guest endianness don't match?  I think at least
> > the capabilities have 32bit values which need to be swapped.  Dunno
> > about the gallium commands ...
> 
> For 3D we probably need to define the gallium command streams to be
> little endian, however the big problem is the data that is stored
> inside objects.
> Texture and vertex, constants, indices etc. How do we decide to swap these,
> when do we swap things, on the DMA transfers to the host, do we just
> swap the formats on the host side etc.
> 
> I probably need to spend some time working this out with BenH, but
> I'm not really sure how we can avoid backing ourselves into a large inefficent
> hole at some point.

I surely don't wanna go down that route, and I think it is reasonable to
just not support 3D/virgl mode if we would have to swap data.


So, we could define *two* virgl feature bits.  One for little endian,
one for bigendian.  endianness applies to the gallium command stream and
to gallium formats using integers in host endianess.

On the host side we'll go set the feature bit matching host endianness.
qemu handles the virtqueue command struct swapping, and virglrenderer
should only see native endian.

On the guest side we'll look for the feature bit matching guest
endianness, and if it isn't set due to guest + host having different
byte order you'll get 2D support only.

The endianness negotiation is a bit iffy, but that way it is possible to
have virgl on bigendian without swapping everything twice.


The other reasonable way would be to simply define virgl being little
endian.  Bigendian guests / hosts would either simply not support 3D
then, or implement swapping.  But in the bigendian-guest on
bigendian-host case we'll swap everything twice then ...

cheers,
  Gerd

  reply	other threads:[~2014-09-30  7:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23 13:27 [Qemu-devel] [PATCH 0/8] add virtio-gpu Gerd Hoffmann
2014-09-23 13:28 ` [Qemu-devel] [PATCH 1/8] virtio-gpu/2d: add hardware spec include file Gerd Hoffmann
2014-09-25 15:02   ` Gerd Hoffmann
2014-09-30  0:27     ` Dave Airlie
2014-09-30  7:54       ` Gerd Hoffmann [this message]
2014-09-30  7:55       ` Gerd Hoffmann
2014-10-03  4:38         ` Dave Airlie
2014-10-06  9:20           ` Gerd Hoffmann
2014-10-16  3:53             ` Dave Airlie
2014-10-16 12:18               ` Gerd Hoffmann
2014-10-15 10:05   ` Gerd Hoffmann
2014-10-16  3:55     ` Dave Airlie
2014-09-23 13:28 ` [Qemu-devel] [PATCH 2/8] virtio-gpu/2d: add virtio gpu core code Gerd Hoffmann
2014-09-23 13:28 ` [Qemu-devel] [PATCH 3/8] virtio-gpu-pci: add virtio pci support Gerd Hoffmann
2014-09-23 13:28 ` [Qemu-devel] [PATCH 4/8] virtio-vga: add virtio gpu device with vga compatibility Gerd Hoffmann
2014-09-23 13:28 ` [Qemu-devel] [PATCH 5/8] virtio-vga: add '-vga virtio' support Gerd Hoffmann
2014-09-23 13:28 ` [Qemu-devel] [PATCH 6/8] virtio-vga: add vgabios configuration Gerd Hoffmann
2014-09-23 13:28 ` [Qemu-devel] [PATCH 7/8] virtio-vga: add vgabios binary Gerd Hoffmann
2014-09-23 13:28 ` [Qemu-devel] [PATCH 8/8] virtio-gpu: add to display-vga test Gerd Hoffmann

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=1412063681.23471.6.camel@nilsson.home.kraxel.org \
    --to=kraxel@redhat.com \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --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).