~ci-train-bot/mir/mir-ubuntu-zesty-2791

« back to all changes in this revision

Viewing changes to tests/acceptance-tests/test_render_surface.cpp

  • Committer: Bileto Bot
  • Date: 2017-02-09 21:46:11 UTC
  • mfrom: (1160.2680.216 mir-dev)
  • Revision ID: ci-train-bot@canonical.com-20170209214611-npcbbl3ivh2x981r
* New upstream release 0.26.1 (https://launchpad.net/mir/+milestone/0.26.1)
  - ABI summary:
    . mirclient ABI unchanged at 9
    . mirserver ABI unchanged at 43
    . mircommon ABI unchanged at 7
    . mirplatform ABI bumped to 15
    . mirprotobuf ABI unchanged at 3
    . mirplatformgraphics ABI bumped to 12
    . mirclientplatform ABI unchanged at 5
    . mirinputplatform ABI unchanged at 6
    . mircore ABI unchanged at 1
  - Enhancements:
    . Support for MirBuffer API that allows for better management of
      hardware/software buffers.
    . Support for MirPresentationChain API that allows better control
      over {de}queueing of individual buffers {from}to the server.
    . Interim support for MirRenderSurface API that provides a unit of
      renderable for lower level content such as MirBufferStreams and
      MirPresentationChains, etc.. MirRenderSurface API is marked
      deprecated as it (and the relevant entry points) will be renamed to
      MirSurface before general availability. It will initially be used for
      revamping support for EGL drivers.
    . Synchronous version of mir_prompt_session_new_fds_for_prompt_providers()
      API (mir_prompt_session_new_fds_for_prompt_providers_sync()) added for
      convenience.
    . Better name for MirPersistentId-->MirWindowId. MirPersistentId has now
      been deprecated.
  - Bugs fixed:
    . [regression] Unity8 stutters constantly (like half frame rate).
      (LP: #1661128)
    . mir 0.26 - spinner loading animation, minimize, maximize too fast.
      (LP: #1661072)
    . [regression] Nested server segfaults or rapidly logs exceptions when a
      fullscreen client starts [in mir_presentation_chain_set_dropping_mode
      ... std::exception::what: Operation not permitted] (LP: #1661508)
    . mir_window_request_persistent_id_sync seg faults when called twice.
      (LP: #1661704)
    . [regression] Windowed clients of nested servers are all black.
      (LP: #1661521)
    . Mir graphics platform ABI broke in series 0.26 but sonames never
      changed (LP: #1662455)
    . Fixes for 0.26 changelog.
    . [regression] mirscreencast hangs during screencast creation. (LP: #1662997)
    . libmirclient-dev missing build dependency on libmircore-dev. (LP: #1662942)
    . mir_window_spec_set_cursor_name() doesn't trigger
      mir::scene::SurfaceObserver::cursor_image_set_to. (LP: #1663197)
    . [regression] Software clients of nested servers are all black in Mir 0.25.0
      and later. (LP: #1663062)
    . New and improved client APIs: MirInputConfig, MirWindow, DisplayConfig,
      MirScreencastSpec.
    . Support for setting the input configuration.
    . Introduced an extension mechanism for platform-specific APIs.
    . Support for screencasting to a specific MirBuffer.
    . Added DisplayConfigurationController::base_configuration() so
      downstreams can get the base configuration (weirdly they can already
      set it).
    . X11 platform: Allow adjustable scale parameter.
    . Added monitor EDID support to both the client API and server-side.
    . mirout: Now shows scaling factor, subpixel arrangement, form factor and
      EDID.
    . mirout: Can now change the monitor configuration as well as report it.
    . Introduced client-side vsync which dramatically reduces latency
      from the client to the screen, by up to 44ms.
    . Removed all input resampling logic. We now expect toolkits to do their
      own, if at all. This reduces input lag by up to 16.9ms, or 8.4ms on
      average.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 */
18
18
 
19
19
#include "mir_toolkit/mir_client_library.h"
20
 
#include "mir_toolkit/mir_render_surface.h"
 
20
#include "mir_toolkit/rs/mir_render_surface.h"
21
21
#include "mir_toolkit/mir_presentation_chain.h"
22
22
 
23
23
#include "mir/geometry/size.h"
40
40
 
41
41
using namespace testing;
42
42
 
 
43
#pragma GCC diagnostic push
 
44
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
43
45
TEST_F(RenderSurfaceTest, creates_and_releases_render_surfaces)
44
46
{
45
47
    auto connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
74
76
    auto bs = mir_render_surface_get_buffer_stream(
75
77
        rs,
76
78
        physical_size.width.as_int(), physical_size.height.as_int(),
77
 
        mir_pixel_format_abgr_8888,
78
 
        mir_buffer_usage_hardware);
 
79
        mir_pixel_format_abgr_8888);
79
80
 
80
81
    ASSERT_THAT(bs, NotNull());
81
82
    EXPECT_TRUE(mir_buffer_stream_is_valid(bs));
96
97
    auto bs = mir_render_surface_get_buffer_stream(
97
98
        rs,
98
99
        physical_size.width.as_int(), physical_size.height.as_int(),
99
 
        mir_pixel_format_abgr_8888,
100
 
        mir_buffer_usage_hardware);
 
100
        mir_pixel_format_abgr_8888);
101
101
 
102
102
    ASSERT_THAT(bs, NotNull());
103
103
    EXPECT_TRUE(mir_buffer_stream_is_valid(bs));
106
106
    auto bs2 = mir_render_surface_get_buffer_stream(
107
107
        rs,
108
108
        physical_size.width.as_int(), physical_size.height.as_int(),
109
 
        mir_pixel_format_abgr_8888,
110
 
        mir_buffer_usage_hardware);
 
109
        mir_pixel_format_abgr_8888);
111
110
 
112
111
    EXPECT_THAT(bs2, Eq(nullptr));
113
112
 
125
124
    auto bs = mir_render_surface_get_buffer_stream(
126
125
        rs,
127
126
        physical_size.width.as_int(), physical_size.height.as_int(),
128
 
        mir_pixel_format_abgr_8888,
129
 
        mir_buffer_usage_hardware);
 
127
        mir_pixel_format_abgr_8888);
130
128
 
131
129
    ASSERT_THAT(bs, NotNull());
132
130
    EXPECT_TRUE(mir_buffer_stream_is_valid(bs));
146
144
    auto spec = mir_create_normal_window_spec(
147
145
        connection,
148
146
        physical_size.width.as_int(), physical_size.height.as_int());
149
 
    mir_surface_spec_add_render_surface(
 
147
    mir_window_spec_add_render_surface(
150
148
        spec, rs, logical_size.width.as_int(), logical_size.height.as_int(), 0, 0);
151
149
    auto window = mir_create_window_sync(spec);
152
150
    mir_window_spec_release(spec);
163
161
{
164
162
    int const width{800}, height{600};
165
163
    MirPixelFormat const format{mir_pixel_format_abgr_8888};
166
 
    MirBufferUsage const usage{mir_buffer_usage_software};
167
164
 
168
165
    auto connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
169
166
 
171
168
        connection, logical_size.width.as_int(), logical_size.height.as_int());
172
169
    auto spec = mir_create_normal_window_spec(connection, width, height);
173
170
    mir_window_spec_set_pixel_format(spec, format);
174
 
    mir_surface_spec_add_render_surface(spec, rs, width, height, 0, 0);
 
171
    mir_window_spec_add_render_surface(spec, rs, width, height, 0, 0);
175
172
    auto window = mir_create_window_sync(spec);
176
173
    mir_window_spec_release(spec);
177
 
    auto bs = mir_render_surface_get_buffer_stream(rs,
178
 
                                                   640, 480,
179
 
                                                   format,
180
 
                                                   usage);
 
174
    auto bs = mir_render_surface_get_buffer_stream(rs, 640, 480, format);
181
175
 
182
176
    EXPECT_THAT(window, IsValid());
183
177
    EXPECT_THAT(mir_window_get_buffer_stream(window), Eq(nullptr));
235
229
        connection, logical_size.width.as_int(), logical_size.height.as_int());
236
230
    auto spec = mir_create_normal_window_spec(connection, width, height);
237
231
    mir_window_spec_set_pixel_format(spec, format);
238
 
    mir_surface_spec_add_render_surface(spec, rs, width, height, 0, 0);
 
232
    mir_window_spec_add_render_surface(spec, rs, width, height, 0, 0);
239
233
    auto window = mir_create_window_sync(spec);
240
234
    mir_window_spec_release(spec);
241
235
    auto pc = mir_render_surface_get_presentation_chain(rs);
279
273
    auto bs = mir_render_surface_get_buffer_stream(
280
274
        rs,
281
275
        physical_size.width.as_int(), physical_size.height.as_int(),
282
 
        mir_pixel_format_abgr_8888,
283
 
        mir_buffer_usage_hardware);
 
276
        mir_pixel_format_abgr_8888);
284
277
 
285
278
    EXPECT_THAT(bs, Eq(nullptr));
286
279
 
298
291
    auto bs = mir_render_surface_get_buffer_stream(
299
292
        rs,
300
293
        physical_size.width.as_int(), physical_size.height.as_int(),
301
 
        mir_pixel_format_abgr_8888,
302
 
        mir_buffer_usage_hardware);
 
294
        mir_pixel_format_abgr_8888);
303
295
 
304
296
    ASSERT_THAT(bs, NotNull());
305
297
    EXPECT_TRUE(mir_buffer_stream_is_valid(bs));
311
303
    mir_render_surface_release(rs);
312
304
    mir_connection_release(connection);
313
305
}
 
306
 
 
307
TEST_F(RenderSurfaceTest, stores_user_set_size_for_driver_to_access)
 
308
{
 
309
    auto width = 0;
 
310
    auto height = 0;
 
311
    geom::Size const size { 101, 102 };
 
312
 
 
313
    auto connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
 
314
    auto rs = mir_connection_create_render_surface_sync(
 
315
        connection, logical_size.width.as_int(), logical_size.height.as_int());
 
316
 
 
317
    mir_render_surface_get_size(rs, &width, &height);
 
318
    EXPECT_THAT(width, Eq(logical_size.width.as_int())); 
 
319
    EXPECT_THAT(height, Eq(logical_size.height.as_int()));
 
320
 
 
321
    mir_render_surface_set_size(rs, size.width.as_int(), size.height.as_int());
 
322
    mir_render_surface_get_size(rs, &width, &height);
 
323
    EXPECT_THAT(width, Eq(size.width.as_int())); 
 
324
    EXPECT_THAT(height, Eq(size.height.as_int()));
 
325
 
 
326
    mir_render_surface_release(rs);
 
327
    mir_connection_release(connection);
 
328
}
 
329
#pragma GCC diagnostic pop