summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-16 23:37:06 +0200
committerwm4 <wm4@nowhere>2019-10-16 23:41:06 +0200
commitbd0af9a7614f230ba62e3426a84925a49de60d51 (patch)
tree22e4d65a3c0fc865a45b999dc9ee48edc672c04e
parentb7eae31834ed6ecd724d68b2939d6b9073b1d296 (diff)
downloadmpv-bd0af9a7614f230ba62e3426a84925a49de60d51.tar.bz2
mpv-bd0af9a7614f230ba62e3426a84925a49de60d51.tar.xz
vf_d3d11vpp: remove RGB conversion hack
With the previous commit, this is dead code. This also makes the f_autoconvert.c code for this dead code (fortunately). Will probably remove this later.
-rw-r--r--filters/f_autoconvert.c3
-rw-r--r--filters/f_autoconvert.h9
-rw-r--r--video/filter/vf_d3d11vpp.c54
3 files changed, 6 insertions, 60 deletions
diff --git a/filters/f_autoconvert.c b/filters/f_autoconvert.c
index 76c93363ca..065092ac64 100644
--- a/filters/f_autoconvert.c
+++ b/filters/f_autoconvert.c
@@ -65,9 +65,6 @@ struct subfmt_conv {
};
static const struct subfmt_conv subfmt_converters[] = {
-#if HAVE_D3D_HWACCEL
- {IMGFMT_D3D11, vf_d3d11_create_outconv},
-#endif
{0}
};
diff --git a/filters/f_autoconvert.h b/filters/f_autoconvert.h
index c26612f2f9..e8c5a44134 100644
--- a/filters/f_autoconvert.h
+++ b/filters/f_autoconvert.h
@@ -47,11 +47,7 @@ void mp_autoconvert_add_all_sw_imgfmts(struct mp_autoconvert *c);
bool mp_autoconvert_probe_input_video(struct mp_autoconvert *c,
struct mp_image *img);
-// Add the formats supported by the hwdec interops (or essentially refine them),
-// and trigger conversion if hw_subfmts mismatch. This is mostly a hack for
-// D3D11/ANGLE (which supports NV12 only).
-// Must be called mp_autoconvert_add_imgfmt(), and overrides them where formats
-// collide.
+// This is pointless.
struct mp_hwdec_devices;
void mp_autoconvert_add_vo_hwdec_subfmts(struct mp_autoconvert *c,
struct mp_hwdec_devices *devs);
@@ -75,6 +71,3 @@ void mp_autoconvert_clear(struct mp_autoconvert *c);
// See mp_autoconvert.on_audio_format_change.
void mp_autoconvert_format_change_continue(struct mp_autoconvert *c);
-
-// vf_d3d11vpp.c
-struct mp_filter *vf_d3d11_create_outconv(struct mp_filter *parent);
diff --git a/video/filter/vf_d3d11vpp.c b/video/filter/vf_d3d11vpp.c
index 6ba1996da3..5464019dac 100644
--- a/video/filter/vf_d3d11vpp.c
+++ b/video/filter/vf_d3d11vpp.c
@@ -52,7 +52,6 @@ struct priv {
struct opts *opts;
ID3D11Device *vo_dev;
- const int *vo_formats;
ID3D11DeviceContext *device_ctx;
ID3D11VideoDevice *video_dev;
@@ -63,8 +62,6 @@ struct priv {
D3D11_VIDEO_FRAME_FORMAT d3d_frame_format;
DXGI_FORMAT out_format;
- bool out_shared;
- bool out_rgb;
bool require_filtering;
@@ -99,7 +96,6 @@ static struct mp_image *alloc_pool(void *pctx, int fmt, int w, int h)
.SampleDesc = { .Count = 1 },
.Usage = D3D11_USAGE_DEFAULT,
.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE,
- .MiscFlags = p->out_shared ? D3D11_RESOURCE_MISC_SHARED : 0,
};
hr = ID3D11Device_CreateTexture2D(p->vo_dev, &texdesc, NULL, &texture);
if (FAILED(hr))
@@ -221,21 +217,9 @@ static int recreate_video_proc(struct mp_filter *vf)
ID3D11VideoContext_VideoProcessorSetStreamColorSpace(p->video_ctx,
p->video_proc,
0, &csp);
- if (p->out_rgb) {
- if (p->params.color.space != MP_CSP_BT_601 &&
- p->params.color.space != MP_CSP_BT_709)
- {
- MP_WARN(vf, "Unsupported video colorspace (%s/%s). Consider "
- "disabling hardware decoding, or using "
- "--hwdec=d3d11va-copy to get correct output.\n",
- m_opt_choice_str(mp_csp_names, p->params.color.space),
- m_opt_choice_str(mp_csp_levels_names, p->params.color.levels));
- }
- } else {
- ID3D11VideoContext_VideoProcessorSetOutputColorSpace(p->video_ctx,
- p->video_proc,
- &csp);
- }
+ ID3D11VideoContext_VideoProcessorSetOutputColorSpace(p->video_ctx,
+ p->video_proc,
+ &csp);
return 0;
fail:
@@ -350,15 +334,6 @@ cleanup:
return out;
}
-static bool vo_supports(struct priv *p, int subfmt)
-{
- for (int n = 0; p->vo_formats && p->vo_formats[n]; n++) {
- if (p->vo_formats[n] == subfmt)
- return true;
- }
- return false;
-}
-
static void vf_d3d11vpp_process(struct mp_filter *vf)
{
struct priv *p = vf->priv;
@@ -372,17 +347,8 @@ static void vf_d3d11vpp_process(struct mp_filter *vf)
p->params = in_fmt->params;
p->out_params = p->params;
- if (vo_supports(p, IMGFMT_NV12)) {
- p->out_params.hw_subfmt = IMGFMT_NV12;
- p->out_format = DXGI_FORMAT_NV12;
- p->out_shared = false;
- p->out_rgb = false;
- } else {
- p->out_params.hw_subfmt = IMGFMT_RGB0;
- p->out_format = DXGI_FORMAT_B8G8R8A8_UNORM;
- p->out_shared = true;
- p->out_rgb = true;
- }
+ p->out_params.hw_subfmt = IMGFMT_NV12;
+ p->out_format = DXGI_FORMAT_NV12;
p->out_params.hw_flags = 0;
p->require_filtering = p->params.hw_subfmt != p->out_params.hw_subfmt;
@@ -475,8 +441,6 @@ static struct mp_filter *vf_d3d11vpp_create(struct mp_filter *parent,
p->vo_dev = d3dctx->device;
ID3D11Device_AddRef(p->vo_dev);
- p->vo_formats = hwctx->supported_formats;
-
HRESULT hr;
hr = ID3D11Device_QueryInterface(p->vo_dev, &IID_ID3D11VideoDevice,
@@ -539,11 +503,3 @@ const struct mp_user_filter_entry vf_d3d11vpp = {
},
.create = vf_d3d11vpp_create,
};
-
-// Create a filter for the purpose of converting the sub-format for hwdec
-// interops which are incapable of handling some formats (ANGLE).
-struct mp_filter *vf_d3d11_create_outconv(struct mp_filter *parent)
-{
- // options==NULL is normally not allowed, and specially handled.
- return vf_d3d11vpp_create(parent, NULL);
-}