~vanvugt/mir/unique-id

« back to all changes in this revision

Viewing changes to src/server/graphics/gbm/gbm_display.cpp

  • Committer: Daniel van Vugt
  • Date: 2013-04-16 06:59:13 UTC
  • mfrom: (578.1.12 trunk)
  • Revision ID: daniel.van.vugt@canonical.com-20130416065913-ihl399t0ud6t2uax
Merge latest lp:mir

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Copyright © 2012 Canonical Ltd.
3
3
 *
4
4
 * This program is free software: you can redistribute it and/or modify it
5
 
 * under the terms of the GNU Lesser General Public License version 3,
 
5
 * under the terms of the GNU General Public License version 3,
6
6
 * as published by the Free Software Foundation.
7
7
 *
8
8
 * This program is distributed in the hope that it will be useful,
10
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
 * GNU General Public License for more details.
12
12
 *
13
 
 * You should have received a copy of the GNU Lesser General Public License
 
13
 * You should have received a copy of the GNU General Public License
14
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
15
 *
16
16
 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
22
22
#include "kms_display_configuration.h"
23
23
#include "kms_output.h"
24
24
#include "kms_page_flipper.h"
 
25
#include "virtual_terminal.h"
25
26
 
26
27
#include "mir/geometry/rectangle.h"
27
28
 
36
37
      output_container{platform->drm.fd,
37
38
                       std::make_shared<KMSPageFlipper>(platform->drm.fd)}
38
39
{
 
40
    platform->vt->set_graphics_mode();
 
41
 
39
42
    shared_egl.setup(platform->gbm);
40
43
 
41
44
    configure(configuration());
43
46
    shared_egl.make_current();
44
47
}
45
48
 
 
49
mgg::GBMDisplay::~GBMDisplay()
 
50
{
 
51
}
 
52
 
46
53
geom::Rectangle mgg::GBMDisplay::view_area() const
47
54
{
48
55
    return display_buffers[0]->view_area();
92
99
                                                        max_size.height.as_uint32_t());
93
100
 
94
101
    /* Create a single DisplayBuffer that displays the surface on all the outputs */
95
 
    std::unique_ptr<DisplayBuffer> db{new GBMDisplayBuffer{platform, listener, enabled_outputs,
96
 
                                                           std::move(surface), max_size,
97
 
                                                           shared_egl.context()}};
 
102
    std::unique_ptr<GBMDisplayBuffer> db{new GBMDisplayBuffer{platform, listener, enabled_outputs,
 
103
                                                              std::move(surface), max_size,
 
104
                                                              shared_egl.context()}};
98
105
    display_buffers.push_back(std::move(db));
99
106
}
 
107
 
 
108
void mgg::GBMDisplay::register_pause_resume_handlers(
 
109
    MainLoop& main_loop,
 
110
    std::function<void()> const& pause_handler,
 
111
    std::function<void()> const& resume_handler)
 
112
{
 
113
    platform->vt->register_switch_handlers(main_loop, pause_handler, resume_handler);
 
114
}
 
115
 
 
116
void mgg::GBMDisplay::pause()
 
117
{
 
118
    platform->drm.drop_master();
 
119
}
 
120
 
 
121
void mgg::GBMDisplay::resume()
 
122
{
 
123
    platform->drm.set_master();
 
124
 
 
125
    for (auto& db_ptr : display_buffers)
 
126
        db_ptr->schedule_set_crtc();
 
127
}