diff options
author | Philip Langdale <philipl@overt.org> | 2019-11-16 15:10:13 -0800 |
---|---|---|
committer | Philip Langdale <github.philipl@overt.org> | 2019-12-28 14:31:06 -0800 |
commit | eb852dc50c42ccc68a4a56d03baefc34dc20ebd8 (patch) | |
tree | 0a863320e0496f8c121158756be2aaae197cb2fd /video/out/gpu | |
parent | 5a261507173d28c762ba4f605d7983d928d4bf24 (diff) | |
download | mpv-eb852dc50c42ccc68a4a56d03baefc34dc20ebd8.tar.bz2 mpv-eb852dc50c42ccc68a4a56d03baefc34dc20ebd8.tar.xz |
vo_gpu: hwdec_vdpau: remove direct_mode
As we are less and less interested in vpdpau, with nvdec and vaapi
being better choices in general on nvidia and AMD respectively, we
might consider removing direct_mode, where we bypass the vdpau
mixer and work directly with yuv textures. Normally, working with
yuv textures would be great, but vdpau built in an assumption that
all frames are delivered as separate fields, causing us to have
to re-interleave them.
nvidia then introduces a new OpenGL extension that can return the
yuv frames as frames, but we can't just unconditionally switch to
that as we'd want to keep supporting older hardware where the drivers
are no longer getting new features. The end result is that we
wouldn't be able to get rid of the old code paths.
Removing direct_mode means we always use the mixer, and work with
rgba frame textures. There are some theoretical limitations to
this, but in practice they probably don't matter much - unsupported
colourspaces don't matter because without 10bit decoding support,
we can't use them anyway, and apparently we're not doing separate
chroma scaling these days, so scaling the rbga doesn't really lose
anything (and the vdpau hq scaling option remains available).
Diffstat (limited to 'video/out/gpu')
-rw-r--r-- | video/out/gpu/hwdec.h | 1 | ||||
-rw-r--r-- | video/out/gpu/video.c | 45 |
2 files changed, 0 insertions, 46 deletions
diff --git a/video/out/gpu/hwdec.h b/video/out/gpu/hwdec.h index 258ab881b6..3a1ae3e2ff 100644 --- a/video/out/gpu/hwdec.h +++ b/video/out/gpu/hwdec.h @@ -43,7 +43,6 @@ struct ra_hwdec_mapper { // The common code won't mess with these, so you can e.g. set them in the // .init() callback. struct ra_tex *tex[4]; - bool vdpau_fields; }; // This can be used to map frames of a specific hw format as GL textures. diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index a7369f185c..3ec5cdfcd9 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -216,7 +216,6 @@ struct gl_video { struct ra_tex *error_diffusion_tex[2]; struct ra_tex *screen_tex; struct ra_tex *output_tex; - struct ra_tex *vdpau_deinterleave_tex[2]; struct ra_tex **hook_textures; int num_hook_textures; int idx_hook_textures; @@ -1044,9 +1043,6 @@ static void uninit_video(struct gl_video *p) p->hwdec_active = false; p->hwdec_overlay = NULL; ra_hwdec_mapper_free(&p->hwdec_mapper); - - for (int n = 0; n < 2; n++) - ra_tex_free(p->ra, &p->vdpau_deinterleave_tex[n]); } static void pass_record(struct gl_video *p, struct mp_pass_perf perf) @@ -3502,42 +3498,6 @@ void gl_video_perfdata(struct gl_video *p, struct voctrl_performance_data *out) frame_perf_data(p->pass_redraw, &out->redraw); } -// This assumes nv12, with textures set to GL_NEAREST filtering. -static void reinterleave_vdpau(struct gl_video *p, - struct ra_tex *input[4], struct ra_tex *output[2]) -{ - for (int n = 0; n < 2; n++) { - struct ra_tex **tex = &p->vdpau_deinterleave_tex[n]; - // This is an array of the 2 to-merge planes. - struct ra_tex **src = &input[n * 2]; - int w = src[0]->params.w; - int h = src[0]->params.h; - int ids[2]; - for (int t = 0; t < 2; t++) { - ids[t] = pass_bind(p, (struct image){ - .tex = src[t], - .multiplier = 1.0, - .transform = identity_trans, - .w = w, - .h = h, - }); - } - - pass_describe(p, "vdpau reinterleaving"); - GLSLF("color = fract(gl_FragCoord.y * 0.5) < 0.5\n"); - GLSLF(" ? texture(texture%d, texcoord%d)\n", ids[0], ids[0]); - GLSLF(" : texture(texture%d, texcoord%d);", ids[1], ids[1]); - - int comps = n == 0 ? 1 : 2; - const struct ra_format *fmt = ra_find_unorm_format(p->ra, 1, comps); - ra_tex_resize(p->ra, p->log, tex, w, h * 2, fmt); - struct ra_fbo fbo = { *tex }; - finish_pass_fbo(p, fbo, true, &(struct mp_rect){0, 0, w, h * 2}); - - output[n] = *tex; - } -} - // Returns false on failure. static bool pass_upload_image(struct gl_video *p, struct mp_image *mpi, uint64_t id) { @@ -3574,11 +3534,6 @@ static bool pass_upload_image(struct gl_video *p, struct mp_image *mpi, uint64_t struct mp_image layout = {0}; mp_image_set_params(&layout, &p->image_params); struct ra_tex **tex = p->hwdec_mapper->tex; - struct ra_tex *tmp[4] = {0}; - if (p->hwdec_mapper->vdpau_fields) { - reinterleave_vdpau(p, tex, tmp); - tex = tmp; - } for (int n = 0; n < p->plane_count; n++) { vimg->planes[n] = (struct texplane){ .w = mp_image_plane_w(&layout, n), |