https://bugs.dragonflybsd.org/https://bugs.dragonflybsd.org/favicon.ico?16293952082019-02-10T21:49:50ZDragonFlyBSD bugtrackerDragonFlyBSD - Bug #3171: mesa-libs 18.3.2 not workinghttps://bugs.dragonflybsd.org/issues/3171?journal_id=136002019-02-10T21:49:50Ztuxillo
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>In Progress</i></li></ul><p>After some kprintf'ing, the EINVAL comes from:</p>
<p>sys/dev/drm/i915/i915_gem_execbuffer.c:1025</p>
<p>1021 /* Offset can be used as input (EXEC_OBJECT_PINNED), reject<br />1022 * any non-page-aligned or non-canonical addresses.<br />1023 */<br />1024 if (exec[i].flags & EXEC_OBJECT_PINNED) {<br />1025 if (exec[i].offset !=<br />1026 gen8_canonical_addr(exec[i].offset & PAGE_MASK))<br />1027 return -EINVAL;</p> DragonFlyBSD - Bug #3171: mesa-libs 18.3.2 not workinghttps://bugs.dragonflybsd.org/issues/3171?journal_id=136012019-02-11T06:18:14Zftigeot
<ul></ul><p>The new behavior is caused by this mesa commit present between mesa-18.1.9 and mesa-18.2.0 :</p>
<p>commit a363bb2cd0e2a141f2c60be005009703bffcbe4e (HEAD, refs/bisect/bad)<br />Author: Kenneth Graunke <<a class="email" href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br />Date: Tue Apr 10 01:18:25 2018 -0700</p>
<pre><code>i965: Allocate VMA in userspace for full-PPGTT systems.</code></pre>
<pre><code>This patch enables soft-pinning of all buffers, allowing us to skip<br /> relocation processing entirely. All systems with full PPGTT and > 4GB<br /> of VMA should gain these benefits. This should be most Gen8+.</code></pre>
<pre><code>Unfortunately, this excludes a few systems:<br /> - Cherryview (only has 32-bit addressing, despite 48-bit pointers)<br /> - Broadwell with a 32-bit kernel<br /> - Anybody running pre-4.5 kernel.</code></pre>
<pre><code>We may enable it for Cherryview in the future, but it would require<br /> some tweaks to the memory zone.</code></pre>
<pre><code>Reviewed-by: Jordan Justen &lt;<a class="email" href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>&gt;</code></pre>
<p>diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c<br />index 121e952b9ed..b5e3eb6bff9 100644<br />--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c<br />+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c<br /><code>@ -1724,7 +1724,7 </code>@ brw_bufmgr_init(struct gen_device_info *devinfo, int fd)<br /> bufmgr->initial_kflags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;</p>
<pre><code>/* Allocate VMA in userspace if we have softpin and full PPGTT. */<br />- if (false && gem_param(fd, I915_PARAM_HAS_EXEC_SOFTPIN) > 0 &&<br />+ if (gem_param(fd, I915_PARAM_HAS_EXEC_SOFTPIN) > 0 &&<br /> gem_param(fd, I915_PARAM_HAS_ALIASING_PPGTT) > 1) {<br /> bufmgr->initial_kflags |= EXEC_OBJECT_PINNED;</code></pre> DragonFlyBSD - Bug #3171: mesa-libs 18.3.2 not workinghttps://bugs.dragonflybsd.org/issues/3171?journal_id=136022019-02-11T12:10:34Ztuxillo
<ul></ul><p>Hi,</p>
<p>In Mesa commit a363bb2cd they enable unconditionally the soft-pinning feature<sup><a href="#fn1">1</a></sup> for all buffers in systems that report having support for both soft-pinning and full PPGTT [2].<br />DragonFly BSD reports supporting I915_PARAM_HAS_EXEC_SOFTPIN. For Graphics Gen 7 or higher, I915_PARAM_HAS_ALIASING_PPGTT is reported as supported.</p>
<p>With this feature enabled, the condition in 'sys/dev/drm/i915/i915_gem_execbuffer.c:1025' is now checked and fails, that's why the EINVAL is returned to userland.</p>
<p>According to ftigeot's comments in the IRC, PAGE_MASK is defined differently in Linux and in DragonFly:</p>
<p>Linux: #define PAGE_MASK (~(PAGE_SIZE-1))<br />DragonFly: #define PAGE_MASK (PAGE_SIZE-1)</p>
<p>----<br />[1] <a class="external" href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=506a8e87d8d2746b9e9d2433503fe237c54e4750">https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=506a8e87d8d2746b9e9d2433503fe237c54e4750</a><br />[2] <a class="external" href="https://bwidawsk.net/blog/index.php/2014/07/true-ppgtt-part-3/">https://bwidawsk.net/blog/index.php/2014/07/true-ppgtt-part-3/</a></p> DragonFlyBSD - Bug #3171: mesa-libs 18.3.2 not workinghttps://bugs.dragonflybsd.org/issues/3171?journal_id=136112019-02-21T20:18:01Ztuxillo
<ul><li><strong>Status</strong> changed from <i>In Progress</i> to <i>Closed</i></li><li><strong>Assignee</strong> set to <i>ftigeot</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li><li><strong>Estimated time</strong> set to <i>10:00 h</i></li></ul><p>This commit to Deltaports disables soft-pinning all together from graphics/mesa-dri:</p>
<p>commit 630507ebacd566668d1cb8507b86fccec01f4f9b<br />Author: François Tigeot <<a class="email" href="mailto:ftigeot@wolfpond.org">ftigeot@wolfpond.org</a>><br />Date: Mon Feb 11 19:45:31 2019 +0100</p>
<pre><code>graphics/mesa-dri: Disable soft-spinning of all buffers</code></pre>
<p>This commit to DragonFly provides a fix for when soft-pinning is enabled again:</p>
<p>commit d653c72734cf5be86d3cd2b4208c1e4ec68ade00<br />Author: François Tigeot <<a class="email" href="mailto:ftigeot@wolfpond.org">ftigeot@wolfpond.org</a>><br />Date: Sun Feb 17 09:06:17 2019 +0100</p>
<pre><code>drm: Fix Linux/DragonFly PAGE_MASK confusion</code></pre>