From 4e7e390cabe4fb2724a74997d2960b1de489f21d Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sat, 20 Mar 2021 22:11:49 +0900 Subject: [PATCH] d3d11decoder: Temporarily remove zero-copy related code We will re-implement it based on memory pool Part-of: --- gst-libs/gst/d3d11/gstd3d11memory.c | 39 --------------- gst-libs/gst/d3d11/gstd3d11memory.h | 5 -- sys/d3d11/gstd3d11decoder.cpp | 73 ++--------------------------- 3 files changed, 3 insertions(+), 114 deletions(-) diff --git a/gst-libs/gst/d3d11/gstd3d11memory.c b/gst-libs/gst/d3d11/gstd3d11memory.c index 0c96d7f317..1196a719d8 100644 --- a/gst-libs/gst/d3d11/gstd3d11memory.c +++ b/gst-libs/gst/d3d11/gstd3d11memory.c @@ -1142,45 +1142,6 @@ gst_d3d11_allocator_set_flushing (GstD3D11Allocator * allocator, GST_D3D11_ALLOCATOR_UNLOCK (allocator); } -/** - * gst_d3d11_allocator_get_texture_array_size: - * @allocator: a #GstD3D11Allocator - * @array_size: (out) (optional): the size of texture array - * @num_texture_in_use: (out) (optional): the number of textures in use - * - * Returns: %TRUE if the size of texture array is known - * - * Since: 1.20 - */ -gboolean -gst_d3d11_allocator_get_texture_array_size (GstD3D11Allocator * allocator, - guint * array_size, guint * num_texture_in_use) -{ - GstD3D11AllocatorPrivate *priv; - - g_return_val_if_fail (GST_IS_D3D11_ALLOCATOR (allocator), FALSE); - - priv = allocator->priv; - - /* For non-array-texture memory, the size is 1 */ - if (array_size) - *array_size = priv->array_texture_size; - if (num_texture_in_use) - *num_texture_in_use = 1; - - /* size == 1 means we are not texture pool allocator */ - if (priv->array_texture_size == 1) - return TRUE; - - if (num_texture_in_use) { - GST_D3D11_ALLOCATOR_LOCK (allocator); - *num_texture_in_use = priv->num_array_textures_in_use; - GST_D3D11_ALLOCATOR_UNLOCK (allocator); - } - - return TRUE; -} - /** * gst_is_d3d11_memory: * @mem: a #GstMemory diff --git a/gst-libs/gst/d3d11/gstd3d11memory.h b/gst-libs/gst/d3d11/gstd3d11memory.h index e120e6e48b..f28d01dec7 100644 --- a/gst-libs/gst/d3d11/gstd3d11memory.h +++ b/gst-libs/gst/d3d11/gstd3d11memory.h @@ -168,11 +168,6 @@ GstMemory * gst_d3d11_allocator_alloc_staging (GstD3D11Allocator * alloc GstD3D11AllocationFlags flags, gint * stride); -GST_D3D11_API -gboolean gst_d3d11_allocator_get_texture_array_size (GstD3D11Allocator * allocator, - guint * array_size, - guint * num_texture_in_use); - GST_D3D11_API void gst_d3d11_allocator_set_flushing (GstD3D11Allocator * allocator, gboolean flushing); diff --git a/sys/d3d11/gstd3d11decoder.cpp b/sys/d3d11/gstd3d11decoder.cpp index d70d7e4b3c..5f792b2786 100644 --- a/sys/d3d11/gstd3d11decoder.cpp +++ b/sys/d3d11/gstd3d11decoder.cpp @@ -129,8 +129,6 @@ struct _GstD3D11Decoder gboolean configured; gboolean opened; - gboolean reverse_playback; - GstD3D11Device *device; ID3D11VideoDevice *video_device; @@ -1048,20 +1046,10 @@ gst_d3d11_decoder_get_output_view_buffer (GstD3D11Decoder * decoder, { GstBuffer *buf = NULL; GstFlowReturn ret; - gboolean reverse_playback = FALSE; - gboolean rate_changed = FALSE; g_return_val_if_fail (GST_IS_D3D11_DECODER (decoder), FALSE); - if (videodec->input_segment.rate < 0) - reverse_playback = TRUE; - - if (reverse_playback != decoder->reverse_playback) { - GST_DEBUG_OBJECT (videodec, "Rate was changed, need re-negotiation"); - rate_changed = TRUE; - } - - if (!decoder->internal_pool || rate_changed) { + if (!decoder->internal_pool) { gboolean reconfigured; /* Replicate gst_video_decoder_allocate_output_buffer(). @@ -1075,7 +1063,7 @@ gst_d3d11_decoder_get_output_view_buffer (GstD3D11Decoder * decoder, "Downstream was reconfigured, negotiating again"); GST_VIDEO_DECODER_STREAM_UNLOCK (videodec); - if (reconfigured || rate_changed) + if (reconfigured) gst_video_decoder_negotiate (videodec); if (!gst_d3d11_decoder_prepare_output_view_pool (decoder)) { @@ -1484,22 +1472,6 @@ gst_d3d11_decoder_decide_allocation (GstD3D11Decoder * decoder, size = (guint) vinfo.size; } - if (videodec->input_segment.rate >= 0) { - decoder->reverse_playback = FALSE; - - /* Don't allow too large pool size */ - if (use_d3d11_pool) { - guint prev_max = max; - - max = MAX (4, max); - max = MAX (max, min); - - GST_DEBUG_OBJECT (videodec, "Update max size %d -> %d", prev_max, max); - } - } else { - decoder->reverse_playback = TRUE; - } - config = gst_buffer_pool_get_config (pool); gst_buffer_pool_config_set_params (config, outcaps, size, min, max); gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META); @@ -1573,46 +1545,7 @@ gboolean gst_d3d11_decoder_can_direct_render (GstD3D11Decoder * decoder, GstBuffer * view_buffer, GstMiniObject * picture) { - GstMemory *mem; - GstD3D11Allocator *alloc; - guint array_size, num_texture_in_use; - - g_return_val_if_fail (GST_IS_D3D11_DECODER (decoder), FALSE); - g_return_val_if_fail (GST_IS_BUFFER (view_buffer), FALSE); - g_return_val_if_fail (picture != NULL, FALSE); - - if (!decoder->can_direct_rendering || !decoder->downstream_supports_d3d11) - return FALSE; - - /* XXX: Not a thread-safe way, but should not be a problem. - * This object must be protected by videodecoder stream lock - * and codec base classes are working on upstream streaming thread - * (i.g., single threaded) */ - - /* Baseclass is not holding this picture. So we can wait for this memory - * to be consumed by downstream as it will be relased once it's processed - * by downstream */ - if (GST_MINI_OBJECT_REFCOUNT (picture) == 1) - return TRUE; - - mem = gst_buffer_peek_memory (view_buffer, 0); - alloc = GST_D3D11_ALLOCATOR_CAST (mem->allocator); - - /* something went wrong */ - if (!gst_d3d11_allocator_get_texture_array_size (alloc, &array_size, - &num_texture_in_use)) { - GST_ERROR_OBJECT (decoder, "Couldn't query size of texture array"); - return FALSE; - } - - GST_TRACE_OBJECT (decoder, "textures-in-use/array-size: %d/%d", - num_texture_in_use, array_size); - - /* DPB pool is full now */ - if (num_texture_in_use >= array_size) - return FALSE; - - return TRUE; + return FALSE; } /* Keep sync with chromium and keep in sorted order.