mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
d3d11decoder: Disable zero-copy for blacklisted device
Should enable it for verified devices. For now, Xbox is blacklisted Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
This commit is contained in:
parent
1144cdc63a
commit
bc99ea1e30
6 changed files with 26 additions and 1 deletions
|
@ -92,6 +92,9 @@ struct _GstD3D11DecoderPrivate
|
|||
|
||||
GUID decoder_profile;
|
||||
|
||||
/* For device specific workaround */
|
||||
gboolean is_xbox_device;
|
||||
|
||||
/* for internal shader */
|
||||
GstD3D11ColorConverter *converter;
|
||||
ID3D11Texture2D *shader_resource_texture;
|
||||
|
@ -673,6 +676,8 @@ gst_d3d11_decoder_open (GstD3D11Decoder * decoder, GstD3D11Codec codec,
|
|||
|
||||
gst_d3d11_decoder_reset_unlocked (decoder);
|
||||
|
||||
priv->is_xbox_device = gst_d3d11_is_xbox_device (priv->device);
|
||||
|
||||
/* NOTE: other dxva implementations (ffmpeg and vlc) do this
|
||||
* and they say the required alignment were mentioned by dxva spec.
|
||||
* See ff_dxva2_common_frame_params() in dxva.c of ffmpeg and
|
||||
|
@ -681,7 +686,7 @@ gst_d3d11_decoder_open (GstD3D11Decoder * decoder, GstD3D11Codec codec,
|
|||
switch (codec) {
|
||||
case GST_D3D11_CODEC_H265:
|
||||
/* See directx_va_Setup() impl. in vlc */
|
||||
if (!gst_d3d11_is_xbox_device (priv->device))
|
||||
if (!priv->is_xbox_device)
|
||||
alignment = 128;
|
||||
else
|
||||
alignment = 16;
|
||||
|
@ -1591,6 +1596,20 @@ gst_d3d11_decoder_decide_allocation (GstVideoDecoder * decoder,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_d3d11_decoder_supports_direct_rendering (GstD3D11Decoder * decoder)
|
||||
{
|
||||
GstD3D11DecoderPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GST_IS_D3D11_DECODER (decoder), FALSE);
|
||||
|
||||
priv = decoder->priv;
|
||||
|
||||
/* FIXME: Need to figure out Xbox device's behavior
|
||||
* https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1312
|
||||
*/
|
||||
return !priv->is_xbox_device;
|
||||
}
|
||||
|
||||
/* Keep sync with chromium and keep in sorted order.
|
||||
* See supported_profile_helpers.cc in chromium */
|
||||
|
|
|
@ -152,6 +152,8 @@ gboolean gst_d3d11_decoder_decide_allocation (GstVideoDecoder * decod
|
|||
GstD3D11Codec codec,
|
||||
gboolean use_d3d11_pool);
|
||||
|
||||
gboolean gst_d3d11_decoder_supports_direct_rendering (GstD3D11Decoder * decoder);
|
||||
|
||||
/* Utils for class registration */
|
||||
gboolean gst_d3d11_decoder_util_is_legacy_device (GstD3D11Device * device);
|
||||
|
||||
|
|
|
@ -631,6 +631,7 @@ gst_d3d11_h264_dec_output_picture (GstH264Decoder * decoder,
|
|||
* we cannot do that since baseclass will store the decoded buffer
|
||||
* up to gop size but our dpb pool cannot be increased */
|
||||
if (self->use_d3d11_output &&
|
||||
gst_d3d11_decoder_supports_direct_rendering (self->d3d11_decoder) &&
|
||||
GST_VIDEO_DECODER (self)->input_segment.rate > 0) {
|
||||
GstMemory *mem;
|
||||
|
||||
|
|
|
@ -671,6 +671,7 @@ gst_d3d11_h265_dec_output_picture (GstH265Decoder * decoder,
|
|||
* we cannot do that since baseclass will store the decoded buffer
|
||||
* up to gop size but our dpb pool cannot be increased */
|
||||
if (self->use_d3d11_output &&
|
||||
gst_d3d11_decoder_supports_direct_rendering (self->d3d11_decoder) &&
|
||||
GST_VIDEO_DECODER (self)->input_segment.rate > 0) {
|
||||
GstMemory *mem;
|
||||
|
||||
|
|
|
@ -401,6 +401,7 @@ gst_d3d11_vp8_dec_output_picture (GstVp8Decoder * decoder,
|
|||
* we cannot do that since baseclass will store the decoded buffer
|
||||
* up to gop size but our dpb pool cannot be increased */
|
||||
if (self->use_d3d11_output &&
|
||||
gst_d3d11_decoder_supports_direct_rendering (self->d3d11_decoder) &&
|
||||
GST_VIDEO_DECODER (self)->input_segment.rate > 0) {
|
||||
GstMemory *mem;
|
||||
|
||||
|
|
|
@ -502,6 +502,7 @@ gst_d3d11_vp9_dec_output_picture (GstVp9Decoder * decoder,
|
|||
* we cannot do that since baseclass will store the decoded buffer
|
||||
* up to gop size but our dpb pool cannot be increased */
|
||||
if (self->use_d3d11_output &&
|
||||
gst_d3d11_decoder_supports_direct_rendering (self->d3d11_decoder) &&
|
||||
GST_VIDEO_DECODER (self)->input_segment.rate > 0 &&
|
||||
GST_VIDEO_INFO_WIDTH (&self->output_state->info) ==
|
||||
picture->frame_hdr.width
|
||||
|
|
Loading…
Reference in a new issue