~vanvugt/mir/frame-skip

« back to all changes in this revision

Viewing changes to src/platform/graphics/mesa/real_kms_output.cpp

  • Committer: Daniel van Vugt
  • Date: 2014-11-21 09:01:43 UTC
  • Revision ID: daniel.van.vugt@canonical.com-20141121090143-qf1k2us60vc9h0rh
Prototype frame skip detection

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
    : drm_fd{drm_fd}, connector_id{connector_id}, page_flipper{page_flipper},
135
135
      connector(), mode_index{0}, current_crtc(), saved_crtc(),
136
136
      using_saved_crtc{true}, has_cursor_{false},
137
 
      power_mode(mir_power_mode_on)
 
137
      power_mode(mir_power_mode_on),
 
138
      any_seq(false)
138
139
{
139
140
    reset();
140
141
 
252
253
    return page_flipper->schedule_flip(current_crtc->crtc_id, fb_id);
253
254
}
254
255
 
255
 
void mgm::RealKMSOutput::wait_for_page_flip()
 
256
unsigned int mgm::RealKMSOutput::wait_for_page_flip()
256
257
{
257
258
    std::unique_lock<std::mutex> lg(power_mutex);
258
259
    if (power_mode != mir_power_mode_on)
259
 
        return;
 
260
        return 0;
260
261
    if (!current_crtc)
261
262
    {
262
263
        fatal_error("Output %s has no associated CRTC to wait on",
263
264
                   connector_name(connector.get()).c_str());
264
265
    }
265
 
    page_flipper->wait_for_flip(current_crtc->crtc_id);
 
266
    auto seq = page_flipper->wait_for_flip(current_crtc->crtc_id);
 
267
    unsigned int delta = 1;
 
268
    if (!any_seq)
 
269
        any_seq = true;
 
270
    else
 
271
        delta = seq - last_seq;
 
272
    last_seq = seq;
 
273
    return delta;
266
274
}
267
275
 
268
276
void mgm::RealKMSOutput::set_cursor(gbm_bo* buffer)