It seems that GLX requires us to explicitly set opts.want alpha before ra_ctx_create is called. b7fd232524bc213df91fa77ca0261ff514fad1e4 rearranged the function calls in a way made this not work. Fix this by rearranging it again so the value is set before ra_ctx is created.
Unified · Split
| @@ -107,12 +107,10 @@ err_out: · 106 unmodified lines | ||
| 107 | 107 | } |
| 108 | 108 | #endif // HAVE_D3D11 |
| 109 | 109 | |
| 110 | −struct gpu_ctx *gpu_ctx_create(struct vo *vo, struct gl_video_opts *gl_opts) | |
| 110 | +struct gpu_ctx *gpu_ctx_create(struct vo *vo, struct ra_ctx_opts *ctx_opts) | |
| 111 | 111 | { |
| 112 | 112 | struct gpu_ctx *ctx = talloc_zero(NULL, struct gpu_ctx); |
| 113 | 113 | ctx->log = vo->log; |
| 114 | − | |
| 115 | − struct ra_ctx_opts *ctx_opts = mp_get_config_group(ctx, vo->global, &ra_ctx_conf); | |
| 116 | 114 | ctx->ra_ctx = ra_ctx_create(vo, *ctx_opts); |
| 117 | 115 | if (!ctx->ra_ctx) |
| 118 | 116 | goto err_out; |
| @@ -21,8 +21,8 @@ · 20 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | struct mp_log; |
| 23 | 23 | struct ra_ctx; |
| 24 | +struct ra_ctx_opts; | |
| 24 | 25 | struct vo; |
| 25 | −struct gl_video_opts; | |
| 26 | 26 | |
| 27 | 27 | struct gpu_ctx { |
| 28 | 28 | struct mp_log *log; |
| @@ -35,6 +35,6 @@ struct gpu_ctx { · 6 unmodified lines | ||
| 35 | 35 | void *priv; |
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | −struct gpu_ctx *gpu_ctx_create(struct vo *vo, struct gl_video_opts *gl_opts); | |
| 38 | +struct gpu_ctx *gpu_ctx_create(struct vo *vo, struct ra_ctx_opts *ctx_opts); | |
| 39 | 39 | bool gpu_ctx_resize(struct gpu_ctx *ctx, int w, int h); |
| 40 | 40 | void gpu_ctx_destroy(struct gpu_ctx **ctxp); |
| @@ -169,13 +169,13 @@ static void get_and_update_ambient_lighting(struct gpu_priv *p) · 168 unmodified lines | ||
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | −static void update_ra_ctx_options(struct vo *vo) | |
| 172 | +static void update_ra_ctx_options(struct vo *vo, struct ra_ctx_opts *ctx_opts) | |
| 173 | 173 | { |
| 174 | 174 | struct gpu_priv *p = vo->priv; |
| 175 | 175 | struct gl_video_opts *gl_opts = mp_get_config_group(p->ctx, vo->global, &gl_video_conf); |
| 176 | − p->ctx->opts.want_alpha = (gl_opts->background == BACKGROUND_COLOR && | |
| 177 | − gl_opts->background_color.a != 255) || | |
| 178 | − gl_opts->background == BACKGROUND_NONE; | |
| 176 | + ctx_opts->want_alpha = (gl_opts->background == BACKGROUND_COLOR && | |
| 177 | + gl_opts->background_color.a != 255) || | |
| 178 | + gl_opts->background == BACKGROUND_NONE; | |
| 179 | 179 | talloc_free(gl_opts); |
| 180 | 180 | } |
| 181 | 181 | |
| @@ -198,12 +198,14 @@ static int control(struct vo *vo, uint32_t request, void *data) · 16 unmodified lines | ||
| 198 | 198 | request_hwdec_api(vo, data); |
| 199 | 199 | return true; |
| 200 | 200 | case VOCTRL_UPDATE_RENDER_OPTS: { |
| 201 | − update_ra_ctx_options(vo); | |
| 201 | + struct ra_ctx_opts *ctx_opts = mp_get_config_group(vo, vo->global, &ra_ctx_conf); | |
| 202 | + update_ra_ctx_options(vo, ctx_opts); | |
| 202 | 203 | gl_video_configure_queue(p->renderer, vo); |
| 203 | 204 | get_and_update_icc_profile(p); |
| 204 | 205 | if (p->ctx->fns->update_render_opts) |
| 205 | 206 | p->ctx->fns->update_render_opts(p->ctx); |
| 206 | 207 | vo->want_redraw = true; |
| 208 | + talloc_free(ctx_opts); | |
| 207 | 209 | return true; |
| 208 | 210 | } |
| 209 | 211 | case VOCTRL_RESET: |
| @@ -286,14 +288,13 @@ static int preinit(struct vo *vo) · 76 unmodified lines | ||
| 286 | 288 | p->log = vo->log; |
| 287 | 289 | |
| 288 | 290 | struct ra_ctx_opts *ctx_opts = mp_get_config_group(vo, vo->global, &ra_ctx_conf); |
| 289 | − struct ra_ctx_opts opts = *ctx_opts; | |
| 290 | − p->ctx = ra_ctx_create(vo, opts); | |
| 291 | + update_ra_ctx_options(vo, ctx_opts); | |
| 292 | + p->ctx = ra_ctx_create(vo, *ctx_opts); | |
| 291 | 293 | talloc_free(ctx_opts); |
| 292 | 294 | if (!p->ctx) |
| 293 | 295 | goto err_out; |
| 294 | 296 | assert(p->ctx->ra); |
| 295 | 297 | assert(p->ctx->swapchain); |
| 296 | − update_ra_ctx_options(vo); | |
| 297 | 298 | |
| 298 | 299 | p->renderer = gl_video_init(p->ctx->ra, vo->log, vo->global); |
| 299 | 300 | gl_video_set_osd_source(p->renderer, vo->osd); |
| @@ -1477,17 +1477,17 @@ static inline void copy_frame_info_to_mp(struct frame_info *pl, · 1476 unmodified lines | ||
| 1477 | 1477 | } |
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | −static void update_ra_ctx_options(struct vo *vo) | |
| 1480 | +static void update_ra_ctx_options(struct vo *vo, struct ra_ctx_opts *ctx_opts) | |
| 1481 | 1481 | { |
| 1482 | 1482 | struct priv *p = vo->priv; |
| 1483 | 1483 | struct gl_video_opts *gl_opts = p->opts_cache->opts; |
| 1484 | 1484 | bool border_alpha = (p->next_opts->border_background == BACKGROUND_COLOR && |
| 1485 | 1485 | gl_opts->background_color.a != 255) || |
| 1486 | 1486 | p->next_opts->border_background == BACKGROUND_NONE; |
| 1487 | − p->ra_ctx->opts.want_alpha = (gl_opts->background == BACKGROUND_COLOR && | |
| 1488 | − gl_opts->background_color.a != 255) || | |
| 1489 | − gl_opts->background == BACKGROUND_NONE || | |
| 1490 | − border_alpha; | |
| 1487 | + ctx_opts->want_alpha = (gl_opts->background == BACKGROUND_COLOR && | |
| 1488 | + gl_opts->background_color.a != 255) || | |
| 1489 | + gl_opts->background == BACKGROUND_NONE || | |
| 1490 | + border_alpha; | |
| 1491 | 1491 | } |
| 1492 | 1492 | |
| 1493 | 1493 | static int control(struct vo *vo, uint32_t request, void *data) |
| @@ -1505,7 +1505,7 @@ static int control(struct vo *vo, uint32_t request, void *data) · 11 unmodified lines | ||
| 1505 | 1505 | |
| 1506 | 1506 | case VOCTRL_UPDATE_RENDER_OPTS: { |
| 1507 | 1507 | m_config_cache_update(p->opts_cache); |
| 1508 | − update_ra_ctx_options(vo); | |
| 1508 | + update_ra_ctx_options(vo, &p->ra_ctx->opts); | |
| 1509 | 1509 | if (p->ra_ctx->fns->update_render_opts) |
| 1510 | 1510 | p->ra_ctx->fns->update_render_opts(p->ra_ctx); |
| 1511 | 1511 | update_render_options(vo); |
| @@ -1825,7 +1825,10 @@ static int preinit(struct vo *vo) · 313 unmodified lines | ||
| 1825 | 1825 | p->log = vo->log; |
| 1826 | 1826 | |
| 1827 | 1827 | struct gl_video_opts *gl_opts = p->opts_cache->opts; |
| 1828 | − p->context = gpu_ctx_create(vo, gl_opts); | |
| 1828 | + struct ra_ctx_opts *ctx_opts = mp_get_config_group(vo, vo->global, &ra_ctx_conf); | |
| 1829 | + update_ra_ctx_options(vo, ctx_opts); | |
| 1830 | + p->context = gpu_ctx_create(vo, ctx_opts); | |
| 1831 | + talloc_free(ctx_opts); | |
| 1829 | 1832 | if (!p->context) |
| 1830 | 1833 | goto err_out; |
| 1831 | 1834 | // For the time being |
| @@ -1838,7 +1841,6 @@ static int preinit(struct vo *vo) · 6 unmodified lines | ||
| 1838 | 1841 | .global = p->global, |
| 1839 | 1842 | .ra_ctx = p->ra_ctx, |
| 1840 | 1843 | }; |
| 1841 | − update_ra_ctx_options(vo); | |
| 1842 | 1844 | |
| 1843 | 1845 | vo->hwdec_devs = hwdec_devices_create(); |
| 1844 | 1846 | hwdec_devices_set_loader(vo->hwdec_devs, load_hwdec_api, vo); |