diff options
author | Julien Isorce <[email protected]> | 2016-06-14 08:40:33 +0100 |
---|---|---|
committer | Julien Isorce <[email protected]> | 2016-06-14 08:40:33 +0100 |
commit | 1cdb4da1d6ce94d947e41d4f0e568074f4f59577 (patch) | |
tree | c60dab717fdf7a51a3be5ce68f63bac7d9118a8f /src/gallium/state_trackers/va | |
parent | 5a87bc718197deab7577a028c64a7f591bbfaec4 (diff) |
st/va: ensure linear memory for dmabuf
In order to do zero-copy between two different devices
the memory should not be tiled.
Tested with GStreamer on a laptop that has 2 GPUs:
1- gstvaapidecode:
HW decoding and dmabuf export with nouveau driver on Nvidia GPU.
2- glimagesink:
EGLImage imports dmabuf on Intel GPU.
TEST: DRI_PRIME=1 gst-launch vaapidecodebin ! glimagesink
Signed-off-by: Julien Isorce <[email protected]>
Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/va')
-rw-r--r-- | src/gallium/state_trackers/va/surface.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c index 8a6a397528a..5efb8934c5c 100644 --- a/src/gallium/state_trackers/va/surface.c +++ b/src/gallium/state_trackers/va/surface.c @@ -621,6 +621,14 @@ vlVaCreateSurfaces2(VADriverContextP ctx, unsigned int format, switch (memory_type) { case VA_SURFACE_ATTRIB_MEM_TYPE_VA: + /* The application will clear the TILING flag when the surface is + * intended to be exported as dmabuf. Adding shared flag because not + * null memory_attibute means VASurfaceAttribExternalBuffers is used. + */ + if (memory_attibute && + !(memory_attibute->flags & VA_SURFACE_EXTBUF_DESC_ENABLE_TILING)) + templat.bind = PIPE_BIND_LINEAR | PIPE_BIND_SHARED; + surf->buffer = drv->pipe->create_video_buffer(drv->pipe, &templat); if (!surf->buffer) { FREE(surf); |