summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLingfeng Yang <lfy@google.com>2020-04-16 11:53:41 -0700
committerAlistair Delva <adelva@google.com>2020-04-22 16:26:40 -0700
commit4dbf0dd8c63e5e4757d599cedd1f70b94033ed39 (patch)
tree95f5e7fb6a730bdc426fda3c394459a300544962
parenta43b80a692f020db340b20cb787e60560e9194aa (diff)
downloadcuttlefish-modules-4dbf0dd8c63e5e4757d599cedd1f70b94033ed39.tar.gz
CHROMIUM: drm/virtgpu: add legacy VIRTIO_GPU_* values for non-upstream variants
Upstream is foolishly using values for VIRTIO_GPU_RESP_OK_* that we are already using in crosvm's virtio-gpu impl. In order to work around this, this change renumbers to values that are unlikely to collide with existing ones, and renaming the existing ones as *_LEGACY so that the kernel may be compatible with both old and new versions of crosvm. BUG=chromium:1047867 TEST=glxgears on crostini Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2051223 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org> Bug: 153580313 Signed-off-by: Lingfeng Yang <lfy@google.com> Change-Id: I40d37c877d13392cc26274561f13684aabc54a23
-rw-r--r--uapi/linux/virtio_gpu.h10
-rw-r--r--virtio_gpu/virtgpu_vq.c12
2 files changed, 18 insertions, 4 deletions
diff --git a/uapi/linux/virtio_gpu.h b/uapi/linux/virtio_gpu.h
index c841289..7961f20 100644
--- a/uapi/linux/virtio_gpu.h
+++ b/uapi/linux/virtio_gpu.h
@@ -103,8 +103,14 @@ enum virtio_gpu_ctrl_type {
VIRTIO_GPU_RESP_OK_CAPSET_INFO,
VIRTIO_GPU_RESP_OK_CAPSET,
VIRTIO_GPU_RESP_OK_EDID,
- VIRTIO_GPU_RESP_OK_RESOURCE_PLANE_INFO,
- VIRTIO_GPU_RESP_OK_ALLOCATION_METADATA,
+
+ /* CHROMIUM: legacy responses */
+ VIRTIO_GPU_RESP_OK_RESOURCE_PLANE_INFO_LEGACY = 0x1104,
+ VIRTIO_GPU_RESP_OK_ALLOCATION_METADATA_LEGACY = 0x1106,
+
+ /* CHROMIUM: success responses */
+ VIRTIO_GPU_RESP_OK_RESOURCE_PLANE_INFO = 0x11FF,
+ VIRTIO_GPU_RESP_OK_ALLOCATION_METADATA = 0x11FE,
/* error responses */
VIRTIO_GPU_RESP_ERR_UNSPEC = 0x1200,
diff --git a/virtio_gpu/virtgpu_vq.c b/virtio_gpu/virtgpu_vq.c
index 2392cdb..d6b657c 100644
--- a/virtio_gpu/virtgpu_vq.c
+++ b/virtio_gpu/virtgpu_vq.c
@@ -920,8 +920,13 @@ static void virtio_gpu_cmd_resource_create_cb(struct virtio_gpu_device *vgdev,
*/
vbuf->data_buf = NULL;
- if (resp_type != VIRTIO_GPU_RESP_OK_RESOURCE_PLANE_INFO)
+ switch (resp_type) {
+ case VIRTIO_GPU_RESP_OK_RESOURCE_PLANE_INFO:
+ case VIRTIO_GPU_RESP_OK_RESOURCE_PLANE_INFO_LEGACY:
+ break;
+ default:
goto finish_pending;
+ }
obj->num_planes = le32_to_cpu(resp->num_planes);
obj->format_modifier = le64_to_cpu(resp->format_modifier);
@@ -955,8 +960,11 @@ static void virtio_gpu_cmd_allocation_metadata_cb(struct virtio_gpu_device *vgde
if (!response)
return;
- if (resp_type == VIRTIO_GPU_RESP_OK_ALLOCATION_METADATA)
+ switch (resp_type) {
+ case VIRTIO_GPU_RESP_OK_ALLOCATION_METADATA:
+ case VIRTIO_GPU_RESP_OK_ALLOCATION_METADATA_LEGACY:
memcpy(&response->info, resp, total_size);
+ }
response->callback_done = true;
wake_up_all(&vgdev->resp_wq);