summaryrefslogtreecommitdiffstats
path: root/video/out/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/gpu')
-rw-r--r--video/out/gpu/context.c43
-rw-r--r--video/out/gpu/context.h17
-rw-r--r--video/out/gpu/lcms.c16
-rw-r--r--video/out/gpu/lcms.h12
-rw-r--r--video/out/gpu/video_shaders.c8
-rw-r--r--video/out/gpu/video_shaders.h7
6 files changed, 55 insertions, 48 deletions
diff --git a/video/out/gpu/context.c b/video/out/gpu/context.c
index 6e58cce485..e0beb845c2 100644
--- a/video/out/gpu/context.c
+++ b/video/out/gpu/context.c
@@ -112,8 +112,8 @@ static const struct ra_ctx_fns *contexts[] = {
#endif
};
-int ra_ctx_api_help(struct mp_log *log, const struct m_option *opt,
- struct bstr name)
+static int ra_ctx_api_help(struct mp_log *log, const struct m_option *opt,
+ struct bstr name)
{
mp_info(log, "GPU APIs (contexts):\n");
mp_info(log, " auto (autodetect)\n");
@@ -122,8 +122,8 @@ int ra_ctx_api_help(struct mp_log *log, const struct m_option *opt,
return M_OPT_EXIT;
}
-int ra_ctx_validate_api(struct mp_log *log, const struct m_option *opt,
- struct bstr name, const char **value)
+static int ra_ctx_validate_api(struct mp_log *log, const struct m_option *opt,
+ struct bstr name, const char **value)
{
struct bstr param = bstr0(*value);
if (bstr_equals0(param, "auto"))
@@ -135,8 +135,8 @@ int ra_ctx_validate_api(struct mp_log *log, const struct m_option *opt,
return M_OPT_INVALID;
}
-int ra_ctx_context_help(struct mp_log *log, const struct m_option *opt,
- struct bstr name)
+static int ra_ctx_context_help(struct mp_log *log, const struct m_option *opt,
+ struct bstr name)
{
mp_info(log, "GPU contexts (APIs):\n");
mp_info(log, " auto (autodetect)\n");
@@ -145,8 +145,8 @@ int ra_ctx_context_help(struct mp_log *log, const struct m_option *opt,
return M_OPT_EXIT;
}
-int ra_ctx_validate_context(struct mp_log *log, const struct m_option *opt,
- struct bstr name, const char **value)
+static int ra_ctx_validate_context(struct mp_log *log, const struct m_option *opt,
+ struct bstr name, const char **value)
{
struct bstr param = bstr0(*value);
if (bstr_equals0(param, "auto"))
@@ -160,11 +160,10 @@ int ra_ctx_validate_context(struct mp_log *log, const struct m_option *opt,
// Create a VO window and create a RA context on it.
// vo_flags: passed to the backend's create window function
-struct ra_ctx *ra_ctx_create(struct vo *vo, const char *context_type,
- const char *context_name, struct ra_ctx_opts opts)
+struct ra_ctx *ra_ctx_create(struct vo *vo, struct ra_ctx_opts opts)
{
- bool api_auto = !context_type || strcmp(context_type, "auto") == 0;
- bool ctx_auto = !context_name || strcmp(context_name, "auto") == 0;
+ bool api_auto = !opts.context_type || strcmp(opts.context_type, "auto") == 0;
+ bool ctx_auto = !opts.context_name || strcmp(opts.context_name, "auto") == 0;
if (ctx_auto) {
MP_VERBOSE(vo, "Probing for best GPU context.\n");
@@ -177,9 +176,9 @@ struct ra_ctx *ra_ctx_create(struct vo *vo, const char *context_type,
vo->probing = opts.probing;
for (int i = 0; i < MP_ARRAY_SIZE(contexts); i++) {
- if (!opts.probing && strcmp(contexts[i]->name, context_name) != 0)
+ if (!opts.probing && strcmp(contexts[i]->name, opts.context_name) != 0)
continue;
- if (!api_auto && strcmp(contexts[i]->type, context_type) != 0)
+ if (!api_auto && strcmp(contexts[i]->type, opts.context_type) != 0)
continue;
struct ra_ctx *ctx = talloc_ptrtype(NULL, ctx);
@@ -223,3 +222,19 @@ void ra_ctx_destroy(struct ra_ctx **ctx_ptr)
*ctx_ptr = NULL;
}
+
+#define OPT_BASE_STRUCT struct ra_ctx_opts
+const struct m_sub_options ra_ctx_conf = {
+ .opts = (const m_option_t[]) {
+ {"gpu-context",
+ OPT_STRING_VALIDATE(context_name, ra_ctx_validate_context),
+ .help = ra_ctx_context_help},
+ {"gpu-api",
+ OPT_STRING_VALIDATE(context_type, ra_ctx_validate_api),
+ .help = ra_ctx_api_help},
+ {"gpu-debug", OPT_FLAG(debug)},
+ {"gpu-sw", OPT_FLAG(allow_sw)},
+ {0}
+ },
+ .size = sizeof(struct ra_ctx_opts),
+};
diff --git a/video/out/gpu/context.h b/video/out/gpu/context.h
index ca71150f54..7ad37f0d61 100644
--- a/video/out/gpu/context.h
+++ b/video/out/gpu/context.h
@@ -11,8 +11,12 @@ struct ra_ctx_opts {
int want_alpha; // create an alpha framebuffer if possible
int debug; // enable debugging layers/callbacks etc.
bool probing; // the backend was auto-probed
+ char *context_name; // filter by `ra_ctx_fns.name`
+ char *context_type; // filter by `ra_ctx_fns.type`
};
+extern const struct m_sub_options ra_ctx_conf;
+
struct ra_ctx {
struct vo *vo;
struct ra *ra;
@@ -95,16 +99,5 @@ struct ra_swapchain_fns {
// Create and destroy a ra_ctx. This also takes care of creating and destroying
// the underlying `struct ra`, and perhaps the underlying VO backend.
-struct ra_ctx *ra_ctx_create(struct vo *vo, const char *context_type,
- const char *context_name, struct ra_ctx_opts opts);
+struct ra_ctx *ra_ctx_create(struct vo *vo, struct ra_ctx_opts opts);
void ra_ctx_destroy(struct ra_ctx **ctx);
-
-struct m_option;
-int ra_ctx_api_help(struct mp_log *log, const struct m_option *opt,
- struct bstr name);
-int ra_ctx_validate_api(struct mp_log *log, const struct m_option *opt,
- struct bstr name, const char **value);
-int ra_ctx_context_help(struct mp_log *log, const struct m_option *opt,
- struct bstr name);
-int ra_ctx_validate_context(struct mp_log *log, const struct m_option *opt,
- struct bstr name, const char **value);
diff --git a/video/out/gpu/lcms.c b/video/out/gpu/lcms.c
index 704f1fbf1d..17edf96f3b 100644
--- a/video/out/gpu/lcms.c
+++ b/video/out/gpu/lcms.c
@@ -54,18 +54,6 @@ struct gl_lcms {
struct mp_icc_opts *opts;
};
-static bool parse_3dlut_size(const char *arg, int *p1, int *p2, int *p3)
-{
- if (sscanf(arg, "%dx%dx%d", p1, p2, p3) != 3)
- return false;
- for (int n = 0; n < 3; n++) {
- int s = ((int[]) { *p1, *p2, *p3 })[n];
- if (s < 2 || s > 512)
- return false;
- }
- return true;
-}
-
static int validate_3dlut_size_opt(struct mp_log *log, const m_option_t *opt,
struct bstr name, const char **value)
{
@@ -73,7 +61,7 @@ static int validate_3dlut_size_opt(struct mp_log *log, const m_option_t *opt,
int p1, p2, p3;
char s[20];
snprintf(s, sizeof(s), "%.*s", BSTR_P(param));
- return parse_3dlut_size(s, &p1, &p2, &p3);
+ return gl_parse_3dlut_size(s, &p1, &p2, &p3);
}
#define OPT_BASE_STRUCT struct mp_icc_opts
@@ -367,7 +355,7 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **result_lut3d,
abort();
}
- if (!parse_3dlut_size(p->opts->size_str, &s_r, &s_g, &s_b))
+ if (!gl_parse_3dlut_size(p->opts->size_str, &s_r, &s_g, &s_b))
return false;
if (!gl_lcms_has_profile(p))
diff --git a/video/out/gpu/lcms.h b/video/out/gpu/lcms.h
index 35bbd61fe0..62b2437194 100644
--- a/video/out/gpu/lcms.h
+++ b/video/out/gpu/lcms.h
@@ -40,4 +40,16 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **,
bool gl_lcms_has_changed(struct gl_lcms *p, enum mp_csp_prim prim,
enum mp_csp_trc trc, struct AVBufferRef *vid_profile);
+static inline bool gl_parse_3dlut_size(const char *arg, int *p1, int *p2, int *p3)
+{
+ if (sscanf(arg, "%dx%dx%d", p1, p2, p3) != 3)
+ return false;
+ for (int n = 0; n < 3; n++) {
+ int s = ((int[]) { *p1, *p2, *p3 })[n];
+ if (s < 2 || s > 512)
+ return false;
+ }
+ return true;
+}
+
#endif
diff --git a/video/out/gpu/video_shaders.c b/video/out/gpu/video_shaders.c
index d39b867e2a..d5bc678145 100644
--- a/video/out/gpu/video_shaders.c
+++ b/video/out/gpu/video_shaders.c
@@ -937,14 +937,6 @@ static void prng_init(struct gl_shader_cache *sc, AVLFG *lfg)
gl_sc_uniform_f(sc, "random", (double)av_lfg_get(lfg) / UINT32_MAX);
}
-struct deband_opts {
- int enabled;
- int iterations;
- float threshold;
- float range;
- float grain;
-};
-
const struct deband_opts deband_opts_def = {
.iterations = 1,
.threshold = 32.0,
diff --git a/video/out/gpu/video_shaders.h b/video/out/gpu/video_shaders.h
index f20d643e99..27e7874c6d 100644
--- a/video/out/gpu/video_shaders.h
+++ b/video/out/gpu/video_shaders.h
@@ -23,6 +23,13 @@
#include "utils.h"
#include "video.h"
+struct deband_opts {
+ int iterations;
+ float threshold;
+ float range;
+ float grain;
+};
+
extern const struct deband_opts deband_opts_def;
extern const struct m_sub_options deband_conf;