зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1403049 - Remove EGLImageImage r=snorp
This commit is contained in:
Родитель
acf8913934
Коммит
afe9dcf6ff
|
@ -608,10 +608,6 @@ GLBlitHelper::BlitImageToFramebuffer(layers::Image* srcImage,
|
|||
case ImageFormat::SURFACE_TEXTURE:
|
||||
return BlitImage(static_cast<layers::SurfaceTextureImage*>(srcImage), destSize,
|
||||
destOrigin);
|
||||
|
||||
case ImageFormat::EGLIMAGE:
|
||||
return BlitImage(static_cast<layers::EGLImageImage*>(srcImage), destSize,
|
||||
destOrigin);
|
||||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
case ImageFormat::MAC_IOSURFACE:
|
||||
|
@ -647,41 +643,6 @@ GLBlitHelper::BlitImage(layers::SurfaceTextureImage* srcImage, const gfx::IntSiz
|
|||
gfxCriticalError() << "BlitImage(SurfaceTextureImage) not implemented.";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
GLBlitHelper::BlitImage(layers::EGLImageImage* const srcImage,
|
||||
const gfx::IntSize& destSize, const OriginPos destOrigin) const
|
||||
{
|
||||
const EGLImage eglImage = srcImage->GetImage();
|
||||
const EGLSync eglSync = srcImage->GetSync();
|
||||
if (eglSync) {
|
||||
EGLint status = sEGLLibrary.fClientWaitSync(EGL_DISPLAY(), eglSync, 0, LOCAL_EGL_FOREVER);
|
||||
if (status != LOCAL_EGL_CONDITION_SATISFIED) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
GLuint tex = 0;
|
||||
mGL->fGenTextures(1, &tex);
|
||||
|
||||
const ScopedSaveMultiTex saveTex(mGL, 1, LOCAL_GL_TEXTURE_2D);
|
||||
mGL->fBindTexture(LOCAL_GL_TEXTURE_2D, tex);
|
||||
mGL->TexParams_SetClampNoMips();
|
||||
mGL->fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, eglImage);
|
||||
|
||||
const auto& srcOrigin = srcImage->GetOriginPos();
|
||||
const bool yFlip = destOrigin != srcOrigin;
|
||||
const gfx::IntRect srcRect(0, 0, 1, 1);
|
||||
const gfx::IntSize srcSize(1, 1);
|
||||
const DrawBlitProg::BaseArgs baseArgs = { destSize, yFlip, srcRect, srcSize };
|
||||
|
||||
const auto& prog = GetDrawBlitProg({kFragHeader_Tex2D, kFragBody_RGBA});
|
||||
MOZ_RELEASE_ASSERT(prog);
|
||||
prog->Draw(baseArgs);
|
||||
|
||||
mGL->fDeleteTextures(1, &tex);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// -------------------------------------
|
||||
|
|
|
@ -28,7 +28,6 @@ class GPUVideoImage;
|
|||
class PlanarYCbCrImage;
|
||||
class SurfaceTextureImage;
|
||||
class MacIOSurfaceImage;
|
||||
class EGLImageImage;
|
||||
class SurfaceDescriptorD3D10;
|
||||
class SurfaceDescriptorDXGIYCbCr;
|
||||
} // namespace layers
|
||||
|
@ -133,8 +132,6 @@ public:
|
|||
// Blit onto the current FB.
|
||||
bool BlitImage(layers::SurfaceTextureImage* stImage, const gfx::IntSize& destSize,
|
||||
OriginPos destOrigin) const;
|
||||
bool BlitImage(layers::EGLImageImage* eglImage, const gfx::IntSize& destSize,
|
||||
OriginPos destOrigin) const;
|
||||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
bool BlitImage(layers::MacIOSurfaceImage* srcImage, const gfx::IntSize& destSize,
|
||||
|
|
|
@ -16,35 +16,6 @@ namespace layers {
|
|||
|
||||
static RefPtr<GLContext> sSnapshotContext;
|
||||
|
||||
EGLImageImage::EGLImageImage(EGLImage aImage, EGLSync aSync,
|
||||
const gfx::IntSize& aSize, const gl::OriginPos& aOrigin,
|
||||
bool aOwns)
|
||||
: GLImage(ImageFormat::EGLIMAGE),
|
||||
mImage(aImage),
|
||||
mSync(aSync),
|
||||
mSize(aSize),
|
||||
mPos(aOrigin),
|
||||
mOwns(aOwns)
|
||||
{
|
||||
}
|
||||
|
||||
EGLImageImage::~EGLImageImage()
|
||||
{
|
||||
if (!mOwns) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mImage) {
|
||||
sEGLLibrary.fDestroyImage(EGL_DISPLAY(), mImage);
|
||||
mImage = nullptr;
|
||||
}
|
||||
|
||||
if (mSync) {
|
||||
sEGLLibrary.fDestroySync(EGL_DISPLAY(), mSync);
|
||||
mSync = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<gfx::SourceSurface>
|
||||
GLImage::GetAsSourceSurface()
|
||||
{
|
||||
|
|
|
@ -28,38 +28,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class EGLImageImage : public GLImage {
|
||||
public:
|
||||
EGLImageImage(EGLImage aImage, EGLSync aSync,
|
||||
const gfx::IntSize& aSize, const gl::OriginPos& aOrigin,
|
||||
bool aOwns);
|
||||
|
||||
gfx::IntSize GetSize() override { return mSize; }
|
||||
gl::OriginPos GetOriginPos() const {
|
||||
return mPos;
|
||||
}
|
||||
EGLImage GetImage() const {
|
||||
return mImage;
|
||||
}
|
||||
EGLSync GetSync() const {
|
||||
return mSync;
|
||||
}
|
||||
|
||||
EGLImageImage* AsEGLImageImage() override {
|
||||
return this;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~EGLImageImage();
|
||||
|
||||
private:
|
||||
EGLImage mImage;
|
||||
EGLSync mSync;
|
||||
gfx::IntSize mSize;
|
||||
gl::OriginPos mPos;
|
||||
bool mOwns;
|
||||
};
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
|
||||
class SurfaceTextureImage : public GLImage {
|
||||
|
|
|
@ -174,7 +174,6 @@ protected:
|
|||
|
||||
/* Forward declarations for Image derivatives. */
|
||||
class GLImage;
|
||||
class EGLImageImage;
|
||||
class SharedRGBImage;
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
class SurfaceTextureImage;
|
||||
|
@ -233,7 +232,6 @@ public:
|
|||
virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) { return nullptr; }
|
||||
|
||||
/* Access to derived classes. */
|
||||
virtual EGLImageImage* AsEGLImageImage() { return nullptr; }
|
||||
virtual GLImage* AsGLImage() { return nullptr; }
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
virtual SurfaceTextureImage* AsSurfaceTextureImage() { return nullptr; }
|
||||
|
|
|
@ -55,11 +55,6 @@ enum class ImageFormat {
|
|||
*/
|
||||
SURFACE_TEXTURE,
|
||||
|
||||
/**
|
||||
* An EGL Image that can be shared across threads.
|
||||
*/
|
||||
EGLIMAGE,
|
||||
|
||||
/**
|
||||
* The D3D9_RGB32_TEXTURE format creates a D3D9SurfaceImage, and wraps a
|
||||
* IDirect3DTexture9 in RGB32 layout.
|
||||
|
|
|
@ -400,8 +400,6 @@ AppendToString(std::stringstream& aStream, ImageFormat format,
|
|||
aStream << "ImageFormat::MAC_IOSURFACE"; break;
|
||||
case ImageFormat::SURFACE_TEXTURE:
|
||||
aStream << "ImageFormat::SURFACE_TEXTURE"; break;
|
||||
case ImageFormat::EGLIMAGE:
|
||||
aStream << "ImageFormat::EGLIMAGE"; break;
|
||||
case ImageFormat::D3D9_RGB32_TEXTURE:
|
||||
aStream << "ImageFormat::D3D9_RBG32_TEXTURE"; break;
|
||||
case ImageFormat::OVERLAY_IMAGE:
|
||||
|
|
|
@ -118,24 +118,14 @@ ImageClient::CreateTextureClientForImage(Image* aImage, KnowsCompositor* aForwar
|
|||
if (!status) {
|
||||
return nullptr;
|
||||
}
|
||||
} else if (aImage->GetFormat() == ImageFormat::SURFACE_TEXTURE ||
|
||||
aImage->GetFormat() == ImageFormat::EGLIMAGE) {
|
||||
gfx::IntSize size = aImage->GetSize();
|
||||
|
||||
if (aImage->GetFormat() == ImageFormat::EGLIMAGE) {
|
||||
EGLImageImage* typedImage = aImage->AsEGLImageImage();
|
||||
texture = EGLImageTextureData::CreateTextureClient(
|
||||
typedImage, size, aForwarder->GetTextureForwarder(), TextureFlags::DEFAULT);
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
} else if (aImage->GetFormat() == ImageFormat::SURFACE_TEXTURE) {
|
||||
SurfaceTextureImage* typedImage = aImage->AsSurfaceTextureImage();
|
||||
texture = AndroidSurfaceTextureData::CreateTextureClient(
|
||||
typedImage->GetHandle(), size, typedImage->GetContinuous(), typedImage->GetOriginPos(),
|
||||
aForwarder->GetTextureForwarder(), TextureFlags::DEFAULT);
|
||||
} else if (aImage->GetFormat() == ImageFormat::SURFACE_TEXTURE) {
|
||||
gfx::IntSize size = aImage->GetSize();
|
||||
SurfaceTextureImage* typedImage = aImage->AsSurfaceTextureImage();
|
||||
texture = AndroidSurfaceTextureData::CreateTextureClient(
|
||||
typedImage->GetHandle(), size, typedImage->GetContinuous(), typedImage->GetOriginPos(),
|
||||
aForwarder->GetTextureForwarder(), TextureFlags::DEFAULT);
|
||||
#endif
|
||||
} else {
|
||||
MOZ_ASSERT(false, "Bad ImageFormat.");
|
||||
}
|
||||
} else {
|
||||
RefPtr<gfx::SourceSurface> surface = aImage->GetAsSourceSurface();
|
||||
MOZ_ASSERT(surface);
|
||||
|
|
|
@ -17,62 +17,6 @@ namespace layers {
|
|||
|
||||
class CompositableForwarder;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// EGLImage
|
||||
|
||||
EGLImageTextureData::EGLImageTextureData(EGLImageImage* aImage, gfx::IntSize aSize)
|
||||
: mImage(aImage)
|
||||
, mSize(aSize)
|
||||
{
|
||||
MOZ_ASSERT(aImage);
|
||||
}
|
||||
|
||||
already_AddRefed<TextureClient>
|
||||
EGLImageTextureData::CreateTextureClient(EGLImageImage* aImage, gfx::IntSize aSize,
|
||||
LayersIPCChannel* aAllocator, TextureFlags aFlags)
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsParentProcess(),
|
||||
"Can't pass an `EGLImage` between processes.");
|
||||
|
||||
if (!aImage || !XRE_IsParentProcess()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// XXX - This is quite sad and slow.
|
||||
aFlags |= TextureFlags::DEALLOCATE_CLIENT;
|
||||
|
||||
if (aImage->GetOriginPos() == gl::OriginPos::BottomLeft) {
|
||||
aFlags |= TextureFlags::ORIGIN_BOTTOM_LEFT;
|
||||
}
|
||||
|
||||
return TextureClient::CreateWithData(
|
||||
new EGLImageTextureData(aImage, aSize),
|
||||
aFlags, aAllocator
|
||||
);
|
||||
}
|
||||
|
||||
void
|
||||
EGLImageTextureData::FillInfo(TextureData::Info& aInfo) const
|
||||
{
|
||||
aInfo.size = mSize;
|
||||
aInfo.format = gfx::SurfaceFormat::UNKNOWN;
|
||||
aInfo.hasIntermediateBuffer = false;
|
||||
aInfo.hasSynchronization = false;
|
||||
aInfo.supportsMoz2D = false;
|
||||
aInfo.canExposeMappedData = false;
|
||||
}
|
||||
|
||||
bool
|
||||
EGLImageTextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
|
||||
{
|
||||
const bool hasAlpha = true;
|
||||
aOutDescriptor =
|
||||
EGLImageDescriptor((uintptr_t)mImage->GetImage(),
|
||||
(uintptr_t)mImage->GetSync(),
|
||||
mImage->GetSize(), hasAlpha);
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// AndroidSurface
|
||||
|
||||
|
|
|
@ -20,34 +20,6 @@ namespace mozilla {
|
|||
|
||||
namespace layers {
|
||||
|
||||
class EGLImageTextureData : public TextureData
|
||||
{
|
||||
public:
|
||||
|
||||
static already_AddRefed<TextureClient>
|
||||
CreateTextureClient(EGLImageImage* aImage, gfx::IntSize aSize,
|
||||
LayersIPCChannel* aAllocator, TextureFlags aFlags);
|
||||
|
||||
virtual void FillInfo(TextureData::Info& aInfo) const override;
|
||||
|
||||
virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
|
||||
|
||||
virtual void Deallocate(LayersIPCChannel*) override { mImage = nullptr; }
|
||||
|
||||
virtual void Forget(LayersIPCChannel*) override { mImage = nullptr; }
|
||||
|
||||
// Unused functions.
|
||||
virtual bool Lock(OpenMode) override { return true; }
|
||||
|
||||
virtual void Unlock() override {}
|
||||
|
||||
protected:
|
||||
EGLImageTextureData(EGLImageImage* aImage, gfx::IntSize aSize);
|
||||
|
||||
RefPtr<EGLImageImage> mImage;
|
||||
const gfx::IntSize mSize;
|
||||
};
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
|
||||
class AndroidSurfaceTextureData : public TextureData
|
||||
|
|
Загрузка…
Ссылка в новой задаче