<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jul 6, 2017 at 4:27 PM, Ben Widawsky <span dir="ltr"><<a href="mailto:ben@bwidawsk.net" target="_blank">ben@bwidawsk.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We don't yet have optimal MOCS settings, but we have enough to know how<br>
to at least determine when we might have non-optimal settings within our<br>
driver.<br>
<br>
Signed-off-by: Ben Widawsky <<a href="mailto:ben@bwidawsk.net">ben@bwidawsk.net</a>><br>
---<br>
src/intel/vulkan/anv_device.c | 12 ++++++++++++<br>
src/intel/vulkan/anv_private.h | 2 ++<br>
src/mesa/drivers/dri/i915/<wbr>intel_context.c | 7 ++++++-<br>
src/mesa/drivers/dri/i965/<wbr>intel_screen.c | 14 ++++++++++++++<br>
src/mesa/drivers/dri/i965/<wbr>intel_screen.h | 2 ++<br>
5 files changed, 36 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_device.<wbr>c b/src/intel/vulkan/anv_device.<wbr>c<br>
index 3dc55dbb8d..8e180dbf18 100644<br>
--- a/src/intel/vulkan/anv_device.<wbr>c<br>
+++ b/src/intel/vulkan/anv_device.<wbr>c<br>
@@ -368,6 +368,18 @@ anv_physical_device_init(<wbr>struct anv_physical_device *device,<br>
device->info.max_cs_threads = max_cs_threads;<br>
}<br>
<br>
+ if (device->info.gen >= 9) {<br>
+ device->mocs_version = anv_gem_get_param(fd,<br>
+ I915_PARAM_MOCS_TABLE_VERSION)<wbr>;<br>
+ switch (device->mocs_version) {<br>
+ default:<br>
+ anv_perf_warn("Kernel exposes newer MOCS table\n");<br></blockquote><div><br></div><div>A perf_warn here seems reasonable though it makes more sense to me to make it<br><br></div><div>if (device->mocs_version > ANV_MAX_KNOWN_MOCS_VERSION)<br></div><div> anv_perf_warn("...");<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ case 1:<br>
+ case 0:<br>
+ device->mocs_version = MOCS_TABLE_VERSION;<br></blockquote><div><br></div><div>Why are we stomping device->mocs_version to MOCS_TABLE_VERSION? Are you just trying to avoid the version 0? If so, why not just have<br><br></div><div>/* If the MOCS_TABLE_VERSION query fails, assume version 1 */<br></div><div>if (device->mocs_version == 0)<br></div><div> device->mocs_version = 1;<br></div><div><br></div><div>I don't think we want to have it dependent on a #define in an external header file. What if someone updates it for i965 and doesn't update anv or vice-versa?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ }<br>
+ }<br>
+<br>
brw_process_intel_debug_<wbr>variable();<br>
<br>
device->compiler = brw_compiler_create(NULL, &device->info);<br>
diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<wbr>private.h<br>
index 573778dad5..b8241a9b22 100644<br>
--- a/src/intel/vulkan/anv_<wbr>private.h<br>
+++ b/src/intel/vulkan/anv_<wbr>private.h<br>
@@ -684,6 +684,8 @@ struct anv_physical_device {<br>
uint32_t eu_total;<br>
uint32_t subslice_total;<br>
<br>
+ uint8_t mocs_version;<br>
+<br>
struct {<br>
uint32_t type_count;<br>
struct anv_memory_type types[VK_MAX_MEMORY_TYPES];<br>
diff --git a/src/mesa/drivers/dri/i915/<wbr>intel_context.c b/src/mesa/drivers/dri/i915/<wbr>intel_context.c<br>
index e0766a0e3f..9169ea650e 100644<br>
--- a/src/mesa/drivers/dri/i915/<wbr>intel_context.c<br>
+++ b/src/mesa/drivers/dri/i915/<wbr>intel_context.c<br>
@@ -521,8 +521,13 @@ intelInitContext(struct intel_context *intel,<br>
INTEL_DEBUG = parse_debug_string(getenv("<wbr>INTEL_DEBUG"), debug_control);<br>
if (INTEL_DEBUG & DEBUG_BUFMGR)<br>
dri_bufmgr_set_debug(intel-><wbr>bufmgr, true);<br>
- if (INTEL_DEBUG & DEBUG_PERF)<br>
+ if (INTEL_DEBUG & DEBUG_PERF) {<br>
intel->perf_debug = true;<br>
+ if (screen->mocs_version > MOCS_TABLE_VERSION) {<br>
+ fprintf(stderr, "Kernel exposes newer MOCS table\n");<br>
+ screen->mocs_version = MOCS_TABLE_VERSION;<br>
+ }<br>
+ }<br>
<br>
if (INTEL_DEBUG & DEBUG_AUB)<br>
drm_intel_bufmgr_gem_set_aub_<wbr>dump(intel->bufmgr, true);<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_screen.c b/src/mesa/drivers/dri/i965/<wbr>intel_screen.c<br>
index c75f2125d4..c53f133d49 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_screen.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_screen.c<br>
@@ -2301,6 +2301,20 @@ __DRIconfig **intelInitScreen2(__DRIscreen *dri_screen)<br>
(ret != -1 || errno != EINVAL);<br>
}<br>
<br>
+ if (devinfo->gen >= 9) {<br>
+ screen->mocs_version = intel_get_integer(screen,<br>
+ I915_PARAM_MOCS_TABLE_VERSION)<wbr>;<br>
+ switch (screen->mocs_version) {<br>
+ case 1:<br>
+ case 0:<br>
+ screen->mocs_version = MOCS_TABLE_VERSION;<br></blockquote><div><br></div><div>Same comments apply here.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ break;<br>
+ default:<br>
+ /* We want to perf debug, but we can't yet */<br>
+ break;<br>
+ }<br>
+ }<br>
+<br>
dri_screen->extensions = !screen->has_context_reset_<wbr>notification<br>
? screenExtensions : intelRobustScreenExtensions;<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_screen.h b/src/mesa/drivers/dri/i965/<wbr>intel_screen.h<br>
index f78b3e8f74..eb801f8155 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_screen.h<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_screen.h<br>
@@ -112,6 +112,8 @@ struct intel_screen<br>
bool mesa_format_supports_texture[<wbr>MESA_FORMAT_COUNT];<br>
bool mesa_format_supports_render[<wbr>MESA_FORMAT_COUNT];<br>
enum isl_format mesa_to_isl_render_format[<wbr>MESA_FORMAT_COUNT];<br>
+<br>
+ unsigned mocs_version;<br>
};<br>
<br>
extern void intelDestroyContext(__<wbr>DRIcontext * driContextPriv);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.13.2<br>
<br>
______________________________<wbr>_________________<br>
Intel-gfx mailing list<br>
<a href="mailto:Intel-gfx@lists.freedesktop.org">Intel-gfx@lists.freedesktop.<wbr>org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/intel-gfx" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/intel-gfx</a><br>
</font></span></blockquote></div><br></div></div>