[PATCH 03/03] beignet: set I915_CONTEXT_PARAM_NO_ZEROMAP when initializing context

David Weinehall
2015-05-20T14:04:14Z

Set the I915_CONTEXT_PARAM_NO_ZEROMAP context parameter to disable
zero mappings if libdrm is new enough to expose such functionality.

Signed-off-by: David Weinehall <david.weinehall@intel.com>
---
CMakeLists.txt | 6 ++++++
src/CMakeLists.txt | 5 +++++
src/intel/intel_driver.c | 4 ++++
3 files changed, 15 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5474447dbcf1..6c57a5346d65 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -146,6 +146,12 @@ IF(DRM_INTEL_FOUND)
MESSAGE(STATUS "Disable EU total query support")
MESSAGE(STATUS "Disable subslice total query support")
ENDIF(DRM_INTEL_VERSION VERSION_GREATER 2.4.59)
+ IF(DRM_INTEL_VERSION VERSION_GREATER 2.4.61)
+ MESSAGE(STATUS "Enable no-zeromap support"
+ SET(DRM_INTEL_NOZEROMAP "enable")
+ ELSE(DRM_INTEL_VERSION VERSION_GREATER 2.4.61)
+ MESSAGE(STATUS "Disable no-zeromap support")
+ ENDIF(DRM_intEL_VERSION VERSION_GREATER 2.4.61)
ELSE(DRM_INTEL_FOUND)
MESSAGE(FATAL_ERROR "Looking for DRM Intel (>= 2.4.52) - not found")
ENDIF(DRM_INTEL_FOUND)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index da695324829b..83c838ca20f6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -119,6 +119,11 @@ SET(CMAKE_CXX_FLAGS "-DHAS_USERPTR ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-DHAS_USERPTR ${CMAKE_C_FLAGS}")
endif (DRM_INTEL_USERPTR)

+if (DRM_INTEL_NOZEROMAP)
+SET(CMAKE_CXX_FLAGS "-DHAS_NOZEROMAP ${CMAKE_CXX_FLAGS}")
+SET(CMAKE_C_FLAGS "-DHAS_NOZEROMAP ${CMAKE_C_FLAGS}")
+endif (DRM_INTEL_NOZEROMAP)
+
if (DRM_INTEL_EU_TOTAL)
SET(CMAKE_CXX_FLAGS "-DHAS_EU_TOTAL ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-DHAS_EU_TOTAL ${CMAKE_C_FLAGS}")
diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
index 755ab6b9b4fd..a33c2605fcc8 100644
--- a/src/intel/intel_driver.c
+++ b/src/intel/intel_driver.c
@@ -140,6 +140,10 @@ intel_driver_context_init(intel_driver_t *driver)
{
driver->ctx = drm_intel_gem_context_create(driver->bufmgr);
assert(driver->ctx);
+#ifdef HAS_ZEROMAP
+ drm_intel_gem_context_set_param(driver->ctx,
+ I915_CONTEXT_PARAM_NO_ZEROMAP, 1);
+#endif /* HAS_ZEROMAP */
}

static void