mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
d3d11: Rework memory allocation params signalling
Hide GstD3D11AllocationParams detail from public header and set setter methods. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5717>
This commit is contained in:
parent
393e254255
commit
845f5d4856
18 changed files with 213 additions and 210 deletions
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "gstd3d11bufferpool.h"
|
||||
#include "gstd3d11memory.h"
|
||||
#include "gstd3d11memory-private.h"
|
||||
#include "gstd3d11device.h"
|
||||
#include "gstd3d11utils.h"
|
||||
#include "gstd3d11-private.h"
|
||||
|
@ -138,11 +139,10 @@ gst_d3d11_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
|||
GstCaps *caps = NULL;
|
||||
guint min_buffers, max_buffers;
|
||||
gboolean ret = TRUE;
|
||||
D3D11_TEXTURE2D_DESC *desc;
|
||||
D3D11_TEXTURE2D_DESC desc[GST_VIDEO_MAX_PLANES];
|
||||
const GstD3D11Format *format;
|
||||
GstD3D11AllocationParams *params;
|
||||
gsize offset = 0;
|
||||
guint align = 0;
|
||||
gint i;
|
||||
|
||||
if (!gst_buffer_pool_config_get_params (config, &caps, NULL, &min_buffers,
|
||||
&max_buffers))
|
||||
|
@ -174,73 +174,55 @@ gst_d3d11_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
|||
&info, GST_D3D11_ALLOCATION_FLAG_DEFAULT, 0, 0);
|
||||
}
|
||||
|
||||
desc = priv->d3d11_params->desc;
|
||||
align = gst_d3d11_dxgi_format_get_alignment (desc[0].Format);
|
||||
params = priv->d3d11_params;
|
||||
memset (desc, 0, sizeof (desc));
|
||||
if (params->d3d11_format.dxgi_format != DXGI_FORMAT_UNKNOWN) {
|
||||
desc[0].Width = GST_VIDEO_INFO_WIDTH (¶ms->aligned_info);
|
||||
desc[0].Height = GST_VIDEO_INFO_HEIGHT (¶ms->aligned_info);
|
||||
desc[0].Format = params->d3d11_format.dxgi_format;
|
||||
desc[0].MipLevels = 1;
|
||||
desc[0].ArraySize = params->array_size;
|
||||
desc[0].SampleDesc.Count = params->sample_count;
|
||||
desc[0].SampleDesc.Quality = params->sample_quality;
|
||||
desc[0].BindFlags = params->bind_flags;
|
||||
desc[0].MiscFlags = params->misc_flags;
|
||||
|
||||
/* resolution of semi-planar formats must be multiple of 2 */
|
||||
if (align != 0 && (desc[0].Width % align || desc[0].Height % align)) {
|
||||
gint width, height;
|
||||
GstVideoAlignment video_align;
|
||||
|
||||
GST_WARNING_OBJECT (self, "Resolution %dx%d is not mutiple of %d, fixing",
|
||||
desc[0].Width, desc[0].Height, align);
|
||||
|
||||
width = GST_ROUND_UP_N (desc[0].Width, align);
|
||||
height = GST_ROUND_UP_N (desc[0].Height, align);
|
||||
|
||||
gst_video_alignment_reset (&video_align);
|
||||
video_align.padding_right = width - desc[0].Width;
|
||||
video_align.padding_bottom = height - desc[0].Height;
|
||||
|
||||
gst_d3d11_allocation_params_alignment (priv->d3d11_params, &video_align);
|
||||
}
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
{
|
||||
GST_LOG_OBJECT (self, "Direct3D11 Allocation params");
|
||||
GST_LOG_OBJECT (self, "\tD3D11AllocationFlags: 0x%x",
|
||||
priv->d3d11_params->flags);
|
||||
for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
|
||||
if (desc[i].Format == DXGI_FORMAT_UNKNOWN)
|
||||
switch (params->d3d11_format.dxgi_format) {
|
||||
case DXGI_FORMAT_NV12:
|
||||
case DXGI_FORMAT_P010:
|
||||
case DXGI_FORMAT_P016:
|
||||
desc[0].Width = GST_ROUND_UP_2 (desc[0].Width);
|
||||
desc[0].Height = GST_ROUND_UP_2 (desc[0].Height);
|
||||
break;
|
||||
case DXGI_FORMAT_Y210:
|
||||
case DXGI_FORMAT_Y216:
|
||||
desc[0].Width = GST_ROUND_UP_2 (desc[0].Width);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
GST_LOG_OBJECT (self, "\t[plane %d] %dx%d, DXGI format %d",
|
||||
i, desc[i].Width, desc[i].Height, desc[i].Format);
|
||||
GST_LOG_OBJECT (self, "\t[plane %d] MipLevel %d, ArraySize %d",
|
||||
i, desc[i].MipLevels, desc[i].ArraySize);
|
||||
GST_LOG_OBJECT (self,
|
||||
"\t[plane %d] SampleDesc.Count %d, SampleDesc.Quality %d",
|
||||
i, desc[i].SampleDesc.Count, desc[i].SampleDesc.Quality);
|
||||
GST_LOG_OBJECT (self, "\t[plane %d] Usage %d", i, desc[i].Usage);
|
||||
GST_LOG_OBJECT (self,
|
||||
"\t[plane %d] BindFlags 0x%x", i, desc[i].BindFlags);
|
||||
GST_LOG_OBJECT (self,
|
||||
"\t[plane %d] CPUAccessFlags 0x%x", i, desc[i].CPUAccessFlags);
|
||||
GST_LOG_OBJECT (self,
|
||||
"\t[plane %d] MiscFlags 0x%x", i, desc[i].MiscFlags);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((priv->d3d11_params->flags & GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY)) {
|
||||
guint max_array_size = 0;
|
||||
|
||||
for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
|
||||
if (desc[i].Format == DXGI_FORMAT_UNKNOWN)
|
||||
} else {
|
||||
for (guint i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
|
||||
if (params->d3d11_format.resource_format[i] == DXGI_FORMAT_UNKNOWN)
|
||||
break;
|
||||
|
||||
if (desc[i].ArraySize > max_array_size)
|
||||
max_array_size = desc[i].ArraySize;
|
||||
}
|
||||
|
||||
if (max_buffers == 0 || max_buffers > max_array_size) {
|
||||
GST_WARNING_OBJECT (pool,
|
||||
"Array pool is requested but allowed pool size %d > ArraySize %d",
|
||||
max_buffers, max_array_size);
|
||||
max_buffers = max_array_size;
|
||||
desc[i].Width = GST_VIDEO_INFO_COMP_WIDTH (¶ms->aligned_info, i);
|
||||
desc[i].Height = GST_VIDEO_INFO_COMP_HEIGHT (¶ms->aligned_info, i);
|
||||
desc[i].Format = params->d3d11_format.resource_format[i];
|
||||
desc[i].MipLevels = 1;
|
||||
desc[i].ArraySize = params->array_size;
|
||||
desc[i].SampleDesc.Count = params->sample_count;
|
||||
desc[i].SampleDesc.Quality = params->sample_quality;
|
||||
desc[i].BindFlags = params->bind_flags;
|
||||
desc[i].MiscFlags = params->misc_flags;
|
||||
}
|
||||
}
|
||||
|
||||
if (params->array_size > 1)
|
||||
max_buffers = params->array_size;
|
||||
|
||||
offset = 0;
|
||||
for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
|
||||
for (guint i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
|
||||
GstD3D11Allocator *alloc;
|
||||
GstD3D11PoolAllocator *pool_alloc;
|
||||
GstFlowReturn flow_ret;
|
||||
|
@ -288,7 +270,7 @@ gst_d3d11_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
|||
gst_memory_unref (mem);
|
||||
}
|
||||
|
||||
format = &priv->d3d11_params->d3d11_format;
|
||||
format = ¶ms->d3d11_format;
|
||||
/* single texture semi-planar formats */
|
||||
if (format->dxgi_format != DXGI_FORMAT_UNKNOWN &&
|
||||
GST_VIDEO_INFO_N_PLANES (&info) == 2) {
|
||||
|
|
|
@ -280,31 +280,6 @@ gst_d3d11_dxgi_format_get_resource_format (DXGI_FORMAT format,
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d11_dxgi_format_get_alignment:
|
||||
* @format: a DXGI_FORMAT
|
||||
*
|
||||
* Returns: Width and height Alignment requirement for given @format
|
||||
*
|
||||
* Since: 1.22
|
||||
*/
|
||||
guint
|
||||
gst_d3d11_dxgi_format_get_alignment (DXGI_FORMAT format)
|
||||
{
|
||||
switch (format) {
|
||||
case DXGI_FORMAT_NV12:
|
||||
case DXGI_FORMAT_P010:
|
||||
case DXGI_FORMAT_P016:
|
||||
case DXGI_FORMAT_Y210:
|
||||
case DXGI_FORMAT_Y216:
|
||||
return 2;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d11_dxgi_format_to_string:
|
||||
* @format: a DXGI_FORMAT
|
||||
|
|
|
@ -74,9 +74,6 @@ GST_D3D11_API
|
|||
guint gst_d3d11_dxgi_format_get_resource_format (DXGI_FORMAT format,
|
||||
DXGI_FORMAT resource_format[GST_VIDEO_MAX_PLANES]);
|
||||
|
||||
GST_D3D11_API
|
||||
guint gst_d3d11_dxgi_format_get_alignment (DXGI_FORMAT format);
|
||||
|
||||
GST_D3D11_API
|
||||
const gchar * gst_d3d11_dxgi_format_to_string (DXGI_FORMAT format);
|
||||
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/d3d11/gstd3d11_fwd.h>
|
||||
#include <gst/d3d11/gstd3d11format.h>
|
||||
#include <gst/d3d11/gstd3d11memory.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
struct _GstD3D11AllocationParams
|
||||
{
|
||||
GstVideoInfo info;
|
||||
GstVideoInfo aligned_info;
|
||||
GstD3D11Format d3d11_format;
|
||||
GstD3D11AllocationFlags flags;
|
||||
guint bind_flags;
|
||||
guint misc_flags;
|
||||
guint array_size;
|
||||
guint sample_count;
|
||||
guint sample_quality;
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
#include "gstd3d11device.h"
|
||||
#include "gstd3d11utils.h"
|
||||
#include "gstd3d11-private.h"
|
||||
#include "gstd3d11memory-private.h"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <queue>
|
||||
|
@ -57,8 +58,6 @@ gst_d3d11_allocation_flags_get_type (void)
|
|||
static const GFlagsValue values[] = {
|
||||
{GST_D3D11_ALLOCATION_FLAG_DEFAULT, "GST_D3D11_ALLOCATION_FLAG_DEFAULT",
|
||||
"default"},
|
||||
{GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY,
|
||||
"GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY", "texture-array"},
|
||||
{0, nullptr, nullptr}
|
||||
};
|
||||
|
||||
|
@ -140,14 +139,14 @@ gst_d3d11_allocation_params_new (GstD3D11Device * device,
|
|||
{
|
||||
GstD3D11AllocationParams *ret;
|
||||
GstD3D11Format d3d11_format;
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (info != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_D3D11_DEVICE (device), nullptr);
|
||||
g_return_val_if_fail (info, nullptr);
|
||||
|
||||
if (!gst_d3d11_device_get_format (device, GST_VIDEO_INFO_FORMAT (info),
|
||||
&d3d11_format)) {
|
||||
GST_WARNING ("Couldn't get d3d11 format");
|
||||
return NULL;
|
||||
GST_WARNING_OBJECT (device, "Couldn't get d3d11 format");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ret = g_new0 (GstD3D11AllocationParams, 1);
|
||||
|
@ -155,49 +154,11 @@ gst_d3d11_allocation_params_new (GstD3D11Device * device,
|
|||
ret->info = *info;
|
||||
ret->aligned_info = *info;
|
||||
ret->d3d11_format = d3d11_format;
|
||||
|
||||
/* Usage Flag
|
||||
* https://docs.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_usage
|
||||
*
|
||||
* +----------------------------------------------------------+
|
||||
* | Resource Usage | Default | Dynamic | Immutable | Staging |
|
||||
* +----------------+---------+---------+-----------+---------+
|
||||
* | GPU-Read | Yes | Yes | Yes | Yes |
|
||||
* | GPU-Write | Yes | | | Yes |
|
||||
* | CPU-Read | | | | Yes |
|
||||
* | CPU-Write | | Yes | | Yes |
|
||||
* +----------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* If corresponding dxgi format is undefined, use resource format instead */
|
||||
if (d3d11_format.dxgi_format == DXGI_FORMAT_UNKNOWN) {
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (info); i++) {
|
||||
g_assert (d3d11_format.resource_format[i] != DXGI_FORMAT_UNKNOWN);
|
||||
|
||||
ret->desc[i].Width = GST_VIDEO_INFO_COMP_WIDTH (info, i);
|
||||
ret->desc[i].Height = GST_VIDEO_INFO_COMP_HEIGHT (info, i);
|
||||
ret->desc[i].MipLevels = 1;
|
||||
ret->desc[i].ArraySize = 1;
|
||||
ret->desc[i].Format = d3d11_format.resource_format[i];
|
||||
ret->desc[i].SampleDesc.Count = 1;
|
||||
ret->desc[i].SampleDesc.Quality = 0;
|
||||
ret->desc[i].Usage = D3D11_USAGE_DEFAULT;
|
||||
ret->desc[i].BindFlags = bind_flags;
|
||||
ret->desc[i].MiscFlags = misc_flags;
|
||||
}
|
||||
} else {
|
||||
ret->desc[0].Width = GST_VIDEO_INFO_WIDTH (info);
|
||||
ret->desc[0].Height = GST_VIDEO_INFO_HEIGHT (info);
|
||||
ret->desc[0].MipLevels = 1;
|
||||
ret->desc[0].ArraySize = 1;
|
||||
ret->desc[0].Format = d3d11_format.dxgi_format;
|
||||
ret->desc[0].SampleDesc.Count = 1;
|
||||
ret->desc[0].SampleDesc.Quality = 0;
|
||||
ret->desc[0].Usage = D3D11_USAGE_DEFAULT;
|
||||
ret->desc[0].BindFlags = bind_flags;
|
||||
ret->desc[0].MiscFlags = misc_flags;
|
||||
}
|
||||
|
||||
ret->array_size = 1;
|
||||
ret->bind_flags = bind_flags;
|
||||
ret->misc_flags = misc_flags;
|
||||
ret->sample_count = 1;
|
||||
ret->sample_quality = 0;
|
||||
ret->flags = flags;
|
||||
|
||||
return ret;
|
||||
|
@ -219,13 +180,12 @@ gboolean
|
|||
gst_d3d11_allocation_params_alignment (GstD3D11AllocationParams * params,
|
||||
const GstVideoAlignment * align)
|
||||
{
|
||||
guint i;
|
||||
guint padding_width, padding_height;
|
||||
GstVideoInfo *info;
|
||||
GstVideoInfo new_info;
|
||||
|
||||
g_return_val_if_fail (params != NULL, FALSE);
|
||||
g_return_val_if_fail (align != NULL, FALSE);
|
||||
g_return_val_if_fail (params, FALSE);
|
||||
g_return_val_if_fail (align, FALSE);
|
||||
|
||||
/* d3d11 does not support stride align. Consider padding only */
|
||||
padding_width = align->padding_left + align->padding_right;
|
||||
|
@ -242,11 +202,6 @@ gst_d3d11_allocation_params_alignment (GstD3D11AllocationParams * params,
|
|||
|
||||
params->aligned_info = new_info;
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (info); i++) {
|
||||
params->desc[i].Width = GST_VIDEO_INFO_COMP_WIDTH (&new_info, i);
|
||||
params->desc[i].Height = GST_VIDEO_INFO_COMP_HEIGHT (&new_info, i);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -285,6 +240,75 @@ gst_d3d11_allocation_params_free (GstD3D11AllocationParams * params)
|
|||
g_free (params);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d11_allocation_params_set_bind_flags:
|
||||
* @params: a #GstD3D11AllocationParams
|
||||
* @bind_flags: D3D11_BIND_FLAG
|
||||
*
|
||||
* Appends @bind_flags
|
||||
*
|
||||
* Returns: %TRUE if successful
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
gboolean
|
||||
gst_d3d11_allocation_params_set_bind_flags (GstD3D11AllocationParams * params,
|
||||
guint bind_flags)
|
||||
{
|
||||
g_return_val_if_fail (params, FALSE);
|
||||
|
||||
params->bind_flags |= bind_flags;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d11_allocation_params_set_array_size:
|
||||
* @params: a #GstD3D11AllocationParams
|
||||
* @size: texture array size
|
||||
*
|
||||
* Set texture array size. @size must be non-zero value
|
||||
*
|
||||
* Returns: %TRUE if successful
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
gboolean
|
||||
gst_d3d11_allocation_params_set_array_size (GstD3D11AllocationParams * params,
|
||||
guint size)
|
||||
{
|
||||
g_return_val_if_fail (params, FALSE);
|
||||
g_return_val_if_fail (size > 0, FALSE);
|
||||
|
||||
params->array_size = size;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d11_allocation_params_set_sample_desc:
|
||||
* @params: a #GstD3D11AllocationParams
|
||||
* @sample_count: sample count
|
||||
* @sample_quality: sample quality
|
||||
*
|
||||
* Set sample description
|
||||
*
|
||||
* Returns: %TRUE if successful
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
gboolean
|
||||
gst_d3d11_allocation_params_set_sample_desc (GstD3D11AllocationParams * params,
|
||||
guint sample_count, guint sample_quality)
|
||||
{
|
||||
g_return_val_if_fail (params, FALSE);
|
||||
|
||||
params->sample_count = sample_count;
|
||||
params->sample_quality = sample_quality;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gst_d3d11_allocation_params_compare (const GstD3D11AllocationParams * p1,
|
||||
const GstD3D11AllocationParams * p2)
|
||||
|
|
|
@ -78,17 +78,12 @@ G_BEGIN_DECLS
|
|||
/**
|
||||
* GstD3D11AllocationFlags:
|
||||
* @GST_D3D11_ALLOCATION_FLAG_DEFAULT: Default allocation behavior
|
||||
* @GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY: Indicates each allocated texture
|
||||
* should be array type. This type of
|
||||
* is used for D3D11/DXVA decoders
|
||||
* in general.
|
||||
*
|
||||
* Since: 1.22
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT = 0,
|
||||
GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY = (1 << 0),
|
||||
} GstD3D11AllocationFlags;
|
||||
|
||||
GST_D3D11_API
|
||||
|
@ -140,18 +135,6 @@ GType gst_d3d11_memory_native_type_get_type (void);
|
|||
*
|
||||
* Since: 1.22
|
||||
*/
|
||||
struct _GstD3D11AllocationParams
|
||||
{
|
||||
/* Texture description per plane */
|
||||
D3D11_TEXTURE2D_DESC desc[GST_VIDEO_MAX_PLANES];
|
||||
GstVideoInfo info;
|
||||
GstVideoInfo aligned_info;
|
||||
GstD3D11Format d3d11_format;
|
||||
GstD3D11AllocationFlags flags;
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
GST_D3D11_API
|
||||
GType gst_d3d11_allocation_params_get_type (void);
|
||||
|
@ -173,6 +156,19 @@ GST_D3D11_API
|
|||
gboolean gst_d3d11_allocation_params_alignment (GstD3D11AllocationParams * parms,
|
||||
const GstVideoAlignment * align);
|
||||
|
||||
GST_D3D11_API
|
||||
gboolean gst_d3d11_allocation_params_set_bind_flags (GstD3D11AllocationParams * params,
|
||||
guint bind_flags);
|
||||
|
||||
GST_D3D11_API
|
||||
gboolean gst_d3d11_allocation_params_set_array_size (GstD3D11AllocationParams * params,
|
||||
guint size);
|
||||
|
||||
GST_D3D11_API
|
||||
gboolean gst_d3d11_allocation_params_set_sample_desc (GstD3D11AllocationParams * params,
|
||||
guint sample_count,
|
||||
guint sample_quality);
|
||||
|
||||
/**
|
||||
* GstD3D11Memory:
|
||||
*
|
||||
|
|
|
@ -816,8 +816,8 @@ gst_amf_encoder_prepare_internal_pool (GstAmfEncoder * self)
|
|||
GST_VIDEO_INFO_SIZE (info), 0, 0);
|
||||
|
||||
params = gst_d3d11_allocation_params_new (priv->device, info,
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0);
|
||||
params->desc[0].MiscFlags = D3D11_RESOURCE_MISC_SHARED;
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_SHADER_RESOURCE,
|
||||
D3D11_RESOURCE_MISC_SHARED);
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, params);
|
||||
gst_d3d11_allocation_params_free (params);
|
||||
|
|
|
@ -1776,14 +1776,11 @@ gst_d3d11_compositor_decide_allocation (GstAggregator * agg, GstQuery * query)
|
|||
d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config);
|
||||
if (!d3d11_params) {
|
||||
d3d11_params = gst_d3d11_allocation_params_new (self->device,
|
||||
&info, GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_RENDER_TARGET,
|
||||
0);
|
||||
&info, GST_D3D11_ALLOCATION_FLAG_DEFAULT,
|
||||
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET, 0);
|
||||
} else {
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&info); i++) {
|
||||
d3d11_params->desc[i].BindFlags |= D3D11_BIND_RENDER_TARGET;
|
||||
}
|
||||
gst_d3d11_allocation_params_set_bind_flags (d3d11_params,
|
||||
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
|
||||
}
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);
|
||||
|
|
|
@ -1390,10 +1390,7 @@ gst_d3d11_base_convert_propose_allocation (GstBaseTransform * trans,
|
|||
d3d11_params = gst_d3d11_allocation_params_new (filter->device, &info,
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT, bind_flags, 0);
|
||||
} else {
|
||||
/* Set bind flag */
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&info); i++) {
|
||||
d3d11_params->desc[i].BindFlags |= bind_flags;
|
||||
}
|
||||
gst_d3d11_allocation_params_set_bind_flags (d3d11_params, bind_flags);
|
||||
}
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);
|
||||
|
@ -1444,7 +1441,6 @@ gst_d3d11_base_convert_decide_allocation (GstBaseTransform * trans,
|
|||
GstD3D11AllocationParams *d3d11_params;
|
||||
gboolean update_pool = FALSE;
|
||||
GstVideoInfo info;
|
||||
guint i;
|
||||
GstD3D11Format d3d11_format;
|
||||
guint bind_flags = 0;
|
||||
DXGI_FORMAT dxgi_format = DXGI_FORMAT_UNKNOWN;
|
||||
|
@ -1529,10 +1525,7 @@ gst_d3d11_base_convert_decide_allocation (GstBaseTransform * trans,
|
|||
d3d11_params = gst_d3d11_allocation_params_new (filter->device, &info,
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT, bind_flags, 0);
|
||||
} else {
|
||||
/* Set bind flag */
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&info); i++) {
|
||||
d3d11_params->desc[i].BindFlags |= bind_flags;
|
||||
}
|
||||
gst_d3d11_allocation_params_set_bind_flags (d3d11_params, bind_flags);
|
||||
}
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);
|
||||
|
@ -1651,10 +1644,8 @@ gst_d3d11_base_convert_setup_msaa_texture (GstD3D11BaseConvert * self,
|
|||
|
||||
params = gst_d3d11_allocation_params_new (device, info,
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_RENDER_TARGET, 0);
|
||||
for (guint i = 0; i < GST_VIDEO_INFO_N_PLANES (info); i++) {
|
||||
params->desc[i].SampleDesc.Count = sample_count;
|
||||
params->desc[i].SampleDesc.Quality = quality_levels - 1;
|
||||
}
|
||||
gst_d3d11_allocation_params_set_sample_desc (params,
|
||||
sample_count, quality_levels - 1);
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, params);
|
||||
gst_d3d11_allocation_params_free (params);
|
||||
|
|
|
@ -450,9 +450,7 @@ gst_d3d11_decoder_prepare_output_view_pool (GstD3D11Decoder * self)
|
|||
gst_clear_object (&self->internal_pool);
|
||||
}
|
||||
|
||||
if (!self->use_array_of_texture) {
|
||||
alloc_flags = GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY;
|
||||
} else {
|
||||
if (self->use_array_of_texture) {
|
||||
/* array of texture can have shader resource view */
|
||||
bind_flags |= D3D11_BIND_SHADER_RESOURCE;
|
||||
}
|
||||
|
@ -472,7 +470,7 @@ gst_d3d11_decoder_prepare_output_view_pool (GstD3D11Decoder * self)
|
|||
self->downstream_min_buffers);
|
||||
|
||||
if (!self->use_array_of_texture) {
|
||||
alloc_params->desc[0].ArraySize = pool_size;
|
||||
gst_d3d11_allocation_params_set_array_size (alloc_params, pool_size);
|
||||
} else {
|
||||
self->next_view_id = 0;
|
||||
|
||||
|
@ -1877,7 +1875,8 @@ gst_d3d11_decoder_decide_allocation (GstD3D11Decoder * decoder,
|
|||
* output of shader pipeline if internal resizing is required.
|
||||
* Also, downstream can keep using video processor even if we copy
|
||||
* some decoded textures into downstream buffer */
|
||||
d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET;
|
||||
gst_d3d11_allocation_params_set_bind_flags (d3d11_params,
|
||||
D3D11_BIND_RENDER_TARGET);
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);
|
||||
gst_d3d11_allocation_params_free (d3d11_params);
|
||||
|
|
|
@ -914,7 +914,8 @@ gst_d3d11_deinterlace_propose_allocation (GstBaseTransform * trans,
|
|||
d3d11_params = gst_d3d11_allocation_params_new (self->device, &info,
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_RENDER_TARGET, 0);
|
||||
} else {
|
||||
d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET;
|
||||
gst_d3d11_allocation_params_set_bind_flags (d3d11_params,
|
||||
D3D11_BIND_RENDER_TARGET);
|
||||
}
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);
|
||||
|
@ -1019,7 +1020,8 @@ gst_d3d11_deinterlace_decide_allocation (GstBaseTransform * trans,
|
|||
d3d11_params = gst_d3d11_allocation_params_new (self->device, &info,
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_RENDER_TARGET, 0);
|
||||
} else {
|
||||
d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET;
|
||||
gst_d3d11_allocation_params_set_bind_flags (d3d11_params,
|
||||
D3D11_BIND_RENDER_TARGET);
|
||||
}
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);
|
||||
|
|
|
@ -225,8 +225,8 @@ gst_d3d11_overlay_propose_allocation (GstBaseTransform * trans,
|
|||
|
||||
params = gst_buffer_pool_config_get_d3d11_allocation_params (config);
|
||||
if (params) {
|
||||
params->desc[0].BindFlags |=
|
||||
(D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
|
||||
gst_d3d11_allocation_params_set_bind_flags (params,
|
||||
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
|
||||
} else {
|
||||
params = gst_d3d11_allocation_params_new (filter->device, &info,
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT,
|
||||
|
|
|
@ -789,7 +789,8 @@ gst_d3d11_screen_capture_src_decide_allocation (GstBaseSrc * bsrc,
|
|||
GST_D3D11_ALLOCATION_FLAG_DEFAULT,
|
||||
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET, 0);
|
||||
} else {
|
||||
d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET;
|
||||
gst_d3d11_allocation_params_set_bind_flags (d3d11_params,
|
||||
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
|
||||
}
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);
|
||||
|
@ -821,7 +822,8 @@ gst_d3d11_screen_capture_src_decide_allocation (GstBaseSrc * bsrc,
|
|||
d3d11_params = gst_d3d11_allocation_params_new (self->device, &vinfo,
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_RENDER_TARGET, 0);
|
||||
} else {
|
||||
d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET;
|
||||
gst_d3d11_allocation_params_set_bind_flags (d3d11_params,
|
||||
D3D11_BIND_RENDER_TARGET);
|
||||
}
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);
|
||||
|
|
|
@ -1474,7 +1474,7 @@ gst_d3d11_test_src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
|
|||
d3d11_params = gst_d3d11_allocation_params_new (self->device, &vinfo,
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT, bind_flags, 0);
|
||||
} else {
|
||||
d3d11_params->desc[0].BindFlags |= bind_flags;
|
||||
gst_d3d11_allocation_params_set_bind_flags (d3d11_params, bind_flags);
|
||||
}
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);
|
||||
|
|
|
@ -308,7 +308,6 @@ gst_d3d11_upload_decide_allocation (GstBaseTransform * trans, GstQuery * query)
|
|||
GstD3D11Format d3d11_format;
|
||||
GstD3D11AllocationParams *d3d11_params;
|
||||
guint bind_flags = 0;
|
||||
guint i;
|
||||
DXGI_FORMAT dxgi_format = DXGI_FORMAT_UNKNOWN;
|
||||
UINT supported = 0;
|
||||
HRESULT hr;
|
||||
|
@ -380,10 +379,7 @@ gst_d3d11_upload_decide_allocation (GstBaseTransform * trans, GstQuery * query)
|
|||
d3d11_params = gst_d3d11_allocation_params_new (filter->device, &vinfo,
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT, bind_flags, 0);
|
||||
} else {
|
||||
/* Set bind flag */
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&vinfo); i++) {
|
||||
d3d11_params->desc[i].BindFlags |= bind_flags;
|
||||
}
|
||||
gst_d3d11_allocation_params_set_bind_flags (d3d11_params, bind_flags);
|
||||
}
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);
|
||||
|
|
|
@ -629,8 +629,7 @@ gst_dwrite_overlay_object_decide_allocation (GstDWriteOverlayObject * object,
|
|||
params = gst_d3d11_allocation_params_new (priv->device, &info,
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT, bind_flags, 0);
|
||||
} else {
|
||||
for (guint i = 0; i < GST_VIDEO_INFO_N_PLANES (&info); i++)
|
||||
params->desc[i].BindFlags |= bind_flags;
|
||||
gst_d3d11_allocation_params_set_bind_flags (params, bind_flags);
|
||||
}
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, params);
|
||||
|
@ -723,8 +722,7 @@ gst_dwrite_overlay_object_propose_allocation (GstDWriteOverlayObject * object,
|
|||
params = gst_d3d11_allocation_params_new (dpool->device, &info,
|
||||
GST_D3D11_ALLOCATION_FLAG_DEFAULT, bind_flags, 0);
|
||||
} else {
|
||||
for (guint i = 0; i < GST_VIDEO_INFO_N_PLANES (&info); i++)
|
||||
params->desc[i].BindFlags |= bind_flags;
|
||||
gst_d3d11_allocation_params_set_bind_flags (params, bind_flags);
|
||||
}
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, params);
|
||||
|
|
|
@ -1352,7 +1352,7 @@ gst_qsv_decoder_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
|
|||
D3D11_FORMAT_SUPPORT_SHADER_SAMPLE) != 0)
|
||||
bind_flags |= D3D11_BIND_SHADER_RESOURCE;
|
||||
|
||||
d3d11_params->desc[0].BindFlags |= bind_flags;
|
||||
gst_d3d11_allocation_params_set_bind_flags (d3d11_params, bind_flags);
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);
|
||||
gst_d3d11_allocation_params_free (d3d11_params);
|
||||
}
|
||||
|
|
|
@ -162,10 +162,10 @@ GST_START_TEST (test_unblock_on_stop)
|
|||
fail_unless (config);
|
||||
|
||||
params = gst_d3d11_allocation_params_new (device,
|
||||
&info, GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY, 0, 0);
|
||||
&info, GST_D3D11_ALLOCATION_FLAG_DEFAULT, 0, 0);
|
||||
fail_unless (params);
|
||||
|
||||
params->desc[0].ArraySize = 2;
|
||||
gst_d3d11_allocation_params_set_array_size (params, 2);
|
||||
|
||||
gst_buffer_pool_config_set_d3d11_allocation_params (config, params);
|
||||
gst_d3d11_allocation_params_free (params);
|
||||
|
|
Loading…
Reference in a new issue