зеркало из https://github.com/mozilla/gecko-dev.git
Bug 680817 - Keep GLXPixmaps bound to textures between updates on NVIDIA drivers to improve performance. r=joe
This commit is contained in:
Родитель
31f16514d3
Коммит
9662b1ad04
|
@ -401,45 +401,56 @@ GLXLibrary::CreatePixmap(gfxASurface* aSurface)
|
|||
}
|
||||
|
||||
void
|
||||
GLXLibrary::DestroyPixmap(GLXPixmap aPixmap)
|
||||
GLXLibrary::DestroyPixmap(Display* aDisplay, GLXPixmap aPixmap)
|
||||
{
|
||||
if (!mUseTextureFromPixmap) {
|
||||
return;
|
||||
}
|
||||
|
||||
Display *display = DefaultXDisplay();
|
||||
xDestroyPixmap(display, aPixmap);
|
||||
xDestroyPixmap(aDisplay, aPixmap);
|
||||
}
|
||||
|
||||
void
|
||||
GLXLibrary::BindTexImage(GLXPixmap aPixmap)
|
||||
GLXLibrary::BindTexImage(Display* aDisplay, GLXPixmap aPixmap)
|
||||
{
|
||||
if (!mUseTextureFromPixmap) {
|
||||
return;
|
||||
}
|
||||
|
||||
Display *display = DefaultXDisplay();
|
||||
// Make sure all X drawing to the surface has finished before binding to a texture.
|
||||
if (mClientIsMesa) {
|
||||
// Using XSync instead of Mesa's glXWaitX, because its glxWaitX is a
|
||||
// noop when direct rendering unless the current drawable is a
|
||||
// single-buffer window.
|
||||
FinishX(display);
|
||||
FinishX(aDisplay);
|
||||
} else {
|
||||
xWaitX();
|
||||
}
|
||||
xBindTexImage(display, aPixmap, LOCAL_GLX_FRONT_LEFT_EXT, nullptr);
|
||||
xBindTexImage(aDisplay, aPixmap, LOCAL_GLX_FRONT_LEFT_EXT, nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
GLXLibrary::ReleaseTexImage(GLXPixmap aPixmap)
|
||||
GLXLibrary::ReleaseTexImage(Display* aDisplay, GLXPixmap aPixmap)
|
||||
{
|
||||
if (!mUseTextureFromPixmap) {
|
||||
return;
|
||||
}
|
||||
|
||||
Display *display = DefaultXDisplay();
|
||||
xReleaseTexImage(display, aPixmap, LOCAL_GLX_FRONT_LEFT_EXT);
|
||||
xReleaseTexImage(aDisplay, aPixmap, LOCAL_GLX_FRONT_LEFT_EXT);
|
||||
}
|
||||
|
||||
void
|
||||
GLXLibrary::UpdateTexImage(Display* aDisplay, GLXPixmap aPixmap)
|
||||
{
|
||||
// NVIDIA drivers don't require a rebind of the pixmap in order
|
||||
// to display an updated image, and it's faster not to do it.
|
||||
if (mIsNVIDIA) {
|
||||
xWaitX();
|
||||
return;
|
||||
}
|
||||
|
||||
ReleaseTexImage(aDisplay, aPixmap);
|
||||
BindTexImage(aDisplay, aPixmap);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -98,9 +98,10 @@ public:
|
|||
bool EnsureInitialized();
|
||||
|
||||
GLXPixmap CreatePixmap(gfxASurface* aSurface);
|
||||
void DestroyPixmap(GLXPixmap aPixmap);
|
||||
void BindTexImage(GLXPixmap aPixmap);
|
||||
void ReleaseTexImage(GLXPixmap aPixmap);
|
||||
void DestroyPixmap(Display* aDisplay, GLXPixmap aPixmap);
|
||||
void BindTexImage(Display* aDisplay, GLXPixmap aPixmap);
|
||||
void ReleaseTexImage(Display* aDisplay, GLXPixmap aPixmap);
|
||||
void UpdateTexImage(Display* aDisplay, GLXPixmap aPixmap);
|
||||
|
||||
bool UseTextureFromPixmap() { return mUseTextureFromPixmap; }
|
||||
bool HasRobustness() { return mHasRobustness; }
|
||||
|
|
|
@ -89,7 +89,7 @@ gfxXlibSurface::~gfxXlibSurface()
|
|||
{
|
||||
#if defined(GL_PROVIDER_GLX)
|
||||
if (mGLXPixmap) {
|
||||
gl::sGLXLibrary.DestroyPixmap(mGLXPixmap);
|
||||
gl::sGLXLibrary.DestroyPixmap(mDisplay, mGLXPixmap);
|
||||
}
|
||||
#endif
|
||||
// gfxASurface's destructor calls RecordMemoryFreed().
|
||||
|
@ -278,7 +278,7 @@ gfxXlibSurface::Finish()
|
|||
{
|
||||
#if defined(GL_PROVIDER_GLX)
|
||||
if (mGLXPixmap) {
|
||||
gl::sGLXLibrary.DestroyPixmap(mGLXPixmap);
|
||||
gl::sGLXLibrary.DestroyPixmap(mDisplay, mGLXPixmap);
|
||||
mGLXPixmap = None;
|
||||
}
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче