mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
vaallocator: remove runtime mapping selection
The original idea was to select the type of mapping (either using derive images or downloading the image) in runtime, under the assumption that both methods shared the same memory layout (offsets and strides), because a single GstVideoMeta is assigned by the buffer pool at allocation time. Nonetheless, in recent hardware this assumption is invalid, raising memory access errors. This patch removes completely the mapping type selection at runtime, using the method selected when the allocator is configured, synced with the bufferpool allocation. This problem was fixed originally for iHD driver only. But now it makes sense to remove all of it. Original-patch-by: Mengkejiergeli Ba <mengkejiergeli.ba@intel.com> Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5760>
This commit is contained in:
parent
90af9b7704
commit
6b1fba14bf
1 changed files with 4 additions and 30 deletions
|
@ -1304,7 +1304,7 @@ _clean_mem (GstVaMemory * mem)
|
||||||
mem->image.image_id = VA_INVALID_ID;
|
mem->image.image_id = VA_INVALID_ID;
|
||||||
mem->image.buf = VA_INVALID_ID;
|
mem->image.buf = VA_INVALID_ID;
|
||||||
|
|
||||||
mem->is_derived = TRUE;
|
mem->is_derived = FALSE;
|
||||||
mem->is_dirty = FALSE;
|
mem->is_dirty = FALSE;
|
||||||
mem->prev_mapflags = 0;
|
mem->prev_mapflags = 0;
|
||||||
mem->mapped_data = NULL;
|
mem->mapped_data = NULL;
|
||||||
|
@ -1406,10 +1406,8 @@ static gpointer
|
||||||
_va_map_unlocked (GstVaMemory * mem, GstMapFlags flags)
|
_va_map_unlocked (GstVaMemory * mem, GstMapFlags flags)
|
||||||
{
|
{
|
||||||
GstAllocator *allocator = GST_MEMORY_CAST (mem)->allocator;
|
GstAllocator *allocator = GST_MEMORY_CAST (mem)->allocator;
|
||||||
GstVideoInfo *info;
|
|
||||||
GstVaAllocator *va_allocator;
|
GstVaAllocator *va_allocator;
|
||||||
GstVaDisplay *display;
|
GstVaDisplay *display;
|
||||||
gboolean use_derived;
|
|
||||||
|
|
||||||
g_return_val_if_fail (mem->surface != VA_INVALID_ID, NULL);
|
g_return_val_if_fail (mem->surface != VA_INVALID_ID, NULL);
|
||||||
g_return_val_if_fail (GST_IS_VA_ALLOCATOR (allocator), NULL);
|
g_return_val_if_fail (GST_IS_VA_ALLOCATOR (allocator), NULL);
|
||||||
|
@ -1435,36 +1433,12 @@ _va_map_unlocked (GstVaMemory * mem, GstMapFlags flags)
|
||||||
goto success;
|
goto success;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (va_allocator->feat_use_derived == GST_VA_FEATURE_AUTO) {
|
mem->is_derived = va_allocator->use_derived;
|
||||||
switch (gst_va_display_get_implementation (display)) {
|
|
||||||
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->info)));
|
|
||||||
break;
|
|
||||||
case GST_VA_IMPLEMENTATION_MESA_GALLIUM:
|
|
||||||
/* Reading RGB derived images, with non-standard resolutions,
|
|
||||||
* looks like tiled too. TODO(victor): fill a bug in Mesa. */
|
|
||||||
use_derived = va_allocator->use_derived && !((flags & GST_MAP_READ)
|
|
||||||
&& GST_VIDEO_INFO_IS_RGB (&va_allocator->info));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
use_derived = va_allocator->use_derived;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
use_derived = va_allocator->use_derived;
|
|
||||||
}
|
|
||||||
|
|
||||||
info = &va_allocator->info;
|
if (!va_ensure_image (display, mem->surface, &va_allocator->info, &mem->image,
|
||||||
|
va_allocator->use_derived))
|
||||||
if (!va_ensure_image (display, mem->surface, info, &mem->image, use_derived))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
mem->is_derived = use_derived;
|
|
||||||
|
|
||||||
if (!mem->is_derived) {
|
if (!mem->is_derived) {
|
||||||
if (!va_get_image (display, mem->surface, &mem->image))
|
if (!va_get_image (display, mem->surface, &mem->image))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
Loading…
Reference in a new issue