vo_gpu: support video-target-params

This commit is contained in:
nanahi 2024-03-24 14:20:58 -04:00 committed by sfan5
parent 3f17b18a33
commit f4a7931c53
3 changed files with 27 additions and 0 deletions

View File

@ -183,6 +183,7 @@ struct gl_video {
struct mp_image_params real_image_params; // configured format
struct mp_image_params image_params; // texture format (mind hwdec case)
struct mp_image_params target_params; // target format
struct ra_imgfmt_desc ra_format; // texture format
int plane_count;
@ -2726,6 +2727,21 @@ static void pass_colormanage(struct gl_video *p, struct pl_color_space src,
// Adapt from src to dst as necessary
pass_color_map(p->sc, p->use_linear && !osd, src, dst, src_light, dst_light, &tone_map);
if (!osd) {
struct mp_csp_params cparams = MP_CSP_PARAMS_DEFAULTS;
mp_csp_equalizer_state_get(p->video_eq, &cparams);
if (cparams.levels_out == PL_COLOR_LEVELS_UNKNOWN)
cparams.levels_out = PL_COLOR_LEVELS_FULL;
p->target_params = (struct mp_image_params){
.imgfmt_name = p->fbo_format ? p->fbo_format->name : "unknown",
.w = p->texture_w,
.h = p->texture_h,
.color = dst,
.repr = {.sys = PL_COLOR_SYSTEM_RGB, .levels = cparams.levels_out},
.rotate = p->image_params.rotate,
};
}
if (p->use_lut_3d && (flags & RENDER_SCREEN_COLOR)) {
gl_sc_uniform_texture(p->sc, "lut_3d", p->lut_3d_texture);
GLSL(vec3 cpos;)
@ -4375,3 +4391,8 @@ void gl_video_load_hwdecs_for_img_fmt(struct gl_video *p, struct mp_hwdec_device
assert(p->hwdec_ctx.ra_ctx);
ra_hwdec_ctx_load_fmt(&p->hwdec_ctx, devs, params);
}
struct mp_image_params *gl_video_get_target_params_ptr(struct gl_video *p)
{
return &p->target_params;
}

View File

@ -232,5 +232,6 @@ void gl_video_configure_queue(struct gl_video *p, struct vo *vo);
struct mp_image *gl_video_get_image(struct gl_video *p, int imgfmt, int w, int h,
int stride_align, int flags);
struct mp_image_params *gl_video_get_target_params_ptr(struct gl_video *p);
#endif

View File

@ -85,6 +85,11 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
MP_ERR(vo, "Failed presenting frame!\n");
return;
}
struct mp_image_params *params = gl_video_get_target_params_ptr(p->renderer);
mp_mutex_lock(&vo->params_mutex);
vo->target_params = params;
mp_mutex_unlock(&vo->params_mutex);
}
static void flip_page(struct vo *vo)