[Bug 779146] dmabuf: be able to negotiate tiled surfaces

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Fri Feb 24 10:08:29 UTC 2017


https://bugzilla.gnome.org/show_bug.cgi?id=779146

--- Comment #7 from Julien Isorce <julien.isorce at gmail.com> ---
I think that Nicolas's suggestion is a very good idea. Let's try to apply it on
the following use cases:

vaapidec ! glimagesink   doing HW decoding on integrated intel gpu and GL
rendering on the integrated gpu too.

vaapidec will set GsDmabufBackedFormatMeta,format=INTEL_Y_TILED,LINEAR. GstGL
will read the meta, and fine that the intersection is INTEL_Y_TILED. GstGL will
update the allocation query, and return. So that vaapidec will clear the linear
flag for the vaapi driver which will work in tiled mode.

  vaapidec ! glimagesink   doing HW decoding on integrated intel gpu and GL
rendering on discrete AMD or NVIDIA gpu.

vaapidec will set GsDmabufBackedFormatMeta,format=INTEL_Y_TILED,LINEAR. GstGL
will read the meta, and fine that the intersection is LINEAR. GstGL will update
the allocation query, and return. So that vaapidec will set the linear flag for
the vaapi driver.

  vaapidec ! glimagesink   doing HW decoding on discrete NVIDIA/nouveau gpu and
GL rendering on the integrated intel gpu.

vaapidec will set GsDmabufBackedFormatMeta,format=NVIDIA_Y_TILED,LINEAR. GstGL
will read the meta, and fine that the intersection is LINEAR. GstGL will update
the allocation query, and return. So that vaapidec will set the linear flag for
the vaapi driver.

And so on. But then I think the format modifiers should also appear in -base::
GstDmaBufAllocator. As there is already gst_dmabuf_memory_get_fd, we could add
gst_dmabuf_memory_get_modifier. So that then in GstGL we could pass the
modifiers LO/HI to eglCreateImage in gst_egl_image_from_dmabuf. Also see
https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt
.

Extract from drmfourcc.h:

/* Vendor Ids: */
#define DRM_FORMAT_MOD_NONE           0
#define DRM_FORMAT_MOD_VENDOR_INTEL   0x01
#define DRM_FORMAT_MOD_VENDOR_AMD     0x02
#define DRM_FORMAT_MOD_VENDOR_NV      0x03
#define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04
#define DRM_FORMAT_MOD_VENDOR_QCOM    0x05
/* add more to the end as needed */

#define fourcc_mod_code(vendor, val) \
    ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val &
0x00ffffffffffffffULL))

#define I915_FORMAT_MOD_X_TILED    fourcc_mod_code(INTEL, 1)
#define I915_FORMAT_MOD_Y_TILED    fourcc_mod_code(INTEL, 2)
#define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3)
#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)

I can see there are 3 different way to do tiling for intel: X, Y, Yf. But the
vaapi spec (va.h from libva) only defines one flag:
VA_SURFACE_EXTBUF_DESC_ENABLE_TILING. But I am guessing this is not really a
problem because at importation time it will internally call
"libdrm::dri_bo_get_tiling" to retrieve exact internal tiling and swizzle.

Also maybe the name should be GsDmabufModifierMeta instead of
GsDmabufBackedFormatMeta ?
Or could we just add a new field "guint64 tiling/format_modifier" to the
existing -base::GstVideoMeta ? + eventually a new GstVideoFrameFlags
GST_VIDEO_FRAME_FLAG_LINEAR which would indicates that when mapping the dmabuf
it will be accessible as linear even if the modifier indicates tiled.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list