2
* Copyright © 2012 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
* Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
20
#ifndef MIR_GRAPHICS_MESA_GBM_BUFFER_H_
21
#define MIR_GRAPHICS_MESA_GBM_BUFFER_H_
23
#include "mir/graphics/buffer_basic.h"
37
struct GBMNativeBuffer : MirNativeBuffer
42
MirPixelFormat gbm_format_to_mir_format(uint32_t format);
43
uint32_t mir_format_to_gbm_format(MirPixelFormat format);
44
enum : uint32_t { invalid_gbm_format = std::numeric_limits<uint32_t>::max() };
46
class BufferTextureBinder;
48
class GBMBuffer: public BufferBasic
51
GBMBuffer(std::shared_ptr<gbm_bo> const& handle,
53
std::unique_ptr<BufferTextureBinder> texture_binder);
54
GBMBuffer(const GBMBuffer&) = delete;
57
GBMBuffer& operator=(const GBMBuffer&) = delete;
59
virtual geometry::Size size() const;
61
virtual geometry::Stride stride() const;
63
virtual MirPixelFormat pixel_format() const;
65
virtual std::shared_ptr<MirNativeBuffer> native_buffer_handle() const;
67
virtual void bind_to_texture();
69
bool can_bypass() const override;
72
std::shared_ptr<gbm_bo> const gbm_handle;
74
std::unique_ptr<BufferTextureBinder> const texture_binder;
83
#endif // MIR_GRAPHICS_MESA_GBM_BUFFER_H_