Message ID | 20210511014940.2067715-4-tina.zhang@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add virtio-gpu modifiers support | expand |
> --- a/include/uapi/linux/virtio_gpu.h > +++ b/include/uapi/linux/virtio_gpu.h > @@ -420,6 +420,7 @@ struct virtio_gpu_set_scanout_blob { > __le32 padding; > __le32 strides[4]; > __le32 offsets[4]; > + __le64 modifier; > }; All protocol changes (uapi/linux/virtio_gpu.h updates) should go to a separate patch (best first in the series). A feature flag is needed to signal whenever modifier support is available or not. The code needs to cake care to not send the modifier field in case the host doesn't support it. Naming the modifier field "drm_modifier" is probably a good idea to make clear that we'll use the drm modifier as-is. A virtio-spec update is needed to document the protocol update. take care, Gerd
diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index 7a6d6628e167..351befed105a 100644 --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -34,7 +34,7 @@ #include "virtgpu_drv.h" #include "virtgpu_trace.h" -#define MAX_INLINE_CMD_SIZE 96 +#define MAX_INLINE_CMD_SIZE 112 #define MAX_INLINE_RESP_SIZE 24 #define VBUFFER_SIZE (sizeof(struct virtio_gpu_vbuffer) \ + MAX_INLINE_CMD_SIZE \ @@ -1336,6 +1336,7 @@ void virtio_gpu_cmd_set_scanout_blob(struct virtio_gpu_device *vgdev, cmd_p->format = cpu_to_le32(format); cmd_p->width = cpu_to_le32(fb->width); cmd_p->height = cpu_to_le32(fb->height); + cmd_p->modifier = cpu_to_le64(fb->modifier); for (i = 0; i < 4; i++) { cmd_p->strides[i] = cpu_to_le32(fb->pitches[i]); diff --git a/include/uapi/linux/virtio_gpu.h b/include/uapi/linux/virtio_gpu.h index f853d7672175..6d08481ac4ef 100644 --- a/include/uapi/linux/virtio_gpu.h +++ b/include/uapi/linux/virtio_gpu.h @@ -420,6 +420,7 @@ struct virtio_gpu_set_scanout_blob { __le32 padding; __le32 strides[4]; __le32 offsets[4]; + __le64 modifier; }; /* VIRTIO_GPU_CMD_RESOURCE_MAP_BLOB */