2013-03-01 20:19:20 +00:00
|
|
|
/*
|
|
|
|
* This file is part of mpv.
|
|
|
|
*
|
2016-01-07 09:48:04 +00:00
|
|
|
* mpv is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2013-03-01 20:19:20 +00:00
|
|
|
*
|
|
|
|
* mpv is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2016-01-07 09:48:04 +00:00
|
|
|
* GNU Lesser General Public License for more details.
|
2013-03-01 20:19:20 +00:00
|
|
|
*
|
2016-01-07 09:48:04 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
|
2013-03-01 20:19:20 +00:00
|
|
|
*/
|
2016-01-07 09:48:04 +00:00
|
|
|
|
2013-03-01 20:19:20 +00:00
|
|
|
#ifndef MP_GL_VIDEO_H
|
|
|
|
#define MP_GL_VIDEO_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2014-12-09 20:34:01 +00:00
|
|
|
#include "options/m_option.h"
|
2013-11-24 11:58:06 +00:00
|
|
|
#include "sub/osd.h"
|
2015-09-05 12:03:00 +00:00
|
|
|
#include "utils.h"
|
2016-02-13 14:33:00 +00:00
|
|
|
#include "lcms.h"
|
2017-08-04 17:09:46 +00:00
|
|
|
#include "shader_cache.h"
|
2017-08-10 19:36:57 +00:00
|
|
|
#include "video/csputils.h"
|
2015-09-05 12:03:00 +00:00
|
|
|
#include "video/out/filter_kernels.h"
|
|
|
|
|
vo_opengl: refactor scaler configuration
This merges all of the scaler-related options into a single
configuration struct, and also cleans up the way they're passed through
the code. (For example, the scaler index is no longer threaded through
pass_sample, just the scaler configuration itself, and there's no longer
duplication of the params etc.)
In addition, this commit makes scale-down more principled, and turns it
into a scaler in its own right - so there's no longer an ugly separation
between scale and scale-down in the code.
Finally, the radius stuff has been made more proper - filters always
have a radius now (there's no more radius -1), and get a new .resizable
attribute instead for when it's tunable.
User-visible changes:
1. scale-down has been renamed dscale and now has its own set of config
options (dscale-param1, dscale-radius) etc., instead of reusing
scale-param1 (which was arguably a bug).
2. The default radius is no longer fixed at 3, but instead uses that
filter's preferred radius by default. (Scalers with a default radius
other than 3 include sinc, gaussian, box and triangle)
3. scale-radius etc. now goes down to 0.5, rather than 1.0. 0.5 is the
smallest radius that theoretically makes sense, and indeed it's used
by at least one filter (nearest).
Apart from that, it should just be internal changes only.
Note that this sets up for the refactor discussed in #1720, which would
be to merge scaler and window configurations (include parameters etc.)
into a single, simplified string. In the code, this would now basically
just mean getting rid of all the OPT_FLOATRANGE etc. lines related to
scalers and replacing them by a single function that parses a string and
updates the struct scaler_config as appropriate.
2015-03-26 00:55:32 +00:00
|
|
|
struct scaler_fun {
|
|
|
|
char *name;
|
|
|
|
float params[2];
|
|
|
|
float blur;
|
2016-10-26 14:32:57 +00:00
|
|
|
float taper;
|
vo_opengl: refactor scaler configuration
This merges all of the scaler-related options into a single
configuration struct, and also cleans up the way they're passed through
the code. (For example, the scaler index is no longer threaded through
pass_sample, just the scaler configuration itself, and there's no longer
duplication of the params etc.)
In addition, this commit makes scale-down more principled, and turns it
into a scaler in its own right - so there's no longer an ugly separation
between scale and scale-down in the code.
Finally, the radius stuff has been made more proper - filters always
have a radius now (there's no more radius -1), and get a new .resizable
attribute instead for when it's tunable.
User-visible changes:
1. scale-down has been renamed dscale and now has its own set of config
options (dscale-param1, dscale-radius) etc., instead of reusing
scale-param1 (which was arguably a bug).
2. The default radius is no longer fixed at 3, but instead uses that
filter's preferred radius by default. (Scalers with a default radius
other than 3 include sinc, gaussian, box and triangle)
3. scale-radius etc. now goes down to 0.5, rather than 1.0. 0.5 is the
smallest radius that theoretically makes sense, and indeed it's used
by at least one filter (nearest).
Apart from that, it should just be internal changes only.
Note that this sets up for the refactor discussed in #1720, which would
be to merge scaler and window configurations (include parameters etc.)
into a single, simplified string. In the code, this would now basically
just mean getting rid of all the OPT_FLOATRANGE etc. lines related to
scalers and replacing them by a single function that parses a string and
updates the struct scaler_config as appropriate.
2015-03-26 00:55:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct scaler_config {
|
|
|
|
struct scaler_fun kernel;
|
|
|
|
struct scaler_fun window;
|
|
|
|
float radius;
|
|
|
|
float antiring;
|
2017-07-12 17:08:58 +00:00
|
|
|
float clamp;
|
vo_opengl: refactor scaler configuration
This merges all of the scaler-related options into a single
configuration struct, and also cleans up the way they're passed through
the code. (For example, the scaler index is no longer threaded through
pass_sample, just the scaler configuration itself, and there's no longer
duplication of the params etc.)
In addition, this commit makes scale-down more principled, and turns it
into a scaler in its own right - so there's no longer an ugly separation
between scale and scale-down in the code.
Finally, the radius stuff has been made more proper - filters always
have a radius now (there's no more radius -1), and get a new .resizable
attribute instead for when it's tunable.
User-visible changes:
1. scale-down has been renamed dscale and now has its own set of config
options (dscale-param1, dscale-radius) etc., instead of reusing
scale-param1 (which was arguably a bug).
2. The default radius is no longer fixed at 3, but instead uses that
filter's preferred radius by default. (Scalers with a default radius
other than 3 include sinc, gaussian, box and triangle)
3. scale-radius etc. now goes down to 0.5, rather than 1.0. 0.5 is the
smallest radius that theoretically makes sense, and indeed it's used
by at least one filter (nearest).
Apart from that, it should just be internal changes only.
Note that this sets up for the refactor discussed in #1720, which would
be to merge scaler and window configurations (include parameters etc.)
into a single, simplified string. In the code, this would now basically
just mean getting rid of all the OPT_FLOATRANGE etc. lines related to
scalers and replacing them by a single function that parses a string and
updates the struct scaler_config as appropriate.
2015-03-26 00:55:32 +00:00
|
|
|
};
|
|
|
|
|
2015-09-05 12:03:00 +00:00
|
|
|
struct scaler {
|
|
|
|
int index;
|
|
|
|
struct scaler_config conf;
|
|
|
|
double scale_factor;
|
|
|
|
bool initialized;
|
|
|
|
struct filter_kernel *kernel;
|
2017-07-29 18:15:59 +00:00
|
|
|
struct ra_tex *lut;
|
2017-09-20 08:45:33 +00:00
|
|
|
struct ra_tex *sep_fbo;
|
2015-09-05 12:03:00 +00:00
|
|
|
bool insufficient;
|
|
|
|
|
|
|
|
// kernel points here
|
|
|
|
struct filter_kernel kernel_storage;
|
|
|
|
};
|
|
|
|
|
2016-03-05 08:42:57 +00:00
|
|
|
enum scaler_unit {
|
|
|
|
SCALER_SCALE, // luma/video
|
|
|
|
SCALER_DSCALE, // luma-video downscaling
|
|
|
|
SCALER_CSCALE, // chroma upscaling
|
|
|
|
SCALER_TSCALE, // temporal scaling (interpolation)
|
|
|
|
SCALER_COUNT
|
|
|
|
};
|
|
|
|
|
2016-05-15 22:14:02 +00:00
|
|
|
enum dither_algo {
|
|
|
|
DITHER_NONE = 0,
|
|
|
|
DITHER_FRUIT,
|
|
|
|
DITHER_ORDERED,
|
2019-03-16 11:19:51 +00:00
|
|
|
DITHER_ERROR_DIFFUSION,
|
2016-05-15 22:14:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum alpha_mode {
|
|
|
|
ALPHA_NO = 0,
|
|
|
|
ALPHA_YES,
|
|
|
|
ALPHA_BLEND,
|
|
|
|
ALPHA_BLEND_TILES,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum blend_subs_mode {
|
|
|
|
BLEND_SUBS_NO = 0,
|
|
|
|
BLEND_SUBS_YES,
|
|
|
|
BLEND_SUBS_VIDEO,
|
|
|
|
};
|
|
|
|
|
2016-05-16 00:44:30 +00:00
|
|
|
enum tone_mapping {
|
2022-01-03 02:56:36 +00:00
|
|
|
TONE_MAPPING_AUTO,
|
2016-05-16 00:44:30 +00:00
|
|
|
TONE_MAPPING_CLIP,
|
2017-06-09 07:16:06 +00:00
|
|
|
TONE_MAPPING_MOBIUS,
|
2016-05-30 10:30:23 +00:00
|
|
|
TONE_MAPPING_REINHARD,
|
2016-05-30 10:48:01 +00:00
|
|
|
TONE_MAPPING_HABLE,
|
2016-05-16 00:44:30 +00:00
|
|
|
TONE_MAPPING_GAMMA,
|
|
|
|
TONE_MAPPING_LINEAR,
|
2022-01-03 02:56:36 +00:00
|
|
|
TONE_MAPPING_SPLINE,
|
2020-05-29 19:39:05 +00:00
|
|
|
TONE_MAPPING_BT_2390,
|
2022-01-03 02:56:36 +00:00
|
|
|
TONE_MAPPING_BT_2446A,
|
2023-02-11 17:20:14 +00:00
|
|
|
TONE_MAPPING_ST2094_40,
|
|
|
|
TONE_MAPPING_ST2094_10,
|
2016-05-16 00:44:30 +00:00
|
|
|
};
|
|
|
|
|
2022-01-03 03:31:50 +00:00
|
|
|
enum gamut_mode {
|
|
|
|
GAMUT_AUTO,
|
|
|
|
GAMUT_CLIP,
|
2023-06-19 10:59:51 +00:00
|
|
|
GAMUT_PERCEPTUAL,
|
|
|
|
GAMUT_RELATIVE,
|
|
|
|
GAMUT_SATURATION,
|
|
|
|
GAMUT_ABSOLUTE,
|
2022-01-03 03:31:50 +00:00
|
|
|
GAMUT_DESATURATE,
|
|
|
|
GAMUT_DARKEN,
|
2023-06-19 10:59:51 +00:00
|
|
|
GAMUT_WARN,
|
|
|
|
GAMUT_LINEAR,
|
2022-01-03 03:31:50 +00:00
|
|
|
};
|
|
|
|
|
2018-12-27 17:34:19 +00:00
|
|
|
struct gl_tone_map_opts {
|
|
|
|
int curve;
|
|
|
|
float curve_param;
|
2019-01-02 02:03:38 +00:00
|
|
|
float max_boost;
|
2023-02-20 03:32:50 +00:00
|
|
|
bool inverse;
|
2018-12-27 17:34:19 +00:00
|
|
|
int compute_peak;
|
2019-01-01 06:30:00 +00:00
|
|
|
float decay_rate;
|
2019-01-04 15:46:38 +00:00
|
|
|
float scene_threshold_low;
|
|
|
|
float scene_threshold_high;
|
2023-08-04 14:18:16 +00:00
|
|
|
float peak_percentile;
|
2023-07-17 14:37:36 +00:00
|
|
|
float contrast_recovery;
|
|
|
|
float contrast_smoothness;
|
2022-01-03 03:31:50 +00:00
|
|
|
int gamut_mode;
|
2023-02-20 03:32:50 +00:00
|
|
|
bool visualize;
|
2018-12-27 17:34:19 +00:00
|
|
|
};
|
|
|
|
|
2013-03-01 20:19:20 +00:00
|
|
|
struct gl_video_opts {
|
2015-09-08 20:46:36 +00:00
|
|
|
int dumb_mode;
|
vo_opengl: refactor scaler configuration
This merges all of the scaler-related options into a single
configuration struct, and also cleans up the way they're passed through
the code. (For example, the scaler index is no longer threaded through
pass_sample, just the scaler configuration itself, and there's no longer
duplication of the params etc.)
In addition, this commit makes scale-down more principled, and turns it
into a scaler in its own right - so there's no longer an ugly separation
between scale and scale-down in the code.
Finally, the radius stuff has been made more proper - filters always
have a radius now (there's no more radius -1), and get a new .resizable
attribute instead for when it's tunable.
User-visible changes:
1. scale-down has been renamed dscale and now has its own set of config
options (dscale-param1, dscale-radius) etc., instead of reusing
scale-param1 (which was arguably a bug).
2. The default radius is no longer fixed at 3, but instead uses that
filter's preferred radius by default. (Scalers with a default radius
other than 3 include sinc, gaussian, box and triangle)
3. scale-radius etc. now goes down to 0.5, rather than 1.0. 0.5 is the
smallest radius that theoretically makes sense, and indeed it's used
by at least one filter (nearest).
Apart from that, it should just be internal changes only.
Note that this sets up for the refactor discussed in #1720, which would
be to merge scaler and window configurations (include parameters etc.)
into a single, simplified string. In the code, this would now basically
just mean getting rid of all the OPT_FLOATRANGE etc. lines related to
scalers and replacing them by a single function that parses a string and
updates the struct scaler_config as appropriate.
2015-03-26 00:55:32 +00:00
|
|
|
struct scaler_config scaler[4];
|
vo_opengl: refactor shader generation (part 2)
This adds stuff related to gamma, linear light, sigmoid, BT.2020-CL,
etc, as well as color management. Also adds a new gamma function (gamma22).
This adds new parameters to configure the CMS settings, in particular
letting us target simple colorspaces without requiring usage of a 3DLUT.
This adds smoothmotion. Mostly working, but it's still sensitive to
timing issues. It's based on an actual queue now, but the queue size
is kept small to avoid larger amounts of latency.
Also makes “upscale before blending” the default strategy.
This is justified because the "render after blending" thing doesn't seme
to work consistently any way (introduces stutter due to the way vsync
timing works, or something), so this behavior is a bit closer to master
and makes pausing/unpausing less weird/jumpy.
This adds the remaining scalers, including bicubic_fast, sharpen3,
sharpen5, polar filters and antiringing. Apparently, sharpen3/5 also
consult scale-param1, which was undocumented in master.
This also implements cropping and chroma transformation, plus
rotation/flipping. These are inherently part of the same logic, although
it's a bit rough around the edges in some case, mainly due to the fallback
code paths (for bilinear scaling without indirection).
2015-03-12 21:18:16 +00:00
|
|
|
float gamma;
|
2023-02-20 03:32:50 +00:00
|
|
|
bool gamma_auto;
|
vo_opengl: refactor shader generation (part 2)
This adds stuff related to gamma, linear light, sigmoid, BT.2020-CL,
etc, as well as color management. Also adds a new gamma function (gamma22).
This adds new parameters to configure the CMS settings, in particular
letting us target simple colorspaces without requiring usage of a 3DLUT.
This adds smoothmotion. Mostly working, but it's still sensitive to
timing issues. It's based on an actual queue now, but the queue size
is kept small to avoid larger amounts of latency.
Also makes “upscale before blending” the default strategy.
This is justified because the "render after blending" thing doesn't seme
to work consistently any way (introduces stutter due to the way vsync
timing works, or something), so this behavior is a bit closer to master
and makes pausing/unpausing less weird/jumpy.
This adds the remaining scalers, including bicubic_fast, sharpen3,
sharpen5, polar filters and antiringing. Apparently, sharpen3/5 also
consult scale-param1, which was undocumented in master.
This also implements cropping and chroma transformation, plus
rotation/flipping. These are inherently part of the same logic, although
it's a bit rough around the edges in some case, mainly due to the fallback
code paths (for bilinear scaling without indirection).
2015-03-12 21:18:16 +00:00
|
|
|
int target_prim;
|
|
|
|
int target_trc;
|
2018-02-14 15:10:51 +00:00
|
|
|
int target_peak;
|
2023-06-30 03:46:51 +00:00
|
|
|
int target_contrast;
|
2023-10-31 19:41:19 +00:00
|
|
|
int target_gamut;
|
2018-12-27 17:34:19 +00:00
|
|
|
struct gl_tone_map_opts tone_map;
|
2023-02-20 03:32:50 +00:00
|
|
|
bool correct_downscaling;
|
|
|
|
bool linear_downscaling;
|
|
|
|
bool linear_upscaling;
|
|
|
|
bool sigmoid_upscaling;
|
2015-01-06 09:47:26 +00:00
|
|
|
float sigmoid_center;
|
|
|
|
float sigmoid_slope;
|
2023-02-20 03:32:50 +00:00
|
|
|
bool scaler_resizes_only;
|
|
|
|
bool pbo;
|
2013-03-01 20:19:20 +00:00
|
|
|
int dither_depth;
|
2013-05-25 23:48:39 +00:00
|
|
|
int dither_algo;
|
|
|
|
int dither_size;
|
2023-02-20 03:32:50 +00:00
|
|
|
bool temporal_dither;
|
2015-07-20 17:09:22 +00:00
|
|
|
int temporal_dither_period;
|
2019-03-16 11:19:51 +00:00
|
|
|
char *error_diffusion;
|
2017-08-04 11:48:37 +00:00
|
|
|
char *fbo_format;
|
2013-09-19 14:55:56 +00:00
|
|
|
int alpha_mode;
|
2023-02-20 03:32:50 +00:00
|
|
|
bool use_rectangle;
|
2014-12-09 20:34:01 +00:00
|
|
|
struct m_color background;
|
2023-02-20 03:32:50 +00:00
|
|
|
bool interpolation;
|
2016-01-27 20:07:17 +00:00
|
|
|
float interpolation_threshold;
|
2015-03-23 01:42:19 +00:00
|
|
|
int blend_subs;
|
2016-04-20 23:33:13 +00:00
|
|
|
char **user_shaders;
|
2022-11-03 15:16:59 +00:00
|
|
|
char **user_shader_opts;
|
2023-02-20 03:32:50 +00:00
|
|
|
bool deband;
|
2015-09-05 15:39:27 +00:00
|
|
|
struct deband_opts *deband_opts;
|
2015-09-23 20:43:27 +00:00
|
|
|
float unsharp;
|
2016-10-01 10:01:57 +00:00
|
|
|
int tex_pad_x, tex_pad_y;
|
2016-06-03 18:35:17 +00:00
|
|
|
struct mp_icc_opts *icc_opts;
|
2023-05-03 00:42:23 +00:00
|
|
|
bool shader_cache;
|
2016-10-05 10:18:44 +00:00
|
|
|
int early_flush;
|
2017-04-08 14:38:56 +00:00
|
|
|
char *shader_cache_dir;
|
vo_gpu: make it possible to load multiple hwdec interop drivers
Make the VO<->decoder interface capable of supporting multiple hwdec
APIs at once. The main gain is that this simplifies autoprobing a lot.
Before this change, it could happen that the VO loaded the "wrong" hwdec
API, and the decoder was stuck with the choice (breaking hw decoding).
With the change applied, the VO simply loads all available APIs, so
autoprobing trickery is left entirely to the decoder.
In the past, we were quite careful about not accidentally loading the
wrong interop drivers. This was in part to make sure autoprobing works,
but also because libva had this obnoxious bug of dumping garbage to
stderr when using the API. libva was fixed, so this is not a problem
anymore.
The --opengl-hwdec-interop option is changed in various ways (again...),
and renamed to --gpu-hwdec-interop. It does not have much use anymore,
other than debugging. It's notable that the order in the hwdec interop
array ra_hwdec_drivers[] still matters if multiple drivers support the
same image formats, so the option can explicitly force one, if that
should ever be necessary, or more likely, for debugging. One example are
the ra_hwdec_d3d11egl and ra_hwdec_d3d11eglrgb drivers, which both
support d3d11 input.
vo_gpu now always loads the interop lazily by default, but when it does,
it loads them all. vo_opengl_cb now always loads them when the GL
context handle is initialized. I don't expect that this causes any
problems.
It's now possible to do things like changing between vdpau and nvdec
decoding at runtime.
This is also preparation for cleaning up vd_lavc.c hwdec autoprobing.
It's another reason why hwdec_devices_request_all() does not take a
hwdec type anymore.
2017-12-01 04:05:00 +00:00
|
|
|
char *hwdec_interop;
|
2013-03-01 20:19:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct m_sub_options gl_video_conf;
|
|
|
|
|
|
|
|
struct gl_video;
|
2015-07-01 17:24:28 +00:00
|
|
|
struct vo_frame;
|
2018-02-07 19:18:36 +00:00
|
|
|
struct voctrl_screenshot;
|
2013-03-01 20:19:20 +00:00
|
|
|
|
2018-02-08 00:55:31 +00:00
|
|
|
enum {
|
|
|
|
RENDER_FRAME_SUBS = 1 << 0,
|
2019-11-30 17:09:31 +00:00
|
|
|
RENDER_FRAME_OSD = 1 << 1,
|
|
|
|
RENDER_FRAME_VF_SUBS = 1 << 2,
|
2023-11-06 13:01:15 +00:00
|
|
|
RENDER_SCREEN_COLOR = 1 << 3, // 3D LUT and dithering
|
|
|
|
RENDER_FRAME_DEF = RENDER_FRAME_SUBS | RENDER_FRAME_OSD | RENDER_SCREEN_COLOR,
|
2018-02-08 00:55:31 +00:00
|
|
|
};
|
|
|
|
|
2017-08-07 17:14:18 +00:00
|
|
|
struct gl_video *gl_video_init(struct ra *ra, struct mp_log *log,
|
|
|
|
struct mpv_global *g);
|
2013-03-01 20:19:20 +00:00
|
|
|
void gl_video_uninit(struct gl_video *p);
|
2015-03-23 15:32:59 +00:00
|
|
|
void gl_video_set_osd_source(struct gl_video *p, struct osd_state *osd);
|
2013-11-03 23:00:18 +00:00
|
|
|
bool gl_video_check_format(struct gl_video *p, int mp_format);
|
2013-06-07 23:35:44 +00:00
|
|
|
void gl_video_config(struct gl_video *p, struct mp_image_params *params);
|
2017-08-07 17:14:18 +00:00
|
|
|
void gl_video_render_frame(struct gl_video *p, struct vo_frame *frame,
|
2023-11-23 23:56:46 +00:00
|
|
|
const struct ra_fbo *fbo, int flags);
|
2017-08-07 17:14:18 +00:00
|
|
|
void gl_video_resize(struct gl_video *p,
|
2013-03-01 20:19:20 +00:00
|
|
|
struct mp_rect *src, struct mp_rect *dst,
|
vo_opengl: refactor shader generation (part 1)
The basic idea is to use dynamically generated shaders instead of a
single monolithic file + a ton of ifdefs. Instead of having to setup
every aspect of it separately (like compiling shaders, setting uniforms,
perfoming the actual rendering steps, the GLSL parts), we generate the
GLSL on the fly, and perform the rendering at the same time. The GLSL
is regenerated every frame, but the actual compiled OpenGL-level shaders
are cached, which makes it fast again. Almost all logic can be in a
single place.
The new code is significantly more flexible, which allows us to improve
the code clarity, performance and add more features easily.
This commit is incomplete. It drops almost all previous code, and
readds only the most important things (some of them actually buggy).
The next commit will complete it - it's separate to preserve authorship
information.
2015-03-12 20:57:54 +00:00
|
|
|
struct mp_osd_res *osd);
|
2017-08-07 17:14:18 +00:00
|
|
|
void gl_video_set_fb_depth(struct gl_video *p, int fb_depth);
|
vo_opengl: refactor vo performance subsystem
This replaces `vo-performance` by `vo-passes`, bringing with it a number
of changes and improvements:
1. mpv users can now introspect the vo_opengl passes, which is something
that has been requested multiple times.
2. performance data is now measured per-pass, which helps both
development and debugging.
3. since adding more passes is cheap, we can now report information for
more passes (e.g. the blit pass, and the osd pass). Note: we also
switch to nanosecond scale, to be able to measure these passes
better.
4. `--user-shaders` authors can now describe their own passes, helping
users both identify which user shaders are active at any given time
as well as helping shader authors identify performance issues.
5. the timing data per pass is now exported as a full list of samples,
so projects like Argon-/mpv-stats can immediately read out all of the
samples and render a graph without having to manually poll this
option constantly.
Due to gl_timer's design being complicated (directly reading performance
data would block, so we delay the actual read-back until the next _start
command), it's vital not to conflate different passes that might be
doing different things from one frame to another. To accomplish this,
the actual timers are stored as part of the gl_shader_cache's sc_entry,
which makes them unique for that exact shader.
Starting and stopping the time measurement is easy to unify with the
gl_sc architecture, because the existing API already relies on a
"generate, render, reset" flow, so we can just put timer_start and
timer_stop in sc_generate and sc_reset, respectively.
The ugliest thing about this code is that due to the need to keep pass
information relatively stable in between frames, we need to distinguish
between "new" and "redrawn" frames, which bloats the code somewhat and
also feels hacky and vo_opengl-specific. (But then again, this entire
thing is vo_opengl-specific)
2017-06-29 15:00:06 +00:00
|
|
|
void gl_video_perfdata(struct gl_video *p, struct voctrl_performance_data *out);
|
2017-08-11 11:02:13 +00:00
|
|
|
void gl_video_set_clear_color(struct gl_video *p, struct m_color color);
|
2017-08-15 17:12:39 +00:00
|
|
|
void gl_video_set_osd_pts(struct gl_video *p, double pts);
|
2017-08-11 11:02:13 +00:00
|
|
|
bool gl_video_check_osd_change(struct gl_video *p, struct mp_osd_res *osd,
|
|
|
|
double pts);
|
2013-03-01 20:19:20 +00:00
|
|
|
|
2018-02-07 19:18:36 +00:00
|
|
|
void gl_video_screenshot(struct gl_video *p, struct vo_frame *frame,
|
|
|
|
struct voctrl_screenshot *args);
|
|
|
|
|
2015-02-07 12:54:18 +00:00
|
|
|
float gl_video_scale_ambient_lux(float lmin, float lmax,
|
|
|
|
float rmin, float rmax, float lux);
|
|
|
|
void gl_video_set_ambient_lux(struct gl_video *p, int lux);
|
2016-06-03 18:35:17 +00:00
|
|
|
void gl_video_set_icc_profile(struct gl_video *p, bstr icc_data);
|
|
|
|
bool gl_video_icc_auto_enabled(struct gl_video *p);
|
2016-09-02 12:50:03 +00:00
|
|
|
bool gl_video_gamma_auto_enabled(struct gl_video *p);
|
2015-02-07 12:54:18 +00:00
|
|
|
|
2014-11-23 19:06:05 +00:00
|
|
|
void gl_video_reset(struct gl_video *p);
|
2015-02-04 22:37:38 +00:00
|
|
|
bool gl_video_showing_interpolated_frame(struct gl_video *p);
|
2014-12-09 16:47:02 +00:00
|
|
|
|
vo_gpu: make it possible to load multiple hwdec interop drivers
Make the VO<->decoder interface capable of supporting multiple hwdec
APIs at once. The main gain is that this simplifies autoprobing a lot.
Before this change, it could happen that the VO loaded the "wrong" hwdec
API, and the decoder was stuck with the choice (breaking hw decoding).
With the change applied, the VO simply loads all available APIs, so
autoprobing trickery is left entirely to the decoder.
In the past, we were quite careful about not accidentally loading the
wrong interop drivers. This was in part to make sure autoprobing works,
but also because libva had this obnoxious bug of dumping garbage to
stderr when using the API. libva was fixed, so this is not a problem
anymore.
The --opengl-hwdec-interop option is changed in various ways (again...),
and renamed to --gpu-hwdec-interop. It does not have much use anymore,
other than debugging. It's notable that the order in the hwdec interop
array ra_hwdec_drivers[] still matters if multiple drivers support the
same image formats, so the option can explicitly force one, if that
should ever be necessary, or more likely, for debugging. One example are
the ra_hwdec_d3d11egl and ra_hwdec_d3d11eglrgb drivers, which both
support d3d11 input.
vo_gpu now always loads the interop lazily by default, but when it does,
it loads them all. vo_opengl_cb now always loads them when the GL
context handle is initialized. I don't expect that this causes any
problems.
It's now possible to do things like changing between vdpau and nvdec
decoding at runtime.
This is also preparation for cleaning up vd_lavc.c hwdec autoprobing.
It's another reason why hwdec_devices_request_all() does not take a
hwdec type anymore.
2017-12-01 04:05:00 +00:00
|
|
|
struct mp_hwdec_devices;
|
2022-03-12 18:54:23 +00:00
|
|
|
void gl_video_init_hwdecs(struct gl_video *p, struct ra_ctx *ra_ctx,
|
|
|
|
struct mp_hwdec_devices *devs,
|
vo_gpu: make it possible to load multiple hwdec interop drivers
Make the VO<->decoder interface capable of supporting multiple hwdec
APIs at once. The main gain is that this simplifies autoprobing a lot.
Before this change, it could happen that the VO loaded the "wrong" hwdec
API, and the decoder was stuck with the choice (breaking hw decoding).
With the change applied, the VO simply loads all available APIs, so
autoprobing trickery is left entirely to the decoder.
In the past, we were quite careful about not accidentally loading the
wrong interop drivers. This was in part to make sure autoprobing works,
but also because libva had this obnoxious bug of dumping garbage to
stderr when using the API. libva was fixed, so this is not a problem
anymore.
The --opengl-hwdec-interop option is changed in various ways (again...),
and renamed to --gpu-hwdec-interop. It does not have much use anymore,
other than debugging. It's notable that the order in the hwdec interop
array ra_hwdec_drivers[] still matters if multiple drivers support the
same image formats, so the option can explicitly force one, if that
should ever be necessary, or more likely, for debugging. One example are
the ra_hwdec_d3d11egl and ra_hwdec_d3d11eglrgb drivers, which both
support d3d11 input.
vo_gpu now always loads the interop lazily by default, but when it does,
it loads them all. vo_opengl_cb now always loads them when the GL
context handle is initialized. I don't expect that this causes any
problems.
It's now possible to do things like changing between vdpau and nvdec
decoding at runtime.
This is also preparation for cleaning up vd_lavc.c hwdec autoprobing.
It's another reason why hwdec_devices_request_all() does not take a
hwdec type anymore.
2017-12-01 04:05:00 +00:00
|
|
|
bool load_all_by_default);
|
2022-03-20 19:31:38 +00:00
|
|
|
struct hwdec_imgfmt_request;
|
vo_gpu: hwdec: load hwdec interops on-demand by default
Historically, we have treated hwdec interop loading as a completely
separate step from loading the hwdecs themselves. Some hwdecs need an
interop, and some don't, and users generally configure the exact
hwdec they want, so interops that aren't relevant for that hwdec
shouldn't be loaded to save time and avoid warning/error spam.
The basic approach here is to recognise that interops are tied to
hwdecs by imgfmt. The hwdec outputs some format, and an interop is
needed to get that format to the vo without read back.
So, when we try to load an hwdec, instead of just blindly loading all
interops as we do today, let's pass the imgfmt in and only load
interops that work for that format. If more than one interop is
available for the format, the existing logic (whatever it is) will
continue to be used to pick one.
We also have one callsite in filters where we seem to pre-emptively
load all the interops. It's probably possible to trace down a specific
format but for now I'm just letting it keep loading all of them; it's
no worse than before.
You may notice there is no documentation update - and that's because
the current docs say that when the interop mode is `auto`, the interop
is loaded on demand. So reality now reflects the docs. How nice.
2022-02-06 22:18:59 +00:00
|
|
|
void gl_video_load_hwdecs_for_img_fmt(struct gl_video *p, struct mp_hwdec_devices *devs,
|
2022-03-20 19:31:38 +00:00
|
|
|
struct hwdec_imgfmt_request *params);
|
2013-03-01 20:19:20 +00:00
|
|
|
|
2015-07-16 20:43:40 +00:00
|
|
|
struct vo;
|
|
|
|
void gl_video_configure_queue(struct gl_video *p, struct vo *vo);
|
|
|
|
|
2017-08-14 17:57:44 +00:00
|
|
|
struct mp_image *gl_video_get_image(struct gl_video *p, int imgfmt, int w, int h,
|
2023-01-21 14:21:49 +00:00
|
|
|
int stride_align, int flags);
|
2017-08-14 17:57:44 +00:00
|
|
|
|
2017-07-23 07:41:51 +00:00
|
|
|
|
2013-03-01 20:19:20 +00:00
|
|
|
#endif
|