mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
contrib/vhost-user-gpu: add support for sending dmabuf modifiers
virglrenderer recently added virgl_renderer_resource_get_info_ext as a new api, which gets resource information, including dmabuf modifiers. We have to support dmabuf modifiers since the driver may choose to allocate buffers with these modifiers for efficiency, and importing buffers without modifiers information may result in completely broken rendering. Signed-off-by: Erico Nunes <ernunes@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Sergio Lopez <slp@redhat.com> Message-Id: <20230714153900.475857-3-ernunes@redhat.com>
This commit is contained in:
parent
75f217b4ad
commit
e3c82fe04f
3 changed files with 61 additions and 4 deletions
|
@ -1071,6 +1071,7 @@ static gboolean
|
|||
protocol_features_cb(gint fd, GIOCondition condition, gpointer user_data)
|
||||
{
|
||||
const uint64_t protocol_edid = (1 << VHOST_USER_GPU_PROTOCOL_F_EDID);
|
||||
const uint64_t protocol_dmabuf2 = (1 << VHOST_USER_GPU_PROTOCOL_F_DMABUF2);
|
||||
VuGpu *g = user_data;
|
||||
uint64_t protocol_features;
|
||||
VhostUserGpuMsg msg = {
|
||||
|
@ -1082,7 +1083,7 @@ protocol_features_cb(gint fd, GIOCondition condition, gpointer user_data)
|
|||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
protocol_features &= protocol_edid;
|
||||
protocol_features &= (protocol_edid | protocol_dmabuf2);
|
||||
|
||||
msg = (VhostUserGpuMsg) {
|
||||
.request = VHOST_USER_GPU_SET_PROTOCOL_FEATURES,
|
||||
|
@ -1100,6 +1101,8 @@ protocol_features_cb(gint fd, GIOCondition condition, gpointer user_data)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
g->use_modifiers = !!(protocol_features & protocol_dmabuf2);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue