mirror of
https://github.com/mpv-player/mpv
synced 2025-03-02 12:20:57 +00:00
automatic vsync enabling for vo_gl.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16269 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
872024d3fe
commit
0a19444796
@ -2678,10 +2678,14 @@ Please use \-dr if it works with your OpenGL implementation,
|
||||
since for higher resolutions this provides a
|
||||
.B big
|
||||
speedup.
|
||||
The code is doing very little checks, so if a feature does not work, this
|
||||
might be because it is not supported by your card/OpenGL implementation
|
||||
even if you do not get any error message.
|
||||
Use glxinfo or a similar tool to display the supported OpenGL extensions.
|
||||
.PD 0
|
||||
.RSs
|
||||
.IPs (no)manyfmts
|
||||
Enables support for more (RGB and BGR) color formats.
|
||||
Enables support for more (RGB and BGR) color formats (default: enabled).
|
||||
Needs OpenGL version >= 1.2.
|
||||
.IPs slice-height=<0\-...>
|
||||
Number of lines copied to texture in one piece (default: 4).
|
||||
@ -2700,7 +2704,8 @@ borders in fullscreen mode.
|
||||
Enable or disable aspect scaling and pan-and-scan support (default: enabled).
|
||||
Disabling might increase speed.
|
||||
.IPs rectangle=<0,1,2>
|
||||
Select usage of rectangular textures (saves video RAM, but often slower).
|
||||
Select usage of rectangular textures which saves video RAM, but often is
|
||||
slower (default: 0).
|
||||
.RSss
|
||||
0: Use power-of-two textures (default).
|
||||
.br
|
||||
@ -2710,6 +2715,12 @@ Select usage of rectangular textures (saves video RAM, but often slower).
|
||||
.IPs (no)glfinish
|
||||
Call glFinish() before swapping buffers.
|
||||
Slower but in some cases more correct output (default: disabled).
|
||||
.IPs swapinterval=<n>
|
||||
Minimum interval in displayed frames between to buffer swaps (default: 1).
|
||||
1 is equivalent to enable VSYNC, 0 to disable VSYNC.
|
||||
This will limit the framerate to (horizontal refresh rate / n).
|
||||
Requires GLX_SGI_swap_control support to work.
|
||||
With some (most/all?) implementations this only works in fullscreen mode.
|
||||
.REss
|
||||
.RE
|
||||
.PD 1
|
||||
|
@ -22,6 +22,7 @@ void (APIENTRY *BindProgram)(GLenum, GLuint);
|
||||
void (APIENTRY *ProgramString)(GLenum, GLenum, GLsizei, const GLvoid *);
|
||||
void (APIENTRY *ProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat,
|
||||
GLfloat, GLfloat);
|
||||
int (*SwapInterval)(int);
|
||||
|
||||
/**
|
||||
* \brief adjusts the GL_UNPACK_ALGNMENT to fit the stride.
|
||||
@ -259,6 +260,17 @@ static void getFunctions() {
|
||||
ProgramEnvParameter4f = getProcAddress("glProgramEnvParameter4fARB");
|
||||
if (!ProgramEnvParameter4f)
|
||||
ProgramEnvParameter4f = getProcAddress("glProgramEnvParameter4fNV");
|
||||
SwapInterval = getProcAddress("glXSwapInterval");
|
||||
if (!SwapInterval)
|
||||
SwapInterval = getProcAddress("glXSwapIntervalEXT");
|
||||
if (!SwapInterval)
|
||||
SwapInterval = getProcAddress("glXSwapIntervalSGI");
|
||||
if (!SwapInterval)
|
||||
SwapInterval = getProcAddress("wglSwapInterval");
|
||||
if (!SwapInterval)
|
||||
SwapInterval = getProcAddress("wglSwapIntervalEXT");
|
||||
if (!SwapInterval)
|
||||
SwapInterval = getProcAddress("wglSwapIntervalSGI");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,5 +108,6 @@ extern void (APIENTRY *BindProgram)(GLenum, GLuint);
|
||||
extern void (APIENTRY *ProgramString)(GLenum, GLenum, GLsizei, const GLvoid *);
|
||||
extern void (APIENTRY *ProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat,
|
||||
GLfloat, GLfloat);
|
||||
extern int (*SwapInterval)(int);
|
||||
|
||||
#endif
|
||||
|
@ -62,6 +62,7 @@ static uint32_t image_width;
|
||||
static uint32_t image_height;
|
||||
static int many_fmts;
|
||||
static int use_glFinish;
|
||||
static int swap_interval;
|
||||
static GLenum gl_target;
|
||||
static GLenum gl_texfmt;
|
||||
static GLenum gl_format;
|
||||
@ -149,6 +150,8 @@ static int initGl(uint32_t d_width, uint32_t d_height) {
|
||||
|
||||
glClearColor( 0.0f,0.0f,0.0f,0.0f );
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
if (SwapInterval)
|
||||
SwapInterval(swap_interval);
|
||||
gl_buffer = 0;
|
||||
gl_buffersize = 0;
|
||||
err_shown = 0;
|
||||
@ -519,6 +522,7 @@ static opt_t subopts[] = {
|
||||
{"slice-height", OPT_ARG_INT, &slice_height, (opt_test_f)int_non_neg},
|
||||
{"rectangle", OPT_ARG_INT, &use_rectangle,(opt_test_f)int_non_neg},
|
||||
{"glfinish", OPT_ARG_BOOL, &use_glFinish, NULL},
|
||||
{"swapinterval", OPT_ARG_INT, &swap_interval,NULL},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@ -531,6 +535,7 @@ static int preinit(const char *arg)
|
||||
use_aspect = 1;
|
||||
use_rectangle = 0;
|
||||
use_glFinish = 0;
|
||||
swap_interval = 1;
|
||||
slice_height = 4;
|
||||
if (subopt_parse(arg, subopts) != 0) {
|
||||
mp_msg(MSGT_VO, MSGL_FATAL,
|
||||
@ -551,6 +556,10 @@ static int preinit(const char *arg)
|
||||
" 2: use texture_non_power_of_two\n"
|
||||
" glfinish\n"
|
||||
" Call glFinish() before swapping buffers\n"
|
||||
" swapinterval=<n>\n"
|
||||
" Interval in displayed frames between to buffer swaps.\n"
|
||||
" 1 is equivalent to enable VSYNC, 0 to disable VSYNC.\n"
|
||||
" Requires GLX_SGI_swap_control support to work.\n"
|
||||
"\n" );
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user