mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
d3d11decoder: Temporarily remove zero-copy related code
We will re-implement it based on memory pool Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2097>
This commit is contained in:
parent
316ddddc16
commit
4e7e390cab
3 changed files with 3 additions and 114 deletions
|
@ -1142,45 +1142,6 @@ gst_d3d11_allocator_set_flushing (GstD3D11Allocator * allocator,
|
||||||
GST_D3D11_ALLOCATOR_UNLOCK (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:
|
* gst_is_d3d11_memory:
|
||||||
* @mem: a #GstMemory
|
* @mem: a #GstMemory
|
||||||
|
|
|
@ -168,11 +168,6 @@ GstMemory * gst_d3d11_allocator_alloc_staging (GstD3D11Allocator * alloc
|
||||||
GstD3D11AllocationFlags flags,
|
GstD3D11AllocationFlags flags,
|
||||||
gint * stride);
|
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
|
GST_D3D11_API
|
||||||
void gst_d3d11_allocator_set_flushing (GstD3D11Allocator * allocator,
|
void gst_d3d11_allocator_set_flushing (GstD3D11Allocator * allocator,
|
||||||
gboolean flushing);
|
gboolean flushing);
|
||||||
|
|
|
@ -129,8 +129,6 @@ struct _GstD3D11Decoder
|
||||||
gboolean configured;
|
gboolean configured;
|
||||||
gboolean opened;
|
gboolean opened;
|
||||||
|
|
||||||
gboolean reverse_playback;
|
|
||||||
|
|
||||||
GstD3D11Device *device;
|
GstD3D11Device *device;
|
||||||
|
|
||||||
ID3D11VideoDevice *video_device;
|
ID3D11VideoDevice *video_device;
|
||||||
|
@ -1048,20 +1046,10 @@ gst_d3d11_decoder_get_output_view_buffer (GstD3D11Decoder * decoder,
|
||||||
{
|
{
|
||||||
GstBuffer *buf = NULL;
|
GstBuffer *buf = NULL;
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
gboolean reverse_playback = FALSE;
|
|
||||||
gboolean rate_changed = FALSE;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_D3D11_DECODER (decoder), FALSE);
|
g_return_val_if_fail (GST_IS_D3D11_DECODER (decoder), FALSE);
|
||||||
|
|
||||||
if (videodec->input_segment.rate < 0)
|
if (!decoder->internal_pool) {
|
||||||
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) {
|
|
||||||
gboolean reconfigured;
|
gboolean reconfigured;
|
||||||
|
|
||||||
/* Replicate gst_video_decoder_allocate_output_buffer().
|
/* 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");
|
"Downstream was reconfigured, negotiating again");
|
||||||
GST_VIDEO_DECODER_STREAM_UNLOCK (videodec);
|
GST_VIDEO_DECODER_STREAM_UNLOCK (videodec);
|
||||||
|
|
||||||
if (reconfigured || rate_changed)
|
if (reconfigured)
|
||||||
gst_video_decoder_negotiate (videodec);
|
gst_video_decoder_negotiate (videodec);
|
||||||
|
|
||||||
if (!gst_d3d11_decoder_prepare_output_view_pool (decoder)) {
|
if (!gst_d3d11_decoder_prepare_output_view_pool (decoder)) {
|
||||||
|
@ -1484,22 +1472,6 @@ gst_d3d11_decoder_decide_allocation (GstD3D11Decoder * decoder,
|
||||||
size = (guint) vinfo.size;
|
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);
|
config = gst_buffer_pool_get_config (pool);
|
||||||
gst_buffer_pool_config_set_params (config, outcaps, size, min, max);
|
gst_buffer_pool_config_set_params (config, outcaps, size, min, max);
|
||||||
gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
|
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,
|
gst_d3d11_decoder_can_direct_render (GstD3D11Decoder * decoder,
|
||||||
GstBuffer * view_buffer, GstMiniObject * picture)
|
GstBuffer * view_buffer, GstMiniObject * picture)
|
||||||
{
|
{
|
||||||
GstMemory *mem;
|
return FALSE;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep sync with chromium and keep in sorted order.
|
/* Keep sync with chromium and keep in sorted order.
|
||||||
|
|
Loading…
Reference in a new issue