Mir

Merge lp:~afrantzis/mir/different-mesa-display-validation-functions into lp:~mir-team/mir/trunk

Proposed by Alexandros Frantzis
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 821
Proposed branch: lp:~afrantzis/mir/different-mesa-display-validation-functions
Merge into: lp:~mir-team/mir/trunk
Diff against target: 172 lines (+17/-31)
7 files modified
include/shared/mir_toolkit/mesa/native_display.h (+1/-2)
src/client/gbm/mesa_native_display_container.cpp (+1/-2)
src/client/gbm/mesa_native_display_container.h (+5/-1)
src/server/graphics/gbm/gbm_platform.cpp (+1/-13)
src/server/graphics/gbm/gbm_platform.h (+2/-0)
tests/unit-tests/client/gbm/test_gbm_client_platform.cpp (+4/-6)
tests/unit-tests/graphics/gbm/test_gbm_platform.cpp (+3/-7)
To merge this branch: bzr merge lp:~afrantzis/mir/different-mesa-display-validation-functions
Reviewer Review Type Date Requested Status
Daniel van Vugt Abstain
Kevin DuBois (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Alan Griffiths Approve
Review via email: mp+173215@code.launchpad.net

Commit message

gbm: Provide different functions for validating server and client Mesa EGL native displays

Description of the change

gbm: Provide different functions for validating server and client Mesa EGL native displays

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

I assume the next step is to make use of these different functions?

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

> I assume the next step is to make use of these different functions?

The related change in Mesa to use these was merged earlier today: https://github.com/RAOF/mesa/pull/2

People will need to upgrade to the new Mesa after this is merged (but they update Mesa can be used even without this change). I will send an email to the mir-devel to notify about the update.

Revision history for this message
Kevin DuBois (kdub) wrote :

+1!

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

Can we find a way to make the new function names less wordy and more consistent?...

mir_server_egl_mesa_display_is_valid(MirMesaEGLNativeDisplay* display)
mir_client_egl_mesa_display_is_valid(MirMesaEGLNativeDisplay* display)

By wordy, I mean they're almost too long. By consistent I mean the words are in a different order in the function name to the parameter: egl_mesa vs MesaEGL

Another inconsistency is use of the word "client". No other client functions do that. So maybe drop "_client_". But admittedly that would be inconsistent too.

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

Following further discussion on IRC, I am not very opinionated on this. Land it when you've made a decision.

review: Abstain

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/shared/mir_toolkit/mesa/native_display.h'
2--- include/shared/mir_toolkit/mesa/native_display.h 2013-06-13 21:24:29 +0000
3+++ include/shared/mir_toolkit/mesa/native_display.h 2013-07-05 14:12:25 +0000
4@@ -52,8 +52,7 @@
5 MirSurfaceParameters* surface_parameters);
6 };
7
8-int mir_egl_mesa_display_is_valid(MirMesaEGLNativeDisplay* display);
9-int mir_server_internal_display_is_valid(MirMesaEGLNativeDisplay* display);
10+typedef int (*MirMesaEGLNativeDisplayIsValidFunc)(MirMesaEGLNativeDisplay* display);
11
12 #ifdef __cplusplus
13 } // extern "C"
14
15=== modified file 'src/client/gbm/mesa_native_display_container.cpp'
16--- src/client/gbm/mesa_native_display_container.cpp 2013-06-13 22:10:04 +0000
17+++ src/client/gbm/mesa_native_display_container.cpp 2013-07-05 14:12:25 +0000
18@@ -18,7 +18,6 @@
19
20 #include "mesa_native_display_container.h"
21
22-#include "mir_toolkit/mesa/native_display.h"
23 #include "mir_toolkit/mir_client_library.h"
24
25 #include <cstring>
26@@ -41,7 +40,7 @@
27 return MIR_MESA_TRUE;
28 }
29
30-int mir_egl_mesa_display_is_valid(MirMesaEGLNativeDisplay* display)
31+int mir_client_egl_mesa_display_is_valid(MirMesaEGLNativeDisplay* display)
32 {
33 return mcl::EGLNativeDisplayContainer::instance().validate(display);
34 }
35
36=== modified file 'src/client/gbm/mesa_native_display_container.h'
37--- src/client/gbm/mesa_native_display_container.h 2013-06-13 22:10:04 +0000
38+++ src/client/gbm/mesa_native_display_container.h 2013-07-05 14:12:25 +0000
39@@ -22,6 +22,7 @@
40 #include "../egl_native_display_container.h"
41
42 #include "mir_toolkit/client_types.h"
43+#include "mir_toolkit/mesa/native_display.h"
44
45 #include <unordered_set>
46 #include <mutex>
47@@ -30,9 +31,9 @@
48 {
49 namespace client
50 {
51-
52 namespace gbm
53 {
54+
55 class MesaNativeDisplayContainer : public EGLNativeDisplayContainer
56 {
57 public:
58@@ -52,6 +53,9 @@
59 std::mutex mutable guard;
60 std::unordered_set<MirEGLNativeDisplayType> valid_displays;
61 };
62+
63+extern "C" int mir_client_egl_mesa_display_is_valid(MirMesaEGLNativeDisplay* display);
64+
65 }
66 }
67 } // namespace mir
68
69=== modified file 'src/server/graphics/gbm/gbm_platform.cpp'
70--- src/server/graphics/gbm/gbm_platform.cpp 2013-07-03 17:48:30 +0000
71+++ src/server/graphics/gbm/gbm_platform.cpp 2013-07-05 14:12:25 +0000
72@@ -153,20 +153,8 @@
73 return std::make_shared<mgg::GBMPlatform>(report, vt);
74 }
75
76-extern "C"
77-{
78-int mir_server_internal_display_is_valid(MirMesaEGLNativeDisplay* display)
79+extern "C" int mir_server_egl_mesa_display_is_valid(MirMesaEGLNativeDisplay* display)
80 {
81 return ((mgg::GBMPlatform::internal_display_clients_present) &&
82 (display == mgg::GBMPlatform::internal_native_display.get()));
83 }
84-
85-/* TODO: this function is a bit fragile because libmirserver and libmirclient both have very different
86- * implementations and both have symbols for it.
87- * bug filed: lp:1177902
88- */
89-int mir_egl_mesa_display_is_valid(MirMesaEGLNativeDisplay* display)
90-{
91- return mir_server_internal_display_is_valid(display);
92-}
93-}
94
95=== modified file 'src/server/graphics/gbm/gbm_platform.h'
96--- src/server/graphics/gbm/gbm_platform.h 2013-06-21 07:47:57 +0000
97+++ src/server/graphics/gbm/gbm_platform.h 2013-07-05 14:12:25 +0000
98@@ -68,6 +68,8 @@
99 static std::shared_ptr<InternalNativeDisplay> internal_native_display;
100 };
101
102+extern "C" int mir_server_egl_mesa_display_is_valid(MirMesaEGLNativeDisplay* display);
103+
104 }
105 }
106 }
107
108=== modified file 'tests/unit-tests/client/gbm/test_gbm_client_platform.cpp'
109--- tests/unit-tests/client/gbm/test_gbm_client_platform.cpp 2013-06-05 22:52:53 +0000
110+++ tests/unit-tests/client/gbm/test_gbm_client_platform.cpp 2013-07-05 14:12:25 +0000
111@@ -18,6 +18,7 @@
112
113 #include "src/client/client_platform.h"
114 #include "src/client/native_client_platform_factory.h"
115+#include "src/client/gbm/mesa_native_display_container.h"
116 #include "mir_test_doubles/mock_client_context.h"
117 #include "mir_test_doubles/mock_client_surface.h"
118
119@@ -26,13 +27,10 @@
120 #include <gtest/gtest.h>
121
122 namespace mcl = mir::client;
123+namespace mclg = mir::client::gbm;
124 namespace mt = mir::test;
125 namespace mtd = mir::test::doubles;
126
127-/* TODO: mir_egl_mesa_display_is_valid is a bit fragile because libmirserver and libmirclient both have very
128- * different implementations and both have symbols for it. If the linking order of the test changes,
129- * specifically, if mir_egl_mesa_display_is_valid resolves into libmirserver, then this test will break.
130- */
131 TEST(GBMClientPlatformTest, egl_native_display_is_valid_until_released)
132 {
133 mtd::MockClientContext context;
134@@ -44,7 +42,7 @@
135 std::shared_ptr<EGLNativeDisplayType> native_display = platform->create_egl_native_display();
136
137 nd = reinterpret_cast<MirMesaEGLNativeDisplay*>(*native_display);
138- EXPECT_TRUE(mir_egl_mesa_display_is_valid(nd));
139+ EXPECT_TRUE(mclg::mir_client_egl_mesa_display_is_valid(nd));
140 }
141- EXPECT_FALSE(mir_egl_mesa_display_is_valid(nd));
142+ EXPECT_FALSE(mclg::mir_client_egl_mesa_display_is_valid(nd));
143 }
144
145=== modified file 'tests/unit-tests/graphics/gbm/test_gbm_platform.cpp'
146--- tests/unit-tests/graphics/gbm/test_gbm_platform.cpp 2013-07-01 06:53:02 +0000
147+++ tests/unit-tests/graphics/gbm/test_gbm_platform.cpp 2013-07-05 14:12:25 +0000
148@@ -190,21 +190,17 @@
149 }, std::runtime_error);
150 }
151
152-/* TODO: this function is a bit fragile because libmirserver and libmirclient both have very different
153- * implementations and both have symbols for it. If the linking order of the test changes,
154- * specifically, if mir_egl_mesa_display_is_valid resolves into libmirclient, then this test will break.
155- */
156 TEST_F(GBMGraphicsPlatform, platform_provides_validation_of_display_for_internal_clients)
157 {
158 MirMesaEGLNativeDisplay* native_display = nullptr;
159- EXPECT_EQ(0, mir_server_internal_display_is_valid(native_display));
160+ EXPECT_EQ(0, mgg::mir_server_egl_mesa_display_is_valid(native_display));
161 {
162 auto platform = create_platform();
163 auto client = platform->create_internal_client();
164 native_display = reinterpret_cast<MirMesaEGLNativeDisplay*>(client->egl_native_display());
165- EXPECT_EQ(1, mir_server_internal_display_is_valid(native_display));
166+ EXPECT_EQ(1, mgg::mir_server_egl_mesa_display_is_valid(native_display));
167 }
168- EXPECT_EQ(0, mir_server_internal_display_is_valid(native_display));
169+ EXPECT_EQ(0, mgg::mir_server_egl_mesa_display_is_valid(native_display));
170 }
171
172 namespace

Subscribers

People subscribed via source and target branches