Skip to contentSkip to conversation

drm/virtio: Set missing bo->attached flag

PATCH Applied Dmitry Osipenko 2 participants 3 messages Nov 29, 2024 – Jan 9, 2025

Subsystems (4)
lore
Share & tools
lore

Dmitry Osipenko

author maintainer
#0 lore raw

PATCH 1/1 drm/virtio: Set missing bo->attached flag

VirtIO-GPU driver now supports detachment of shmem BOs from host, but doing it only for imported dma-bufs. Mark all shmem BOs as attached, not just dma-bufs. This is a minor correction since detachment of a non-dmabuf BOs not supported today.

---
 drivers/gpu/drm/virtio/virtgpu_prime.c | 1 -
 drivers/gpu/drm/virtio/virtgpu_vq.c    | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_prime.c +0 -1
index 688810d1b611..33084ce1d01d 100644
@@ -249,7 +249,6 @@ static int virtgpu_dma_buf_init_obj(struct drm_device *dev,
 	virtio_gpu_cmd_resource_create_blob(vgdev, bo, &params,
 					    ents, nents);
 	bo->guest_blob = true;
-	bo->attached = true;
 
 	dma_buf_unpin(attach);
 	dma_resv_unlock(resv);
drivers/gpu/drm/virtio/virtgpu_vq.c +3 -0
index ad91624df42d..062639250a4e 100644
@@ -1300,6 +1300,9 @@ virtio_gpu_cmd_resource_create_blob(struct virtio_gpu_device *vgdev,
 
 	virtio_gpu_queue_ctrl_buffer(vgdev, vbuf);
 	bo->created = true;
+
+	if (nents)
+		bo->attached = true;
 }
 
 void virtio_gpu_cmd_set_scanout_blob(struct virtio_gpu_device *vgdev,
Signature · 1 line
2.47.0
Acked-by on v1 1/1
#1 lore raw
Quoted 33 lines

Subject: [PATCH v1] drm/virtio: Set missing bo->attached flag

VirtIO-GPU driver now supports detachment of shmem BOs from host, but doing it only for imported dma-bufs. Mark all shmem BOs as attached, not just dma-bufs. This is a minor correction since detachment of a non-dmabuf BOs not supported today.

---
 drivers/gpu/drm/virtio/virtgpu_prime.c | 1 -
 drivers/gpu/drm/virtio/virtgpu_vq.c    | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_prime.c +0 -1
index 688810d1b611..33084ce1d01d 100644
@@ -249,7 +249,6 @@ static int virtgpu_dma_buf_init_obj(struct
 drm_device *dev,
 	virtio_gpu_cmd_resource_create_blob(vgdev, bo, &params,
 					    ents, nents);
 	bo->guest_blob = true;
-	bo->attached = true;
 
 	dma_buf_unpin(attach);
drivers/gpu/drm/virtio/virtgpu_prime.c +0 -0
 	dma_resv_unlock(resv);
drivers/gpu/drm/virtio/virtgpu_vq.c +0 -0
index ad91624df42d..062639250a4e 100644

drivers/gpu/drm/virtio/virtgpu_vq.c virtio_gpu_cmd_resource_create_blob(struct · line 1306

Quoted 7 lines
drivers/gpu/drm/virtio/virtgpu_vq.c +3 -0
@@ -1300,6 +1300,9 @@ virtio_gpu_cmd_resource_create_blob(struct
 virtio_gpu_device *vgdev,
 
 	virtio_gpu_queue_ctrl_buffer(vgdev, vbuf);
 	bo->created = true;
+
+	if (nents)
+		bo->attached = true;
Quoted 5 lines
drivers/gpu/drm/virtio/virtgpu_vq.c +0 -0
 }
 

void virtio_gpu_cmd_set_scanout_blob(struct virtio_gpu_device *vgdev,
--
2.47.0

author maintainer Applied
#2 lore raw
In reply to Dmitry Osipenko
Quoted 10 lines · Dmitry Osipenko

VirtIO-GPU driver now supports detachment of shmem BOs from host, but doing it only for imported dma-bufs. Mark all shmem BOs as attached, not just dma-bufs. This is a minor correction since detachment of a non-dmabuf BOs not supported today.

---
 drivers/gpu/drm/virtio/virtgpu_prime.c | 1 -
 drivers/gpu/drm/virtio/virtgpu_vq.c    | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)

Applied to misc-next

Signature · 2 lines
Best regards,
Dmitry