From ced093c738aab4fb30a728a4c1faba817e2d8a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Thu, 22 Apr 2021 17:08:13 +0200 Subject: [PATCH] va: allocator: Disable derived for i965 if YUV and writing. The problem is for uploading YUV frames using derived images, is that derived images imply tiling, so frames are wrongly uploaded. Though derived for reading might work we cannot know the Intel graphics generation to validate the caching. Overall, it's safer to disable derived images for i965. Part-of: --- sys/va/gstvaallocator.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/sys/va/gstvaallocator.c b/sys/va/gstvaallocator.c index 72fb6aa149..8c756f79ba 100644 --- a/sys/va/gstvaallocator.c +++ b/sys/va/gstvaallocator.c @@ -1256,11 +1256,25 @@ _va_map_unlocked (GstVaMemory * mem, GstMapFlags flags) goto success; } - /* On Gen7-Gen9 Intel graphics the memory is mappable but not - * cached, so normal memcpy() access is very slow to read, but it's - * ok for writing. So let's assume that users won't prefer - * direct-mapped memory if they request read access. */ - use_derived = va_allocator->use_derived && !(flags & GST_MAP_READ); + switch (gst_va_display_get_implementation (display)) { + case GST_VA_IMPLEMENTATION_INTEL_IHD: + /* On Gen7+ Intel graphics the memory is mappable but not + * cached, so normal memcpy() access is very slow to read, but + * it's ok for writing. So let's assume that users won't prefer + * direct-mapped memory if they request read access. */ + use_derived = va_allocator->use_derived && !(flags & GST_MAP_READ); + break; + case GST_VA_IMPLEMENTATION_INTEL_I965: + /* YUV derived images are tiled, so writing them is also + * problematic */ + use_derived = va_allocator->use_derived && !((flags & GST_MAP_READ) + || ((flags & GST_MAP_WRITE) + && GST_VIDEO_INFO_IS_YUV (&va_allocator->derived_info))); + break; + default: + use_derived = va_allocator->use_derived; + break; + } if (use_derived) info = &va_allocator->derived_info; else