~ubuntu-branches/ubuntu/utopic/mir/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-03-10 19:28:46 UTC
  • mto: This revision was merged to the branch mainline in revision 63.
  • Revision ID: package-import@ubuntu.com-20140310192846-rq9qm3ec26yrelo2
Tags: upstream-0.1.6+14.04.20140310
ImportĀ upstreamĀ versionĀ 0.1.6+14.04.20140310

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include "mir/graphics/display_buffer.h"
21
21
#include "mir/graphics/display_configuration.h"
22
22
#include "src/platform/graphics/mesa/platform.h"
 
23
#include "src/server/report/null_report_factory.h"
23
24
 
24
25
#include "mir_test_doubles/mock_egl.h"
25
26
#include "mir_test_doubles/mock_gl.h"
26
 
#include "mir/graphics/null_display_report.h"
27
27
#include "mir/graphics/display_configuration_policy.h"
28
28
#include "mir_test_doubles/null_virtual_terminal.h"
29
29
 
42
42
namespace geom = mir::geometry;
43
43
namespace mtd = mir::test::doubles;
44
44
namespace mtf = mir::mir_test_framework;
 
45
namespace mr = mir::report;
45
46
 
46
47
namespace
47
48
{
139
140
        EXPECT_CALL(mock_gbm, gbm_device_get_fd(_))
140
141
            .Times(AtLeast(0));
141
142
 
142
 
        fake_devices.add_standard_drm_devices();
 
143
        fake_devices.add_standard_device("standard-drm-devices");
143
144
    }
144
145
 
145
146
    std::shared_ptr<mgm::Platform> create_platform()
146
147
    {
147
148
        return std::make_shared<mgm::Platform>(
148
 
            std::make_shared<mg::NullDisplayReport>(),
 
149
            mr::null_display_report(),
149
150
            std::make_shared<mtd::NullVirtualTerminal>());
150
151
    }
151
152
 
349
350
        EXPECT_CALL(mock_drm, drmModePageFlip(mock_drm.fake_drm.fd(),
350
351
                                              crtc_ids[i], fb_id,
351
352
                                              _, _))
352
 
            .Times(1)
353
 
            .WillOnce(DoAll(SaveArg<4>(&user_data[i]), Return(0)));
 
353
            .Times(2)
 
354
            .WillRepeatedly(DoAll(SaveArg<4>(&user_data[i]), Return(0)));
354
355
 
355
356
        /* Emit fake DRM page-flip events */
356
357
        EXPECT_EQ(1, write(mock_drm.fake_drm.write_fd(), "a", 1));
365
366
 
366
367
    auto display = create_display_cloned(create_platform());
367
368
 
 
369
    /* First frame: Page flips are scheduled, but not waited for */
 
370
    display->for_each_display_buffer([](mg::DisplayBuffer& buffer)
 
371
    {
 
372
        buffer.post_update();
 
373
    });
 
374
 
 
375
    /* Second frame: Previous page flips finish (drmHandleEvent) and new ones
 
376
       are scheduled */
368
377
    display->for_each_display_buffer([](mg::DisplayBuffer& buffer)
369
378
    {
370
379
        buffer.post_update();