2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 4; -*- */
|
2015-07-30 19:40:56 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef SHARED_SURFACE_GLX_H_
|
|
|
|
#define SHARED_SURFACE_GLX_H_
|
|
|
|
|
|
|
|
#include "SharedSurface.h"
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2015-07-30 19:40:56 +03:00
|
|
|
|
|
|
|
class gfxXlibSurface;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gl {
|
|
|
|
|
|
|
|
class SharedSurface_GLXDrawable : public SharedSurface {
|
|
|
|
public:
|
|
|
|
static UniquePtr<SharedSurface_GLXDrawable> Create(GLContext* prodGL,
|
|
|
|
const SurfaceCaps& caps,
|
|
|
|
const gfx::IntSize& size,
|
|
|
|
bool deallocateClient,
|
|
|
|
bool inSameProcess);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-01-06 02:57:44 +03:00
|
|
|
virtual void ProducerAcquireImpl() override {}
|
|
|
|
virtual void ProducerReleaseImpl() override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-07-30 19:40:56 +03:00
|
|
|
virtual void LockProdImpl() override;
|
|
|
|
virtual void UnlockProdImpl() override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-07-30 19:40:56 +03:00
|
|
|
virtual bool ToSurfaceDescriptor(
|
|
|
|
layers::SurfaceDescriptor* const out_descriptor) override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-10-12 06:21:03 +03:00
|
|
|
virtual bool ReadbackBySharedHandle(
|
|
|
|
gfx::DataSourceSurface* out_surface) override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-07-30 19:40:56 +03:00
|
|
|
private:
|
|
|
|
SharedSurface_GLXDrawable(GLContext* gl, const gfx::IntSize& size,
|
|
|
|
bool inSameProcess,
|
2015-10-18 08:24:48 +03:00
|
|
|
const RefPtr<gfxXlibSurface>& xlibSurface);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<gfxXlibSurface> mXlibSurface;
|
2015-07-30 19:40:56 +03:00
|
|
|
bool mInSameProcess;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SurfaceFactory_GLXDrawable : public SurfaceFactory {
|
|
|
|
public:
|
|
|
|
static UniquePtr<SurfaceFactory_GLXDrawable> Create(
|
|
|
|
GLContext* prodGL, const SurfaceCaps& caps,
|
2016-09-27 06:22:20 +03:00
|
|
|
const RefPtr<layers::LayersIPCChannel>& allocator,
|
2015-07-30 19:40:56 +03:00
|
|
|
const layers::TextureFlags& flags);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-07-30 19:40:56 +03:00
|
|
|
virtual UniquePtr<SharedSurface> CreateShared(
|
|
|
|
const gfx::IntSize& size) override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-07-30 19:40:56 +03:00
|
|
|
private:
|
|
|
|
SurfaceFactory_GLXDrawable(GLContext* prodGL, const SurfaceCaps& caps,
|
2016-09-27 06:22:20 +03:00
|
|
|
const RefPtr<layers::LayersIPCChannel>& allocator,
|
2015-07-30 19:40:56 +03:00
|
|
|
const layers::TextureFlags& flags)
|
|
|
|
: SurfaceFactory(SharedSurfaceType::GLXDrawable, prodGL, caps, allocator,
|
|
|
|
flags) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gl
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // SHARED_SURFACE_GLX_H_
|