Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1614915 > unrolled thread

[PATCH 2/2] drm: virtio: fix virtio_gpu_mode_dumb_create

Started byGerd Hoffmann <kraxel@redhat.com>
First post2017-04-03 09:10 +0200
Last post2017-04-03 11:10 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] drm: virtio: fix virtio_gpu_mode_dumb_create Gerd Hoffmann <kraxel@redhat.com> - 2017-04-03 09:10 +0200
    Re: [PATCH 2/2] drm: virtio: fix virtio_gpu_mode_dumb_create Dave Airlie <airlied@gmail.com> - 2017-04-03 09:50 +0200
    Re: [PATCH 2/2] drm: virtio: fix virtio_gpu_mode_dumb_create Daniel Vetter <daniel@ffwll.ch> - 2017-04-03 10:00 +0200
      Re: [PATCH 2/2] drm: virtio: fix virtio_gpu_mode_dumb_create Gerd Hoffmann <kraxel@redhat.com> - 2017-04-03 11:10 +0200

#1614915 — [PATCH 2/2] drm: virtio: fix virtio_gpu_mode_dumb_create

FromGerd Hoffmann <kraxel@redhat.com>
Date2017-04-03 09:10 +0200
Subject[PATCH 2/2] drm: virtio: fix virtio_gpu_mode_dumb_create
Message-ID<ts4hH-3FM-3@gated-at.bofh.it>
Lookup format using virtio_gpu_translate_format()
instead of hardcoding it.  Fixes xorg display on
bigendian guests (i.e. ppc64).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/gpu/drm/virtio/virtgpu_gem.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c
index 336a57f..cc025d8 100644
--- a/drivers/gpu/drm/virtio/virtgpu_gem.c
+++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
@@ -88,6 +88,7 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
 	int ret;
 	uint32_t pitch;
 	uint32_t resid;
+	uint32_t format;
 
 	pitch = args->width * ((args->bpp + 1) / 8);
 	args->size = pitch * args->height;
@@ -98,9 +99,10 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
 	if (ret)
 		goto fail;
 
+	format = virtio_gpu_translate_format(DRM_FORMAT_XRGB8888);
 	virtio_gpu_resource_id_get(vgdev, &resid);
-	virtio_gpu_cmd_create_resource(vgdev, resid,
-				       2, args->width, args->height);
+	virtio_gpu_cmd_create_resource(vgdev, resid, format,
+				       args->width, args->height);
 
 	/* attach the object to the resource */
 	obj = gem_to_virtio_gpu_obj(gobj);
-- 
2.9.3

[toc] | [next] | [standalone]


#1614946

FromDave Airlie <airlied@gmail.com>
Date2017-04-03 09:50 +0200
Message-ID<ts4Up-3Uo-15@gated-at.bofh.it>
In reply to#1614915
On 3 April 2017 at 17:08, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Lookup format using virtio_gpu_translate_format()
> instead of hardcoding it.  Fixes xorg display on
> bigendian guests (i.e. ppc64).
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

For the series,

Reviewed-by: Dave Airlie <airlied@redhat.com>

> ---
>  drivers/gpu/drm/virtio/virtgpu_gem.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c
> index 336a57f..cc025d8 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_gem.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
> @@ -88,6 +88,7 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
>         int ret;
>         uint32_t pitch;
>         uint32_t resid;
> +       uint32_t format;
>
>         pitch = args->width * ((args->bpp + 1) / 8);
>         args->size = pitch * args->height;
> @@ -98,9 +99,10 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
>         if (ret)
>                 goto fail;
>
> +       format = virtio_gpu_translate_format(DRM_FORMAT_XRGB8888);
>         virtio_gpu_resource_id_get(vgdev, &resid);
> -       virtio_gpu_cmd_create_resource(vgdev, resid,
> -                                      2, args->width, args->height);
> +       virtio_gpu_cmd_create_resource(vgdev, resid, format,
> +                                      args->width, args->height);
>
>         /* attach the object to the resource */
>         obj = gem_to_virtio_gpu_obj(gobj);
> --
> 2.9.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

[toc] | [prev] | [next] | [standalone]


#1614949

FromDaniel Vetter <daniel@ffwll.ch>
Date2017-04-03 10:00 +0200
Message-ID<ts546-3XB-13@gated-at.bofh.it>
In reply to#1614915
On Mon, Apr 03, 2017 at 09:08:45AM +0200, Gerd Hoffmann wrote:
> Lookup format using virtio_gpu_translate_format()
> instead of hardcoding it.  Fixes xorg display on
> bigendian guests (i.e. ppc64).
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

ow ... :(

With what kind of client have you tested this? fbdev? kms native?

Should we patch drm_fourcc.h and essentially state that _all_ drm_fourcc
are in native endian, don't dare mixing things up? Would be good to send
out an rfc and discuss it with radeon/amd maintainers. Afaik they are the
only ones who also care about some big endian platforms.

On the patch itself, once you've added more details about what/how it
falls over:

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Daniel

> ---
>  drivers/gpu/drm/virtio/virtgpu_gem.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c
> index 336a57f..cc025d8 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_gem.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
> @@ -88,6 +88,7 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
>  	int ret;
>  	uint32_t pitch;
>  	uint32_t resid;
> +	uint32_t format;
>  
>  	pitch = args->width * ((args->bpp + 1) / 8);
>  	args->size = pitch * args->height;
> @@ -98,9 +99,10 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
>  	if (ret)
>  		goto fail;
>  
> +	format = virtio_gpu_translate_format(DRM_FORMAT_XRGB8888);
>  	virtio_gpu_resource_id_get(vgdev, &resid);
> -	virtio_gpu_cmd_create_resource(vgdev, resid,
> -				       2, args->width, args->height);
> +	virtio_gpu_cmd_create_resource(vgdev, resid, format,
> +				       args->width, args->height);
>  
>  	/* attach the object to the resource */
>  	obj = gem_to_virtio_gpu_obj(gobj);
> -- 
> 2.9.3
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

[toc] | [prev] | [next] | [standalone]


#1614993

FromGerd Hoffmann <kraxel@redhat.com>
Date2017-04-03 11:10 +0200
Message-ID<ts69P-4Te-3@gated-at.bofh.it>
In reply to#1614949
On Mo, 2017-04-03 at 09:53 +0200, Daniel Vetter wrote:
> On Mon, Apr 03, 2017 at 09:08:45AM +0200, Gerd Hoffmann wrote:
> > Lookup format using virtio_gpu_translate_format()
> > instead of hardcoding it.  Fixes xorg display on
> > bigendian guests (i.e. ppc64).
> > 
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> 
> ow ... :(
> 
> With what kind of client have you tested this? fbdev? kms native?

text console (fbcon) is fine, xorg (modesetting driver) fails.

> Should we patch drm_fourcc.h and essentially state that _all_ drm_fourcc
> are in native endian, don't dare mixing things up?

Well, I don't think this needs clarification.  I never assumed that
fourcc is something else than native endian.  It really was just an
oversight in the virtio driver.

One code path (which creates the framebuffer for fbdev emulation) did
proper drm_fourcc -> virtio format mapping, including endianness
handling.  Patch 1/2 of this series factors this code out into a helper
function so we can easily reuse it.

The other code path (for creating dumb buffers) had the virtio format
hardcoded which happened to work correctly in the little endian case.

cheers,
  Gerd

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web