MALI: rockchip: upgrade midgard DDK to r13p0-00rel0
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / midgard / backend / gpu / mali_kbase_js_affinity.c
index 5459281aa968976c8b3f8158286df11ee2d643c1..d665420ab3805788605cc95d5d1c028164c4865a 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <mali_kbase.h>
 #include "mali_kbase_js_affinity.h"
+#include "mali_kbase_hw.h"
 
 #include <backend/gpu/mali_kbase_pm_internal.h>
 
@@ -114,9 +115,14 @@ bool kbase_js_choose_affinity(u64 * const affinity,
        if ((core_req & (BASE_JD_REQ_FS | BASE_JD_REQ_CS | BASE_JD_REQ_T)) ==
                                                                BASE_JD_REQ_T) {
                spin_unlock_irqrestore(&kbdev->pm.power_change_lock, flags);
-               /* Tiler only job, bit 0 needed to enable tiler but no shader
-                * cores required */
-               *affinity = 1;
+                /* If the hardware supports XAFFINITY then we'll only enable
+                 * the tiler (which is the default so this is a no-op),
+                 * otherwise enable shader core 0. */
+               if (!kbase_hw_has_feature(kbdev, BASE_HW_FEATURE_XAFFINITY))
+                       *affinity = 1;
+               else
+                       *affinity = 0;
+
                return true;
        }
 
@@ -172,9 +178,12 @@ bool kbase_js_choose_affinity(u64 * const affinity,
        if (*affinity == 0)
                return false;
 
-       /* Enable core 0 if tiler required */
-       if (core_req & BASE_JD_REQ_T)
-               *affinity = *affinity | 1;
+       /* Enable core 0 if tiler required for hardware without XAFFINITY
+        * support (notes above) */
+       if (core_req & BASE_JD_REQ_T) {
+               if (!kbase_hw_has_feature(kbdev, BASE_HW_FEATURE_XAFFINITY))
+                       *affinity = *affinity | 1;
+       }
 
        return true;
 }