d3d11: Update gst_d3d11_allocation_params_new() interface

Define GST_D3D11_ALLOCATION_FLAG_DEFAULT (0) value instead of
casting enum type everywhere. And pass D3D11_RESOURCE_MISC_FLAG value

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2646>
This commit is contained in:
Seungha Yang 2022-06-24 01:21:48 +09:00 committed by GStreamer Marge Bot
parent c4a9a96a15
commit aca71fd692
16 changed files with 48 additions and 39 deletions

View File

@ -177,7 +177,7 @@ gst_d3d11_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
/* allocate memory with resource format by default */ /* allocate memory with resource format by default */
priv->d3d11_params = priv->d3d11_params =
gst_d3d11_allocation_params_new (self->device, gst_d3d11_allocation_params_new (self->device,
&info, (GstD3D11AllocationFlags) 0, 0); &info, GST_D3D11_ALLOCATION_FLAG_DEFAULT, 0, 0);
} }
desc = priv->d3d11_params->desc; desc = priv->d3d11_params->desc;

View File

@ -46,7 +46,8 @@ G_DEFINE_BOXED_TYPE_WITH_CODE (GstD3D11AllocationParams,
* @device: a #GstD3D11Device * @device: a #GstD3D11Device
* @info: a #GstVideoInfo * @info: a #GstVideoInfo
* @flags: a #GstD3D11AllocationFlags * @flags: a #GstD3D11AllocationFlags
* @bind_flags: D3D11_BIND_FLAG value used for creating Direct3D11 texture * @bind_flags: D3D11_BIND_FLAG value used for creating texture
* @misc_flags: D3D11_RESOURCE_MISC_FLAG value used for creating texture
* *
* Create #GstD3D11AllocationParams object which is used by #GstD3D11BufferPool * Create #GstD3D11AllocationParams object which is used by #GstD3D11BufferPool
* and #GstD3D11Allocator in order to allocate new ID3D11Texture2D * and #GstD3D11Allocator in order to allocate new ID3D11Texture2D
@ -58,7 +59,7 @@ G_DEFINE_BOXED_TYPE_WITH_CODE (GstD3D11AllocationParams,
*/ */
GstD3D11AllocationParams * GstD3D11AllocationParams *
gst_d3d11_allocation_params_new (GstD3D11Device * device, GstVideoInfo * info, gst_d3d11_allocation_params_new (GstD3D11Device * device, GstVideoInfo * info,
GstD3D11AllocationFlags flags, guint bind_flags) GstD3D11AllocationFlags flags, guint bind_flags, guint misc_flags)
{ {
GstD3D11AllocationParams *ret; GstD3D11AllocationParams *ret;
GstD3D11Format d3d11_format; GstD3D11Format d3d11_format;
@ -105,6 +106,7 @@ gst_d3d11_allocation_params_new (GstD3D11Device * device, GstVideoInfo * info,
ret->desc[i].SampleDesc.Quality = 0; ret->desc[i].SampleDesc.Quality = 0;
ret->desc[i].Usage = D3D11_USAGE_DEFAULT; ret->desc[i].Usage = D3D11_USAGE_DEFAULT;
ret->desc[i].BindFlags = bind_flags; ret->desc[i].BindFlags = bind_flags;
ret->desc[i].MiscFlags = misc_flags;
} }
} else { } else {
ret->desc[0].Width = GST_VIDEO_INFO_WIDTH (info); ret->desc[0].Width = GST_VIDEO_INFO_WIDTH (info);
@ -116,6 +118,7 @@ gst_d3d11_allocation_params_new (GstD3D11Device * device, GstVideoInfo * info,
ret->desc[0].SampleDesc.Quality = 0; ret->desc[0].SampleDesc.Quality = 0;
ret->desc[0].Usage = D3D11_USAGE_DEFAULT; ret->desc[0].Usage = D3D11_USAGE_DEFAULT;
ret->desc[0].BindFlags = bind_flags; ret->desc[0].BindFlags = bind_flags;
ret->desc[0].MiscFlags = misc_flags;
} }
ret->flags = flags; ret->flags = flags;

View File

@ -78,6 +78,7 @@ G_BEGIN_DECLS
/** /**
* GstD3D11AllocationFlags: * GstD3D11AllocationFlags:
* @GST_D3D11_ALLOCATION_FLAG_DEFAULT: Default allocation behavior
* @GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY: Indicates each allocated texture * @GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY: Indicates each allocated texture
* should be array type. This type of * should be array type. This type of
* is used for D3D11/DXVA decoders * is used for D3D11/DXVA decoders
@ -87,6 +88,7 @@ G_BEGIN_DECLS
*/ */
typedef enum typedef enum
{ {
GST_D3D11_ALLOCATION_FLAG_DEFAULT = 0,
GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY = (1 << 0), GST_D3D11_ALLOCATION_FLAG_TEXTURE_ARRAY = (1 << 0),
} GstD3D11AllocationFlags; } GstD3D11AllocationFlags;
@ -142,7 +144,8 @@ GST_D3D11_API
GstD3D11AllocationParams * gst_d3d11_allocation_params_new (GstD3D11Device * device, GstD3D11AllocationParams * gst_d3d11_allocation_params_new (GstD3D11Device * device,
GstVideoInfo * info, GstVideoInfo * info,
GstD3D11AllocationFlags flags, GstD3D11AllocationFlags flags,
guint bind_flags); guint bind_flags,
guint misc_flags);
GST_D3D11_API GST_D3D11_API
GstD3D11AllocationParams * gst_d3d11_allocation_params_copy (GstD3D11AllocationParams * src); GstD3D11AllocationParams * gst_d3d11_allocation_params_copy (GstD3D11AllocationParams * src);

View File

@ -464,7 +464,7 @@ gst_amf_encoder_prepare_internal_pool (GstAmfEncoder * self)
GST_VIDEO_INFO_SIZE (info), 0, 0); GST_VIDEO_INFO_SIZE (info), 0, 0);
params = gst_d3d11_allocation_params_new (priv->device, info, params = gst_d3d11_allocation_params_new (priv->device, info,
(GstD3D11AllocationFlags) 0, 0); GST_D3D11_ALLOCATION_FLAG_DEFAULT, 0, 0);
params->desc[0].MiscFlags = D3D11_RESOURCE_MISC_SHARED; params->desc[0].MiscFlags = D3D11_RESOURCE_MISC_SHARED;
gst_buffer_pool_config_set_d3d11_allocation_params (config, params); gst_buffer_pool_config_set_d3d11_allocation_params (config, params);

View File

@ -726,7 +726,7 @@ gst_d3d11_compositor_pad_ensure_fallback_buffer (GstD3D11Compositor * self,
} }
d3d11_params = gst_d3d11_allocation_params_new (self->device, d3d11_params = gst_d3d11_allocation_params_new (self->device,
info, (GstD3D11AllocationFlags) 0, D3D11_BIND_SHADER_RESOURCE); info, GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0);
pool = gst_d3d11_buffer_pool_new_with_options (self->device, pool = gst_d3d11_buffer_pool_new_with_options (self->device,
caps, d3d11_params, 0, 0); caps, d3d11_params, 0, 0);
@ -1743,8 +1743,8 @@ gst_d3d11_compositor_negotiated_src_caps (GstAggregator * agg, GstCaps * caps)
GstFlowReturn flow_ret; GstFlowReturn flow_ret;
d3d11_params = gst_d3d11_allocation_params_new (self->device, d3d11_params = gst_d3d11_allocation_params_new (self->device,
&info, (GstD3D11AllocationFlags) 0, &info, GST_D3D11_ALLOCATION_FLAG_DEFAULT,
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET); D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET, 0);
pool = gst_d3d11_buffer_pool_new_with_options (self->device, pool = gst_d3d11_buffer_pool_new_with_options (self->device,
caps, d3d11_params, 0, 0); caps, d3d11_params, 0, 0);
@ -1825,7 +1825,8 @@ gst_d3d11_compositor_propose_allocation (GstAggregator * agg,
d3d11_params = d3d11_params =
gst_d3d11_allocation_params_new (self->device, gst_d3d11_allocation_params_new (self->device,
&info, (GstD3D11AllocationFlags) 0, D3D11_BIND_SHADER_RESOURCE); &info, GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_SHADER_RESOURCE,
0);
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params); gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);
gst_d3d11_allocation_params_free (d3d11_params); gst_d3d11_allocation_params_free (d3d11_params);
@ -1925,7 +1926,8 @@ gst_d3d11_compositor_decide_allocation (GstAggregator * agg, GstQuery * query)
d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config); d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config);
if (!d3d11_params) { if (!d3d11_params) {
d3d11_params = gst_d3d11_allocation_params_new (self->device, d3d11_params = gst_d3d11_allocation_params_new (self->device,
&info, (GstD3D11AllocationFlags) 0, D3D11_BIND_RENDER_TARGET); &info, GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_RENDER_TARGET,
0);
} else { } else {
guint i; guint i;

View File

@ -1236,7 +1236,7 @@ gst_d3d11_base_convert_propose_allocation (GstBaseTransform * trans,
d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config); d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config);
if (!d3d11_params) { if (!d3d11_params) {
d3d11_params = gst_d3d11_allocation_params_new (filter->device, &info, d3d11_params = gst_d3d11_allocation_params_new (filter->device, &info,
(GstD3D11AllocationFlags) 0, bind_flags); GST_D3D11_ALLOCATION_FLAG_DEFAULT, bind_flags, 0);
} else { } else {
/* Set bind flag */ /* Set bind flag */
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&info); i++) { for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&info); i++) {
@ -1354,7 +1354,7 @@ gst_d3d11_base_convert_decide_allocation (GstBaseTransform * trans,
d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config); d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config);
if (!d3d11_params) { if (!d3d11_params) {
d3d11_params = gst_d3d11_allocation_params_new (filter->device, &info, d3d11_params = gst_d3d11_allocation_params_new (filter->device, &info,
(GstD3D11AllocationFlags) 0, bind_flags); GST_D3D11_ALLOCATION_FLAG_DEFAULT, bind_flags, 0);
} else { } else {
/* Set bind flag */ /* Set bind flag */
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&info); i++) { for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&info); i++) {

View File

@ -444,7 +444,7 @@ gst_d3d11_decoder_prepare_output_view_pool (GstD3D11Decoder * self)
GstBufferPool *pool = NULL; GstBufferPool *pool = NULL;
GstCaps *caps = NULL; GstCaps *caps = NULL;
GstVideoAlignment align; GstVideoAlignment align;
GstD3D11AllocationFlags alloc_flags = (GstD3D11AllocationFlags) 0; GstD3D11AllocationFlags alloc_flags = GST_D3D11_ALLOCATION_FLAG_DEFAULT;
gint bind_flags = D3D11_BIND_DECODER; gint bind_flags = D3D11_BIND_DECODER;
GstVideoInfo *info = &self->info; GstVideoInfo *info = &self->info;
guint pool_size; guint pool_size;
@ -464,7 +464,7 @@ gst_d3d11_decoder_prepare_output_view_pool (GstD3D11Decoder * self)
} }
alloc_params = gst_d3d11_allocation_params_new (self->device, info, alloc_params = gst_d3d11_allocation_params_new (self->device, info,
alloc_flags, bind_flags); alloc_flags, bind_flags, 0);
if (!alloc_params) { if (!alloc_params) {
GST_ERROR_OBJECT (self, "Failed to create allocation param"); GST_ERROR_OBJECT (self, "Failed to create allocation param");
@ -1792,7 +1792,7 @@ gst_d3d11_decoder_decide_allocation (GstD3D11Decoder * decoder,
d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config); d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config);
if (!d3d11_params) if (!d3d11_params)
d3d11_params = gst_d3d11_allocation_params_new (decoder->device, &vinfo, d3d11_params = gst_d3d11_allocation_params_new (decoder->device, &vinfo,
(GstD3D11AllocationFlags) 0, 0); GST_D3D11_ALLOCATION_FLAG_DEFAULT, 0, 0);
width = GST_VIDEO_INFO_WIDTH (&vinfo); width = GST_VIDEO_INFO_WIDTH (&vinfo);
height = GST_VIDEO_INFO_HEIGHT (&vinfo); height = GST_VIDEO_INFO_HEIGHT (&vinfo);

View File

@ -891,7 +891,7 @@ gst_d3d11_deinterlace_propose_allocation (GstBaseTransform * trans,
d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config); d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config);
if (!d3d11_params) { if (!d3d11_params) {
d3d11_params = gst_d3d11_allocation_params_new (self->device, &info, d3d11_params = gst_d3d11_allocation_params_new (self->device, &info,
(GstD3D11AllocationFlags) 0, D3D11_BIND_RENDER_TARGET); GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_RENDER_TARGET, 0);
} else { } else {
d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET; d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET;
} }
@ -996,7 +996,7 @@ gst_d3d11_deinterlace_decide_allocation (GstBaseTransform * trans,
d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config); d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config);
if (!d3d11_params) { if (!d3d11_params) {
d3d11_params = gst_d3d11_allocation_params_new (self->device, &info, d3d11_params = gst_d3d11_allocation_params_new (self->device, &info,
(GstD3D11AllocationFlags) 0, D3D11_BIND_RENDER_TARGET); GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_RENDER_TARGET, 0);
} else { } else {
d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET; d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET;
} }
@ -1052,7 +1052,7 @@ gst_d3d11_deinterlace_prepare_fallback_pool (GstD3D11Deinterlace * self,
/* Empty bind flag is allowed for video processor input */ /* Empty bind flag is allowed for video processor input */
d3d11_params = gst_d3d11_allocation_params_new (self->device, in_info, d3d11_params = gst_d3d11_allocation_params_new (self->device, in_info,
(GstD3D11AllocationFlags) 0, 0); GST_D3D11_ALLOCATION_FLAG_DEFAULT, 0, 0);
self->fallback_in_pool = gst_d3d11_buffer_pool_new_with_options (self->device, self->fallback_in_pool = gst_d3d11_buffer_pool_new_with_options (self->device,
in_caps, d3d11_params, 0, 0); in_caps, d3d11_params, 0, 0);
gst_d3d11_allocation_params_free (d3d11_params); gst_d3d11_allocation_params_free (d3d11_params);
@ -1064,7 +1064,7 @@ gst_d3d11_deinterlace_prepare_fallback_pool (GstD3D11Deinterlace * self,
/* For processor output, render target bind flag is required */ /* For processor output, render target bind flag is required */
d3d11_params = gst_d3d11_allocation_params_new (self->device, out_info, d3d11_params = gst_d3d11_allocation_params_new (self->device, out_info,
(GstD3D11AllocationFlags) 0, D3D11_BIND_RENDER_TARGET); GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_RENDER_TARGET, 0);
self->fallback_out_pool = self->fallback_out_pool =
gst_d3d11_buffer_pool_new_with_options (self->device, gst_d3d11_buffer_pool_new_with_options (self->device,
out_caps, d3d11_params, 0, 0); out_caps, d3d11_params, 0, 0);

View File

@ -527,8 +527,8 @@ gst_d3d11_screen_capture_src_decide_allocation (GstBaseSrc * bsrc,
d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config); d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config);
if (!d3d11_params) { if (!d3d11_params) {
d3d11_params = gst_d3d11_allocation_params_new (self->device, &vinfo, d3d11_params = gst_d3d11_allocation_params_new (self->device, &vinfo,
(GstD3D11AllocationFlags) 0, GST_D3D11_ALLOCATION_FLAG_DEFAULT,
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET); D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET, 0);
} else { } else {
d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET; d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET;
} }
@ -560,7 +560,7 @@ gst_d3d11_screen_capture_src_decide_allocation (GstBaseSrc * bsrc,
d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config); d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config);
if (!d3d11_params) { if (!d3d11_params) {
d3d11_params = gst_d3d11_allocation_params_new (self->device, &vinfo, d3d11_params = gst_d3d11_allocation_params_new (self->device, &vinfo,
(GstD3D11AllocationFlags) 0, D3D11_BIND_RENDER_TARGET); GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_RENDER_TARGET, 0);
} else { } else {
d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET; d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET;
} }

View File

@ -1306,8 +1306,8 @@ gst_d3d11_test_src_setup_resource (GstD3D11TestSrc * self, GstCaps * caps)
draw_caps = gst_video_info_to_caps (&draw_info); draw_caps = gst_video_info_to_caps (&draw_info);
params = gst_d3d11_allocation_params_new (self->device, &draw_info, params = gst_d3d11_allocation_params_new (self->device, &draw_info,
(GstD3D11AllocationFlags) 0, GST_D3D11_ALLOCATION_FLAG_DEFAULT,
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET); D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET, 0);
self->render_pool = gst_d3d11_buffer_pool_new_with_options (self->device, self->render_pool = gst_d3d11_buffer_pool_new_with_options (self->device,
draw_caps, params, 0, 0); draw_caps, params, 0, 0);
@ -1321,7 +1321,7 @@ gst_d3d11_test_src_setup_resource (GstD3D11TestSrc * self, GstCaps * caps)
} }
params = gst_d3d11_allocation_params_new (self->device, &self->info, params = gst_d3d11_allocation_params_new (self->device, &self->info,
(GstD3D11AllocationFlags) 0, D3D11_BIND_RENDER_TARGET); GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_RENDER_TARGET, 0);
self->convert_pool = gst_d3d11_buffer_pool_new_with_options (self->device, self->convert_pool = gst_d3d11_buffer_pool_new_with_options (self->device,
caps, params, 0, 0); caps, params, 0, 0);
gst_d3d11_allocation_params_free (params); gst_d3d11_allocation_params_free (params);
@ -1479,8 +1479,8 @@ gst_d3d11_test_src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config); d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config);
if (!d3d11_params) { if (!d3d11_params) {
d3d11_params = gst_d3d11_allocation_params_new (self->device, &vinfo, d3d11_params = gst_d3d11_allocation_params_new (self->device, &vinfo,
(GstD3D11AllocationFlags) 0, GST_D3D11_ALLOCATION_FLAG_DEFAULT,
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET); D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET, 0);
} else { } else {
d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET; d3d11_params->desc[0].BindFlags |= D3D11_BIND_RENDER_TARGET;
} }

View File

@ -378,7 +378,7 @@ gst_d3d11_upload_decide_allocation (GstBaseTransform * trans, GstQuery * query)
d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config); d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config);
if (!d3d11_params) { if (!d3d11_params) {
d3d11_params = gst_d3d11_allocation_params_new (filter->device, &vinfo, d3d11_params = gst_d3d11_allocation_params_new (filter->device, &vinfo,
(GstD3D11AllocationFlags) 0, bind_flags); GST_D3D11_ALLOCATION_FLAG_DEFAULT, bind_flags, 0);
} else { } else {
/* Set bind flag */ /* Set bind flag */
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&vinfo); i++) { for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&vinfo); i++) {

View File

@ -635,7 +635,7 @@ gst_d3d11_video_sink_update_window (GstD3D11VideoSink * self, GstCaps * caps)
} }
d3d11_params = gst_d3d11_allocation_params_new (self->device, d3d11_params = gst_d3d11_allocation_params_new (self->device,
&self->info, (GstD3D11AllocationFlags) 0, bind_flags); &self->info, GST_D3D11_ALLOCATION_FLAG_DEFAULT, bind_flags, 0);
self->fallback_pool = gst_d3d11_buffer_pool_new_with_options (self->device, self->fallback_pool = gst_d3d11_buffer_pool_new_with_options (self->device,
caps, d3d11_params, 2, 0); caps, d3d11_params, 2, 0);
@ -908,7 +908,8 @@ gst_d3d11_video_sink_propose_allocation (GstBaseSink * sink, GstQuery * query)
d3d11_params = d3d11_params =
gst_d3d11_allocation_params_new (self->device, gst_d3d11_allocation_params_new (self->device,
&info, (GstD3D11AllocationFlags) 0, D3D11_BIND_SHADER_RESOURCE); &info, GST_D3D11_ALLOCATION_FLAG_DEFAULT, D3D11_BIND_SHADER_RESOURCE,
0);
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params); gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);
gst_d3d11_allocation_params_free (d3d11_params); gst_d3d11_allocation_params_free (d3d11_params);

View File

@ -1000,8 +1000,7 @@ gst_nv_encoder_create_d3d11_pool (GstNvEncoder * self,
GstD3D11AllocationParams *params; GstD3D11AllocationParams *params;
params = gst_d3d11_allocation_params_new (priv->device, &state->info, params = gst_d3d11_allocation_params_new (priv->device, &state->info,
(GstD3D11AllocationFlags) 0, 0); GST_D3D11_ALLOCATION_FLAG_DEFAULT, 0, D3D11_RESOURCE_MISC_SHARED);
params->desc[0].MiscFlags = D3D11_RESOURCE_MISC_SHARED;
pool = gst_d3d11_buffer_pool_new (priv->device); pool = gst_d3d11_buffer_pool_new (priv->device);

View File

@ -222,7 +222,7 @@ gst_qsv_d3d11_allocator_alloc (GstQsvAllocator * allocator,
pool = gst_d3d11_buffer_pool_new (self->device); pool = gst_d3d11_buffer_pool_new (self->device);
params = gst_d3d11_allocation_params_new (self->device, &info, params = gst_d3d11_allocation_params_new (self->device, &info,
(GstD3D11AllocationFlags) 0, bind_flags); GST_D3D11_ALLOCATION_FLAG_DEFAULT, bind_flags, 0);
gst_d3d11_allocation_params_alignment (params, &align); gst_d3d11_allocation_params_alignment (params, &align);

View File

@ -880,8 +880,8 @@ gst_qsv_decoder_prepare_d3d11_pool (GstQsvDecoder * self,
/* Bind to shader resource as well for this texture can be used /* Bind to shader resource as well for this texture can be used
* in generic pixel shader */ * in generic pixel shader */
params = gst_d3d11_allocation_params_new (device, info, params = gst_d3d11_allocation_params_new (device, info,
(GstD3D11AllocationFlags) 0, GST_D3D11_ALLOCATION_FLAG_DEFAULT,
D3D11_BIND_DECODER | D3D11_BIND_SHADER_RESOURCE); D3D11_BIND_DECODER | D3D11_BIND_SHADER_RESOURCE, 0);
gst_d3d11_allocation_params_alignment (params, align); gst_d3d11_allocation_params_alignment (params, align);
gst_buffer_pool_config_set_d3d11_allocation_params (config, params); gst_buffer_pool_config_set_d3d11_allocation_params (config, params);
gst_d3d11_allocation_params_free (params); gst_d3d11_allocation_params_free (params);
@ -1232,9 +1232,10 @@ gst_qsv_decoder_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
* copying in case of reverse playback */ * copying in case of reverse playback */
if (use_d3d11_pool) { if (use_d3d11_pool) {
d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config); d3d11_params = gst_buffer_pool_config_get_d3d11_allocation_params (config);
if (!d3d11_params) if (!d3d11_params) {
d3d11_params = gst_d3d11_allocation_params_new (device, &vinfo, d3d11_params = gst_d3d11_allocation_params_new (device, &vinfo,
(GstD3D11AllocationFlags) 0, 0); GST_D3D11_ALLOCATION_FLAG_DEFAULT, 0, 0);
}
/* Use both render target (for videoprocessor) and shader resource /* Use both render target (for videoprocessor) and shader resource
* for (pixel shader) bind flags for downstream to be able to use consistent * for (pixel shader) bind flags for downstream to be able to use consistent
* conversion path even when we copy textures */ * conversion path even when we copy textures */

View File

@ -915,7 +915,7 @@ gst_qsv_encoder_prepare_d3d11_pool (GstQsvEncoder * self,
priv->internal_pool = gst_d3d11_buffer_pool_new (device); priv->internal_pool = gst_d3d11_buffer_pool_new (device);
config = gst_buffer_pool_get_config (priv->internal_pool); config = gst_buffer_pool_get_config (priv->internal_pool);
params = gst_d3d11_allocation_params_new (device, aligned_info, params = gst_d3d11_allocation_params_new (device, aligned_info,
(GstD3D11AllocationFlags) 0, bind_flags); GST_D3D11_ALLOCATION_FLAG_DEFAULT, bind_flags, 0);
gst_buffer_pool_config_set_d3d11_allocation_params (config, params); gst_buffer_pool_config_set_d3d11_allocation_params (config, params);
gst_d3d11_allocation_params_free (params); gst_d3d11_allocation_params_free (params);
@ -1487,7 +1487,7 @@ gst_qsv_encoder_propose_allocation (GstVideoEncoder * encoder, GstQuery * query)
GST_VIDEO_INFO_HEIGHT (&info); GST_VIDEO_INFO_HEIGHT (&info);
d3d11_params = gst_d3d11_allocation_params_new (device, &info, d3d11_params = gst_d3d11_allocation_params_new (device, &info,
(GstD3D11AllocationFlags) 0, 0); GST_D3D11_ALLOCATION_FLAG_DEFAULT, 0, 0);
gst_d3d11_allocation_params_alignment (d3d11_params, &align); gst_d3d11_allocation_params_alignment (d3d11_params, &align);
gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params); gst_buffer_pool_config_set_d3d11_allocation_params (config, d3d11_params);