Commit 3e93bc2a authored by Gerd Hoffmann's avatar Gerd Hoffmann

drm/virtio: make resource id workaround runtime switchable.

Also update the comment with a reference to the virglrenderer fix.
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Reviewed-by: default avatarChia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190822102614.18164-1-kraxel@redhat.com
parent 15c665bb
...@@ -27,34 +27,38 @@ ...@@ -27,34 +27,38 @@
#include "virtgpu_drv.h" #include "virtgpu_drv.h"
static int virtio_gpu_virglrenderer_workaround = 1;
module_param_named(virglhack, virtio_gpu_virglrenderer_workaround, int, 0400);
static int virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev, static int virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev,
uint32_t *resid) uint32_t *resid)
{ {
#if 0 if (virtio_gpu_virglrenderer_workaround) {
int handle = ida_alloc(&vgdev->resource_ida, GFP_KERNEL); /*
* Hack to avoid re-using resource IDs.
if (handle < 0) *
return handle; * virglrenderer versions up to (and including) 0.7.0
#else * can't deal with that. virglrenderer commit
static int handle; * "f91a9dd35715 Fix unlinking resources from hash
* table." (Feb 2019) fixes the bug.
/* */
* FIXME: dirty hack to avoid re-using IDs, virglrenderer static int handle;
* can't deal with that. Needs fixing in virglrenderer, also handle++;
* should figure a better way to handle that in the guest. *resid = handle + 1;
*/ } else {
handle++; int handle = ida_alloc(&vgdev->resource_ida, GFP_KERNEL);
#endif if (handle < 0)
return handle;
*resid = handle + 1; *resid = handle + 1;
}
return 0; return 0;
} }
static void virtio_gpu_resource_id_put(struct virtio_gpu_device *vgdev, uint32_t id) static void virtio_gpu_resource_id_put(struct virtio_gpu_device *vgdev, uint32_t id)
{ {
#if 0 if (!virtio_gpu_virglrenderer_workaround) {
ida_free(&vgdev->resource_ida, id - 1); ida_free(&vgdev->resource_ida, id - 1);
#endif }
} }
static void virtio_gpu_ttm_bo_destroy(struct ttm_buffer_object *tbo) static void virtio_gpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment