mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-08 23:42:28 +00:00
vaallocator: Allow non-linear modifiers for dummy mem_maps
A client may map dmabufs without the intention to either read or write to the memory. One example is clients wanting to use the `gst_video_frame_map()` helper function. Thus, in order to make buffers from `GstVaDmabufAllocator` conveniently usable, ignore the modifier check if the client specified neither `GST_MAP_READ` nor `GST_MAP_WRITE`. Also skip the `va_sync_surface()` call in that case, as it's likely only needed for CPU reads/writes. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5965>
This commit is contained in:
parent
c84285d44d
commit
9ee58825cc
1 changed files with 10 additions and 8 deletions
|
@ -391,15 +391,17 @@ gst_va_dmabuf_mem_map (GstMemory * gmem, gsize maxsize, GstMapFlags flags)
|
||||||
GstVaDmabufAllocator *self = GST_VA_DMABUF_ALLOCATOR (gmem->allocator);
|
GstVaDmabufAllocator *self = GST_VA_DMABUF_ALLOCATOR (gmem->allocator);
|
||||||
VASurfaceID surface = gst_va_memory_get_surface (gmem);
|
VASurfaceID surface = gst_va_memory_get_surface (gmem);
|
||||||
|
|
||||||
if (self->info.drm_modifier != DRM_FORMAT_MOD_LINEAR) {
|
if (flags & GST_MAP_READWRITE) {
|
||||||
GST_ERROR_OBJECT (self, "Failed to map the dmabuf because the modifier "
|
if (self->info.drm_modifier != DRM_FORMAT_MOD_LINEAR) {
|
||||||
"is: %#" G_GINT64_MODIFIER "x, which is not linear.",
|
GST_ERROR_OBJECT (self, "Failed to map the dmabuf because the modifier "
|
||||||
self->info.drm_modifier);
|
"is: %#" G_GINT64_MODIFIER "x, which is not linear.",
|
||||||
return NULL;
|
self->info.drm_modifier);
|
||||||
}
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!va_sync_surface (self->display, surface))
|
if (!va_sync_surface (self->display, surface))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return self->parent_map (gmem, maxsize, flags);
|
return self->parent_map (gmem, maxsize, flags);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue