gallium/radeon: simplify radeon_flags_from_heap
authorMarek Olšák <marek.olsak@amd.com>
Sun, 31 Dec 2017 19:42:27 +0000 (20:42 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 27 Jan 2018 01:09:09 +0000 (02:09 +0100)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/gallium/drivers/radeon/radeon_winsys.h

index 307f8efaec084775d5bd423c4708d78cd0d3f899..6e87f75b81d6bf7eadbdbe87095a110ef0d07ac8 100644 (file)
@@ -687,30 +687,24 @@ static inline enum radeon_bo_domain radeon_domain_from_heap(enum radeon_heap hea
 
 static inline unsigned radeon_flags_from_heap(enum radeon_heap heap)
 {
+    unsigned flags = RADEON_FLAG_NO_INTERPROCESS_SHARING |
+                     (heap != RADEON_HEAP_GTT ? RADEON_FLAG_GTT_WC : 0);
+
     switch (heap) {
     case RADEON_HEAP_VRAM_NO_CPU_ACCESS:
-        return RADEON_FLAG_GTT_WC |
-               RADEON_FLAG_NO_CPU_ACCESS |
-               RADEON_FLAG_NO_INTERPROCESS_SHARING;
+        return flags |
+               RADEON_FLAG_NO_CPU_ACCESS;
 
     case RADEON_HEAP_VRAM_READ_ONLY:
-        return RADEON_FLAG_GTT_WC |
-               RADEON_FLAG_NO_INTERPROCESS_SHARING |
+    case RADEON_HEAP_GTT_WC_READ_ONLY:
+        return flags |
                RADEON_FLAG_READ_ONLY;
 
     case RADEON_HEAP_VRAM:
     case RADEON_HEAP_GTT_WC:
-        return RADEON_FLAG_GTT_WC |
-               RADEON_FLAG_NO_INTERPROCESS_SHARING;
-
-    case RADEON_HEAP_GTT_WC_READ_ONLY:
-        return RADEON_FLAG_GTT_WC |
-               RADEON_FLAG_NO_INTERPROCESS_SHARING |
-               RADEON_FLAG_READ_ONLY;
-
     case RADEON_HEAP_GTT:
     default:
-        return RADEON_FLAG_NO_INTERPROCESS_SHARING;
+        return flags;
     }
 }