Re: [PATCH RFC 3/3] drm/virtio: Include modifier as part of set_scanout_blob

2021-05-11 Thread Gerd Hoffmann
> --- 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



[PATCH RFC 3/3] drm/virtio: Include modifier as part of set_scanout_blob

2021-05-10 Thread Tina Zhang
From: Vivek Kasireddy 

With new use-cases coming up that include virtio-gpu:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9592

the FB associated with a Guest blob may have a modifier. Therefore,
this modifier info needs to be included as part of set_scanout_blob.

v2: (Tina)
* Use drm_plane_add_modifiers() to set allow_fb_modifiers.
* Append the modifier field to the virtio_gpu_set_scanout_blob struct.

Signed-off-by: Vivek Kasireddy 
Signed-off-by: Tina Zhang 
---
 drivers/gpu/drm/virtio/virtgpu_vq.c | 3 ++-
 include/uapi/linux/virtio_gpu.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

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 */
-- 
2.25.1