v3d: enable options to ignore SCANOUT flag on resource creation

This is a downstream patch for enabling the usage of more tiled
buffers in Raspberry OS under an enviroment using mutter and Xorg.

This patch enables the following behaviour in order to reduce the
number of CMA usage and use tiled layouts because we ignore
the possible SCANOUT usage of the resource.

This patch makes mutter to not ignore SCANOUT flags because as
compositor it should allocate linear render buffers suitable for display.

Then if the Xserver has enabled the dmabuf_capable option, the
buffers backing the windows pixmaps will allocate using modifiers,
but as current gbm_bo_create_wth_modifieres doesn't add the SCANOUT flag
at Mesa 20.3.5, we ignore the SHARED flag also and we back the buffer
not using CMA memory. With the Mutter compositor we didn't find a
situation were this pixmaps needed to be SCANOUT. But this is not sure,
but it allows us to not use CMA for every window opened, and having them
in tiled format saves all linear->tiled conversion for sampling.

Finally to take advantage of using Tiled render buffers for applications
we can enable in the enviroment V3D_IGNORE_SCANOUT_USAGES so all render
targes use the tiled UIF format without CMA memory instead of a linear one.
As the compositor mutter will composite the final surface for display we
aren't going to use the SCANOUT flag. This only applies if we are under
an X11 session.
1 file changed