vo_gpu_next: keep target params in priv instead of alocating it

This commit is contained in:
Kacper Michajłow 2024-04-09 20:55:46 +02:00
parent f167d18ec8
commit 89cc477ef1
1 changed files with 7 additions and 4 deletions

View File

@ -158,6 +158,8 @@ struct priv {
// Performance data of last frame // Performance data of last frame
struct frame_info perf_fresh; struct frame_info perf_fresh;
struct frame_info perf_redraw; struct frame_info perf_redraw;
struct mp_image_params target_params;
}; };
static void update_render_options(struct vo *vo); static void update_render_options(struct vo *vo);
@ -1129,9 +1131,7 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
pl_frames_infer_mix(p->rr, &mix, &target, &ref_frame); pl_frames_infer_mix(p->rr, &mix, &target, &ref_frame);
mp_mutex_lock(&vo->params_mutex); mp_mutex_lock(&vo->params_mutex);
if (!vo->target_params) p->target_params = (struct mp_image_params){
vo->target_params = talloc(vo, struct mp_image_params);
*vo->target_params = (struct mp_image_params){
.imgfmt_name = swframe.fbo->params.format .imgfmt_name = swframe.fbo->params.format
? swframe.fbo->params.format->name : NULL, ? swframe.fbo->params.format->name : NULL,
.w = swframe.fbo->params.w, .w = swframe.fbo->params.w,
@ -1140,6 +1140,7 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
.repr = target.repr, .repr = target.repr,
.rotate = target.rotation, .rotate = target.rotation,
}; };
vo->target_params = &p->target_params;
if (vo->params) { if (vo->params) {
vo->params->color.hdr = ref_frame.color.hdr; vo->params->color.hdr = ref_frame.color.hdr;
@ -1231,7 +1232,9 @@ static int reconfig(struct vo *vo, struct mp_image_params *params)
return -1; return -1;
resize(vo); resize(vo);
TA_FREEP(&vo->target_params); mp_mutex_lock(&vo->params_mutex);
vo->target_params = NULL;
mp_mutex_unlock(&vo->params_mutex);
return 0; return 0;
} }