DRM: drm_fb reuse messy with opaque transitions
@daniels
Submitted by Daniel Stone Assigned to Daniel Stone @daniels
Description
Currently in compositor-drm, we have something like the below pseudocode:
struct drm_fb *drm_fb_get_from_bo(struct gbm_bo *bo, uint32_t format)
{
struct drm_fb *fb = gbm_bo_get_user_data(bo);
if (fb)
return fb;
drmModeAddFB2(..., format, &fb->fb_id);
}
drm_output_prepare_{scanout,overlay}_view()
{
uint32_t format;
struct drm_fb *fb;
format = gbm_bo_get_format(bo);
if (surface_is_opaque())
format = get_opaque_format(format);
fb = drm_fb_get_from_bo(bo);
}
This assumes that the lifetime of a gbm_bo is usefully tied to the lifetime of the surface_is_opaque() determination of a surface, where we check to see if the opaque area covers the whole area of the view.
This already breaks today in contrived multi-view situations, and could also break if the gbm_bo ends up living longer than a single repaint cycle in future.
I don't have a great idea of how to fix this right now, apart from maybe creating multiple FBs on demand.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information