Merge lp:~kdub/mir/gbm-ext-v2 into lp:mir
- gbm-ext-v2
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Daniel van Vugt |
Approved revision: | no longer in the source branch. |
Merged at revision: | 4088 |
Proposed branch: | lp:~kdub/mir/gbm-ext-v2 |
Merge into: | lp:mir |
Diff against target: |
537 lines (+349/-15) 6 files modified
include/client/mir_toolkit/extensions/gbm_buffer.h (+90/-0) src/platforms/mesa/client/client_buffer.cpp (+8/-4) src/platforms/mesa/client/client_platform.cpp (+149/-5) src/platforms/mesa/client/client_platform.h (+2/-1) src/platforms/mesa/include/native_buffer.h (+3/-0) tests/unit-tests/platforms/mesa/client/test_client_platform.cpp (+97/-5) |
To merge this branch: | bzr merge lp:~kdub/mir/gbm-ext-v2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andreas Pokorny (community) | Approve | ||
Alan Griffiths | Approve | ||
Daniel van Vugt | Needs Fixing | ||
Mir CI Bot | continuous-integration | Approve | |
Chris Halse Rogers | Approve | ||
Cemil Azizoglu (community) | Approve | ||
Review via email: mp+317620@code.launchpad.net |
Commit message
add MirExtensionGbm
Integrated with the 'rs' platform (in the current naming) Mesa patch on the ML.
Description of the change
add MirExtensionGbm
Integrated with the 'rs' platform (in the current naming) Mesa patch on the ML.
Also, spent some time considering whether the extension should just return a gbm_bo*. This was a bit disadvantageous, because we'd have to link the mesa client plugin to gbm (which it currently doesn't need), and we would need a fair amount of plumbing work to get a gbm_device on the client side.
Mir CI Bot (mir-ci-bot) wrote : | # |
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
Looks good. Some minor typos.
return comment is wrong.
41 +/** Access the import fd a MirBuffer
42 + * \pre The buffer is suitable for GBM_BO_IMPORT_FD
43 + * \warning The fd is owned by the buffer. Do not close() it.
44 + * \param [in] buffer The buffer
45 + * \return The stride of the buffer
46 + */
47 +typedef int (*MirBufferExtF
-------
s/Check/Get
49 +/** Check the stride of a MirBuffer
50 + * \pre The buffer is suitable for GBM_BO_IMPORT_FD
51 + * \param [in] buffer The buffer
52 + * \return The stride of the buffer
53 + */
54 +typedef uint32_t (*MirBufferExtS
56 +/** Check the GBM_FORMAT of a MirBuffer
57 + * \pre The buffer is suitable for GBM_BO_IMPORT_FD
58 + * \param [in] buffer The buffer
59 + * \return The GBM_FORMAT of the buffer
60 + */
61 +typedef uint32_t (*MirBufferExtF
-------
s/Check the gbm_bo_flags/Get buffer's age
70 +/** Check the gbm_bo_flags of a MirBuffer
71 + * \pre The buffer is suitable for GBM_BO_IMPORT_FD
72 + * \param [in] buffer The buffer
73 + * \return The age of the buffer
74 + */
75 +typedef uint64_t (*MirBufferExtA
76
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4041
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Chris Halse Rogers (raof) wrote : | # |
This:
- gbm_buffer{
+ gbm_buffer1{
+ gbm_buffer2{
+ is_gbm_importable, import_fd, buffer_stride, buffer_format, buffer_flags, buffer_age},
is unnecessary; just change the type of gbm_buffer to MirExtensionGbm
Likewise,
if (!strcmp(
- return &gbm_buffer;
+ return &gbm_buffer1;
+ if (!strcmp(
+ return &gbm_buffer2;
Is unnecessary; just check for version <= 2, and return gbm_buffer.
Otherwise looks good!
Kevin DuBois (kdub) wrote : | # |
good point, changing code accordingly
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:4043
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Chris Halse Rogers (raof) wrote : | # |
(Non-blocking)
+}
+catch (...)
+{
+ return INT64_MAX;
+}
Probably (slightly) safer to return 0 here - 0 means the contents are undefined, so the client will have to do more work but is guaranteed to render correctly.
Also, uint64_t? This is almost always going to have a range of 0-3, and cannot possibly go beyond the tens of thousands (buffers will be on the order of megabytes, we're definitely not going to give a client > 10GB of VRAM just for window buffers!)
Is there a reason you picked uint64_t rather than uint32_t?
Daniel van Vugt (vanvugt) wrote : | # |
I agree with the above nit. It's a count of frames so even to exceed uint32 on a 60Hz display will take 2.2 years. A client would have to remember what it rendered 2.2 years ago. So 32-bits is plenty and we also don't need an explicit bit size. Just make it "unsigned int".
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4045
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Daniel van Vugt (vanvugt) wrote : | # |
Still seems like we're playing fast and loose with integer types:
* age is uint32 but never needs to be anything larger than a uint.
* width and height are 'int' but gbm.h uses uint32_t for them.
Please consider:
(1) Removing the "32" from MirBufferExtAge unless the implementation is explicitly limited to 32-bits.
(2) Converting width and height from int to uint32_t (since that's what gbm.h uses?).
We've all been guilty of choosing wrong integer types in the past, but if we're in the business of redesigning existing interfaces then at least the new design should be more correct.
Daniel van Vugt (vanvugt) wrote : | # |
(3) Shouldn't format and flags be uint32 too?
struct gbm_bo *
gbm_bo_
Daniel van Vugt (vanvugt) wrote : | # |
(4) Does MirConnectionAl
Daniel van Vugt (vanvugt) wrote : | # |
Oh you answered (4) in the description, sorry.
Just (1)-(3) then please.
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4047
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Kevin DuBois (kdub) wrote : | # |
sure, fixed. In fixing the signature of the async buffer allocation function, had to go back to having 2 structs as extensions here.
Daniel van Vugt (vanvugt) wrote : | # |
(5) A bunch of these functions take MirBuffer as an 'in' parameter only so should take const pointers, no?
typedef uint32_t (*MirBufferExtF
(6) Given the header is GBM-specific, is it a good idea to define callback types that are not GBM-specific in name inside it?
Kevin DuBois (kdub) wrote : | # |
5) ideally, but not done in other similar situations so I'd rather just leave as-is.
6) sure, (guessing you mean MirBufferExtFd should be MirBufferGbmFd, functions aren't callbacks)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4049
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4050
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Daniel van Vugt (vanvugt) wrote : | # |
(5) I would ignore other extensions as prior art. Those haven't been around as long as the rest of the project where we do use "const" more correctly, so should use const correctly (at least on parameters).
(6) The new naming convention sounds confusing and looks weakly typed:
typedef uint32_t (*MirBufferGbmS
What if 'buffer' is not a GBM buffer?
I'm starting to think that the client producing its own gbm_bo might be the right answer. We would have fewer functions, less confusion and stronger typing. Admittedly with some additional linkage and the client would need to specify a gbm_device. But maybe that's a good thing in a multi-GPU world. I also wonder how this plays with RAOF's multi-GPU work in progress...
Daniel van Vugt (vanvugt) wrote : | # |
(7) I should have picked a different function in (6) because I have another question...
typedef uint32_t (*MirBufferGbmS
Why isn't there a generic mir_buffer_
(8) Does it make sense for a buffer's age to be queried without any context?;
typedef unsigned int (*MirBufferGbmA
You may be using a buffer in two or more different rendering contexts so it can have a different age for each. I don't think MirBufferGbmAge() makes sense.
Daniel van Vugt (vanvugt) wrote : | # |
(8) I forgot 'age' is relative to the producer (singular) and not its consumers, so it makes a little bit of sense. Although I'm not 100% convinced that age should ever be an attribute 'of' or internal to a MirBuffer. It's really an external attribute that emerges from the swapping logic, and is only associated with a buffer in the local producer context.
Kevin DuBois (kdub) wrote : | # |
5) If we add const to this extension, we have some MirBuffer-related functions that have const and others that don't. This seems worse (in terms of update cost or mismatched signatures) than leaving as-is.
6) It is a precondition that the MirBuffer is a a GBM buffer. Stronger typing would get us in trouble with how the buffers get submitted.
7) Stride for buffer was rejected. https:/
8) Sounds like its alright as it is then? The mesa driver makes use of it now, if the mesa driver implements that logic, it can go away.
Daniel van Vugt (vanvugt) wrote : | # |
I'm not convinced (5) and (8) are adequately resolved.
(5) If we make a plan to fix lack of const in 'MirBuffer *' everywhere soon, then OK. If you can change it to "const" in the below diff right now without breaking existing code then please do it before this lands.
(8) Similarly if we can cull that function and existing code still works, please do so. I'm not convinced we have the right design for handling 'age'. It's also not an important feature -- both uses of buffer age in toolkits I've ever seen were buggy and had to avoid it in the end.
Daniel van Vugt (vanvugt) wrote : | # |
(6) is also unconvincing. We shouldn't be designing new APIs that accept MirBuffer* yet implicitly only work on GBM buffers. This would be resolved by forcing the client side to provide gbm_bo. If the extension is for "GBM" then it's perfectly reasonable that users of it will link to GBM and be using gbm.h. If however you can get away with abstracting out gbm.h entirely as you have, then in theory we can get away from calling anything in it "GBM". It should therefore either be a more abstract interface (not mention "GBM" at all) or less abstract interface and use gbm_bo directly.
I feel this GBM v2 extension will soon need to be deprecated and replaced by a v3. However I also don't have sufficient interest in this area of code to stand in the way. Rapid deprecation and redesigns might be the fastest way forward. If any reviewer disagrees with my comments then go ahead and land it...
Kevin DuBois (kdub) wrote : | # |
5) We agree that const* would have been better, but I don't intend to fix it in this MP, as it needs updating elsewhere. I can follow up with an MP that updates everything. (I don't think adding const to the parameter breaks abi or api).
6) Linking to gbm is prohibitive in terms of the existing code. We would not only have to link to the gbm library, but plumb through fds to get the gbm device initialized. Also, the gbm initialization is currently in the mir/rs egl driver, and its not the intention of this MP to change that. The intention is to deprecate MirBufferPackage.
8) It is used to get the egl driver working, so it cannot be culled at this time, unless logic is moved (much the same story as linking to gbm).
I don't mind if we follow up with a v3, and we will have to anyways in the mid-near future when we add gbm buffer import (https:/
The goal here is to get rid of MirBufferPackage before the next upload to our mesa driver.
Kevin DuBois (kdub) wrote : | # |
Preview Diff
1 | === modified file 'include/client/mir_toolkit/extensions/gbm_buffer.h' | |||
2 | --- include/client/mir_toolkit/extensions/gbm_buffer.h 2017-02-15 07:38:33 +0000 | |||
3 | +++ include/client/mir_toolkit/extensions/gbm_buffer.h 2017-03-10 16:32:19 +0000 | |||
4 | @@ -29,6 +29,8 @@ | |||
5 | 29 | 29 | ||
6 | 30 | /** Allocate a MirBuffer via gbm | 30 | /** Allocate a MirBuffer via gbm |
7 | 31 | * | 31 | * |
8 | 32 | * available in V1 and V2. | ||
9 | 33 | * | ||
10 | 32 | * The callback will be called when the buffer is available for use. | 34 | * The callback will be called when the buffer is available for use. |
11 | 33 | * It will be called once when created, and once per every | 35 | * It will be called once when created, and once per every |
12 | 34 | * mir_presentation_chain_submit_buffer. | 36 | * mir_presentation_chain_submit_buffer. |
13 | @@ -53,6 +55,15 @@ | |||
14 | 53 | unsigned int gbm_bo_flags, | 55 | unsigned int gbm_bo_flags, |
15 | 54 | MirBufferCallback available_callback, void* available_context); | 56 | MirBufferCallback available_callback, void* available_context); |
16 | 55 | 57 | ||
17 | 58 | /** v2 version of mir_connection_allocate_buffer_gbm, with more accurate types. | ||
18 | 59 | */ | ||
19 | 60 | typedef void (*MirConnectionAllocateBufferGbm)( | ||
20 | 61 | MirConnection* connection, | ||
21 | 62 | uint32_t width, uint32_t height, | ||
22 | 63 | uint32_t gbm_pixel_format, | ||
23 | 64 | uint32_t gbm_bo_flags, | ||
24 | 65 | MirBufferCallback available_callback, void* available_context); | ||
25 | 66 | |||
26 | 56 | typedef struct MirExtensionGbmBufferV1 | 67 | typedef struct MirExtensionGbmBufferV1 |
27 | 57 | { | 68 | { |
28 | 58 | mir_connection_allocate_buffer_gbm allocate_buffer_gbm; | 69 | mir_connection_allocate_buffer_gbm allocate_buffer_gbm; |
29 | @@ -65,6 +76,85 @@ | |||
30 | 65 | connection, "mir_extension_gbm_buffer", 1); | 76 | connection, "mir_extension_gbm_buffer", 1); |
31 | 66 | } | 77 | } |
32 | 67 | 78 | ||
33 | 79 | /** Allocate a MirBuffer via gbm and wait for the allocation. | ||
34 | 80 | * available in V2. | ||
35 | 81 | * The buffer can be destroyed via mir_buffer_release(). | ||
36 | 82 | * | ||
37 | 83 | * \param [in] connection The connection | ||
38 | 84 | * \param [in] width Requested buffer width | ||
39 | 85 | * \param [in] height Requested buffer height | ||
40 | 86 | * \param [in] gbm_pixel_format The pixel format, one of the GBM_FORMATs | ||
41 | 87 | * \param [in] gbm_bo_flags The gbm_bo_flags for the buffer. | ||
42 | 88 | * \return The buffer | ||
43 | 89 | **/ | ||
44 | 90 | typedef MirBuffer* (*MirConnectionAllocateBufferGbmSync)( | ||
45 | 91 | MirConnection* connection, | ||
46 | 92 | uint32_t width, uint32_t height, | ||
47 | 93 | uint32_t gbm_pixel_format, | ||
48 | 94 | uint32_t gbm_bo_flags); | ||
49 | 95 | |||
50 | 96 | /** Check if a MirBuffer is suitable for import via GBM_BO_IMPORT_FD | ||
51 | 97 | * | ||
52 | 98 | * \param [in] buffer The buffer | ||
53 | 99 | * \return True if suitable, false if unsuitable | ||
54 | 100 | */ | ||
55 | 101 | typedef bool (*MirBufferIsGbmImportable)(MirBuffer* buffer); | ||
56 | 102 | |||
57 | 103 | /** Access the fd a MirBuffer suitable for gbm import | ||
58 | 104 | * \pre The buffer is suitable for GBM_BO_IMPORT_FD | ||
59 | 105 | * \warning The fd is owned by the buffer. Do not close() it. | ||
60 | 106 | * \param [in] buffer The buffer | ||
61 | 107 | * \return The fd | ||
62 | 108 | */ | ||
63 | 109 | typedef int (*MirBufferGbmFd)(MirBuffer* buffer); | ||
64 | 110 | |||
65 | 111 | /** Get the stride of a MirBuffer | ||
66 | 112 | * \pre The buffer is suitable for GBM_BO_IMPORT_FD | ||
67 | 113 | * \param [in] buffer The buffer | ||
68 | 114 | * \return The stride of the buffer | ||
69 | 115 | */ | ||
70 | 116 | typedef uint32_t (*MirBufferGbmStride)(MirBuffer* buffer); | ||
71 | 117 | |||
72 | 118 | /** Get the GBM_FORMAT of a MirBuffer | ||
73 | 119 | * \pre The buffer is suitable for GBM_BO_IMPORT_FD | ||
74 | 120 | * \param [in] buffer The buffer | ||
75 | 121 | * \return The GBM_FORMAT of the buffer | ||
76 | 122 | */ | ||
77 | 123 | typedef uint32_t (*MirBufferGbmFormat)(MirBuffer* buffer); | ||
78 | 124 | |||
79 | 125 | /** Get the gbm_bo_flags of a MirBuffer | ||
80 | 126 | * \pre The buffer is suitable for GBM_BO_IMPORT_FD | ||
81 | 127 | * \param [in] buffer The buffer | ||
82 | 128 | * \return The gbm_bo_flags of the buffer | ||
83 | 129 | */ | ||
84 | 130 | typedef uint32_t (*MirBufferGbmFlags)(MirBuffer* buffer); | ||
85 | 131 | |||
86 | 132 | /** Get the age of a MirBuffer | ||
87 | 133 | * \pre The buffer is suitable for GBM_BO_IMPORT_FD | ||
88 | 134 | * \param [in] buffer The buffer | ||
89 | 135 | * \return The age of the buffer | ||
90 | 136 | */ | ||
91 | 137 | typedef unsigned int (*MirBufferGbmAge)(MirBuffer* buffer); | ||
92 | 138 | |||
93 | 139 | typedef struct MirExtensionGbmBufferV2 | ||
94 | 140 | { | ||
95 | 141 | MirConnectionAllocateBufferGbm allocate_buffer_gbm; | ||
96 | 142 | MirConnectionAllocateBufferGbmSync allocate_buffer_gbm_sync; | ||
97 | 143 | MirBufferIsGbmImportable is_gbm_importable; | ||
98 | 144 | MirBufferGbmFd fd; | ||
99 | 145 | MirBufferGbmStride stride; | ||
100 | 146 | MirBufferGbmFormat format; | ||
101 | 147 | MirBufferGbmFlags flags; | ||
102 | 148 | MirBufferGbmAge age; | ||
103 | 149 | } MirExtensionGbmBufferV2; | ||
104 | 150 | |||
105 | 151 | static inline MirExtensionGbmBufferV2 const* mir_extension_gbm_buffer_v2( | ||
106 | 152 | MirConnection* connection) | ||
107 | 153 | { | ||
108 | 154 | return (MirExtensionGbmBufferV2 const*) mir_connection_request_extension( | ||
109 | 155 | connection, "mir_extension_gbm_buffer", 2); | ||
110 | 156 | } | ||
111 | 157 | |||
112 | 68 | #ifdef __cplusplus | 158 | #ifdef __cplusplus |
113 | 69 | } | 159 | } |
114 | 70 | #endif | 160 | #endif |
115 | 71 | 161 | ||
116 | === modified file 'src/platforms/mesa/client/client_buffer.cpp' | |||
117 | --- src/platforms/mesa/client/client_buffer.cpp 2017-02-15 07:38:33 +0000 | |||
118 | +++ src/platforms/mesa/client/client_buffer.cpp 2017-03-10 16:32:19 +0000 | |||
119 | @@ -76,10 +76,14 @@ | |||
120 | 76 | size_t const size_in_bytes; | 76 | size_t const size_in_bytes; |
121 | 77 | }; | 77 | }; |
122 | 78 | 78 | ||
124 | 79 | std::shared_ptr<mir::graphics::mesa::NativeBuffer> to_native_buffer(MirBufferPackage const& package) | 79 | std::shared_ptr<mir::graphics::mesa::NativeBuffer> to_native_buffer( |
125 | 80 | MirBufferPackage const& package, bool gbm, uint32_t native_format, uint32_t native_flags) | ||
126 | 80 | { | 81 | { |
127 | 81 | auto buffer = std::make_shared<mir::graphics::mesa::NativeBuffer>(); | 82 | auto buffer = std::make_shared<mir::graphics::mesa::NativeBuffer>(); |
128 | 82 | *static_cast<MirBufferPackage*>(buffer.get()) = package; | 83 | *static_cast<MirBufferPackage*>(buffer.get()) = package; |
129 | 84 | buffer->is_gbm_buffer = gbm; | ||
130 | 85 | buffer->native_format = native_format; | ||
131 | 86 | buffer->native_flags = native_flags; | ||
132 | 83 | return buffer; | 87 | return buffer; |
133 | 84 | } | 88 | } |
134 | 85 | 89 | ||
135 | @@ -90,7 +94,7 @@ | |||
136 | 90 | std::shared_ptr<MirBufferPackage> const& package, | 94 | std::shared_ptr<MirBufferPackage> const& package, |
137 | 91 | geom::Size size, MirPixelFormat pf) : | 95 | geom::Size size, MirPixelFormat pf) : |
138 | 92 | buffer_file_ops{buffer_file_ops}, | 96 | buffer_file_ops{buffer_file_ops}, |
140 | 93 | creation_package{to_native_buffer(*package)}, | 97 | creation_package{to_native_buffer(*package, false, 0, 0)}, |
141 | 94 | rect({geom::Point{0, 0}, size}), | 98 | rect({geom::Point{0, 0}, size}), |
142 | 95 | buffer_pf{pf}, | 99 | buffer_pf{pf}, |
143 | 96 | egl_image_attrs{ | 100 | egl_image_attrs{ |
144 | @@ -117,9 +121,9 @@ | |||
145 | 117 | std::shared_ptr<BufferFileOps> const& buffer_file_ops, | 121 | std::shared_ptr<BufferFileOps> const& buffer_file_ops, |
146 | 118 | std::shared_ptr<MirBufferPackage> const& package, | 122 | std::shared_ptr<MirBufferPackage> const& package, |
147 | 119 | geometry::Size size, | 123 | geometry::Size size, |
149 | 120 | unsigned int native_pf, unsigned int /*native_flags*/) : | 124 | unsigned int native_pf, unsigned int native_flags) : |
150 | 121 | buffer_file_ops{buffer_file_ops}, | 125 | buffer_file_ops{buffer_file_ops}, |
152 | 122 | creation_package{to_native_buffer(*package)}, | 126 | creation_package{to_native_buffer(*package, true, native_pf, native_flags)}, |
153 | 123 | rect({geom::Point{0, 0}, size}), | 127 | rect({geom::Point{0, 0}, size}), |
154 | 124 | buffer_pf{mir::graphics::mesa::gbm_format_to_mir_format(native_pf)}, | 128 | buffer_pf{mir::graphics::mesa::gbm_format_to_mir_format(native_pf)}, |
155 | 125 | egl_image_attrs{ | 129 | egl_image_attrs{ |
156 | 126 | 130 | ||
157 | === modified file 'src/platforms/mesa/client/client_platform.cpp' | |||
158 | --- src/platforms/mesa/client/client_platform.cpp 2017-02-15 07:38:33 +0000 | |||
159 | +++ src/platforms/mesa/client/client_platform.cpp 2017-03-10 16:32:19 +0000 | |||
160 | @@ -23,7 +23,9 @@ | |||
161 | 23 | #include "native_surface.h" | 23 | #include "native_surface.h" |
162 | 24 | #include "mir/client_buffer_factory.h" | 24 | #include "mir/client_buffer_factory.h" |
163 | 25 | #include "mir/client_context.h" | 25 | #include "mir/client_context.h" |
164 | 26 | #include "mir/client_buffer.h" | ||
165 | 26 | #include "mir/mir_render_surface.h" | 27 | #include "mir/mir_render_surface.h" |
166 | 28 | #include "mir/mir_buffer.h" | ||
167 | 27 | #include "mir/weak_egl.h" | 29 | #include "mir/weak_egl.h" |
168 | 28 | #include "mir/platform_message.h" | 30 | #include "mir/platform_message.h" |
169 | 29 | #include "mir_toolkit/mesa/platform_operation.h" | 31 | #include "mir_toolkit/mesa/platform_operation.h" |
170 | @@ -33,6 +35,8 @@ | |||
171 | 33 | #include <boost/throw_exception.hpp> | 35 | #include <boost/throw_exception.hpp> |
172 | 34 | #include <stdexcept> | 36 | #include <stdexcept> |
173 | 35 | #include <cstring> | 37 | #include <cstring> |
174 | 38 | #include <mutex> | ||
175 | 39 | #include <condition_variable> | ||
176 | 36 | 40 | ||
177 | 37 | namespace mgm=mir::graphics::mesa; | 41 | namespace mgm=mir::graphics::mesa; |
178 | 38 | namespace mcl=mir::client; | 42 | namespace mcl=mir::client; |
179 | @@ -123,9 +127,9 @@ | |||
180 | 123 | 127 | ||
181 | 124 | void allocate_buffer_gbm( | 128 | void allocate_buffer_gbm( |
182 | 125 | MirConnection* connection, | 129 | MirConnection* connection, |
186 | 126 | int width, int height, | 130 | uint32_t width, uint32_t height, |
187 | 127 | unsigned int gbm_pixel_format, | 131 | uint32_t gbm_pixel_format, |
188 | 128 | unsigned int gbm_bo_flags, | 132 | uint32_t gbm_bo_flags, |
189 | 129 | MirBufferCallback available_callback, void* available_context) | 133 | MirBufferCallback available_callback, void* available_context) |
190 | 130 | { | 134 | { |
191 | 131 | auto context = mcl::to_client_context(connection); | 135 | auto context = mcl::to_client_context(connection); |
192 | @@ -134,6 +138,142 @@ | |||
193 | 134 | available_callback, available_context); | 138 | available_callback, available_context); |
194 | 135 | } | 139 | } |
195 | 136 | 140 | ||
196 | 141 | void allocate_buffer_gbm_legacy( | ||
197 | 142 | MirConnection* connection, | ||
198 | 143 | int width, int height, | ||
199 | 144 | unsigned int gbm_pixel_format, | ||
200 | 145 | unsigned int gbm_bo_flags, | ||
201 | 146 | MirBufferCallback available_callback, void* available_context) | ||
202 | 147 | { | ||
203 | 148 | allocate_buffer_gbm( | ||
204 | 149 | connection, static_cast<uint32_t>(width), static_cast<uint32_t>(height), | ||
205 | 150 | static_cast<uint32_t>(gbm_pixel_format), static_cast<uint32_t>(gbm_bo_flags), | ||
206 | 151 | available_callback, available_context); | ||
207 | 152 | } | ||
208 | 153 | |||
209 | 154 | MirBuffer* allocate_buffer_gbm_sync( | ||
210 | 155 | MirConnection* connection, | ||
211 | 156 | uint32_t width, uint32_t height, | ||
212 | 157 | uint32_t gbm_pixel_format, | ||
213 | 158 | uint32_t gbm_bo_flags) | ||
214 | 159 | try | ||
215 | 160 | { | ||
216 | 161 | struct BufferSync | ||
217 | 162 | { | ||
218 | 163 | void set_buffer(MirBuffer* b) | ||
219 | 164 | { | ||
220 | 165 | std::unique_lock<decltype(mutex)> lk(mutex); | ||
221 | 166 | buffer = b; | ||
222 | 167 | cv.notify_all(); | ||
223 | 168 | } | ||
224 | 169 | |||
225 | 170 | MirBuffer* wait_for_buffer() | ||
226 | 171 | { | ||
227 | 172 | std::unique_lock<decltype(mutex)> lk(mutex); | ||
228 | 173 | cv.wait(lk, [this]{ return buffer; }); | ||
229 | 174 | return buffer; | ||
230 | 175 | } | ||
231 | 176 | private: | ||
232 | 177 | std::mutex mutex; | ||
233 | 178 | std::condition_variable cv; | ||
234 | 179 | MirBuffer* buffer = nullptr; | ||
235 | 180 | } sync; | ||
236 | 181 | |||
237 | 182 | allocate_buffer_gbm( | ||
238 | 183 | connection, width, height, gbm_pixel_format, gbm_bo_flags, | ||
239 | 184 | [](auto* b, auto* context){ reinterpret_cast<BufferSync*>(context)->set_buffer(b); }, &sync); | ||
240 | 185 | return sync.wait_for_buffer(); | ||
241 | 186 | } | ||
242 | 187 | catch (...) | ||
243 | 188 | { | ||
244 | 189 | return nullptr; | ||
245 | 190 | } | ||
246 | 191 | |||
247 | 192 | bool is_gbm_importable(MirBuffer* b) | ||
248 | 193 | try | ||
249 | 194 | { | ||
250 | 195 | if (!b) | ||
251 | 196 | return false; | ||
252 | 197 | auto buffer = reinterpret_cast<mcl::MirBuffer*>(b); | ||
253 | 198 | auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get()); | ||
254 | 199 | if (!native) | ||
255 | 200 | return false; | ||
256 | 201 | return native->is_gbm_buffer; | ||
257 | 202 | } | ||
258 | 203 | catch (...) | ||
259 | 204 | { | ||
260 | 205 | return false; | ||
261 | 206 | } | ||
262 | 207 | |||
263 | 208 | int import_fd(MirBuffer* b) | ||
264 | 209 | try | ||
265 | 210 | { | ||
266 | 211 | if (!is_gbm_importable(b)) | ||
267 | 212 | return -1; | ||
268 | 213 | auto buffer = reinterpret_cast<mcl::MirBuffer*>(b); | ||
269 | 214 | auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get()); | ||
270 | 215 | return native->fd[0]; | ||
271 | 216 | } | ||
272 | 217 | catch (...) | ||
273 | 218 | { | ||
274 | 219 | return -1; | ||
275 | 220 | } | ||
276 | 221 | |||
277 | 222 | uint32_t buffer_stride(MirBuffer* b) | ||
278 | 223 | try | ||
279 | 224 | { | ||
280 | 225 | if (!is_gbm_importable(b)) | ||
281 | 226 | return 0; | ||
282 | 227 | auto buffer = reinterpret_cast<mcl::MirBuffer*>(b); | ||
283 | 228 | auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get()); | ||
284 | 229 | return native->stride; | ||
285 | 230 | } | ||
286 | 231 | catch (...) | ||
287 | 232 | { | ||
288 | 233 | return 0; | ||
289 | 234 | } | ||
290 | 235 | |||
291 | 236 | uint32_t buffer_format(MirBuffer* b) | ||
292 | 237 | try | ||
293 | 238 | { | ||
294 | 239 | if (!is_gbm_importable(b)) | ||
295 | 240 | return 0; | ||
296 | 241 | auto buffer = reinterpret_cast<mcl::MirBuffer*>(b); | ||
297 | 242 | auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get()); | ||
298 | 243 | return native->native_format; | ||
299 | 244 | } | ||
300 | 245 | catch (...) | ||
301 | 246 | { | ||
302 | 247 | return 0; | ||
303 | 248 | } | ||
304 | 249 | |||
305 | 250 | uint32_t buffer_flags(MirBuffer* b) | ||
306 | 251 | try | ||
307 | 252 | { | ||
308 | 253 | if (!is_gbm_importable(b)) | ||
309 | 254 | return 0; | ||
310 | 255 | auto buffer = reinterpret_cast<mcl::MirBuffer*>(b); | ||
311 | 256 | auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get()); | ||
312 | 257 | return native->native_flags; | ||
313 | 258 | } | ||
314 | 259 | catch (...) | ||
315 | 260 | { | ||
316 | 261 | return 0; | ||
317 | 262 | } | ||
318 | 263 | |||
319 | 264 | unsigned int buffer_age(MirBuffer* b) | ||
320 | 265 | try | ||
321 | 266 | { | ||
322 | 267 | if (!is_gbm_importable(b)) | ||
323 | 268 | return 0; | ||
324 | 269 | auto buffer = reinterpret_cast<mcl::MirBuffer*>(b); | ||
325 | 270 | auto native = dynamic_cast<mgm::NativeBuffer*>(buffer->client_buffer()->native_buffer_handle().get()); | ||
326 | 271 | return native->age; | ||
327 | 272 | } | ||
328 | 273 | catch (...) | ||
329 | 274 | { | ||
330 | 275 | return 0; | ||
331 | 276 | } | ||
332 | 137 | #pragma GCC diagnostic push | 277 | #pragma GCC diagnostic push |
333 | 138 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | 278 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
334 | 139 | MirBufferStream* get_hw_stream( | 279 | MirBufferStream* get_hw_stream( |
335 | @@ -164,7 +304,9 @@ | |||
336 | 164 | gbm_dev{nullptr}, | 304 | gbm_dev{nullptr}, |
337 | 165 | drm_extensions{auth_fd_ext, auth_magic_ext}, | 305 | drm_extensions{auth_fd_ext, auth_magic_ext}, |
338 | 166 | mesa_auth{set_device, this}, | 306 | mesa_auth{set_device, this}, |
340 | 167 | gbm_buffer{allocate_buffer_gbm}, | 307 | gbm_buffer1{allocate_buffer_gbm_legacy}, |
341 | 308 | gbm_buffer2{allocate_buffer_gbm, allocate_buffer_gbm_sync, | ||
342 | 309 | is_gbm_importable, import_fd, buffer_stride, buffer_format, buffer_flags, buffer_age}, | ||
343 | 168 | hw_stream{get_hw_stream} | 310 | hw_stream{get_hw_stream} |
344 | 169 | { | 311 | { |
345 | 170 | } | 312 | } |
346 | @@ -289,7 +431,9 @@ | |||
347 | 289 | if (!strcmp(extension_name, "mir_extension_set_gbm_device") && (version == 1)) | 431 | if (!strcmp(extension_name, "mir_extension_set_gbm_device") && (version == 1)) |
348 | 290 | return &mesa_auth; | 432 | return &mesa_auth; |
349 | 291 | if (!strcmp(extension_name, "mir_extension_gbm_buffer") && (version == 1)) | 433 | if (!strcmp(extension_name, "mir_extension_gbm_buffer") && (version == 1)) |
351 | 292 | return &gbm_buffer; | 434 | return &gbm_buffer1; |
352 | 435 | if (!strcmp(extension_name, "mir_extension_gbm_buffer") && (version == 2)) | ||
353 | 436 | return &gbm_buffer2; | ||
354 | 293 | if (!strcmp(extension_name, "mir_extension_hardware_buffer_stream") && (version == 1)) | 437 | if (!strcmp(extension_name, "mir_extension_hardware_buffer_stream") && (version == 1)) |
355 | 294 | return &hw_stream; | 438 | return &hw_stream; |
356 | 295 | 439 | ||
357 | 296 | 440 | ||
358 | === modified file 'src/platforms/mesa/client/client_platform.h' | |||
359 | --- src/platforms/mesa/client/client_platform.h 2017-02-15 07:38:33 +0000 | |||
360 | +++ src/platforms/mesa/client/client_platform.h 2017-03-10 16:32:19 +0000 | |||
361 | @@ -65,7 +65,8 @@ | |||
362 | 65 | gbm_device* gbm_dev; | 65 | gbm_device* gbm_dev; |
363 | 66 | MirExtensionMesaDRMAuthV1 drm_extensions; | 66 | MirExtensionMesaDRMAuthV1 drm_extensions; |
364 | 67 | MirExtensionSetGbmDeviceV1 mesa_auth; | 67 | MirExtensionSetGbmDeviceV1 mesa_auth; |
366 | 68 | MirExtensionGbmBufferV1 gbm_buffer; | 68 | MirExtensionGbmBufferV1 gbm_buffer1; |
367 | 69 | MirExtensionGbmBufferV2 gbm_buffer2; | ||
368 | 69 | MirExtensionHardwareBufferStreamV1 hw_stream; | 70 | MirExtensionHardwareBufferStreamV1 hw_stream; |
369 | 70 | }; | 71 | }; |
370 | 71 | 72 | ||
371 | 72 | 73 | ||
372 | === modified file 'src/platforms/mesa/include/native_buffer.h' | |||
373 | --- src/platforms/mesa/include/native_buffer.h 2017-01-18 02:29:37 +0000 | |||
374 | +++ src/platforms/mesa/include/native_buffer.h 2017-03-10 16:32:19 +0000 | |||
375 | @@ -34,6 +34,9 @@ | |||
376 | 34 | struct NativeBuffer : graphics::NativeBuffer, MirBufferPackage | 34 | struct NativeBuffer : graphics::NativeBuffer, MirBufferPackage |
377 | 35 | { | 35 | { |
378 | 36 | struct gbm_bo *bo; | 36 | struct gbm_bo *bo; |
379 | 37 | bool is_gbm_buffer; | ||
380 | 38 | uint32_t native_format; | ||
381 | 39 | uint32_t native_flags; | ||
382 | 37 | }; | 40 | }; |
383 | 38 | } | 41 | } |
384 | 39 | } | 42 | } |
385 | 40 | 43 | ||
386 | === modified file 'tests/unit-tests/platforms/mesa/client/test_client_platform.cpp' | |||
387 | --- tests/unit-tests/platforms/mesa/client/test_client_platform.cpp 2017-01-30 08:13:20 +0000 | |||
388 | +++ tests/unit-tests/platforms/mesa/client/test_client_platform.cpp 2017-03-10 16:32:19 +0000 | |||
389 | @@ -19,9 +19,12 @@ | |||
390 | 19 | #include "mir/client_platform.h" | 19 | #include "mir/client_platform.h" |
391 | 20 | #include "mir/shared_library.h" | 20 | #include "mir/shared_library.h" |
392 | 21 | #include "mir/raii.h" | 21 | #include "mir/raii.h" |
393 | 22 | #include "src/platforms/mesa/client/buffer_file_ops.h" | ||
394 | 23 | #include "src/platforms/mesa/client/client_buffer.h" | ||
395 | 22 | #include "src/platforms/mesa/client/mesa_native_display_container.h" | 24 | #include "src/platforms/mesa/client/mesa_native_display_container.h" |
396 | 23 | #include "src/client/rpc/mir_basic_rpc_channel.h" | 25 | #include "src/client/rpc/mir_basic_rpc_channel.h" |
397 | 24 | #include "src/client/mir_connection.h" | 26 | #include "src/client/mir_connection.h" |
398 | 27 | #include "src/client/buffer.h" | ||
399 | 25 | #include "mir_test_framework/client_platform_factory.h" | 28 | #include "mir_test_framework/client_platform_factory.h" |
400 | 26 | #include "mir/test/doubles/mock_egl.h" | 29 | #include "mir/test/doubles/mock_egl.h" |
401 | 27 | #include "mir/test/doubles/mock_egl_native_surface.h" | 30 | #include "mir/test/doubles/mock_egl_native_surface.h" |
402 | @@ -50,6 +53,12 @@ | |||
403 | 50 | 53 | ||
404 | 51 | namespace | 54 | namespace |
405 | 52 | { | 55 | { |
406 | 56 | struct StubOps : mclm::BufferFileOps | ||
407 | 57 | { | ||
408 | 58 | int close(int) const override { return 0; } | ||
409 | 59 | void* map(int, off_t, size_t) const override { return nullptr; } | ||
410 | 60 | void unmap(void*, size_t) const override {} | ||
411 | 61 | }; | ||
412 | 53 | 62 | ||
413 | 54 | struct StubClientContext : mcl::ClientContext | 63 | struct StubClientContext : mcl::ClientContext |
414 | 55 | { | 64 | { |
415 | @@ -98,10 +107,28 @@ | |||
416 | 98 | return platform->platform_operation(request_msg.get()); | 107 | return platform->platform_operation(request_msg.get()); |
417 | 99 | } | 108 | } |
418 | 100 | 109 | ||
419 | 110 | std::shared_ptr<MirBufferPackage> make_pkg() | ||
420 | 111 | { | ||
421 | 112 | auto pkg = std::make_shared<MirBufferPackage>(); | ||
422 | 113 | pkg->width = width; | ||
423 | 114 | pkg->height = height; | ||
424 | 115 | pkg->stride = stride; | ||
425 | 116 | pkg->fd_items = 1; | ||
426 | 117 | pkg->fd[0] = fake_fd; | ||
427 | 118 | pkg->data_items = 0; | ||
428 | 119 | return pkg; | ||
429 | 120 | } | ||
430 | 121 | |||
431 | 101 | StubClientContext client_context; | 122 | StubClientContext client_context; |
432 | 102 | std::shared_ptr<mir::client::ClientPlatform> platform = | 123 | std::shared_ptr<mir::client::ClientPlatform> platform = |
433 | 103 | mtf::create_mesa_client_platform(&client_context); | 124 | mtf::create_mesa_client_platform(&client_context); |
434 | 104 | mir::test::doubles::MockEGL mock_egl; | 125 | mir::test::doubles::MockEGL mock_egl; |
435 | 126 | int fake_fd = 11; | ||
436 | 127 | int width = 23; | ||
437 | 128 | int height = 230; | ||
438 | 129 | int stride = 81290; | ||
439 | 130 | int flags = GBM_BO_USE_RENDERING; | ||
440 | 131 | int pf = GBM_FORMAT_ABGR8888; | ||
441 | 105 | }; | 132 | }; |
442 | 106 | 133 | ||
443 | 107 | } | 134 | } |
444 | @@ -203,16 +230,14 @@ | |||
445 | 203 | EXPECT_NE(nullptr, egl_native_window); | 230 | EXPECT_NE(nullptr, egl_native_window); |
446 | 204 | } | 231 | } |
447 | 205 | 232 | ||
449 | 206 | TEST_F(MesaClientPlatformTest, can_allocate_buffer) | 233 | TEST_F(MesaClientPlatformTest, can_allocate_buffer_v1) |
450 | 207 | { | 234 | { |
451 | 208 | using namespace std::literals::chrono_literals; | 235 | using namespace std::literals::chrono_literals; |
452 | 209 | 236 | ||
453 | 210 | mtd::StubConnectionConfiguration conf(platform); | 237 | mtd::StubConnectionConfiguration conf(platform); |
454 | 211 | MirConnection connection(conf); | 238 | MirConnection connection(conf); |
459 | 212 | #pragma GCC diagnostic push | 239 | if (auto wh = connection.connect("", [](MirConnection*, void*){}, nullptr)) |
460 | 213 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | 240 | wh->wait_for_all(); |
457 | 214 | mir_wait_for(connection.connect("", [](MirConnection*, void*){}, nullptr)); | ||
458 | 215 | #pragma GCC diagnostic pop | ||
461 | 216 | 241 | ||
462 | 217 | int width = 32; | 242 | int width = 32; |
463 | 218 | int height = 90; | 243 | int height = 90; |
464 | @@ -230,6 +255,73 @@ | |||
465 | 230 | EXPECT_THAT(conf.channel->channel_call_count, Eq(call_count + 1)); | 255 | EXPECT_THAT(conf.channel->channel_call_count, Eq(call_count + 1)); |
466 | 231 | } | 256 | } |
467 | 232 | 257 | ||
468 | 258 | TEST_F(MesaClientPlatformTest, can_allocate_buffer_v2) | ||
469 | 259 | { | ||
470 | 260 | using namespace std::literals::chrono_literals; | ||
471 | 261 | |||
472 | 262 | mtd::StubConnectionConfiguration conf(platform); | ||
473 | 263 | MirConnection connection(conf); | ||
474 | 264 | if (auto wh = connection.connect("", [](MirConnection*, void*){}, nullptr)) | ||
475 | 265 | wh->wait_for_all(); | ||
476 | 266 | |||
477 | 267 | int width = 32; | ||
478 | 268 | int height = 90; | ||
479 | 269 | auto ext = static_cast<MirExtensionGbmBufferV1*>( | ||
480 | 270 | platform->request_interface("mir_extension_gbm_buffer", 2)); | ||
481 | 271 | ASSERT_THAT(ext, Ne(nullptr)); | ||
482 | 272 | ASSERT_THAT(ext->allocate_buffer_gbm, Ne(nullptr)); | ||
483 | 273 | |||
484 | 274 | auto call_count = conf.channel->channel_call_count; | ||
485 | 275 | ext->allocate_buffer_gbm( | ||
486 | 276 | &connection, width, height, pf, flags, | ||
487 | 277 | [] (::MirBuffer*, void*) {}, nullptr); | ||
488 | 278 | EXPECT_THAT(conf.channel->channel_call_count, Eq(call_count + 1)); | ||
489 | 279 | } | ||
490 | 280 | |||
491 | 281 | TEST_F(MesaClientPlatformTest, shm_buffer_is_not_gbm_compatible) | ||
492 | 282 | { | ||
493 | 283 | mtd::StubConnectionConfiguration conf(platform); | ||
494 | 284 | MirConnection connection(conf); | ||
495 | 285 | if (auto wh = connection.connect("", [](MirConnection*, void*){}, nullptr)) | ||
496 | 286 | wh->wait_for_all(); | ||
497 | 287 | auto ext = static_cast<MirExtensionGbmBufferV2*>( | ||
498 | 288 | platform->request_interface("mir_extension_gbm_buffer", 2)); | ||
499 | 289 | ASSERT_THAT(ext, Ne(nullptr)); | ||
500 | 290 | ASSERT_THAT(ext->is_gbm_importable, Ne(nullptr)); | ||
501 | 291 | |||
502 | 292 | auto client_buffer = std::make_shared<mclm::ClientBuffer>( | ||
503 | 293 | std::make_shared<StubOps>(), make_pkg(), geom::Size{width, height}, mir_pixel_format_rgb_888); | ||
504 | 294 | mcl::Buffer mirbuffer(nullptr, nullptr, 0, client_buffer, nullptr, mir_buffer_usage_software); | ||
505 | 295 | EXPECT_FALSE(ext->is_gbm_importable(reinterpret_cast<MirBuffer*>(&mirbuffer))); | ||
506 | 296 | } | ||
507 | 297 | |||
508 | 298 | TEST_F(MesaClientPlatformTest, bo_buffer_is_gbm_compatible) | ||
509 | 299 | { | ||
510 | 300 | mtd::StubConnectionConfiguration conf(platform); | ||
511 | 301 | MirConnection connection(conf); | ||
512 | 302 | if (auto wh = connection.connect("", [](MirConnection*, void*){}, nullptr)) | ||
513 | 303 | wh->wait_for_all(); | ||
514 | 304 | auto ext = static_cast<MirExtensionGbmBufferV2*>( | ||
515 | 305 | platform->request_interface("mir_extension_gbm_buffer", 2)); | ||
516 | 306 | auto client_buffer = std::make_shared<mclm::ClientBuffer>( | ||
517 | 307 | std::make_shared<StubOps>(), make_pkg(), geom::Size{width, height}, pf, flags); | ||
518 | 308 | mcl::Buffer mirbuffer(nullptr, nullptr, 0, client_buffer, nullptr, mir_buffer_usage_hardware); | ||
519 | 309 | |||
520 | 310 | ASSERT_THAT(ext, Ne(nullptr)); | ||
521 | 311 | ASSERT_THAT(ext->is_gbm_importable, Ne(nullptr)); | ||
522 | 312 | ASSERT_THAT(ext->fd, Ne(nullptr)); | ||
523 | 313 | ASSERT_THAT(ext->stride, Ne(nullptr)); | ||
524 | 314 | ASSERT_THAT(ext->format, Ne(nullptr)); | ||
525 | 315 | ASSERT_THAT(ext->flags, Ne(nullptr)); | ||
526 | 316 | ASSERT_THAT(ext->age, Ne(nullptr)); | ||
527 | 317 | EXPECT_TRUE(ext->is_gbm_importable(reinterpret_cast<MirBuffer*>(&mirbuffer))); | ||
528 | 318 | EXPECT_THAT(ext->fd(reinterpret_cast<MirBuffer*>(&mirbuffer)), Eq(fake_fd)); | ||
529 | 319 | EXPECT_THAT(ext->stride(reinterpret_cast<MirBuffer*>(&mirbuffer)), Eq(stride)); | ||
530 | 320 | EXPECT_THAT(ext->format(reinterpret_cast<MirBuffer*>(&mirbuffer)), Eq(pf)); | ||
531 | 321 | EXPECT_THAT(ext->flags(reinterpret_cast<MirBuffer*>(&mirbuffer)), Eq(flags)); | ||
532 | 322 | EXPECT_THAT(ext->age(reinterpret_cast<MirBuffer*>(&mirbuffer)), Eq(0)); | ||
533 | 323 | } | ||
534 | 324 | |||
535 | 233 | TEST_F(MesaClientPlatformTest, converts_gbm_format_correctly) | 325 | TEST_F(MesaClientPlatformTest, converts_gbm_format_correctly) |
536 | 234 | { | 326 | { |
537 | 235 | EXPECT_THAT(platform->native_format_for(mir_pixel_format_argb_8888), Eq(GBM_FORMAT_ARGB8888)); | 327 | EXPECT_THAT(platform->native_format_for(mir_pixel_format_argb_8888), Eq(GBM_FORMAT_ARGB8888)); |
FAILED: Continuous integration, rev:4039 /mir-jenkins. ubuntu. com/job/ mir-ci/ 3013/ /mir-jenkins. ubuntu. com/job/ build-mir/ 4023/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/4110 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 4100 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 4100 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= zesty/4100 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/4050 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/4050/ artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4050/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/4050 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/4050/ artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 4050 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 4050/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 4050 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 4050/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4050 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4050/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 3013/rebuild
https:/