~peat-new/mir/hack-eglswapbuffer-call-fbpost

« back to all changes in this revision

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

  • Committer: Ratchanan Srirattanamet
  • Date: 2016-08-15 04:11:26 UTC
  • Revision ID: peathot@hotmail.com-20160815041126-cqo0km0r8vo1g4ev
android: [HACK] run FB's post from native_window's queue buffer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
mga::HwcFbDevice::HwcFbDevice(
40
40
    std::shared_ptr<HwcWrapper> const& hwc_wrapper,
41
41
    std::shared_ptr<framebuffer_device_t> const& fb_device) :
42
 
    hwc_wrapper(hwc_wrapper), 
 
42
    hwc_wrapper(hwc_wrapper),
43
43
    fb_device(fb_device),
44
44
    vsync_subscription{
45
45
        [hwc_wrapper, this]{
85
85
        BOOST_THROW_EXCEPTION(std::runtime_error(ss.str()));
86
86
    }
87
87
 
88
 
    auto& buffer = *context.last_rendered_buffer();
89
 
    auto native_buffer = buffer.native_buffer_handle();
90
 
    native_buffer->ensure_available_for(mga::BufferAccess::read);
91
 
    if (fb_device->post(fb_device.get(), native_buffer->handle()) != 0)
92
 
    {
93
 
        BOOST_THROW_EXCEPTION(std::runtime_error("error posting with fb device"));
94
 
    }
 
88
    //FB Post moved to frame_available function.
95
89
 
96
90
    std::unique_lock<std::mutex> lk(vsync_wait_mutex);
97
91
    vsync_occurred = false;
123
117
{
124
118
    return false;
125
119
}
 
120
 
 
121
void mga::HwcFbDevice::frame_available(std::shared_ptr<mg::Buffer> buffer)
 
122
{
 
123
    auto native_buffer = buffer->native_buffer_handle();
 
124
    native_buffer->ensure_available_for(mga::BufferAccess::read);
 
125
    if (fb_device->post(fb_device.get(), native_buffer->handle()) != 0)
 
126
    {
 
127
        BOOST_THROW_EXCEPTION(std::runtime_error("error posting with fb device"));
 
128
    }
 
129
}