From: Marek Olšák <marek.ol...@amd.com>

This can result in 2x increase in performance on non-harvested Kaveris.

v2: don't do it on radeon

Tested-by: Michel Dänzer <michel.daen...@amd.com>
---
 src/amd/common/ac_gpu_info.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c
index 031fd183b6f..8147fb0bbc3 100644
--- a/src/amd/common/ac_gpu_info.c
+++ b/src/amd/common/ac_gpu_info.c
@@ -309,21 +309,26 @@ bool ac_query_gpu_info(int fd, amdgpu_device_handle dev,
        info->uvd_enc_supported =
                uvd_enc.available_rings ? true : false;
        info->has_userptr = true;
        info->has_syncobj = has_syncobj(fd);
        info->has_syncobj_wait_for_submit = info->has_syncobj && 
info->drm_minor >= 20;
        info->has_fence_to_handle = info->has_syncobj && info->drm_minor >= 21;
        info->has_ctx_priority = info->drm_minor >= 22;
        /* TODO: Enable this once the kernel handles it efficiently. */
        info->has_local_buffers = info->drm_minor >= 20 &&
                                  !info->has_dedicated_vram;
+
        info->num_render_backends = amdinfo->rb_pipes;
+       /* The value returned by the kernel driver was wrong. */
+       if (info->family == CHIP_KAVERI)
+               info->num_render_backends = 2;
+
        info->clock_crystal_freq = amdinfo->gpu_counter_freq;
        if (!info->clock_crystal_freq) {
                fprintf(stderr, "amdgpu: clock crystal frequency is 0, 
timestamps will be wrong\n");
                info->clock_crystal_freq = 1;
        }
        info->tcc_cache_line_size = 64; /* TC L2 line size on GCN */
        info->gb_addr_config = amdinfo->gb_addr_cfg;
        if (info->chip_class == GFX9) {
                info->num_tile_pipes = 1 << 
G_0098F8_NUM_PIPES(amdinfo->gb_addr_cfg);
                info->pipe_interleave_bytes =
@@ -620,37 +625,43 @@ ac_get_raster_config(struct radeon_info *info,
                        raster_config = 0x00000000;
                else
                        raster_config = 0x00000002;
                raster_config_1 = 0x00000000;
                break;
        case CHIP_CARRIZO:
                raster_config = 0x00000002;
                raster_config_1 = 0x00000000;
                break;
        case CHIP_KAVERI:
-               /* KV should be 0x00000002, but that causes problems with 
radeon */
-               raster_config = 0x00000000; /* 0x00000002 */
+               raster_config = 0x00000002;
                raster_config_1 = 0x00000000;
                break;
        case CHIP_KABINI:
        case CHIP_MULLINS:
        case CHIP_STONEY:
                raster_config = 0x00000000;
                raster_config_1 = 0x00000000;
                break;
        default:
                fprintf(stderr,
                        "ac: Unknown GPU, using 0 for raster_config\n");
                raster_config = 0x00000000;
                raster_config_1 = 0x00000000;
                break;
        }
+
+       /* drm/radeon on Kaveri is buggy, so disable 1 RB to work around it.
+        * This decreases performance by up to 50% when the RB is the 
bottleneck.
+        */
+       if (info->family == CHIP_KAVERI && info->drm_major == 2)
+               raster_config = 0x00000000;
+
        *raster_config_p = raster_config;
        *raster_config_1_p = raster_config_1;
 }
 
 void
 ac_get_harvested_configs(struct radeon_info *info,
                         unsigned raster_config,
                         unsigned *cik_raster_config_1_p,
                         unsigned *raster_config_se)
 {
-- 
2.17.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to