[PATCH 2/2] [RFC] drm/virtgpu: modify uapi with stride/layer_stride fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This doesn't really break userspace, since it always passes down
0 for stride/layer_stride currently. We could:

(1) modify UAPI now and add a VIRTGPU_PARAM_STRIDE_FIX feature

(2) modify the UAPI now, and not expose a corresponding feature
    (i.e, VIRTGPU_PARAM_STRIDE_FIX).  This would fold this minor fix
    into another bigger feature (like the proposed metadata query).

(3) don't modify UAPI now, wait until another feature lands.

I don't have a preference either way, as long as we get something like
this eventually.

The corresponding userspace is:

https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2129

Signed-off-by: Gurchetan Singh <gurchetansingh@xxxxxxxxxxxx>
---
 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 +++-----
 include/uapi/drm/virtgpu_drm.h         | 4 ++++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 98b72dead962..c29473ac24a1 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -325,10 +325,9 @@ static int virtio_gpu_transfer_from_host_ioctl(struct drm_device *dev,
 		goto err_unlock;
 	}
 
-	/* TODO: add the correct stride / layer_stride. */
 	virtio_gpu_cmd_transfer_from_host_3d
-		(vgdev, vfpriv->ctx_id, offset, args->level, 0, 0,
-		 &box, objs, fence);
+		(vgdev, vfpriv->ctx_id, offset, args->level, args->stride,
+		 args->layer_stride, &box, objs, fence);
 	dma_fence_put(&fence->f);
 	return 0;
 
@@ -371,11 +370,10 @@ static int virtio_gpu_transfer_to_host_ioctl(struct drm_device *dev, void *data,
 		if (!fence)
 			goto err_unlock;
 
-		/* TODO: add the correct stride / layer_stride. */
 		virtio_gpu_cmd_transfer_to_host_3d
 			(vgdev,
 			 vfpriv ? vfpriv->ctx_id : 0, offset, args->level,
-			 0, 0, &box, objs, fence);
+			 args->stride, args->layer_stride, &box, objs, fence);
 		dma_fence_put(&fence->f);
 	}
 	return 0;
diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
index f06a789f34cd..b2fc92c3d2be 100644
--- a/include/uapi/drm/virtgpu_drm.h
+++ b/include/uapi/drm/virtgpu_drm.h
@@ -117,6 +117,8 @@ struct drm_virtgpu_3d_transfer_to_host {
 	struct drm_virtgpu_3d_box box;
 	__u32 level;
 	__u32 offset;
+	__u32 stride;
+	__u32 layer_stride;
 };
 
 struct drm_virtgpu_3d_transfer_from_host {
@@ -124,6 +126,8 @@ struct drm_virtgpu_3d_transfer_from_host {
 	struct drm_virtgpu_3d_box box;
 	__u32 level;
 	__u32 offset;
+	__u32 stride;
+	__u32 layer_stride;
 };
 
 #define VIRTGPU_WAIT_NOWAIT 1 /* like it */
-- 
2.23.0.444.g18eeb5a265-goog

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux