]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amdgpu: reduce the number of placements for a BO
authorChristian König <christian.koenig@amd.com>
Wed, 18 Jul 2018 09:16:35 +0000 (11:16 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 25 Jul 2018 20:06:13 +0000 (15:06 -0500)
Make struct amdgpu_bo a bit smaller.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h

index 7b3398c337f13dab7fa7a9a69d4fa2b7e2e1dce8..21bfa2d8039e030b332406e9789df2343f609013 100644 (file)
@@ -216,6 +216,8 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain)
                c++;
        }
 
+       BUG_ON(c >= AMDGPU_BO_MAX_PLACEMENTS);
+
        placement->num_placement = c;
        placement->placement = places;
 
index 345fcd1769923ff45b35d4b8dc296e186200bc28..18945dd6982db005c04c6654f41f09a6bb12b1cc 100644 (file)
@@ -32,6 +32,7 @@
 #include "amdgpu.h"
 
 #define AMDGPU_BO_INVALID_OFFSET       LONG_MAX
+#define AMDGPU_BO_MAX_PLACEMENTS       3
 
 struct amdgpu_bo_param {
        unsigned long                   size;
@@ -77,7 +78,7 @@ struct amdgpu_bo {
        /* Protected by tbo.reserved */
        u32                             preferred_domains;
        u32                             allowed_domains;
-       struct ttm_place                placements[AMDGPU_GEM_DOMAIN_MAX + 1];
+       struct ttm_place                placements[AMDGPU_BO_MAX_PLACEMENTS];
        struct ttm_placement            placement;
        struct ttm_buffer_object        tbo;
        struct ttm_bo_kmap_obj          kmap;