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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2127>
This commit is contained in:
Víctor Manuel Jáquez Leal 2021-04-22 17:08:13 +02:00
parent 2b0fa73c10
commit ced093c738

View file

@ -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