Bug 1619882 [Wayland] Use WaylandDMABufSurface global lock instead of VAAPIFrameHolder at WaylandDMABUFSurfaceImage, r=sotaro

VAAPIFrameHolder was moved to FFmpegVideoDecoder class and we use WaylandDMABufSurface global lock to keep
surface reference until it's used.

Differential Revision: https://phabricator.services.mozilla.com/D76691
This commit is contained in:
Martin Stransky 2020-05-29 15:22:07 +00:00
parent 09e34aad82
commit 30ea024440

View File

@ -12,31 +12,18 @@
#include "mozilla/gfx/Point.h"
#include "mozilla/layers/TextureClient.h"
namespace mozilla {
class VAAPIFrameHolder;
}
namespace mozilla {
namespace layers {
typedef void (*AVFrameReleaseCallback)(VAAPIFrameHolder* aFrameHolder);
class WaylandDMABUFSurfaceImage : public Image {
public:
explicit WaylandDMABUFSurfaceImage(WaylandDMABufSurface* aSurface,
AVFrameReleaseCallback aReleaseCallback,
VAAPIFrameHolder* aFrameHolder)
: Image(nullptr, ImageFormat::WAYLAND_DMABUF),
mSurface(aSurface),
mReleaseCallback(aReleaseCallback),
mFrameHolder(aFrameHolder) {}
~WaylandDMABUFSurfaceImage() {
if (mReleaseCallback) {
mReleaseCallback(mFrameHolder);
}
explicit WaylandDMABUFSurfaceImage(WaylandDMABufSurface* aSurface)
: Image(nullptr, ImageFormat::WAYLAND_DMABUF), mSurface(aSurface) {
mSurface->GlobalRefAdd();
}
~WaylandDMABUFSurfaceImage() { mSurface->GlobalRefRelease(); }
WaylandDMABufSurface* GetSurface() { return mSurface; }
gfx::IntSize GetSize() const override {
@ -52,11 +39,6 @@ class WaylandDMABUFSurfaceImage : public Image {
private:
RefPtr<WaylandDMABufSurface> mSurface;
RefPtr<TextureClient> mTextureClient;
// When WaylandDMABUFSurfaceImage is created on top of ffmpeg frame located at
// GPU memory we need to keep it until painting of the frame is finished.
AVFrameReleaseCallback mReleaseCallback;
VAAPIFrameHolder* mFrameHolder;
};
} // namespace layers