Bug 1197954 - Add support for GLX_SGI_video_sync to GLContextProviderGLX. r=jgilbert

MozReview-Commit-ID: Fn9jwecuz5q
This commit is contained in:
Andrew Comminos 2016-03-01 19:01:00 -08:00
Родитель 08e70e0e44
Коммит 158d5666b8
2 изменённых файлов: 55 добавлений и 0 удалений

Просмотреть файл

@ -169,6 +169,12 @@ GLXLibrary::EnsureInitialized()
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct symbols_videosync[] = {
{ (PRFuncPtr*) &xGetVideoSyncInternal, { "glXGetVideoSyncSGI", nullptr } },
{ (PRFuncPtr*) &xWaitVideoSyncInternal, { "glXWaitVideoSyncSGI", nullptr } },
{ nullptr, { nullptr } }
};
if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, &symbols[0])) {
NS_WARNING("Couldn't find required entry point in OpenGL shared library");
return false;
@ -246,6 +252,13 @@ GLXLibrary::EnsureInitialized()
mHasRobustness = true;
}
if (HasExtension(extensionsStr, "GLX_SGI_video_sync") &&
GLLibraryLoader::LoadSymbols(mOGLLibrary, symbols_videosync,
(GLLibraryLoader::PlatformLookupFunction)&xGetProcAddress))
{
mHasVideoSync = true;
}
mIsATI = serverVendor && DoesStringMatch(serverVendor, "ATI");
mIsNVIDIA = serverVendor && DoesStringMatch(serverVendor, "NVIDIA Corporation");
mClientIsMesa = clientVendor && DoesStringMatch(clientVendor, "Mesa");
@ -269,6 +282,16 @@ GLXLibrary::SupportsTextureFromPixmap(gfxASurface* aSurface)
return true;
}
bool
GLXLibrary::SupportsVideoSync()
{
if (!EnsureInitialized()) {
return false;
}
return mHasVideoSync;
}
GLXPixmap
GLXLibrary::CreatePixmap(gfxASurface* aSurface)
{
@ -737,6 +760,24 @@ GLXLibrary::xCreateContextAttribs(Display* display,
return result;
}
int
GLXLibrary::xGetVideoSync(unsigned int* count)
{
BEFORE_GLX_CALL;
int result = xGetVideoSyncInternal(count);
AFTER_GLX_CALL;
return result;
}
int
GLXLibrary::xWaitVideoSync(int divisor, int remainder, unsigned int* count)
{
BEFORE_GLX_CALL;
int result = xWaitVideoSyncInternal(divisor, remainder, count);
AFTER_GLX_CALL;
return result;
}
already_AddRefed<GLContextGLX>
GLContextGLX::CreateGLContext(
const SurfaceCaps& caps,

Просмотреть файл

@ -54,9 +54,12 @@ public:
, xWaitGLInternal(nullptr)
, xWaitXInternal(nullptr)
, xCreateContextAttribsInternal(nullptr)
, xGetVideoSyncInternal(nullptr)
, xWaitVideoSyncInternal(nullptr)
, mInitialized(false), mTriedInitializing(false)
, mUseTextureFromPixmap(false), mDebug(false)
, mHasRobustness(false), mHasCreateContextAttribs(false)
, mHasVideoSync(false)
, mIsATI(false), mIsNVIDIA(false)
, mClientIsMesa(false), mGLXMajorVersion(0)
, mGLXMinorVersion(0)
@ -120,6 +123,9 @@ public:
Bool direct,
const int* attrib_list);
int xGetVideoSync(unsigned int* count);
int xWaitVideoSync(int divisor, int remainder, unsigned int* count);
bool EnsureInitialized();
GLXPixmap CreatePixmap(gfxASurface* aSurface);
@ -132,6 +138,7 @@ public:
bool HasRobustness() { return mHasRobustness; }
bool HasCreateContextAttribs() { return mHasCreateContextAttribs; }
bool SupportsTextureFromPixmap(gfxASurface* aSurface);
bool SupportsVideoSync();
bool IsATI() { return mIsATI; }
bool GLXVersionCheck(int aMajor, int aMinor);
@ -225,6 +232,12 @@ private:
const int *);
PFNGLXCREATECONTEXTATTRIBS xCreateContextAttribsInternal;
typedef int (GLAPIENTRY *PFNGLXGETVIDEOSYNCSGI) (unsigned int *count);
PFNGLXGETVIDEOSYNCSGI xGetVideoSyncInternal;
typedef int (GLAPIENTRY *PFNGLXWAITVIDEOSYNCSGI) (int divisor, int remainder, unsigned int *count);
PFNGLXWAITVIDEOSYNCSGI xWaitVideoSyncInternal;
#ifdef DEBUG
void BeforeGLXCall();
void AfterGLXCall();
@ -236,6 +249,7 @@ private:
bool mDebug;
bool mHasRobustness;
bool mHasCreateContextAttribs;
bool mHasVideoSync;
bool mIsATI;
bool mIsNVIDIA;
bool mClientIsMesa;