From 94134fb62a5de76ab6c65c7a859033eb25255991 Mon Sep 17 00:00:00 2001 From: Antonio Huete Jimenez Date: Mon, 11 Feb 2019 00:46:38 +0100 Subject: [PATCH] i915 - Try to fix a problem with mesa-libs 18.3.x This patch is based on this Linux's commit: commit 085603287452fc96376ed4888bf29f8c095d2b40 Author: Chris Wilson Date: Thu Oct 25 10:18:23 2018 +0100 drm/i915: Compare user's 64b GTT offset even on 32b Beware mixing unsigned long constants and 64b values, as on 32b the constant will be zero extended and discard the high 32b when used as a mask! --- sys/dev/drm/i915/i915_gem_execbuffer.c | 2 +- sys/dev/drm/i915/i915_gem_gtt.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/drm/i915/i915_gem_execbuffer.c b/sys/dev/drm/i915/i915_gem_execbuffer.c index a761ed4856..336780d100 100644 --- a/sys/dev/drm/i915/i915_gem_execbuffer.c +++ b/sys/dev/drm/i915/i915_gem_execbuffer.c @@ -1023,7 +1023,7 @@ validate_exec_list(struct drm_device *dev, */ if (exec[i].flags & EXEC_OBJECT_PINNED) { if (exec[i].offset != - gen8_canonical_addr(exec[i].offset & PAGE_MASK)) + gen8_canonical_addr(exec[i].offset & I915_GTT_PAGE_MASK)) return -EINVAL; /* From drm_mm perspective address space is continuous, diff --git a/sys/dev/drm/i915/i915_gem_gtt.h b/sys/dev/drm/i915/i915_gem_gtt.h index 40d784ad21..ac979d8a50 100644 --- a/sys/dev/drm/i915/i915_gem_gtt.h +++ b/sys/dev/drm/i915/i915_gem_gtt.h @@ -44,6 +44,9 @@ typedef uint64_t gen8_ppgtt_pml4e_t; #define ggtt_total_entries(ggtt) ((ggtt)->base.total >> PAGE_SHIFT) +#define I915_GTT_PAGE_SIZE_4K (1ULL << 12) +#define I915_GTT_PAGE_MASK -I915_GTT_PAGE_SIZE_4K + /* gen6-hsw has bit 11-4 for physical addr bit 39-32 */ #define GEN6_GTT_ADDR_ENCODE(addr) ((addr) | (((addr) >> 28) & 0xff0)) #define GEN6_PTE_ADDR_ENCODE(addr) GEN6_GTT_ADDR_ENCODE(addr) -- 2.20.1