[Mesa-dev] [PATCH 1/2] gallium/radeon/winsyses: add radeon_winsys::min_alloc_size

Nicolai Hähnle nhaehnle at gmail.com
Tue Sep 27 14:56:19 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/gallium/drivers/radeon/radeon_winsys.h        | 1 +
 src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c     | 2 ++
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 4 ++++
 3 files changed, 7 insertions(+)

diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h
index 55f0395..d0705d6 100644
--- a/src/gallium/drivers/radeon/radeon_winsys.h
+++ b/src/gallium/drivers/radeon/radeon_winsys.h
@@ -176,20 +176,21 @@ struct radeon_info {
     uint32_t                    pci_func;
 
     /* Device info. */
     uint32_t                    pci_id;
     enum radeon_family          family;
     enum chip_class             chip_class;
     uint32_t                    gart_page_size;
     uint64_t                    gart_size;
     uint64_t                    vram_size;
     uint64_t                    max_alloc_size;
+    uint32_t                    min_alloc_size;
     bool                        has_dedicated_vram;
     bool                        has_virtual_memory;
     bool                        gfx_ib_pad_with_type2;
     bool                        has_sdma;
     bool                        has_uvd;
     uint32_t                    uvd_fw_version;
     uint32_t                    vce_fw_version;
     uint32_t                    me_fw_version;
     uint32_t                    pfp_fw_version;
     uint32_t                    ce_fw_version;
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
index c83489d..c28e1ca 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
@@ -550,20 +550,22 @@ amdgpu_winsys_create(int fd, radeon_screen_create_t screen_create)
 
    if (!pb_slabs_init(&ws->bo_slabs,
                       AMDGPU_SLAB_MIN_SIZE_LOG2, AMDGPU_SLAB_MAX_SIZE_LOG2,
                       12, /* number of heaps (domain/flags combinations) */
                       ws,
                       amdgpu_bo_can_reclaim_slab,
                       amdgpu_bo_slab_alloc,
                       amdgpu_bo_slab_free))
       goto fail_cache;
 
+   ws->info.min_alloc_size = 1 << AMDGPU_SLAB_MIN_SIZE_LOG2;
+
    /* init reference */
    pipe_reference_init(&ws->reference, 1);
 
    /* Set functions. */
    ws->base.unref = amdgpu_winsys_unref;
    ws->base.destroy = amdgpu_winsys_destroy;
    ws->base.query_info = amdgpu_winsys_query_info;
    ws->base.cs_request_feature = amdgpu_cs_request_feature;
    ws->base.query_value = amdgpu_query_value;
    ws->base.read_registers = amdgpu_read_registers;
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index ae55746..16e4408 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -767,20 +767,24 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create)
          * honor the address offset.
          */
         if (!pb_slabs_init(&ws->bo_slabs,
                            RADEON_SLAB_MIN_SIZE_LOG2, RADEON_SLAB_MAX_SIZE_LOG2,
                            12,
                            ws,
                            radeon_bo_can_reclaim_slab,
                            radeon_bo_slab_alloc,
                            radeon_bo_slab_free))
             goto fail_cache;
+
+        ws->info.min_alloc_size = 1 << RADEON_SLAB_MIN_SIZE_LOG2;
+    } else {
+        ws->info.min_alloc_size = ws->info.gart_page_size;
     }
 
     if (ws->gen >= DRV_R600) {
         ws->surf_man = radeon_surface_manager_new(ws->fd);
         if (!ws->surf_man)
             goto fail_slab;
     }
 
     /* init reference */
     pipe_reference_init(&ws->reference, 1);
-- 
2.7.4



More information about the mesa-dev mailing list