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

« back to all changes in this revision

Viewing changes to tests/unit-tests/platforms/mesa/kms/test_real_kms_output.cpp

  • Committer: Bileto Bot
  • Date: 2017-04-13 15:26:17 UTC
  • mfrom: (1160.2883.164 0.27)
  • Revision ID: ci-train-bot@canonical.com-20170413152617-bs7slz07xbzxu2d3
* New upstream release 0.27.0 (https://launchpad.net/mir/+milestone/0.27.0)
  - ABI summary:
    . mirclient ABI unchanged at 9
    . mirserver ABI bumped to 44
    . mircommon ABI unchanged at 7
    . mirplatform ABI bumped to 61
    . mirprotobuf ABI unchanged at 3
    . mirplatformgraphics ABI bumped to 13
    . mirclientplatform ABI unchanged at 5
    . mirinputplatform ABI bumped to 7
    . mircore ABI unchanged at 1
  - Enhancements:
    . Mostly groundwork required to support major enhancements coming in
      future Mir versions.
    . Removed android-input and eliminated the entire "3rd_party/" subtree.
      Now the Mir source tree contains original code only.
    . Added mir_prompt_session_new_fds_for_prompt_providers_sync API.
    . mirout: Added load and save options for keeping display configs
      on disk.
    . mirout: Added "--" support for applying configuration changes under
      Unity8.
    . Fixed failure of DRM hardware cursor {hide(); show(image);}
    . Added server option: "--cursor software" (MIR_SERVER_CURSOR=software)
    . Added letterboxing/black bars support to the GL renderer in preparation
      for generic output cloning.
    . Added client API for getting the logical size of an output.
    . Migrated MirCookie to use SHA-256.
    . Ensure RealKMSOutputConfiguration stays in sync with actual hardware
      state.
    . Added support for drag-and-drop.
    . Lots of other client API enhancements.
    . Minor clean-ups, optimizations and dead code removal.
  - Bugs fixed:
    . [enhancement] Make able to get version information from client /
      server APIs (LP: #1195540)
    . Touch screen coordinates don't rotate with the screen (LP: #1349660)
    . Subpixel order not included in Mir display information (LP: #1393578)
    . [enhancement] Missing client API for relative surface movement (e.g.
      dragging client-decorated windows) (LP: #1420334) . Mir does not reset
      key states when paused or resumed (modifiers get stuck after VT
      switching) (LP: #1536279)
    . Inconsistent behaviour of Num Lock (LP: #1588237)
    . [ FAILED ] NestedInput.nested_event_filter_receives_keyboard_from_host
      (LP: #1613523)
    . Rotating an output left or right without restarting the
      compositor distorts the image (LP: #1643488)
    . support display scaling slider in unity8 (LP: #1645372)
    . [ FAILED ] NestedInputWithMouse.mouse_pointer_coordinates_in_nested_
      server_are_accumulated (LP: #1646375)
    . [ FAILED ] NestedInputWithMouse.mouse_pointer_position_is_in_sync_with_
      host_server (LP: #1646558)
    . abi_check doesn't check mircore (LP: #1649354)
    . Under Unity8, mir_demo_client_target is distorted and input in the
      wrong place on start-up (LP: #1655804)
    . [testsfail] PromptSessionClientAPI.client_pid_is_associated_with_
      session hangs and times out (LP: #1655929)
    . EDID does not change when hotplugging a monitor (LP: #1660017)
    . [regression] Mir 0.26.0 - spinner loading animation, minimize, maximize
      too fast (LP: #1661072)
    . [regression] Unity8 stutters constantly (like half frame rate) using
      Mir 0.26.0 (LP: #1661128)
    . [regression] mir_demo_server refuses to quit on Ctrl+Alt+Backspace or
      Ctrl+C in its terminal (deadlock in DefaultInputDeviceHub::add_device)
      (LP: #1661151)
    . [regression] mirout crashes when connecting to unity8 or any nested
      server: [libprotobuf FATAL
      /usr/include/google/protobuf/repeated_field.h:1408] CHECK failed:
      (index) < (current_size_): (LP: #1661163)
    . [ FAILED ] DefaultInputManagerTest.forwards_pause_continue_state_
      changes_to_platform (LP: #1661187)
    . [regression] Segfault on detect_fd_leaks during acceptance tests (in
      DisplayConfiguration/{DisplayFormatSetting,DisplaySubpixelSetting})
      (LP: #1661498)
    . [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)
    . [regression] Windowed clients of nested servers are all black
      (LP: #1661521)
    . mir_window_request_persistent_id_sync seg faults when called twice
      (LP: #1661704)
    . mir_acceptance_tests now takes 10 seconds longer (in r4002 compared to
      r4001) (LP: #1662044)
    . Mir graphics platform ABI broke in series 0.26 but sonames never
      changed (LP: #1662455)
    . libmirclient-dev missing build depndency on libmircore-dev
      (LP: #1662942)
    . [regression] mirscreencast hangs during screencast creation
      (LP: #1662997)
    . [regression] Software clients of nested servers with size >=480x480
      are all black in Mir 0.25.0 and later (or stretched and distorted under
      Unity8) (LP: #1663062)
    . mir_window_spec_set_cursor_name() doesn't trigger
      mir::scene::SurfaceObserver::cursor_image_set_to (LP: #1663197)
    . android complaint during mirscreencast of nested server (LP: #1664562)
    . qtubuntu sends wrong text as part of QKeyEvent (LP: #1664610)
    . Mir server crashed with SIGSEGV in
      mir::compositor::TemporaryBuffer::size() called from
      mir::gl::tessellate_renderable_into_rectangle() (LP: #1664760)
    . mirout reports logical size of a rotated display incorrectly
      (LP: #1665271)
    . Nested servers (Unity8) periodically stutter (half frame rate) with
      Mir 0.26.1 (LP: #1666372)
    . If the only surface in a session cannot take focus the server crashes
      (LP: #1667645)
    . [regression] OSK input shaping no longer works correctly (LP: #1669444)
    . GTK window functions `Always on Top, Move and Resize' don't work in
      Mir/Unity8 (LP: #1669524)
    . [regression] mir_proving_server mode hotkeys (Ctrl+Alt+=/-) cause the
      server to segfault (LP: #1669752)
    . Test takes minutes to complete: MediatingDisplayChangerTest.confirmed_
      configuration_doesnt_revert_after_timeout (LP: #1671033)
    . [ FAILED ] PosixRWMutex.prefer_writer_nonrecursive_prevents_writer_
      starvation (Timeout waiting to acquire write lock) (LP: #1671037)
    . [regression] Mixing screen rotation with mode changes makes the image
      squished (LP: #1672269)
    . unity-system-compositor crashed with SIGSEGV in
      libinput_device_config_accel_is_available() from
      libinput_device_config_accel_set_speed() from
      mir::input::evdev::LibInputDevice::apply_settings() (LP: #1672955)
    . Presentation chains should support various Vulkan presentation modes
      (LP: #1673533)
    . Need an extension for GBM buffers to replace
      mir_buffer_get_buffer_package() (LP: #1673534)
    . cross-compile-chroot.sh (to zesty) fails to build [cannot find -ludev]
      due to libudev.so being in a different directory to where libudev.pc
      searches for it (LP: #1674201)
    . Please transition to Boost 1.62 (LP: #1675138)
    . [regression] Mir is assigning the first output ID = 0 (==
      mir_display_output_id_invalid) (LP: #1675331)
    . Mir sending key repeat events continually to nested shell after VT
      switch (causes Unity8 lockup for a while) (LP: #1675357)
    . mirout commands don't work when followed by -- (LP: #1676320)
    . mir_demo_standalone_render_overlays fails to link (LP: #1677239)
    . [regression] doxygen processing for capnproto/protobuf broken
      (LP: #1679248)
    . mir_window_spec_set_cursor_render_surface does not work (LP: #1679836)

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
#include <gtest/gtest.h>
31
31
#include <gmock/gmock.h>
 
32
#include <fcntl.h>
32
33
 
33
34
namespace mg = mir::graphics;
34
35
namespace mgm = mir::graphics::mesa;
59
60
{
60
61
public:
61
62
    RealKMSOutputTest()
62
 
        : invalid_id{0}, crtc_ids{10, 11},
 
63
        : drm_fd{open(drm_device, 0, 0)},
 
64
          invalid_id{0}, crtc_ids{10, 11},
63
65
          encoder_ids{20, 21}, connector_ids{30, 21},
64
66
          possible_encoder_ids1{encoder_ids[0]},
65
67
          possible_encoder_ids2{encoder_ids[0], encoder_ids[1]}
66
68
    {
67
69
        ON_CALL(mock_page_flipper, wait_for_flip(_))
68
70
            .WillByDefault(Return(mg::Frame{}));
 
71
 
 
72
        ON_CALL(mock_gbm, gbm_bo_get_handle(_))
 
73
            .WillByDefault(Return(gbm_bo_handle{0}));
69
74
    }
70
75
 
71
76
    void setup_outputs_connected_crtc()
72
77
    {
73
 
        mtd::FakeDRMResources& resources(mock_drm.fake_drm);
74
78
        uint32_t const possible_crtcs_mask{0x1};
75
79
 
76
 
        resources.reset();
77
 
 
78
 
        resources.add_crtc(crtc_ids[0], drmModeModeInfo());
79
 
        resources.add_encoder(encoder_ids[0], crtc_ids[0], possible_crtcs_mask);
80
 
        resources.add_connector(connector_ids[0], DRM_MODE_CONNECTOR_VGA,
81
 
                                DRM_MODE_CONNECTED, encoder_ids[0],
82
 
                                modes_empty, possible_encoder_ids1, geom::Size());
83
 
 
84
 
        resources.prepare();
 
80
        mock_drm.reset(drm_device);
 
81
 
 
82
        mock_drm.add_crtc(
 
83
            drm_device,
 
84
            crtc_ids[0],
 
85
            drmModeModeInfo());
 
86
        mock_drm.add_encoder(
 
87
            drm_device,
 
88
            encoder_ids[0],
 
89
            crtc_ids[0],
 
90
            possible_crtcs_mask);
 
91
        mock_drm.add_connector(
 
92
            drm_device,
 
93
            connector_ids[0],
 
94
            DRM_MODE_CONNECTOR_VGA,
 
95
            DRM_MODE_CONNECTED,
 
96
            encoder_ids[0],
 
97
            modes_empty,
 
98
            possible_encoder_ids1,
 
99
            geom::Size());
 
100
 
 
101
        mock_drm.prepare(drm_device);
85
102
    }
86
103
 
87
104
    void setup_outputs_no_connected_crtc()
88
105
    {
89
 
        mtd::FakeDRMResources& resources(mock_drm.fake_drm);
90
106
        uint32_t const possible_crtcs_mask1{0x1};
91
107
        uint32_t const possible_crtcs_mask_all{0x3};
92
108
 
93
 
        resources.reset();
94
 
 
95
 
        resources.add_crtc(crtc_ids[0], drmModeModeInfo());
96
 
        resources.add_crtc(crtc_ids[1], drmModeModeInfo());
97
 
        resources.add_encoder(encoder_ids[0], crtc_ids[0], possible_crtcs_mask1);
98
 
        resources.add_encoder(encoder_ids[1], invalid_id, possible_crtcs_mask_all);
99
 
        resources.add_connector(connector_ids[0], DRM_MODE_CONNECTOR_Composite,
100
 
                                DRM_MODE_CONNECTED, invalid_id,
101
 
                                modes_empty, possible_encoder_ids2, geom::Size());
102
 
        resources.add_connector(connector_ids[1], DRM_MODE_CONNECTOR_DVIA,
103
 
                                DRM_MODE_CONNECTED, encoder_ids[0],
104
 
                                modes_empty, possible_encoder_ids2, geom::Size());
105
 
 
106
 
        resources.prepare();
 
109
        mock_drm.reset(drm_device);
 
110
 
 
111
        mock_drm.add_crtc(
 
112
            drm_device,
 
113
            crtc_ids[0],
 
114
            drmModeModeInfo());
 
115
        mock_drm.add_crtc(
 
116
            drm_device,
 
117
            crtc_ids[1],
 
118
            drmModeModeInfo());
 
119
        mock_drm.add_encoder(
 
120
            drm_device,
 
121
            encoder_ids[0],
 
122
            crtc_ids[0],
 
123
            possible_crtcs_mask1);
 
124
        mock_drm.add_encoder(
 
125
            drm_device,
 
126
            encoder_ids[1],
 
127
            invalid_id,
 
128
            possible_crtcs_mask_all);
 
129
        mock_drm.add_connector(
 
130
            drm_device,
 
131
            connector_ids[0],
 
132
            DRM_MODE_CONNECTOR_Composite,
 
133
            DRM_MODE_CONNECTED,
 
134
            invalid_id,
 
135
            modes_empty,
 
136
            possible_encoder_ids2,
 
137
            geom::Size());
 
138
        mock_drm.add_connector(
 
139
            drm_device,
 
140
            connector_ids[1],
 
141
            DRM_MODE_CONNECTOR_DVIA,
 
142
            DRM_MODE_CONNECTED,
 
143
            encoder_ids[0],
 
144
            modes_empty,
 
145
            possible_encoder_ids2,
 
146
            geom::Size());
 
147
 
 
148
        mock_drm.prepare(drm_device);
 
149
    }
 
150
 
 
151
    void append_fb_id(uint32_t fb_id)
 
152
    {
 
153
        EXPECT_CALL(mock_drm, drmModeAddFB2(_,_,_,_,_,_,_,_,_))
 
154
            .WillOnce(
 
155
                DoAll(
 
156
                    SetArgPointee<7>(fb_id),
 
157
                    Return(0)));
107
158
    }
108
159
 
109
160
    testing::NiceMock<mtd::MockDRM> mock_drm;
110
161
    testing::NiceMock<mtd::MockGBM> mock_gbm;
111
162
    MockPageFlipper mock_page_flipper;
112
163
    NullPageFlipper null_page_flipper;
113
 
 
114
164
    std::vector<drmModeModeInfo> modes_empty;
 
165
 
 
166
    char const* const drm_device = "/dev/dri/card0";
 
167
    int const drm_fd;
 
168
 
 
169
    gbm_bo* const fake_bo{reinterpret_cast<gbm_bo*>(0x123ba)};
115
170
    uint32_t const invalid_id;
116
171
    std::vector<uint32_t> const crtc_ids;
117
172
    std::vector<uint32_t> const encoder_ids;
122
177
 
123
178
}
124
179
 
125
 
TEST_F(RealKMSOutputTest, construction_queries_connector)
126
 
{
127
 
    using namespace testing;
128
 
 
129
 
    setup_outputs_connected_crtc();
130
 
 
131
 
    EXPECT_CALL(mock_drm, drmModeGetConnector(_,connector_ids[0]))
132
 
        .Times(1);
133
 
 
134
 
    mgm::RealKMSOutput output{mock_drm.fake_drm.fd(), connector_ids[0],
135
 
                              mt::fake_shared(null_page_flipper)};
136
 
}
137
 
 
138
180
TEST_F(RealKMSOutputTest, operations_use_existing_crtc)
139
181
{
140
182
    using namespace testing;
141
183
 
142
 
    uint32_t const fb_id{67};
143
 
 
144
184
    setup_outputs_connected_crtc();
145
185
 
 
186
    uint32_t const fb_id{42};
 
187
    append_fb_id(fb_id);
 
188
 
146
189
    {
147
190
        InSequence s;
148
191
 
163
206
            .Times(1);
164
207
    }
165
208
 
166
 
    mgm::RealKMSOutput output{mock_drm.fake_drm.fd(), connector_ids[0],
167
 
                              mt::fake_shared(mock_page_flipper)};
168
 
 
169
 
    EXPECT_TRUE(output.set_crtc(fb_id));
170
 
    EXPECT_TRUE(output.schedule_page_flip(fb_id));
 
209
    mgm::RealKMSOutput output{
 
210
        drm_fd,
 
211
        mg::kms::get_connector(drm_fd, connector_ids[0]),
 
212
        mt::fake_shared(mock_page_flipper)};
 
213
 
 
214
    auto fb = output.fb_for(fake_bo);
 
215
 
 
216
    EXPECT_TRUE(output.set_crtc(*fb));
 
217
    EXPECT_TRUE(output.schedule_page_flip(*fb));
171
218
    output.wait_for_page_flip();
172
219
}
173
220
 
199
246
            .Times(1);
200
247
    }
201
248
 
202
 
    mgm::RealKMSOutput output{mock_drm.fake_drm.fd(), connector_ids[0],
203
 
                              mt::fake_shared(mock_page_flipper)};
204
 
 
205
 
    EXPECT_TRUE(output.set_crtc(fb_id));
206
 
    EXPECT_TRUE(output.schedule_page_flip(fb_id));
 
249
    append_fb_id(fb_id);
 
250
 
 
251
    mgm::RealKMSOutput output{
 
252
        drm_fd,
 
253
        mg::kms::get_connector(drm_fd, connector_ids[0]),
 
254
        mt::fake_shared(mock_page_flipper)};
 
255
 
 
256
    auto fb = output.fb_for(fake_bo);
 
257
 
 
258
    EXPECT_TRUE(output.set_crtc(*fb));
 
259
    EXPECT_TRUE(output.schedule_page_flip(*fb));
207
260
    output.wait_for_page_flip();
208
261
}
209
262
 
219
272
    {
220
273
        InSequence s;
221
274
 
222
 
        EXPECT_CALL(mock_drm, drmModeSetCrtc(_, crtc_ids[0], fb_id, _, _, _, _, _))
 
275
        EXPECT_CALL(mock_drm, drmModeSetCrtc(_, crtc_ids[0], _, _, _, _, _, _))
223
276
            .Times(1)
224
277
            .WillOnce(Return(1));
225
278
 
233
286
            .Times(0);
234
287
    }
235
288
 
236
 
    mgm::RealKMSOutput output{mock_drm.fake_drm.fd(), connector_ids[0],
237
 
                              mt::fake_shared(mock_page_flipper)};
238
 
 
239
 
    EXPECT_FALSE(output.set_crtc(fb_id));
 
289
    append_fb_id(fb_id);
 
290
 
 
291
    mgm::RealKMSOutput output{
 
292
        drm_fd,
 
293
        mg::kms::get_connector(drm_fd, connector_ids[0]),
 
294
        mt::fake_shared(mock_page_flipper)};
 
295
 
 
296
    auto fb = output.fb_for(fake_bo);
 
297
 
 
298
    EXPECT_FALSE(output.set_crtc(*fb));
 
299
 
240
300
    EXPECT_NO_THROW({
241
 
        EXPECT_FALSE(output.schedule_page_flip(fb_id));
 
301
        EXPECT_FALSE(output.schedule_page_flip(*fb));
242
302
    });
243
303
    EXPECT_THROW({  // schedule failed. It's programmer error if you then wait.
244
304
        output.wait_for_page_flip();
251
311
 
252
312
    setup_outputs_connected_crtc();
253
313
 
254
 
    mgm::RealKMSOutput output{mock_drm.fake_drm.fd(), connector_ids[0],
255
 
                              mt::fake_shared(mock_page_flipper)};
 
314
    mgm::RealKMSOutput output{
 
315
        drm_fd,
 
316
        mg::kms::get_connector(drm_fd, connector_ids[0]),
 
317
        mt::fake_shared(mock_page_flipper)};
256
318
 
257
319
    EXPECT_CALL(mock_drm, drmModeSetCrtc(_, crtc_ids[0], 0, 0, 0, nullptr, 0, nullptr))
258
320
        .Times(1)
265
327
{
266
328
    using namespace testing;
267
329
 
268
 
    mtd::FakeDRMResources& resources(mock_drm.fake_drm);
269
330
    uint32_t const possible_crtcs_mask_empty{0x0};
270
331
 
271
 
    resources.reset();
272
 
 
273
 
    resources.add_encoder(encoder_ids[0], invalid_id, possible_crtcs_mask_empty);
274
 
    resources.add_connector(connector_ids[0], DRM_MODE_CONNECTOR_VGA,
275
 
                            DRM_MODE_CONNECTED, encoder_ids[0],
276
 
                            modes_empty, possible_encoder_ids1, geom::Size());
277
 
 
278
 
    resources.prepare();
279
 
 
280
 
    mgm::RealKMSOutput output{mock_drm.fake_drm.fd(), connector_ids[0],
281
 
                              mt::fake_shared(mock_page_flipper)};
 
332
    mock_drm.reset(drm_device);
 
333
 
 
334
    mock_drm.add_encoder(
 
335
        drm_device,
 
336
        encoder_ids[0],
 
337
        invalid_id,
 
338
        possible_crtcs_mask_empty);
 
339
    mock_drm.add_connector(
 
340
        drm_device,
 
341
        connector_ids[0],
 
342
        DRM_MODE_CONNECTOR_VGA,
 
343
        DRM_MODE_CONNECTED,
 
344
        encoder_ids[0],
 
345
        modes_empty,
 
346
        possible_encoder_ids1,
 
347
        geom::Size());
 
348
 
 
349
    mock_drm.prepare(drm_device);
 
350
 
 
351
    mgm::RealKMSOutput output{
 
352
        drm_fd,
 
353
        mg::kms::get_connector(drm_fd, connector_ids[0]),
 
354
        mt::fake_shared(mock_page_flipper)};
282
355
 
283
356
    EXPECT_CALL(mock_drm, drmModeSetCrtc(_, _, 0, 0, 0, nullptr, 0, nullptr))
284
357
        .Times(0);
296
369
 
297
370
    setup_outputs_connected_crtc();
298
371
 
299
 
    mgm::RealKMSOutput output{mock_drm.fake_drm.fd(), connector_ids[0],
300
 
                              mt::fake_shared(mock_page_flipper)};
301
 
 
302
 
    EXPECT_TRUE(output.set_crtc(987));
 
372
    mgm::RealKMSOutput output{
 
373
        drm_fd,
 
374
        mg::kms::get_connector(drm_fd, connector_ids[0]),
 
375
        mt::fake_shared(mock_page_flipper)};
 
376
 
 
377
    auto fb = output.fb_for(fake_bo);
 
378
 
 
379
    EXPECT_TRUE(output.set_crtc(*fb));
303
380
    EXPECT_NO_THROW({
304
381
        output.move_cursor({123, 456});
305
382
    });
320
397
 
321
398
    setup_outputs_connected_crtc();
322
399
 
323
 
    mgm::RealKMSOutput output{mock_drm.fake_drm.fd(), connector_ids[0],
324
 
                              mt::fake_shared(mock_page_flipper)};
325
 
 
326
 
    EXPECT_TRUE(output.set_crtc(987));
 
400
    mgm::RealKMSOutput output{
 
401
        drm_fd,
 
402
        mg::kms::get_connector(drm_fd, connector_ids[0]),
 
403
        mt::fake_shared(mock_page_flipper)};
 
404
 
 
405
    auto fb = output.fb_for(fake_bo);
 
406
 
 
407
    EXPECT_TRUE(output.set_crtc(*fb));
327
408
    struct gbm_bo *dummy = reinterpret_cast<struct gbm_bo*>(0x1234567);
328
409
    EXPECT_NO_THROW({
329
410
        output.set_cursor(dummy);
345
426
 
346
427
    setup_outputs_connected_crtc();
347
428
 
348
 
    mgm::RealKMSOutput output{mock_drm.fake_drm.fd(), connector_ids[0],
349
 
                              mt::fake_shared(mock_page_flipper)};
350
 
 
351
 
    EXPECT_TRUE(output.set_crtc(987));
 
429
    mgm::RealKMSOutput output{
 
430
        drm_fd,
 
431
        mg::kms::get_connector(drm_fd, connector_ids[0]),
 
432
        mt::fake_shared(mock_page_flipper)};
 
433
 
 
434
    auto fb = output.fb_for(fake_bo);
 
435
 
 
436
    EXPECT_TRUE(output.set_crtc(*fb));
352
437
    struct gbm_bo *dummy = reinterpret_cast<struct gbm_bo*>(0x1234567);
353
438
    output.set_cursor(dummy);
354
439
    EXPECT_FALSE(output.has_cursor());
362
447
 
363
448
    setup_outputs_connected_crtc();
364
449
 
365
 
    mgm::RealKMSOutput output{mock_drm.fake_drm.fd(), connector_ids[0],
366
 
                              mt::fake_shared(mock_page_flipper)};
 
450
    mgm::RealKMSOutput output{
 
451
        drm_fd,
 
452
        mg::kms::get_connector(drm_fd, connector_ids[0]),
 
453
        mt::fake_shared(mock_page_flipper)};
367
454
 
368
455
    EXPECT_CALL(mock_drm, drmModeSetCrtc(_, crtc_ids[0], 0, 0, 0, nullptr, 0, nullptr))
369
456
        .Times(1)
382
469
 
383
470
    setup_outputs_connected_crtc();
384
471
 
385
 
    mgm::RealKMSOutput output{mock_drm.fake_drm.fd(), connector_ids[0],
386
 
                              mt::fake_shared(mock_page_flipper)};
 
472
    mgm::RealKMSOutput output{
 
473
        drm_fd,
 
474
        mg::kms::get_connector(drm_fd, connector_ids[0]),
 
475
        mt::fake_shared(mock_page_flipper)};
387
476
 
388
477
    mg::GammaCurves gamma{{1}, {2}, {3}};
389
478
 
390
 
    EXPECT_CALL(mock_drm, drmModeCrtcSetGamma(mock_drm.fake_drm.fd(), crtc_ids[0],
 
479
    EXPECT_CALL(mock_drm, drmModeCrtcSetGamma(drm_fd, crtc_ids[0],
391
480
                                              gamma.red.size(),
392
481
                                              const_cast<uint16_t*>(gamma.red.data()),
393
482
                                              const_cast<uint16_t*>(gamma.green.data()),
394
483
                                              const_cast<uint16_t*>(gamma.blue.data())))
395
484
        .Times(1);
396
485
 
397
 
    EXPECT_TRUE(output.set_crtc(fb_id));
 
486
    append_fb_id(fb_id);
 
487
 
 
488
    auto fb = output.fb_for(fake_bo);
 
489
 
 
490
    EXPECT_TRUE(output.set_crtc(*fb));
 
491
 
398
492
    output.set_gamma(gamma);
399
493
}
400
494
 
406
500
 
407
501
    setup_outputs_connected_crtc();
408
502
 
409
 
    mgm::RealKMSOutput output{mock_drm.fake_drm.fd(), connector_ids[0],
410
 
                              mt::fake_shared(mock_page_flipper)};
 
503
    mgm::RealKMSOutput output{
 
504
        drm_fd,
 
505
        mg::kms::get_connector(drm_fd, connector_ids[0]),
 
506
        mt::fake_shared(mock_page_flipper)};
411
507
 
412
508
    mg::GammaCurves gamma{{1}, {2}, {3}};
413
509
 
414
 
    EXPECT_CALL(mock_drm, drmModeCrtcSetGamma(mock_drm.fake_drm.fd(), crtc_ids[0],
 
510
    EXPECT_CALL(mock_drm, drmModeCrtcSetGamma(drm_fd, crtc_ids[0],
415
511
                                              gamma.red.size(),
416
512
                                              const_cast<uint16_t*>(gamma.red.data()),
417
513
                                              const_cast<uint16_t*>(gamma.green.data()),
418
514
                                              const_cast<uint16_t*>(gamma.blue.data())))
419
515
        .WillOnce(Return(-ENOSYS));
420
516
 
421
 
    EXPECT_TRUE(output.set_crtc(fb_id));
 
517
    append_fb_id(fb_id);
 
518
 
 
519
    auto fb = output.fb_for(fake_bo);
 
520
 
 
521
    EXPECT_TRUE(output.set_crtc(*fb));
422
522
 
423
523
    EXPECT_NO_THROW(output.set_gamma(gamma););
424
524
}