Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
angle
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
angle
Commits
84f505db
Commit
84f505db
authored
Nov 09, 2015
by
Corentin Wallez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "GLX backend: fallback to lesser swap_control extensions"
This reverts commit
26e3736f
.
parent
0e39f492
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
157 deletions
+38
-157
DisplayGLX.cpp
src/libANGLE/renderer/gl/glx/DisplayGLX.cpp
+13
-84
DisplayGLX.h
src/libANGLE/renderer/gl/glx/DisplayGLX.h
+0
-32
FunctionsGLX.cpp
src/libANGLE/renderer/gl/glx/FunctionsGLX.cpp
+7
-25
FunctionsGLX.h
src/libANGLE/renderer/gl/glx/FunctionsGLX.h
+0
-6
WindowSurfaceGLX.cpp
src/libANGLE/renderer/gl/glx/WindowSurfaceGLX.cpp
+16
-6
WindowSurfaceGLX.h
src/libANGLE/renderer/gl/glx/WindowSurfaceGLX.h
+2
-4
No files found.
src/libANGLE/renderer/gl/glx/DisplayGLX.cpp
View file @
84f505db
...
...
@@ -26,13 +26,6 @@ static int IgnoreX11Errors(Display *, XErrorEvent *)
return
0
;
}
SwapControlData
::
SwapControlData
()
:
targetSwapInterval
(
0
),
maxSwapInterval
(
-
1
),
currentSwapInterval
(
-
1
)
{
}
class
FunctionsGLGLX
:
public
FunctionsGL
{
public
:
...
...
@@ -62,10 +55,6 @@ DisplayGLX::DisplayGLX()
mDummyPbuffer
(
0
),
mUsesNewXDisplay
(
false
),
mIsMesa
(
false
),
mSwapControl
(
SwapControl
::
Absent
),
mMinSwapInterval
(
0
),
mMaxSwapInterval
(
0
),
mCurrentSwapInterval
(
-
1
),
mEGLDisplay
(
nullptr
)
{
}
...
...
@@ -113,40 +102,6 @@ egl::Error DisplayGLX::initialize(egl::Display *display)
}
}
// Choose the swap_control extension to use, if any.
// The EXT version is better as it allows glXSwapInterval to be called per
// window, while we'll potentially need to change the swap interval on each
// swap buffers when using the SGI or MESA versions.
if
(
mGLX
.
hasExtension
(
"GLX_EXT_swap_control"
))
{
mSwapControl
=
SwapControl
::
EXT
;
// In GLX_EXT_swap_control querying these is done on a GLXWindow so we just
// set default values.
mMinSwapInterval
=
0
;
mMaxSwapInterval
=
4
;
}
else
if
(
mGLX
.
hasExtension
(
"GLX_MESA_swap_control"
))
{
// If we have the Mesa or SGI extension, assume that you can at least set
// a swap interval of 0 or 1.
mSwapControl
=
SwapControl
::
Mesa
;
mMinSwapInterval
=
0
;
mMinSwapInterval
=
1
;
}
else
if
(
mGLX
.
hasExtension
(
"GLX_SGI_swap_control"
))
{
mSwapControl
=
SwapControl
::
SGI
;
mMinSwapInterval
=
0
;
mMinSwapInterval
=
1
;
}
else
{
mSwapControl
=
SwapControl
::
Absent
;
mMinSwapInterval
=
1
;
mMinSwapInterval
=
1
;
}
// When glXMakeCurrent is called, the context and the surface must be
// compatible which in glX-speak means that their config have the same
// color buffer type, are both RGBA or ColorIndex, and their buffers have
...
...
@@ -383,6 +338,8 @@ egl::ConfigSet DisplayGLX::generateConfigs() const
egl
::
ConfigSet
configs
;
configIdToGLXConfig
.
clear
();
bool
hasSwapControl
=
mGLX
.
hasExtension
(
"GLX_EXT_swap_control"
);
int
contextRedSize
=
getGLXFBConfigAttrib
(
mContextConfig
,
GLX_RED_SIZE
);
int
contextGreenSize
=
getGLXFBConfigAttrib
(
mContextConfig
,
GLX_GREEN_SIZE
);
int
contextBlueSize
=
getGLXFBConfigAttrib
(
mContextConfig
,
GLX_BLUE_SIZE
);
...
...
@@ -517,9 +474,17 @@ egl::ConfigSet DisplayGLX::generateConfigs() const
(
glxDrawable
&
GLX_PBUFFER_BIT
?
EGL_PBUFFER_BIT
:
0
)
|
(
glxDrawable
&
GLX_PIXMAP_BIT
?
EGL_PIXMAP_BIT
:
0
);
config
.
minSwapInterval
=
mMinSwapInterval
;
config
.
maxSwapInterval
=
mMaxSwapInterval
;
if
(
hasSwapControl
)
{
// In GLX_EXT_swap_control querying these is done on a GLXWindow so we just set a default value.
config
.
minSwapInterval
=
0
;
config
.
maxSwapInterval
=
4
;
}
else
{
config
.
minSwapInterval
=
1
;
config
.
maxSwapInterval
=
1
;
}
// TODO(cwallez) wildly guessing these formats, another TODO says they should be removed anyway
config
.
renderTargetFormat
=
GL_RGBA8
;
config
.
depthStencilFormat
=
GL_DEPTH24_STENCIL8
;
...
...
@@ -592,42 +557,6 @@ void DisplayGLX::syncXCommands() const
}
}
void
DisplayGLX
::
setSwapInterval
(
glx
::
Drawable
drawable
,
SwapControlData
*
data
)
{
// TODO(cwallez) error checking?
if
(
mSwapControl
==
SwapControl
::
EXT
)
{
// Prefer the EXT extension, it gives per-drawable swap intervals, which will
// minimize the number of driver calls.
if
(
data
->
maxSwapInterval
<
0
)
{
unsigned
int
maxSwapInterval
=
0
;
mGLX
.
queryDrawable
(
drawable
,
GLX_MAX_SWAP_INTERVAL_EXT
,
&
maxSwapInterval
);
data
->
maxSwapInterval
=
maxSwapInterval
;
}
if
(
data
->
currentSwapInterval
!=
data
->
targetSwapInterval
)
{
const
int
realInterval
=
std
::
min
(
data
->
targetSwapInterval
,
data
->
maxSwapInterval
);
mGLX
.
swapIntervalEXT
(
drawable
,
realInterval
);
data
->
currentSwapInterval
=
data
->
targetSwapInterval
;
}
}
else
if
(
mCurrentSwapInterval
!=
data
->
targetSwapInterval
)
{
// With the Mesa or SGI extensions we can still do per-drawable swap control
// manually but it is more expensive in number of driver calls.
if
(
mSwapControl
==
SwapControl
::
Mesa
)
{
mGLX
.
swapIntervalMESA
(
data
->
targetSwapInterval
);
}
else
if
(
mSwapControl
==
SwapControl
::
Mesa
)
{
mGLX
.
swapIntervalSGI
(
data
->
targetSwapInterval
);
}
mCurrentSwapInterval
=
data
->
targetSwapInterval
;
}
}
const
FunctionsGL
*
DisplayGLX
::
getFunctionsGL
()
const
{
return
mFunctionsGL
;
...
...
src/libANGLE/renderer/gl/glx/DisplayGLX.h
View file @
84f505db
...
...
@@ -20,20 +20,6 @@ namespace rx
class
FunctionsGLX
;
// State-tracking data for the swap control to allow DisplayGLX to remember per
// drawable information for swap control.
struct
SwapControlData
{
SwapControlData
();
// Set by the drawable
int
targetSwapInterval
;
// DisplayGLX-side state-tracking
int
maxSwapInterval
;
int
currentSwapInterval
;
};
class
DisplayGLX
:
public
DisplayGL
{
public
:
...
...
@@ -73,12 +59,6 @@ class DisplayGLX : public DisplayGL
// between the application's display and ANGLE's one.
void
syncXCommands
()
const
;
// Depending on the supported GLX extension, swap interval can be set
// globally or per drawable. This function will make sure the drawable's
// swap interval is the one required so that the subsequent swapBuffers
// acts as expected.
void
setSwapInterval
(
glx
::
Drawable
drawable
,
SwapControlData
*
data
);
private
:
const
FunctionsGL
*
getFunctionsGL
()
const
override
;
...
...
@@ -103,18 +83,6 @@ class DisplayGLX : public DisplayGL
bool
mUsesNewXDisplay
;
bool
mIsMesa
;
enum
class
SwapControl
{
Absent
,
EXT
,
Mesa
,
SGI
,
};
SwapControl
mSwapControl
;
int
mMinSwapInterval
;
int
mMaxSwapInterval
;
int
mCurrentSwapInterval
;
FunctionsGLX
mGLX
;
egl
::
Display
*
mEGLDisplay
;
};
...
...
src/libANGLE/renderer/gl/glx/FunctionsGLX.cpp
View file @
84f505db
...
...
@@ -55,9 +55,7 @@ struct FunctionsGLX::GLXFunctionTable
destroyPbufferPtr
(
nullptr
),
queryDrawablePtr
(
nullptr
),
createContextAttribsARBPtr
(
nullptr
),
swapIntervalEXTPtr
(
nullptr
),
swapIntervalMESAPtr
(
nullptr
),
swapIntervalSGIPtr
(
nullptr
)
swapIntervalEXTPtr
(
nullptr
)
{
}
...
...
@@ -91,12 +89,6 @@ struct FunctionsGLX::GLXFunctionTable
// GLX_EXT_swap_control
PFNGLXSWAPINTERVALEXTPROC
swapIntervalEXTPtr
;
// GLX_MESA_swap_control
PFNGLXSWAPINTERVALMESAPROC
swapIntervalMESAPtr
;
// GLX_SGI_swap_control
PFNGLXSWAPINTERVALSGIPROC
swapIntervalSGIPtr
;
};
FunctionsGLX
::
FunctionsGLX
()
...
...
@@ -221,17 +213,17 @@ bool FunctionsGLX::initialize(Display *xDisplay, int screen, std::string *errorS
{
GET_PROC_OR_ERROR
(
&
mFnPtrs
->
createContextAttribsARBPtr
,
glXCreateContextAttribsARB
);
}
if
(
hasExtension
(
"GLX_EXT_swap_control"
))
else
{
GET_PROC_OR_ERROR
(
&
mFnPtrs
->
swapIntervalEXTPtr
,
glXSwapIntervalEXT
)
;
mFnPtrs
->
createContextAttribsARBPtr
=
nullptr
;
}
if
(
hasExtension
(
"GLX_
MESA
_swap_control"
))
if
(
hasExtension
(
"GLX_
EXT
_swap_control"
))
{
GET_PROC_OR_ERROR
(
&
mFnPtrs
->
swapInterval
MESAPtr
,
glXSwapIntervalMESA
);
GET_PROC_OR_ERROR
(
&
mFnPtrs
->
swapInterval
EXTPtr
,
glXSwapIntervalEXT
);
}
if
(
hasExtension
(
"GLX_SGI_swap_control"
))
else
{
GET_PROC_OR_ERROR
(
&
mFnPtrs
->
swapIntervalSGIPtr
,
glXSwapIntervalSGI
)
;
mFnPtrs
->
swapIntervalEXTPtr
=
nullptr
;
}
#undef GET_FNPTR_OR_ERROR
...
...
@@ -368,14 +360,4 @@ void FunctionsGLX::swapIntervalEXT(glx::Drawable drawable, int intervals) const
mFnPtrs
->
swapIntervalEXTPtr
(
mXDisplay
,
drawable
,
intervals
);
}
int
FunctionsGLX
::
swapIntervalMESA
(
int
intervals
)
const
{
return
mFnPtrs
->
swapIntervalMESAPtr
(
intervals
);
}
int
FunctionsGLX
::
swapIntervalSGI
(
int
intervals
)
const
{
return
mFnPtrs
->
swapIntervalSGIPtr
(
intervals
);
}
}
src/libANGLE/renderer/gl/glx/FunctionsGLX.h
View file @
84f505db
...
...
@@ -67,12 +67,6 @@ class FunctionsGLX
// GLX_EXT_swap_control
void
swapIntervalEXT
(
glx
::
Drawable
drawable
,
int
interval
)
const
;
// GLX_MESA_swap_control
int
swapIntervalMESA
(
int
interval
)
const
;
// GLX_SGI_swap_control
int
swapIntervalSGI
(
int
interval
)
const
;
private
:
// So as to isolate GLX from angle we do not include angleutils.h and cannot
// use angle::NonCopyable so we replicated it here instead.
...
...
src/libANGLE/renderer/gl/glx/WindowSurfaceGLX.cpp
View file @
84f505db
...
...
@@ -28,10 +28,11 @@ WindowSurfaceGLX::WindowSurfaceGLX(const FunctionsGLX &glx,
mWindow
(
0
),
mDisplay
(
display
),
mGLX
(
glx
),
mGLXDisplay
(
glxDisplay
),
mGLXDisplay
(
*
glxDisplay
),
mContext
(
context
),
mFBConfig
(
fbConfig
),
mGLXWindow
(
0
)
mGLXWindow
(
0
),
mMaxSwapInterval
(
1
)
{
}
...
...
@@ -47,7 +48,7 @@ WindowSurfaceGLX::~WindowSurfaceGLX()
XDestroyWindow
(
mDisplay
,
mWindow
);
}
mGLXDisplay
->
syncXCommands
();
mGLXDisplay
.
syncXCommands
();
}
egl
::
Error
WindowSurfaceGLX
::
initialize
()
...
...
@@ -94,13 +95,18 @@ egl::Error WindowSurfaceGLX::initialize()
0
,
visualInfo
->
depth
,
InputOutput
,
visual
,
attributeMask
,
&
attributes
);
mGLXWindow
=
mGLX
.
createWindow
(
mFBConfig
,
mWindow
,
nullptr
);
if
(
mGLX
.
hasExtension
(
"GLX_EXT_swap_control"
))
{
mGLX
.
queryDrawable
(
mGLXWindow
,
GLX_MAX_SWAP_INTERVAL_EXT
,
&
mMaxSwapInterval
);
}
XMapWindow
(
mDisplay
,
mWindow
);
XFlush
(
mDisplay
);
XFree
(
visualInfo
);
XFreeColormap
(
mDisplay
,
colormap
);
mGLXDisplay
->
syncXCommands
();
mGLXDisplay
.
syncXCommands
();
return
egl
::
Error
(
EGL_SUCCESS
);
}
...
...
@@ -134,7 +140,6 @@ egl::Error WindowSurfaceGLX::swap()
mGLX
.
waitX
();
}
mGLXDisplay
->
setSwapInterval
(
mGLXWindow
,
&
mSwapControl
);
mGLX
.
swapBuffers
(
mGLXWindow
);
return
egl
::
Error
(
EGL_SUCCESS
);
...
...
@@ -166,7 +171,12 @@ egl::Error WindowSurfaceGLX::releaseTexImage(EGLint buffer)
void
WindowSurfaceGLX
::
setSwapInterval
(
EGLint
interval
)
{
mSwapControl
.
targetSwapInterval
=
interval
;
if
(
mGLX
.
hasExtension
(
"GLX_EXT_swap_control"
))
{
// TODO(cwallez) error checking?
const
int
realInterval
=
std
::
min
(
interval
,
static_cast
<
int
>
(
mMaxSwapInterval
));
mGLX
.
swapIntervalEXT
(
mGLXWindow
,
realInterval
);
}
}
EGLint
WindowSurfaceGLX
::
getWidth
()
const
...
...
src/libANGLE/renderer/gl/glx/WindowSurfaceGLX.h
View file @
84f505db
...
...
@@ -10,7 +10,6 @@
#define LIBANGLE_RENDERER_GL_GLX_WINDOWSURFACEGLX_H_
#include "libANGLE/renderer/gl/SurfaceGL.h"
#include "libANGLE/renderer/gl/glx/DisplayGLX.h"
#include "libANGLE/renderer/gl/glx/platform_glx.h"
namespace
rx
...
...
@@ -56,13 +55,12 @@ class WindowSurfaceGLX : public SurfaceGL
Display
*
mDisplay
;
const
FunctionsGLX
&
mGLX
;
DisplayGLX
*
mGLXDisplay
;
const
DisplayGLX
&
mGLXDisplay
;
glx
::
Context
mContext
;
glx
::
FBConfig
mFBConfig
;
glx
::
Window
mGLXWindow
;
SwapControlData
mSwapControl
;
unsigned
int
mMaxSwapInterval
;
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment