mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Backed out changeset 2df13967b746 (bug 1289251)
This commit is contained in:
parent
7237b5b278
commit
47d3ad2b27
@ -16,7 +16,6 @@
|
|||||||
#include "mozilla/MathAlgorithms.h"
|
#include "mozilla/MathAlgorithms.h"
|
||||||
#include "mozilla/StaticPtr.h"
|
#include "mozilla/StaticPtr.h"
|
||||||
#include "mozilla/widget/CompositorWidget.h"
|
#include "mozilla/widget/CompositorWidget.h"
|
||||||
#include "mozilla/widget/X11CompositorWidget.h"
|
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
|
|
||||||
#include "prenv.h"
|
#include "prenv.h"
|
||||||
@ -1098,7 +1097,13 @@ GLContextProviderGLX::CreateWrappingExisting(void* aContext, void* aSurface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<GLContext>
|
already_AddRefed<GLContext>
|
||||||
CreateForWidget(Display* aXDisplay, Window aXWindow, bool aForceAccelerated)
|
GLContextProviderGLX::CreateForCompositorWidget(CompositorWidget* aCompositorWidget, bool aForceAccelerated)
|
||||||
|
{
|
||||||
|
return CreateForWindow(aCompositorWidget->RealWidget(), aForceAccelerated);
|
||||||
|
}
|
||||||
|
|
||||||
|
already_AddRefed<GLContext>
|
||||||
|
GLContextProviderGLX::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated)
|
||||||
{
|
{
|
||||||
if (!sGLXLibrary.EnsureInitialized()) {
|
if (!sGLXLibrary.EnsureInitialized()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -1111,17 +1116,19 @@ CreateForWidget(Display* aXDisplay, Window aXWindow, bool aForceAccelerated)
|
|||||||
// performance might be suboptimal. But using the existing visual
|
// performance might be suboptimal. But using the existing visual
|
||||||
// is a relatively safe intermediate step.
|
// is a relatively safe intermediate step.
|
||||||
|
|
||||||
if (!aXDisplay) {
|
Display* display = (Display*)aWidget->GetNativeData(NS_NATIVE_COMPOSITOR_DISPLAY);
|
||||||
|
if (!display) {
|
||||||
NS_ERROR("X Display required for GLX Context provider");
|
NS_ERROR("X Display required for GLX Context provider");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xscreen = DefaultScreen(aXDisplay);
|
int xscreen = DefaultScreen(display);
|
||||||
|
Window window = GET_NATIVE_WINDOW(aWidget);
|
||||||
|
|
||||||
ScopedXFree<GLXFBConfig> cfgs;
|
ScopedXFree<GLXFBConfig> cfgs;
|
||||||
GLXFBConfig config;
|
GLXFBConfig config;
|
||||||
int visid;
|
int visid;
|
||||||
if (!GLContextGLX::FindFBConfigForWindow(aXDisplay, xscreen, aXWindow, &cfgs,
|
if (!GLContextGLX::FindFBConfigForWindow(display, xscreen, window, &cfgs,
|
||||||
&config, &visid))
|
&config, &visid))
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -1131,33 +1138,11 @@ CreateForWidget(Display* aXDisplay, Window aXWindow, bool aForceAccelerated)
|
|||||||
GLContextGLX* shareContext = GetGlobalContextGLX();
|
GLContextGLX* shareContext = GetGlobalContextGLX();
|
||||||
RefPtr<GLContextGLX> gl = GLContextGLX::CreateGLContext(CreateContextFlags::NONE,
|
RefPtr<GLContextGLX> gl = GLContextGLX::CreateGLContext(CreateContextFlags::NONE,
|
||||||
caps, shareContext, false,
|
caps, shareContext, false,
|
||||||
aXDisplay, aXWindow, config,
|
display, window, config,
|
||||||
false);
|
false);
|
||||||
return gl.forget();
|
return gl.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<GLContext>
|
|
||||||
GLContextProviderGLX::CreateForCompositorWidget(CompositorWidget* aCompositorWidget, bool aForceAccelerated)
|
|
||||||
{
|
|
||||||
X11CompositorWidget* compWidget = aCompositorWidget->AsX11();
|
|
||||||
MOZ_ASSERT(compWidget);
|
|
||||||
|
|
||||||
return CreateForWidget(compWidget->XDisplay(),
|
|
||||||
compWidget->XWindow(),
|
|
||||||
aForceAccelerated);
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<GLContext>
|
|
||||||
GLContextProviderGLX::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated)
|
|
||||||
{
|
|
||||||
Display* display = (Display*)aWidget->GetNativeData(NS_NATIVE_COMPOSITOR_DISPLAY);
|
|
||||||
Window window = GET_NATIVE_WINDOW(aWidget);
|
|
||||||
|
|
||||||
return CreateForWidget(display,
|
|
||||||
window,
|
|
||||||
aForceAccelerated);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
ChooseConfig(GLXLibrary* glx, Display* display, int screen, const SurfaceCaps& minCaps,
|
ChooseConfig(GLXLibrary* glx, Display* display, int screen, const SurfaceCaps& minCaps,
|
||||||
ScopedXFree<GLXFBConfig>* const out_scopedConfigArr,
|
ScopedXFree<GLXFBConfig>* const out_scopedConfigArr,
|
||||||
|
@ -49,9 +49,6 @@ public:
|
|||||||
X11CompositorWidget* AsX11() override { return this; }
|
X11CompositorWidget* AsX11() override { return this; }
|
||||||
CompositorWidgetDelegate* AsDelegate() override { return this; }
|
CompositorWidgetDelegate* AsDelegate() override { return this; }
|
||||||
|
|
||||||
Display* XDisplay() const { return mXDisplay; }
|
|
||||||
Window XWindow() const { return mXWindow; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsWindow* mWidget;
|
nsWindow* mWidget;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user