Bug 1599016 [Wayland] Don't use GL_TEXTURE_EXTERNAL_OES textures with DMA BUF backend, r=sotaro

Differential Revision: https://phabricator.services.mozilla.com/D54690

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2019-11-26 11:15:48 +00:00
parent d3860ab285
commit a731b16af1
4 changed files with 7 additions and 15 deletions

View File

@ -39,7 +39,7 @@ bool WaylandDMABUFTextureHostOGL::Lock() {
auto format = mSurface->HasAlpha() ? gfx::SurfaceFormat::R8G8B8A8
: gfx::SurfaceFormat::R8G8B8X8;
mTextureSource = new EGLImageTextureSource(
mProvider, mSurface->GetEGLImage(), format, LOCAL_GL_TEXTURE_EXTERNAL,
mProvider, mSurface->GetEGLImage(), format, LOCAL_GL_TEXTURE_2D,
LOCAL_GL_CLAMP_TO_EDGE,
gfx::IntSize(mSurface->GetWidth(), mSurface->GetHeight()));
}
@ -108,7 +108,7 @@ void WaylandDMABUFTextureHostOGL::PushResourceUpdates(
? &wr::TransactionBuilder::AddExternalImage
: &wr::TransactionBuilder::UpdateExternalImage;
auto imageType =
wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
wr::ExternalImageType::TextureHandle(wr::TextureTarget::Default);
gfx::SurfaceFormat format = mSurface->HasAlpha()
? gfx::SurfaceFormat::R8G8B8A8

View File

@ -15,9 +15,7 @@ namespace wr {
RenderWaylandDMABUFTextureHostOGL::RenderWaylandDMABUFTextureHostOGL(
WaylandDMABufSurface* aSurface)
: mSurface(aSurface),
mTextureTarget(LOCAL_GL_TEXTURE_2D),
mTextureHandle(0) {
: mSurface(aSurface), mTextureHandle(0) {
MOZ_COUNT_CTOR_INHERITED(RenderWaylandDMABUFTextureHostOGL,
RenderTextureHostOGL);
}
@ -65,20 +63,16 @@ wr::WrExternalImage RenderWaylandDMABUFTextureHostOGL::Lock(
return InvalidToWrExternalImage();
}
mTextureTarget = mGL->GetPreferredEGLImageTextureTarget();
MOZ_ASSERT(mTextureTarget == LOCAL_GL_TEXTURE_2D ||
mTextureTarget == LOCAL_GL_TEXTURE_EXTERNAL);
mGL->fGenTextures(1, &mTextureHandle);
// Cache rendering filter.
mCachedRendering = aRendering;
ActivateBindAndTexParameteri(mGL, LOCAL_GL_TEXTURE0, mTextureTarget,
ActivateBindAndTexParameteri(mGL, LOCAL_GL_TEXTURE0, LOCAL_GL_TEXTURE_2D,
mTextureHandle, aRendering);
mGL->fEGLImageTargetTexture2D(mTextureTarget, mSurface->GetEGLImage());
mGL->fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, mSurface->GetEGLImage());
} else if (IsFilterUpdateNecessary(aRendering)) {
// Cache new rendering filter.
mCachedRendering = aRendering;
ActivateBindAndTexParameteri(mGL, LOCAL_GL_TEXTURE0, mTextureTarget,
ActivateBindAndTexParameteri(mGL, LOCAL_GL_TEXTURE0, LOCAL_GL_TEXTURE_2D,
mTextureHandle, aRendering);
}

View File

@ -36,7 +36,6 @@ class RenderWaylandDMABUFTextureHostOGL final : public RenderTextureHostOGL {
RefPtr<WaylandDMABufSurface> mSurface;
RefPtr<gl::GLContext> mGL;
GLenum mTextureTarget;
GLuint mTextureHandle;
};

View File

@ -276,8 +276,7 @@ bool WaylandDMABufSurface::CreateWLBuffer() {
bool WaylandDMABufSurface::IsEGLSupported(mozilla::gl::GLContext* aGLContext) {
auto* egl = gl::GLLibraryEGL::Get();
return (egl->HasKHRImageBase() &&
aGLContext->IsExtensionSupported(GLContext::OES_EGL_image_external));
return egl->HasKHRImageBase();
}
bool WaylandDMABufSurface::CreateEGLImage(mozilla::gl::GLContext* aGLContext) {