v3d: Don't force SCANOUT for PIPE_BIND_SHARED requests

This was workaround for the users of gbm_bo_create_with_modifiers(),
which were unable to specify the buffer usage (GPU / GPU+DISPLAY).

But after the commit [1] this become possible. And forcing usage to
GBM_BO_USE_SCANOUT migrated directly into gbm_bo_create_with_modifiers
[2], allowing us to remove such workarounds from the drivers.

This makes possible to allocate the buffers in VRAM using
{gbm_bo_create_with_modifiers2 | gbm_bo_create} and providing correct
use flag thus saving CMA memory.

This should also enable tiling for such buffers.

[1]: 268e12c605 ("gbm: add gbm_{bo,surface}_create_with_modifiers2")
[2]: ad50b47a14 ("gbm: assume USE_SCANOUT in create_with_modifiers")

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14151>
This commit is contained in:
Roman Stratiienko 2021-12-10 19:35:55 +02:00 committed by Marge Bot
parent 2cbbfd23ce
commit ef3b31c967
1 changed files with 1 additions and 10 deletions

View File

@ -814,16 +814,7 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen,
v3d_setup_slices(rsc, 0, tmpl->bind & PIPE_BIND_SHARED);
/* If we're in a renderonly setup, use the other device to perform our
* allocation and just import it to v3d. The other device may be
* using CMA, and V3D can import from CMA but doesn't do CMA
* allocations on its own.
*
* We always allocate this way for SHARED, because get_handle will
* need a resource on the display fd.
*/
if (screen->ro && (tmpl->bind & (PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED))) {
if (screen->ro && (tmpl->bind & PIPE_BIND_SCANOUT)) {
struct winsys_handle handle;
struct pipe_resource scanout_tmpl = {
.target = prsc->target,