drm: virtio: fix virtio_gpu_mode_dumb_create
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 3 Apr 2017 07:08:45 +0000 (09:08 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 4 Apr 2017 08:10:20 +0000 (10:10 +0200)
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>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: Laurent Vivier <lvivier@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170403070845.10793-3-kraxel@redhat.com
drivers/gpu/drm/virtio/virtgpu_gem.c

index 336a57fd6d5d6821591b7f15b91b270a14d7c2f8..cc025d8fbe195096a62a2d426709ba2bcaf28cc5 100644 (file)
@@ -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);