From: Erico Nunes <ernunes@redhat.com>
To: qemu-devel@nongnu.org
Cc: marcandre.lureau@redhat.com, slp@redhat.com,
Erico Nunes <ernunes@redhat.com>
Subject: [PATCH 3/3] vhost-user-gpu: support dmabuf modifiers
Date: Fri, 14 Jul 2023 17:39:00 +0200 [thread overview]
Message-ID: <20230714153900.475857-4-ernunes@redhat.com> (raw)
In-Reply-To: <20230714153900.475857-1-ernunes@redhat.com>
When the backend sends VHOST_USER_GPU_DMABUF_SCANOUT2, handle it
by getting the modifiers information which is now available.
Signed-off-by: Erico Nunes <ernunes@redhat.com>
---
hw/display/vhost-user-gpu.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c
index e8ee03094e..1150521d9d 100644
--- a/hw/display/vhost-user-gpu.c
+++ b/hw/display/vhost-user-gpu.c
@@ -32,6 +32,7 @@ typedef enum VhostUserGpuRequest {
VHOST_USER_GPU_DMABUF_SCANOUT,
VHOST_USER_GPU_DMABUF_UPDATE,
VHOST_USER_GPU_GET_EDID,
+ VHOST_USER_GPU_DMABUF_SCANOUT2,
} VhostUserGpuRequest;
typedef struct VhostUserGpuDisplayInfoReply {
@@ -79,6 +80,11 @@ typedef struct VhostUserGpuDMABUFScanout {
int fd_drm_fourcc;
} QEMU_PACKED VhostUserGpuDMABUFScanout;
+typedef struct VhostUserGpuDMABUFScanout2 {
+ struct VhostUserGpuDMABUFScanout dmabuf_scanout;
+ uint64_t modifier;
+} QEMU_PACKED VhostUserGpuDMABUFScanout2;
+
typedef struct VhostUserGpuEdidRequest {
uint32_t scanout_id;
} QEMU_PACKED VhostUserGpuEdidRequest;
@@ -93,6 +99,7 @@ typedef struct VhostUserGpuMsg {
VhostUserGpuScanout scanout;
VhostUserGpuUpdate update;
VhostUserGpuDMABUFScanout dmabuf_scanout;
+ VhostUserGpuDMABUFScanout2 dmabuf_scanout2;
VhostUserGpuEdidRequest edid_req;
struct virtio_gpu_resp_edid resp_edid;
struct virtio_gpu_resp_display_info display_info;
@@ -107,6 +114,7 @@ static VhostUserGpuMsg m __attribute__ ((unused));
#define VHOST_USER_GPU_MSG_FLAG_REPLY 0x4
#define VHOST_USER_GPU_PROTOCOL_F_EDID 0
+#define VHOST_USER_GPU_PROTOCOL_F_DMABUF2 1
static void vhost_user_gpu_update_blocked(VhostUserGPU *g, bool blocked);
@@ -171,7 +179,8 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUserGpuMsg *msg)
.flags = VHOST_USER_GPU_MSG_FLAG_REPLY,
.size = sizeof(uint64_t),
.payload = {
- .u64 = (1 << VHOST_USER_GPU_PROTOCOL_F_EDID)
+ .u64 = (1 << VHOST_USER_GPU_PROTOCOL_F_EDID) |
+ (1 << VHOST_USER_GPU_PROTOCOL_F_DMABUF2)
}
};
@@ -236,6 +245,7 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUserGpuMsg *msg)
break;
}
+ case VHOST_USER_GPU_DMABUF_SCANOUT2:
case VHOST_USER_GPU_DMABUF_SCANOUT: {
VhostUserGpuDMABUFScanout *m = &msg->payload.dmabuf_scanout;
int fd = qemu_chr_fe_get_msgfd(&g->vhost_chr);
@@ -269,6 +279,11 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUserGpuMsg *msg)
.fourcc = m->fd_drm_fourcc,
.y0_top = m->fd_flags & VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP,
};
+ if (msg->request == VHOST_USER_GPU_DMABUF_SCANOUT2) {
+ VhostUserGpuDMABUFScanout2 *m2 = &msg->payload.dmabuf_scanout2;
+ dmabuf->modifier = m2->modifier;
+ }
+
dpy_gl_scanout_dmabuf(con, dmabuf);
break;
}
--
2.40.1
next prev parent reply other threads:[~2023-07-14 15:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-14 15:38 [PATCH 0/3] vhost-user-gpu: support dmabuf modifiers Erico Nunes
2023-07-14 15:38 ` [PATCH 1/3] docs: vhost-user-gpu: add protocol changes for " Erico Nunes
2023-07-14 15:38 ` [PATCH 2/3] contrib/vhost-user-gpu: add support for sending " Erico Nunes
2023-07-14 15:39 ` Erico Nunes [this message]
2023-07-14 20:03 ` [PATCH 0/3] vhost-user-gpu: support " Marc-André Lureau
2023-08-22 16:46 ` Erico Nunes
2023-07-17 11:26 ` Sergio Lopez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230714153900.475857-4-ernunes@redhat.com \
--to=ernunes@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=slp@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).