Implement weston_view_is_opaque()
The DRM backend currently does gymnastics to figure out whether or not a view is opaque, in drm_view_is_opaque()
. We need to know this so we can tell whether or not we should be blending behind a given object; disabling blending where possible can be an important optimisation, and it also has a large impact on our damage tracking. If a view is fully opaque, we can totally ignore everything behind it.
Unfortunately finding this out is somewhat convoluted.
If the buffer format is an opaque format, obviously the view is opaque. We do not store the buffer format anywhere on import. It would be good if the various buffer importers (SHM, wl_buffer inside gl-renderer
, dmabuf) would have a field inside weston_buffer
which was set to true if they knew for a fact the buffer format was opaque and would never be blended.
Using this and moving drm_view_is_opaque()
into the core would be great:
- if the view has a non-zero alpha, view is not opaque
- test alpha channel for solid-colour views
- if the buffer has an opaque pixel format, view is opaque
- else, test whether or not the view's opaque region completely covers the view
For the last check, we would want to pass in a 'relevant area' bounding box: when painting views, we are typically only interested in areas that are a) on that output, and b) not occluded (covered) by other views which have already been painted.