[Mesa-dev] [PATCH 4/5] nouveau: no modifier != the invalid modifier

James Jones jajones at nvidia.com
Wed Feb 5 20:52:46 UTC 2020

Other drivers fail resource allocation when a list
of modifiers for the resource is provided but none
are supported. This includes cases when the never-
supported DRM_FORMAT_MOD_INVALID modifier is
explicitly passed.  To enable matching that
functionality in nouveau, use an empty modifier
list rather than creating a one-entry list
containing only DRM_FORMAT_MOD_INVALID when the
non-modifier resource creation function is used.

This change stops short of failing allocations
when no modifier is specified, because the current
code ignores all modifiers except the linear
modifier when creating resources, so there is not
yet a framework in place to determine which
modifiers are valid for a given resource creation
request, and hence no way to reject only those
which are invalid.

Signed-off-by: James Jones <jajones at nvidia.com>
 src/gallium/drivers/nouveau/nvc0/nvc0_resource.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c
index 18c4dfad23d..c9ee097d269 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c
@@ -10,13 +10,11 @@ static struct pipe_resource *
 nvc0_resource_create(struct pipe_screen *screen,
                      const struct pipe_resource *templ)
-   const uint64_t modifier = DRM_FORMAT_MOD_INVALID;
    switch (templ->target) {
    case PIPE_BUFFER:
       return nouveau_buffer_create(screen, templ);
-      return nvc0_miptree_create(screen, templ, &modifier, 1);
+      return nvc0_miptree_create(screen, templ, NULL, 0);

More information about the mesa-dev mailing list