Re: [Qemu-devel] [PATCH v1 1/2] virtio_gpu: Handle endian conversion

2017-09-14 Thread Gerd Hoffmann
On Wed, 2017-09-13 at 11:53 -0400, Farhan Ali wrote: > > On 09/13/2017 04:13 AM, Gerd Hoffmann wrote: > > Please move this to a helper function, maybe by updating the > > VIRTIO_GPU_FILL_CMD macro. > > > > The header fields should be byteswapped too.  As most structs have > > 32bit fields only

Re: [Qemu-devel] [PATCH v1 1/2] virtio_gpu: Handle endian conversion

2017-09-13 Thread Farhan Ali
On 09/13/2017 04:13 AM, Gerd Hoffmann wrote: Please move this to a helper function, maybe by updating the VIRTIO_GPU_FILL_CMD macro. The header fields should be byteswapped too. As most structs have 32bit fields only (with the exception of hdr.fence_id) you should be able to create a generic

Re: [Qemu-devel] [PATCH v1 1/2] virtio_gpu: Handle endian conversion

2017-09-13 Thread Gerd Hoffmann
Hi, > @@ -287,6 +287,12 @@ static void > virtio_gpu_resource_create_2d(VirtIOGPU *g, >  struct virtio_gpu_resource_create_2d c2d; >   >  VIRTIO_GPU_FILL_CMD(c2d); > + > +c2d.resource_id = le32_to_cpu(c2d.resource_id); > +c2d.format = le32_to_cpu(c2d.format); > +c2d.width =

[Qemu-devel] [PATCH v1 1/2] virtio_gpu: Handle endian conversion

2017-09-12 Thread Farhan Ali
Virtio GPU code currently only supports litte endian format, and so using the Virtio GPU device on a big endian machine does not work. Let's fix it by supporting the correct host cpu byte order. Signed-off-by: Farhan Ali --- hw/display/virtio-gpu.c | 53