anv/device: Store the default MOCS in the device
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 27 Feb 2016 00:22:47 +0000 (16:22 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 27 Feb 2016 18:26:13 +0000 (10:26 -0800)
src/intel/vulkan/anv_private.h
src/intel/vulkan/gen7_state.c
src/intel/vulkan/gen8_state.c

index 041ad87f75dd9a83bea940a7139bd1828e44cad9..2f3a6597ac26fc26801d117b32b7bd3c2b0f2095 100644 (file)
@@ -680,6 +680,8 @@ struct anv_device {
 
     struct anv_block_pool                       scratch_block_pool;
 
+    uint32_t                                    default_mocs;
+
     pthread_mutex_t                             mutex;
 };
 
@@ -859,19 +861,19 @@ __gen_combine_address(struct anv_batch *batch, void *location,
    .L3CacheabilityControlL3CC                   = 1,           \
 }
 
-#define GEN8_MOCS {                                     \
-      .MemoryTypeLLCeLLCCacheabilityControl = WB,       \
-      .TargetCache = L3DefertoPATforLLCeLLCselection,   \
-      .AgeforQUADLRU = 0                                \
+#define GEN8_MOCS (struct GEN8_MEMORY_OBJECT_CONTROL_STATE) {  \
+      .MemoryTypeLLCeLLCCacheabilityControl = WB,              \
+      .TargetCache = L3DefertoPATforLLCeLLCselection,          \
+      .AgeforQUADLRU = 0                                       \
    }
 
 /* Skylake: MOCS is now an index into an array of 62 different caching
  * configurations programmed by the kernel.
  */
 
-#define GEN9_MOCS {                                     \
-      /* TC=LLC/eLLC, LeCC=WB, LRUM=3, L3CC=WB */       \
-      .IndextoMOCSTables                           = 2  \
+#define GEN9_MOCS (struct GEN9_MEMORY_OBJECT_CONTROL_STATE) {  \
+      /* TC=LLC/eLLC, LeCC=WB, LRUM=3, L3CC=WB */              \
+      .IndextoMOCSTables                           = 2         \
    }
 
 #define GEN9_MOCS_PTE {                                 \
index 5323c378d02d5b7adbd25e97aaf4eb7fe8a9fede..48c41faf57f582f0b896588ecf45d54e6f45790e 100644 (file)
@@ -37,6 +37,9 @@
 VkResult
 genX(init_device_state)(struct anv_device *device)
 {
+   GENX(MEMORY_OBJECT_CONTROL_STATE_pack)(NULL, &device->default_mocs,
+                                          &GENX(MOCS));
+
    struct anv_batch batch;
 
    uint32_t cmds[64];
index 2686bfa8f3c35e14263ae8c1b29139ba1dfa680a..6226eba43ec154704e1fe2f2ea9f500b9ef4de7c 100644 (file)
@@ -37,6 +37,9 @@
 VkResult
 genX(init_device_state)(struct anv_device *device)
 {
+   GENX(MEMORY_OBJECT_CONTROL_STATE_pack)(NULL, &device->default_mocs,
+                                          &GENX(MOCS));
+
    struct anv_batch batch;
 
    uint32_t cmds[64];