diff --git a/sys/d3d11/gstd3d11decoder.c b/sys/d3d11/gstd3d11decoder.c index 39035577ba..e211f48c38 100644 --- a/sys/d3d11/gstd3d11decoder.c +++ b/sys/d3d11/gstd3d11decoder.c @@ -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 */ diff --git a/sys/d3d11/gstd3d11decoder.h b/sys/d3d11/gstd3d11decoder.h index aa59050a71..50dacc35a2 100644 --- a/sys/d3d11/gstd3d11decoder.h +++ b/sys/d3d11/gstd3d11decoder.h @@ -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); diff --git a/sys/d3d11/gstd3d11h264dec.c b/sys/d3d11/gstd3d11h264dec.c index e180cfb07d..9bdc2ad6f6 100644 --- a/sys/d3d11/gstd3d11h264dec.c +++ b/sys/d3d11/gstd3d11h264dec.c @@ -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; diff --git a/sys/d3d11/gstd3d11h265dec.c b/sys/d3d11/gstd3d11h265dec.c index c3b0028662..8dce255044 100644 --- a/sys/d3d11/gstd3d11h265dec.c +++ b/sys/d3d11/gstd3d11h265dec.c @@ -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; diff --git a/sys/d3d11/gstd3d11vp8dec.c b/sys/d3d11/gstd3d11vp8dec.c index d06f17fdb5..9402bbb8af 100644 --- a/sys/d3d11/gstd3d11vp8dec.c +++ b/sys/d3d11/gstd3d11vp8dec.c @@ -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; diff --git a/sys/d3d11/gstd3d11vp9dec.c b/sys/d3d11/gstd3d11vp9dec.c index c22a980b2c..9b94d56bc2 100644 --- a/sys/d3d11/gstd3d11vp9dec.c +++ b/sys/d3d11/gstd3d11vp9dec.c @@ -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