freedreno: Set up supported modifiers in fd*_resource_screen_init()
authorKristian H. Kristensen <hoegsberg@google.com>
Wed, 5 Feb 2020 01:41:27 +0000 (17:41 -0800)
committerMarge Bot <eric+marge@anholt.net>
Wed, 5 Feb 2020 20:53:32 +0000 (20:53 +0000)
Keep the modifier logic together.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3704>

src/gallium/drivers/freedreno/a6xx/fd6_screen.c
src/gallium/drivers/freedreno/freedreno_resource.c
src/gallium/drivers/freedreno/freedreno_screen.c

index 32d06ed13a400ef6d3232089ba66d95e14445ee6..bf1f9680c7c1ee92095e2bc7c195db9237457c97 100644 (file)
@@ -138,14 +138,6 @@ fd6_screen_init(struct pipe_screen *pscreen)
 
        screen->tile_mode = fd6_tile_mode;
 
-       static const uint64_t supported_modifiers[] = {
-               DRM_FORMAT_MOD_LINEAR,
-               DRM_FORMAT_MOD_QCOM_COMPRESSED,
-       };
-
-       screen->supported_modifiers = supported_modifiers;
-       screen->num_supported_modifiers = ARRAY_SIZE(supported_modifiers);
-
        fd6_resource_screen_init(pscreen);
        fd6_emit_init_screen(pscreen);
 }
index 59b1d9793fabbc9008b1f885408950ce863d5525..54bf359a0cc3b5766670e5f1233659584c4da619 100644 (file)
@@ -1206,6 +1206,10 @@ static const struct u_transfer_vtbl transfer_vtbl = {
                .get_stencil              = fd_resource_get_stencil,
 };
 
+static const uint64_t supported_modifiers[] = {
+       DRM_FORMAT_MOD_LINEAR,
+};
+
 void
 fd_resource_screen_init(struct pipe_screen *pscreen)
 {
@@ -1226,6 +1230,10 @@ fd_resource_screen_init(struct pipe_screen *pscreen)
 
        if (!screen->setup_slices)
                screen->setup_slices = fd_setup_slices;
+       if (!screen->supported_modifiers) {
+               screen->supported_modifiers = supported_modifiers;
+               screen->num_supported_modifiers = ARRAY_SIZE(supported_modifiers);
+       }
 }
 
 static void
index 3c0ed69a9cb13a0ad48bd49ca31f9092fbb14708..f79d858e11eb391edf315bff224e3fa72968465f 100644 (file)
@@ -985,15 +985,6 @@ fd_screen_create(struct fd_device *dev, struct renderonly *ro)
 
        pscreen->query_dmabuf_modifiers = fd_screen_query_dmabuf_modifiers;
 
-       if (!screen->supported_modifiers) {
-               static const uint64_t supported_modifiers[] = {
-                       DRM_FORMAT_MOD_LINEAR,
-               };
-
-               screen->supported_modifiers = supported_modifiers;
-               screen->num_supported_modifiers = ARRAY_SIZE(supported_modifiers);
-       }
-
        slab_create_parent(&screen->transfer_pool, sizeof(struct fd_transfer), 16);
 
        return pscreen;