Mir

Merge lp:~alan-griffiths/mir/multiwin-fix-for-nested into lp:mir

Proposed by Alan Griffiths
Status: Superseded
Proposed branch: lp:~alan-griffiths/mir/multiwin-fix-for-nested
Merge into: lp:mir
Diff against target: 99 lines (+23/-19)
3 files modified
src/server/graphics/nested/nested_display.cpp (+21/-18)
src/server/graphics/nested/nested_display.h (+1/-0)
src/server/graphics/nested/nested_output.cpp (+1/-1)
To merge this branch: bzr merge lp:~alan-griffiths/mir/multiwin-fix-for-nested
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Daniel van Vugt Needs Fixing
Alexandros Frantzis (community) Approve
Review via email: mp+185535@code.launchpad.net

This proposal has been superseded by a proposal from 2013-09-16.

Commit message

graphics: fix nested to use opaque buffers for output

Description of the change

graphics: fix nested to use opaque buffers for output

This fixes a problem best seen with ./mir_demo_client_multiwin (where the windows appear invisible unless the alpha is cranked way up in the sourcecode).

To post a comment you must log in.
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Looks good.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I'm concerned we're pulling egl_context_attribs from a different file (nested_output.cpp/h) but it's not clear from the name. You should either retain a local attrib list or name the shared one in a way that makes it more obvious where it's coming from. Maybe use the word "nested".

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/server/graphics/nested/nested_display.cpp'
--- src/server/graphics/nested/nested_display.cpp 2013-09-12 13:13:23 +0000
+++ src/server/graphics/nested/nested_display.cpp 2013-09-13 15:54:49 +0000
@@ -66,22 +66,7 @@
66 BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to initialize EGL."));66 BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to initialize EGL."));
67 }67 }
6868
69 static const EGLint context_attr[] = {69 egl_context_ = eglCreateContext(egl_display, choose_config(egl_attribs), EGL_NO_CONTEXT, egl_context_attribs);
70 EGL_CONTEXT_CLIENT_VERSION, 2,
71 EGL_NONE
72 };
73
74 static const EGLint config_attr[] = {
75 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
76 EGL_RED_SIZE, 8,
77 EGL_GREEN_SIZE, 8,
78 EGL_BLUE_SIZE, 8,
79 EGL_ALPHA_SIZE, 0,
80 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
81 EGL_NONE
82 };
83
84 egl_context_ = eglCreateContext(egl_display, choose_config(config_attr), EGL_NO_CONTEXT, context_attr);
85 if (egl_context_ == EGL_NO_CONTEXT)70 if (egl_context_ == EGL_NO_CONTEXT)
86 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to create shared EGL context"));71 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to create shared EGL context"));
87}72}
@@ -125,11 +110,30 @@
125 event_handler{event_handler},110 event_handler{event_handler},
126 display_report{display_report},111 display_report{display_report},
127 egl_display{*connection},112 egl_display{*connection},
113 egl_pixel_format{mir_pixel_format_xbgr_8888},
128 outputs{}114 outputs{}
129{115{
130 egl_display.initialize();116 egl_display.initialize();
131 eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, egl_display.egl_context());117 eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, egl_display.egl_context());
132 configure(*configuration());118 configure(*configuration());
119
120
121 static unsigned const max_formats = 32;
122 MirPixelFormat formats[max_formats];
123 unsigned int valid_formats;
124
125 mir_connection_get_available_surface_formats(*connection, formats, max_formats, &valid_formats);
126
127 // Find an opaque buffer format
128 for (auto f = formats; f != formats+valid_formats; ++f)
129 {
130 if (*f == mir_pixel_format_xbgr_8888 ||
131 *f == mir_pixel_format_xrgb_8888)
132 {
133 egl_pixel_format = *f;
134 break;
135 }
136 }
133}137}
134138
135mgn::NestedDisplay::~NestedDisplay() noexcept139mgn::NestedDisplay::~NestedDisplay() noexcept
@@ -163,14 +167,13 @@
163 geometry::Rectangle const area{output.top_left, output.modes[output.current_mode_index].size};167 geometry::Rectangle const area{output.top_left, output.modes[output.current_mode_index].size};
164168
165 auto const& egl_display_mode = output.modes[output.current_mode_index];169 auto const& egl_display_mode = output.modes[output.current_mode_index];
166 auto const egl_display_format = output.pixel_formats[output.current_format_index];
167170
168 MirSurfaceParameters const request_params =171 MirSurfaceParameters const request_params =
169 {172 {
170 "Mir nested display",173 "Mir nested display",
171 egl_display_mode.size.width.as_int(),174 egl_display_mode.size.width.as_int(),
172 egl_display_mode.size.height.as_int(),175 egl_display_mode.size.height.as_int(),
173 MirPixelFormat(egl_display_format),176 egl_pixel_format,
174 mir_buffer_usage_hardware,177 mir_buffer_usage_hardware,
175 static_cast<uint32_t>(output.id.as_value())178 static_cast<uint32_t>(output.id.as_value())
176 };179 };
177180
=== modified file 'src/server/graphics/nested/nested_display.h'
--- src/server/graphics/nested/nested_display.h 2013-09-12 13:13:23 +0000
+++ src/server/graphics/nested/nested_display.h 2013-09-13 15:54:49 +0000
@@ -121,6 +121,7 @@
121 std::shared_ptr<input::EventFilter> const event_handler;121 std::shared_ptr<input::EventFilter> const event_handler;
122 std::shared_ptr<DisplayReport> const display_report;122 std::shared_ptr<DisplayReport> const display_report;
123 detail::EGLDisplayHandle egl_display;123 detail::EGLDisplayHandle egl_display;
124 MirPixelFormat egl_pixel_format;
124125
125 std::mutex outputs_mutex;126 std::mutex outputs_mutex;
126 std::unordered_map<DisplayConfigurationOutputId, std::shared_ptr<detail::NestedOutput>> outputs;127 std::unordered_map<DisplayConfigurationOutputId, std::shared_ptr<detail::NestedOutput>> outputs;
127128
=== modified file 'src/server/graphics/nested/nested_output.cpp'
--- src/server/graphics/nested/nested_output.cpp 2013-09-11 13:56:56 +0000
+++ src/server/graphics/nested/nested_output.cpp 2013-09-13 15:54:49 +0000
@@ -42,7 +42,7 @@
42 EGL_RED_SIZE, 8,42 EGL_RED_SIZE, 8,
43 EGL_GREEN_SIZE, 8,43 EGL_GREEN_SIZE, 8,
44 EGL_BLUE_SIZE, 8,44 EGL_BLUE_SIZE, 8,
45 EGL_ALPHA_SIZE, 8,45 EGL_ALPHA_SIZE, 0,
46 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,46 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
47 EGL_NONE47 EGL_NONE
48};48};

Subscribers

People subscribed via source and target branches