Mir
display_buffer.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
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 General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIR_GRAPHICS_NESTED_DETAIL_NESTED_OUTPUT_H_
20 #define MIR_GRAPHICS_NESTED_DETAIL_NESTED_OUTPUT_H_
21 
24 #include "display.h"
25 #include "host_surface.h"
26 
27 #include <EGL/egl.h>
28 
29 namespace mir
30 {
31 namespace graphics
32 {
33 namespace nested
34 {
35 class HostSurface;
36 
37 namespace detail
38 {
39 
43 {
44 public:
46  EGLDisplayHandle const& egl_display,
47  std::shared_ptr<HostSurface> const& host_surface,
48  geometry::Rectangle const& area,
49  MirPixelFormat preferred_format,
50  std::shared_ptr<HostConnection> const& host_connection
51  );
52 
53  ~DisplayBuffer() noexcept;
54 
55  geometry::Rectangle view_area() const override;
56  void make_current() override;
57  void release_current() override;
58  void swap_buffers() override;
59  void bind() override;
60  MirOrientation orientation() const override;
61  MirMirrorMode mirror_mode() const override;
62 
63  bool post_renderables_if_optimizable(RenderableList const& renderlist) override;
64 
66 
67  DisplayBuffer(DisplayBuffer const&) = delete;
68  DisplayBuffer operator=(DisplayBuffer const&) = delete;
69 private:
70  EGLDisplayHandle const& egl_display;
71  std::shared_ptr<HostSurface> const host_surface;
72  std::shared_ptr<HostConnection> const host_connection;
73  EGLConfig const egl_config;
74  EGLContextStore const egl_context;
75  geometry::Rectangle const area;
76  EGLSurfaceHandle const egl_surface;
77 
78  static void event_thunk(MirSurface* surface, MirEvent const* event, void* context);
79  void mir_event(MirEvent const& event);
80 };
81 }
82 }
83 }
84 }
85 
86 #endif /* MIR_GRAPHICS_NESTED_DETAIL_NESTED_OUTPUT_H_ */
All things Mir.
Definition: atomic_callback.h:25
Definition: mir_surface.h:147
Interface to an output framebuffer.
Definition: display_buffer.h:47
void swap_buffers() override
Swap buffers for OpenGL rendering.
DisplayBuffer operator=(DisplayBuffer const &)=delete
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:164
bool post_renderables_if_optimizable(RenderableList const &renderlist) override
This will render renderlist to the screen and post the result to the screen if there is a hardware op...
void release_current() override
Releases the current GL render target.
MirMirrorMode mirror_mode() const override
Returns the mirror mode of the display buffer relative to orientation.
Definition: display_buffer.h:35
Definition: egl_resources.h:29
MirMirrorMode
Mirroring axis relative to the "natural" orientation of the display.
Definition: common.h:173
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:134
MirOrientation orientation() const override
Returns the orientation of the display buffer relative to how the user should see it (the orientation...
Definition: display_buffer.h:40
Definition: render_target.h:29
void bind() override
Binds any necessary resources (fbos, textures if any) in preparation for drawing. ...
std::vector< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:79
Definition: rectangle.h:33
NativeDisplayBuffer * native_display_buffer() override
Returns a pointer to the native display buffer object backing this display buffer.
Definition: event.h:30
geometry::Rectangle view_area() const override
The area the DisplayBuffer occupies in the virtual screen space.
void make_current() override
Makes GL render target current to calling thread.

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016