<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/gpu/drm/i915/i915_gem_execbuffer.c, branch linux-3.16.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.16.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.16.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2015-09-29T15:44:43Z</updated>
<entry>
<title>drm/i915: Always mark the object as dirty when used by the GPU</title>
<updated>2015-09-29T15:44:43Z</updated>
<author>
<name>Chris Wilson</name>
</author>
<published>2015-08-31T14:10:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=daf2baffc7c81d6923484903f92580fa39746a57'/>
<id>urn:sha1:daf2baffc7c81d6923484903f92580fa39746a57</id>
<content type='text'>
commit 51bc140431e233284660b1d22c47dec9ecdb521e upstream.

There have been many hard to track down bugs whereby userspace forgot to
flag a write buffer and then cause graphics corruption or a hung GPU
when that buffer was later purged under memory pressure (as the buffer
appeared clean, its pages would have been evicted rather than preserved
and any changes more recent than in the backing storage would be lost).
In retrospect this is a rare optimisation against memory pressure,
already the slow path. If we always mark the buffer as dirty when
accessed by the GPU, anything not used can still be evicted cheaply
(ideal behaviour for mark-and-sweep eviction) but we do not run the risk
of corruption. For correct read serialisation, userspace still has to
notify when the GPU writes to an object. However, there are certain
situations under which userspace may wish to tell white lies to the
kernel...

Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Cc: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Cc: Kristian Høgsberg &lt;krh@bitplanet.net&gt;
Cc: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
Cc: "Goel, Akash" &lt;akash.goel@intel.co&gt;
Cc: Michał Winiarski &lt;michal.winiarski@intel.com&gt;
Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Signed-off-by: Jani Nikula &lt;jani.nikula@intel.com&gt;
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques &lt;luis.henriques@canonical.com&gt;
</content>
</entry>
<entry>
<title>Merge commit '9e9a928eed8796a0a1aaed7e0b676db86ba84594' into drm-next</title>
<updated>2014-06-05T10:28:59Z</updated>
<author>
<name>Dave Airlie</name>
</author>
<published>2014-06-05T10:28:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8d4ad9d4bb0a618c975a32d77087694ec6336f68'/>
<id>urn:sha1:8d4ad9d4bb0a618c975a32d77087694ec6336f68</id>
<content type='text'>
Merge drm-fixes into drm-next.

Both i915 and radeon need this done for later patches.

Conflicts:
	drivers/gpu/drm/drm_crtc_helper.c
	drivers/gpu/drm/i915/i915_drv.h
	drivers/gpu/drm/i915/i915_gem.c
	drivers/gpu/drm/i915/i915_gem_execbuffer.c
	drivers/gpu/drm/i915/i915_gem_gtt.c
</content>
</entry>
<entry>
<title>drm/i915: Prevent negative relocation deltas from wrapping</title>
<updated>2014-05-27T08:18:40Z</updated>
<author>
<name>Chris Wilson</name>
</author>
<published>2014-05-23T06:48:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d23db88c3ab233daed18709e3a24d6c95344117f'/>
<id>urn:sha1:d23db88c3ab233daed18709e3a24d6c95344117f</id>
<content type='text'>
This is pure evil. Userspace, I'm looking at you SNA, repacks batch
buffers on the fly after generation as they are being passed to the
kernel for execution. These batches also contain self-referenced
relocations as a single buffer encompasses the state commands, kernels,
vertices and sampler. During generation the buffers are placed at known
offsets within the full batch, and then the relocation deltas (as passed
to the kernel) are tweaked as the batch is repacked into a smaller buffer.
This means that userspace is passing negative relocations deltas, which
subsequently wrap to large values if the batch is at a low address. The
GPU hangs when it then tries to use the large value as a base for its
address offsets, rather than wrapping back to the real value (as one
would hope). As the GPU uses positive offsets from the base, we can
treat the relocation address as the minimum address read by the GPU.
For the upper bound, we trust that userspace will not read beyond the
end of the buffer.

So, how do we fix negative relocations from wrapping? We can either
check that every relocation looks valid when we write it, and then
position each object such that we prevent the offset wraparound, or we
just special-case the self-referential behaviour of SNA and force all
batches to be above 256k. Daniel prefers the latter approach.

This fixes a GPU hang when it tries to use an address (relocation +
offset) greater than the GTT size. The issue would occur quite easily
with full-ppgtt as each fd gets its own VM space, so low offsets would
often be handed out. However, with the rearrangement of the low GTT due
to capturing the BIOS framebuffer, it is already affecting kernels 3.15
onwards. I think only IVB+ is susceptible to this bug, but the workaround
should only kick in rarely, so it seems sensible to always apply it.

v3: Use a bias for batch buffers to prevent small negative delta relocations
from wrapping.

v4 from Daniel:
- s/BIAS/BATCH_OFFSET_BIAS/
- Extract eb_vma_misplaced/i915_vma_misplaced since the conditions
  were growing rather cumbersome.
- Add a comment to eb_get_batch explaining why we do this.
- Apply the batch offset bias everywhere but mention that we've only
  observed it on gen7 gpus.
- Drop PIN_OFFSET_FIX for now, that slipped in from a feature patch.

v5: Add static to eb_get_batch, spotted by 0-day tester.

Testcase: igt/gem_bad_reloc
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78533
Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt; (v3)
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>drm/i915: Only copy back the modified fields to userspace from execbuffer</title>
<updated>2014-05-27T08:18:39Z</updated>
<author>
<name>Chris Wilson</name>
</author>
<published>2014-05-23T09:45:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9aab8bff7aa3bee567213ad3c1fdfb217bb980a2'/>
<id>urn:sha1:9aab8bff7aa3bee567213ad3c1fdfb217bb980a2</id>
<content type='text'>
We only want to modifiy a single field in the userspace view of the
execbuffer command buffer, so explicitly change that rather than copy
everything back again.

This serves two purposes:

1. The single fields are much cheaper to copy (constant size so the
copy uses special case code) and much smaller than the whole array.

2. We modify the array for internal use that need to be masked from
the user.

Note: We need this backported since without it the next bugfix will
blow up when userspace recycles batchbuffers and relocations.

Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Cc: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>drm/i915: s/i915_hw_context/intel_context</title>
<updated>2014-05-22T21:41:17Z</updated>
<author>
<name>Oscar Mateo</name>
</author>
<published>2014-05-22T13:13:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=273497e5cdacf50da8884d28cba662c332e0a09e'/>
<id>urn:sha1:273497e5cdacf50da8884d28cba662c332e0a09e</id>
<content type='text'>
Up until now, contexts had one (and only one) backing object that was
used by the hardware to save/restore render ring contexts (via the
MI_SET_CONTEXT command). Other rings did not have or need this, so
our i915_hw_context struct had a 1:1 relationship with a a real HW
context.

With Logical Ring Contexts and Execlists, this is not possible anymore:
all rings need a backing object, and it cannot be reused. To prepare
for that, rename our contexts to the more generic term intel_context.

No functional changes.

Signed-off-by: Oscar Mateo &lt;oscar.mateo@intel.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>drm/i915: s/intel_ring_buffer/intel_engine_cs</title>
<updated>2014-05-22T21:01:05Z</updated>
<author>
<name>Oscar Mateo</name>
</author>
<published>2014-05-22T13:13:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a4872ba6d01454dfeb251d96f623ab5d1b0666a4'/>
<id>urn:sha1:a4872ba6d01454dfeb251d96f623ab5d1b0666a4</id>
<content type='text'>
In the upcoming patches we plan to break the correlation between
engine command streamers (a.k.a. rings) and ringbuffers, so it
makes sense to refactor the code and make the change obvious.

No functional changes.

Signed-off-by: Oscar Mateo &lt;oscar.mateo@intel.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>drm/i915: move bsd dispatch index somewhere better</title>
<updated>2014-05-22T13:06:31Z</updated>
<author>
<name>Daniel Vetter</name>
</author>
<published>2014-05-21T15:37:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bdf1e7e3dbcaf0c45e068b80e91035fa8eca3c0e'/>
<id>urn:sha1:bdf1e7e3dbcaf0c45e068b80e91035fa8eca3c0e</id>
<content type='text'>
Adding stuff at the bottom is really no how this should be done, since
that's the place for ums/dri dungeons.

This was added in

commit a8ebba75b358f9c912cbcba0c14a2072e7280b2f
Author: Zhao Yakui &lt;yakui.zhao@intel.com&gt;
Date:   Thu Apr 17 10:37:40 2014 +0800

    drm/i915: Use the coarse ping-pong mechanism based on drm fd to dispatch the BSD command on BDW GT3

Also add a note to prevent this from happening again - people really
should be less lazy and take more time to look for a good home of
their new driver-global state.

Cc: Imre Deak &lt;imre.deak@intel.com&gt;
Cc: Zhao Yakui &lt;yakui.zhao@intel.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>drm/i915: Retire requests before creating a new one</title>
<updated>2014-05-19T13:30:56Z</updated>
<author>
<name>Chris Wilson</name>
</author>
<published>2014-05-15T09:41:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=227f782e4667fc622810bce8be8ccdeee45f89c2'/>
<id>urn:sha1:227f782e4667fc622810bce8be8ccdeee45f89c2</id>
<content type='text'>
More fallout from

commit c8725f3dc0911d4354315a65150aecd8b7d0d74a
Author: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Date:   Mon Mar 17 12:21:55 2014 +0000

    drm/i915: Do not call retire_requests from wait_for_rendering

is that we can completely fill all of memory using small objects, such
that we exhaust the filp space, and spend all of our time evicting
objects from the aperture. As such, we never fill the ring, and never
trigger the last resort flushing in

commit 1cf0ba14740d96fbf6f58a201f000a34b74f4725
Author: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Date:   Mon May 5 09:07:33 2014 +0100

    drm/i915: Flush request queue when waiting for ring space

and so all the requests are left active and the objects keep that last
active reference. Eventually the system comes to a halt as it runs out
of memory.

The impact is mainly limited to test cases as regular userspace will
trigger retirement by manually checking whether an object is active.

Testcase: igt/gem_lut_handle
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78724
Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Tested-by: Guo Jinxian &lt;jinxianx.guo@intel.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>drm/i915: Work-around garbage DR4 from UXA</title>
<updated>2014-05-13T15:16:13Z</updated>
<author>
<name>Daniel Vetter</name>
</author>
<published>2014-05-13T11:37:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ffd93f24800dfbf55e9a245884cbfd8e427fc210'/>
<id>urn:sha1:ffd93f24800dfbf55e9a245884cbfd8e427fc210</id>
<content type='text'>
Somehow UXA submits a completely bogus DR4 value since essentially
forever. It was originally introduced in

commit bade7d7d2505a10a8a7d24b084aff9742e2d6d64
Author: Eric Anholt &lt;eric@anholt.net&gt;
Date:   Fri Jun 6 14:03:25 2008 -0700

    Use the DRM for submitting batchbuffers when available.

and dutifully copied around ever since. Since we want to keep the
general dirt catching around just special case the UXA value.

This regression was introduced in

commit 9cb346648d9c529eccc5c7f30093e82d37004e37
Author: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Date:   Thu Apr 24 08:09:11 2014 +0200

    drm/i915: Catch dirt in unused execbuffer fields

Comment from Chris' review:

"To be fair, it is a sensible value if one supposes a Region style API to
cliprects. Under that API, DR[14] define the extents of the clip region,
and ((0,0), (0,0)) [DR1==DR4==0] would mean all clipped, do not draw
anything."

v2: Pimp commit message a bit and remove the double space.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78494
Cc: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Cc: Jörg Otte &lt;jrg.otte@gmail.com&gt;
Acked-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>drm/i915: Support 64b relocations</title>
<updated>2014-05-05T14:04:23Z</updated>
<author>
<name>Ben Widawsky</name>
</author>
<published>2014-04-29T00:18:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d9ceb957fd97836c7fb0e403062e68ad2f737021'/>
<id>urn:sha1:d9ceb957fd97836c7fb0e403062e68ad2f737021</id>
<content type='text'>
All the rest of the code to enable this is in my branch. Without my
branch, hitting &gt; 32b offsets is impossible. The code has always
"supported" 64b, but it's never actually been run of tested. This change
doesn't actually fix anything. [1] I am not sure why X won't work yet. I
do not get hangs or obvious errors.

There are 3 fixes grouped together here. First is to remove the
hardcoded 0 for the upper dword of the relocation. The next fix is to
use a 64b value for target_offset. The final fix is to not directly
apply target_offset to reloc-&gt;delta. reloc-&gt;delta is part of ABI, and so
we cannot change it. As it stands, 32b is enough to represent everything
we're interested in representing anyway. The main problem is, we cannot
add greater than 32b values to it directly.

[1] Almost all of intel-gpu-tools is not yet ready to test 64b
relocations. There are a few places that expect 32b values for offsets
and these all won't work.

Cc: Rafael Barbalho &lt;rafael.barbalho@intel.com&gt;
Cc: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Signed-off-by: Ben Widawsky &lt;ben@bwidawsk.net&gt;
Reviewed-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
</feed>
