Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2d015d2 authored by Lingfeng Yang's avatar Lingfeng Yang Committed by Alistair Delva
Browse files

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: default avatarDaniel Verkamp <dverkamp@chromium.org>
Tested-by: default avatarZach Reizner <zachr@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Bug: 153580313
Signed-off-by: default avatarLingfeng Yang <lfy@google.com>
Change-Id: I40d37c877d13392cc26274561f13684aabc54a23
parent f5c353b0
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -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);
+8 −2
Original line number Diff line number Diff line
@@ -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,