winsys/amdgpu: Process RADEON_FLAG_* independently from RADEON_DOMAIN_*
authorMichel Dänzer <michel.daenzer@amd.com>
Tue, 26 Jan 2016 07:38:55 +0000 (16:38 +0900)
committerMichel Dänzer <michel@daenzer.net>
Fri, 29 Jan 2016 07:06:06 +0000 (16:06 +0900)
In particular, AMDGPU_GEM_CREATE_CPU_GTT_USWC can affect even BOs created
in VRAM if they get evicted to GTT. In general there's no need to
restrict any of the flags to any particular domains.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c

index 1e997d98dbca109fecd1c48cf27b1fc8bfe8fc7d..59a801b1426fa34e79d030cf6ecc3f32f8acb5c5 100644 (file)
@@ -288,18 +288,17 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
    request.alloc_size = size;
    request.phys_alignment = alignment;
 
-   if (initial_domain & RADEON_DOMAIN_VRAM) {
+   if (initial_domain & RADEON_DOMAIN_VRAM)
       request.preferred_heap |= AMDGPU_GEM_DOMAIN_VRAM;
-      if (flags & RADEON_FLAG_CPU_ACCESS)
-         request.flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
-      if (flags & RADEON_FLAG_NO_CPU_ACCESS)
-         request.flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
-   }
-   if (initial_domain & RADEON_DOMAIN_GTT) {
+   if (initial_domain & RADEON_DOMAIN_GTT)
       request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;
-      if (flags & RADEON_FLAG_GTT_WC)
-         request.flags |= AMDGPU_GEM_CREATE_CPU_GTT_USWC;
-   }
+
+   if (flags & RADEON_FLAG_CPU_ACCESS)
+      request.flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
+   if (flags & RADEON_FLAG_NO_CPU_ACCESS)
+      request.flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
+   if (flags & RADEON_FLAG_GTT_WC)
+      request.flags |= AMDGPU_GEM_CREATE_CPU_GTT_USWC;
 
    r = amdgpu_bo_alloc(ws->dev, &request, &buf_handle);
    if (r) {