2
* Copyright © 2012,2013 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3,
6
* as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Kevin DuBois <kevin.dubois@canonical.com>
20
#ifndef MIR_GRAPHICS_ANDROID_BUFFER_H_
21
#define MIR_GRAPHICS_ANDROID_BUFFER_H_
23
#include "mir/graphics/buffer_basic.h"
24
#include "buffer_usage.h"
27
#include <condition_variable>
30
#define GL_GLEXT_PROTOTYPES
31
#define EGL_EGLEXT_PROTOTYPES
33
#include <EGL/eglext.h>
43
class Buffer: public BufferBasic
46
Buffer(std::shared_ptr<NativeBuffer> const& buffer_handle,
47
std::shared_ptr<EGLExtensions> const& extensions);
50
geometry::Size size() const;
51
geometry::Stride stride() const;
52
MirPixelFormat pixel_format() const;
53
void bind_to_texture();
54
bool can_bypass() const override;
56
//note, you will get the native representation of an android buffer, including
57
//the fences associated with the buffer. You must close these fences
58
std::shared_ptr<NativeBuffer> native_buffer_handle() const;
61
std::mutex mutable content_lock;
63
std::map<EGLDisplay,EGLImageKHR> egl_image_map;
65
std::shared_ptr<NativeBuffer> native_buffer;
66
std::shared_ptr<EGLExtensions> egl_extensions;
73
#endif /* MIR_GRAPHICS_ANDROID_BUFFER_H_ */