vo_gpu: fix video sometimes not being rerendered on equalizer change

With video paused, changing the brightness controls (or similar) would
sometimes not rerender the video frame. So the OSD would redraw, but the
video wouldn't change. This is caused by output caching, and a redraw
request is free to return the cached frame. Change it such to invalidate
the cached frame if any of the options or the equalizer change.

In theory, gl_video_reset_surfaces() could be called if the equalizer
changes - this would apparently force interpolatzion to redraw all
frames. But this looks kind of crappy when changing the equalizer during
playback. It'll "eventually" use the correct settings anyway, and when
paused interpolation is off.
This commit is contained in:
wm4 2017-10-17 09:07:35 +02:00
parent b299a3f546
commit c90f76d322
4 changed files with 9 additions and 4 deletions

View File

@ -424,6 +424,7 @@ static const char *handle_scaler_opt(const char *name, bool tscale);
static void reinit_from_options(struct gl_video *p);
static void get_scale_factors(struct gl_video *p, bool transpose_rot, double xy[2]);
static void gl_video_setup_hooks(struct gl_video *p);
static void gl_video_update_options(struct gl_video *p);
#define GLSL(x) gl_sc_add(p->sc, #x "\n");
#define GLSLF(...) gl_sc_addf(p->sc, __VA_ARGS__)
@ -2993,6 +2994,8 @@ static void gl_video_interpolate_frame(struct gl_video *p, struct vo_frame *t,
void gl_video_render_frame(struct gl_video *p, struct vo_frame *frame,
struct ra_fbo fbo)
{
gl_video_update_options(p);
struct mp_rect target_rc = {0, 0, fbo.tex->params.w, fbo.tex->params.h};
p->broken_frame = false;
@ -3624,12 +3627,15 @@ static const char *handle_scaler_opt(const char *name, bool tscale)
return NULL;
}
void gl_video_update_options(struct gl_video *p)
static void gl_video_update_options(struct gl_video *p)
{
if (m_config_cache_update(p->opts_cache)) {
gl_lcms_update_options(p->cms);
reinit_from_options(p);
}
if (mp_csp_equalizer_state_changed(p->video_eq))
p->output_tex_valid = false;
}
static void reinit_from_options(struct gl_video *p)
@ -3660,6 +3666,8 @@ static void reinit_from_options(struct gl_video *p)
void gl_video_configure_queue(struct gl_video *p, struct vo *vo)
{
gl_video_update_options(p);
int queue_size = 1;
// Figure out an adequate size for the interpolation queue. The larger

View File

@ -150,7 +150,6 @@ struct gl_video *gl_video_init(struct ra *ra, struct mp_log *log,
struct mpv_global *g);
void gl_video_uninit(struct gl_video *p);
void gl_video_set_osd_source(struct gl_video *p, struct osd_state *osd);
void gl_video_update_options(struct gl_video *p);
bool gl_video_check_format(struct gl_video *p, int mp_format);
void gl_video_config(struct gl_video *p, struct mp_image_params *params);
void gl_video_set_output_depth(struct gl_video *p, int r, int g, int b);

View File

@ -199,7 +199,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
request_hwdec_api(vo, data);
return true;
case VOCTRL_UPDATE_RENDER_OPTS: {
gl_video_update_options(p->renderer);
get_and_update_icc_profile(p);
gl_video_configure_queue(p->renderer, p->vo);
p->vo->want_redraw = true;

View File

@ -291,7 +291,6 @@ int mpv_opengl_cb_draw(mpv_opengl_cb_context *ctx, int fbo, int vp_w, int vp_h)
gl_video_config(ctx->renderer, &ctx->img_params);
}
if (ctx->update_new_opts) {
gl_video_update_options(ctx->renderer);
if (vo)
gl_video_configure_queue(ctx->renderer, vo);
int debug;