summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeungha Yang <seungha@centricular.com>2020-06-15 21:10:09 +0900
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-06-16 10:49:02 +0000
commitbc99ea1e30dc5fa662de91edc74724ee040ec664 (patch)
tree1cab1014b5d2e8f663eec97c3b5f2f56b36ccff5
parent1144cdc63a8a4811e28c953d02869d2afc6355c8 (diff)
downloadgstreamer-plugins-bad-bc99ea1e30dc5fa662de91edc74724ee040ec664.tar.gz
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>
-rw-r--r--sys/d3d11/gstd3d11decoder.c21
-rw-r--r--sys/d3d11/gstd3d11decoder.h2
-rw-r--r--sys/d3d11/gstd3d11h264dec.c1
-rw-r--r--sys/d3d11/gstd3d11h265dec.c1
-rw-r--r--sys/d3d11/gstd3d11vp8dec.c1
-rw-r--r--sys/d3d11/gstd3d11vp9dec.c1
6 files changed, 26 insertions, 1 deletions
diff --git a/sys/d3d11/gstd3d11decoder.c b/sys/d3d11/gstd3d11decoder.c
index 39035577b..e211f48c3 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 aa59050a7..50dacc35a 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 e180cfb07..9bdc2ad6f 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 c3b002866..8dce25504 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 d06f17fdb..9402bbb8a 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 c22a980b2..9b94d56bc 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