mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
va: allocator: Use always lseek to get dmabuf size.
Gallium drivers historically have reported strange dmabuf sizes, from always zero to the whole frame (multiple fds). The simplest solution is to use lseek SEEK_END to get the prime descriptor size. Also the allocator raises a warning if both values differ in order to report it to driver. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2574>
This commit is contained in:
parent
83c51c9812
commit
8a2660dc7f
1 changed files with 9 additions and 2 deletions
|
@ -594,11 +594,18 @@ gst_va_dmabuf_allocator_setup_buffer_full (GstAllocator * allocator,
|
|||
|
||||
for (i = 0; i < desc.num_objects; i++) {
|
||||
gint fd = desc.objects[i].fd;
|
||||
gsize size = desc.objects[i].size > 0 ?
|
||||
desc.objects[i].size : _get_fd_size (fd);
|
||||
/* don't rely on prime descriptor reported size since gallium drivers report
|
||||
* different values */
|
||||
gsize size = _get_fd_size (fd);
|
||||
GstMemory *mem = gst_dmabuf_allocator_alloc (allocator, fd, size);
|
||||
guint64 *drm_mod = g_new (guint64, 1);
|
||||
|
||||
if (size != desc.objects[i].size) {
|
||||
GST_WARNING_OBJECT (self, "driver bug: fd size (%" G_GSIZE_FORMAT
|
||||
") differs from object descriptor size (%" G_GUINT32_FORMAT ")",
|
||||
size, desc.objects[i].size);
|
||||
}
|
||||
|
||||
object_offset[i] = gst_buffer_get_size (buffer);
|
||||
gst_buffer_append_memory (buffer, mem);
|
||||
buf->mems[i] = mem;
|
||||
|
|
Loading…
Reference in a new issue