~ubuntu-branches/ubuntu/vivid/mir/vivid

« back to all changes in this revision

Viewing changes to src/client/mesa/native_surface.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-08-11 19:52:06 UTC
  • mto: This revision was merged to the branch mainline in revision 77.
  • Revision ID: package-import@ubuntu.com-20140811195206-05ee991qbzvdbmel
Tags: upstream-0.6.0+14.10.20140811
ImportĀ upstreamĀ versionĀ 0.6.0+14.10.20140811

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include "../client_buffer.h"
21
21
#include "native_surface.h"
22
22
 
 
23
#include <iostream>
 
24
#include <boost/exception/diagnostic_information.hpp> 
 
25
 
23
26
namespace mclm=mir::client::mesa;
24
27
 
25
28
namespace
43
46
    auto s = static_cast<mclm::NativeSurface*>(surface);
44
47
    return s->set_swapinterval(interval);
45
48
}
 
49
 
 
50
void report_exception_at_driver_boundary(std::exception const& e)
 
51
{
 
52
    std::cerr << "Caught exception at Mir/EGL driver boundary: "
 
53
              << boost::diagnostic_information(e) << std::endl;
 
54
}
46
55
}
47
56
 
48
57
mclm::NativeSurface::NativeSurface(ClientSurface& surface)
54
63
}
55
64
 
56
65
int mclm::NativeSurface::advance_buffer(MirBufferPackage* buffer_package)
 
66
try
57
67
{
58
68
    /*
59
69
     * At present dri2_create_mir_window_surface will trigger
72
82
    memcpy(buffer_package, buffer_to_driver.get(), sizeof(MirBufferPackage));
73
83
    return MIR_MESA_TRUE;
74
84
}
 
85
catch (std::exception const& e)
 
86
{
 
87
    report_exception_at_driver_boundary(e);
 
88
    return MIR_MESA_FALSE;
 
89
}
75
90
 
76
91
int mclm::NativeSurface::get_parameters(MirSurfaceParameters* surface_parameters)
 
92
try
77
93
{
78
94
    auto params = surface.get_parameters();
79
95
    memcpy(surface_parameters, &params, sizeof(MirSurfaceParameters));
80
96
    return MIR_MESA_TRUE;
81
97
}
 
98
catch (std::exception const& e)
 
99
{
 
100
    report_exception_at_driver_boundary(e);
 
101
    return MIR_MESA_FALSE;
 
102
}
82
103
 
83
104
int mclm::NativeSurface::set_swapinterval(int interval)
 
105
try
84
106
{
85
107
    if ((interval < 0) || (interval > 1))
86
108
        return MIR_MESA_FALSE;
88
110
    surface.request_and_wait_for_configure(mir_surface_attrib_swapinterval, interval);
89
111
    return MIR_MESA_TRUE;
90
112
}
 
113
catch (std::exception const& e)
 
114
{
 
115
    report_exception_at_driver_boundary(e);
 
116
    return MIR_MESA_FALSE;
 
117
}