2
* Copyright © 2016 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_CLIENT_EGLSTREAM_CLIENT_BUFFER_H_
21
#define MIR_CLIENT_EGLSTREAM_CLIENT_BUFFER_H_
23
#include "mir/aging_buffer.h"
24
#include "mir_toolkit/mir_client_library.h"
25
#include "mir/geometry/rectangle.h"
36
class ClientBuffer : public AgingBuffer
40
std::shared_ptr<MirBufferPackage> const& buffer_package,
44
~ClientBuffer() noexcept;
46
std::shared_ptr<MemoryRegion> secure_for_cpu_write();
47
geometry::Size size() const;
48
geometry::Stride stride() const;
49
MirPixelFormat pixel_format() const;
50
std::shared_ptr<MirNativeBuffer> native_buffer_handle() const;
51
void update_from(MirBufferPackage const&);
52
void fill_update_msg(MirBufferPackage&);
53
MirNativeBuffer* as_mir_native_buffer() const;
54
void set_fence(MirNativeFence*, MirBufferAccess);
55
MirNativeFence* get_fence() const;
56
bool wait_fence(MirBufferAccess, std::chrono::nanoseconds timeout);
59
std::shared_ptr<MirBufferPackage> const creation_package;
60
geometry::Rectangle const rect;
61
MirPixelFormat const buffer_pf;
67
#endif /* MIR_CLIENT_EGLSTREAM_CLIENT_BUFFER_H_ */