compositor-drm: refactor to avoid unnecessary allocation of KMS FBs
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Wed, 2 May 2012 13:42:21 +0000 (16:42 +0300)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 2 May 2012 14:04:26 +0000 (10:04 -0400)
commit555c17ddd8378a5d9ecede42adec56a7395ffeb1
tree7575267b86120528f75d2efc4816b2f3f5224074
parent3e0fe5c0df874c3bd3c72e518899216424fbfe4e
compositor-drm: refactor to avoid unnecessary allocation of KMS FBs

Currently, the drm backend will create and destroy a KMS FB for each
frame. However, the bos for a gbm surface are reused (at least with
mesa) so we can store the fb_id on it and destroy it only on the bo's
destroy callback.

To use the same path for scanning out client buffers, some refactor
was needed. Previously, the bo for the client buffer was destroyed
early so that gbm_surface_release_buffer() would not be called with
it, since at the page flip handler output->scanout_buffer can be
NULL even if the current frame is a client buffer.

This was solved by adding a drm_fb structure that holds a gbm_bo,
an fb_id, and information about the fb coming from a client buffer
or not. A drm_fb is created in such a way that it is destroyed
whenever the bo it references is destroyed. The fields current_*
and next_* in drm_output are changed into only two pointers to
drm_fb's.
src/compositor-drm.c