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
1=== modified file 'src/server/graphics/nested/nested_display.cpp'
2--- src/server/graphics/nested/nested_display.cpp 2013-09-12 13:13:23 +0000
3+++ src/server/graphics/nested/nested_display.cpp 2013-09-13 15:54:49 +0000
4@@ -66,22 +66,7 @@
5 BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to initialize EGL."));
6 }
7
8- static const EGLint context_attr[] = {
9- EGL_CONTEXT_CLIENT_VERSION, 2,
10- EGL_NONE
11- };
12-
13- static const EGLint config_attr[] = {
14- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
15- EGL_RED_SIZE, 8,
16- EGL_GREEN_SIZE, 8,
17- EGL_BLUE_SIZE, 8,
18- EGL_ALPHA_SIZE, 0,
19- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
20- EGL_NONE
21- };
22-
23- egl_context_ = eglCreateContext(egl_display, choose_config(config_attr), EGL_NO_CONTEXT, context_attr);
24+ egl_context_ = eglCreateContext(egl_display, choose_config(egl_attribs), EGL_NO_CONTEXT, egl_context_attribs);
25 if (egl_context_ == EGL_NO_CONTEXT)
26 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to create shared EGL context"));
27 }
28@@ -125,11 +110,30 @@
29 event_handler{event_handler},
30 display_report{display_report},
31 egl_display{*connection},
32+ egl_pixel_format{mir_pixel_format_xbgr_8888},
33 outputs{}
34 {
35 egl_display.initialize();
36 eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, egl_display.egl_context());
37 configure(*configuration());
38+
39+
40+ static unsigned const max_formats = 32;
41+ MirPixelFormat formats[max_formats];
42+ unsigned int valid_formats;
43+
44+ mir_connection_get_available_surface_formats(*connection, formats, max_formats, &valid_formats);
45+
46+ // Find an opaque buffer format
47+ for (auto f = formats; f != formats+valid_formats; ++f)
48+ {
49+ if (*f == mir_pixel_format_xbgr_8888 ||
50+ *f == mir_pixel_format_xrgb_8888)
51+ {
52+ egl_pixel_format = *f;
53+ break;
54+ }
55+ }
56 }
57
58 mgn::NestedDisplay::~NestedDisplay() noexcept
59@@ -163,14 +167,13 @@
60 geometry::Rectangle const area{output.top_left, output.modes[output.current_mode_index].size};
61
62 auto const& egl_display_mode = output.modes[output.current_mode_index];
63- auto const egl_display_format = output.pixel_formats[output.current_format_index];
64
65 MirSurfaceParameters const request_params =
66 {
67 "Mir nested display",
68 egl_display_mode.size.width.as_int(),
69 egl_display_mode.size.height.as_int(),
70- MirPixelFormat(egl_display_format),
71+ egl_pixel_format,
72 mir_buffer_usage_hardware,
73 static_cast<uint32_t>(output.id.as_value())
74 };
75
76=== modified file 'src/server/graphics/nested/nested_display.h'
77--- src/server/graphics/nested/nested_display.h 2013-09-12 13:13:23 +0000
78+++ src/server/graphics/nested/nested_display.h 2013-09-13 15:54:49 +0000
79@@ -121,6 +121,7 @@
80 std::shared_ptr<input::EventFilter> const event_handler;
81 std::shared_ptr<DisplayReport> const display_report;
82 detail::EGLDisplayHandle egl_display;
83+ MirPixelFormat egl_pixel_format;
84
85 std::mutex outputs_mutex;
86 std::unordered_map<DisplayConfigurationOutputId, std::shared_ptr<detail::NestedOutput>> outputs;
87
88=== modified file 'src/server/graphics/nested/nested_output.cpp'
89--- src/server/graphics/nested/nested_output.cpp 2013-09-11 13:56:56 +0000
90+++ src/server/graphics/nested/nested_output.cpp 2013-09-13 15:54:49 +0000
91@@ -42,7 +42,7 @@
92 EGL_RED_SIZE, 8,
93 EGL_GREEN_SIZE, 8,
94 EGL_BLUE_SIZE, 8,
95- EGL_ALPHA_SIZE, 8,
96+ EGL_ALPHA_SIZE, 0,
97 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
98 EGL_NONE
99 };

Subscribers

People subscribed via source and target branches