~ubuntu-branches/ubuntu/wily/mir/wily-proposed

« back to all changes in this revision

Viewing changes to src/platforms/android/server/real_hwc_wrapper.cpp

  • Committer: Package Import Robot
  • Author(s): Alexandros Frantzis
  • Date: 2015-10-08 16:12:19 UTC
  • mto: This revision was merged to the branch mainline in revision 109.
  • Revision ID: package-import@ubuntu.com-20151008161219-emk4a1ys51yy0wjb
Tags: upstream-0.17.0+15.10.20151008.2
ImportĀ upstreamĀ versionĀ 0.17.0+15.10.20151008.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
#include "real_hwc_wrapper.h"
20
20
#include "hwc_report.h"
 
21
#include "display_device_exceptions.h"
21
22
#include <boost/throw_exception.hpp>
22
23
#include <stdexcept>
23
24
#include <sstream>
115
116
    std::array<hwc_display_contents_1_t*, HWC_NUM_DISPLAY_TYPES> const& displays) const
116
117
{
117
118
    report->report_set_list(displays);
118
 
    if (auto rc = hwc_device->set(hwc_device.get(), num_displays(displays),
 
119
    auto const num_displays = ::num_displays(displays);
 
120
    if (auto rc = hwc_device->set(hwc_device.get(), num_displays,
119
121
        const_cast<hwc_display_contents_1**>(displays.data())))
120
122
    {
121
123
        std::stringstream ss;
122
124
        ss << "error during hwc set(). rc = " << std::hex << rc;
 
125
 
 
126
        if (num_displays > 1)
 
127
        {
 
128
            if (!display_connected(DisplayName::external))
 
129
                BOOST_THROW_EXCEPTION(mga::DisplayDisconnectedException(ss.str()));
 
130
            else
 
131
                BOOST_THROW_EXCEPTION(mga::ExternalDisplayError(ss.str()));
 
132
        }
 
133
 
123
134
        BOOST_THROW_EXCEPTION(std::runtime_error(ss.str()));
124
135
    }
125
136
    report->report_set_done(displays);
290
301
    if (rc < 0)
291
302
        BOOST_THROW_EXCEPTION(std::system_error(rc, std::system_category(), "unable to set active display config"));
292
303
}
 
304
 
 
305
bool mga::RealHwcWrapper::display_connected(DisplayName display_name) const
 
306
{
 
307
    size_t num_configs = 0;
 
308
    return hwc_device->getDisplayConfigs(hwc_device.get(), display_name, nullptr, &num_configs) == 0;
 
309
}