<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/gpu/drm/amd, branch v4.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.4</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2015-12-16T22:48:59Z</updated>
<entry>
<title>drm/amdgpu: fix user fence handling</title>
<updated>2015-12-16T22:48:59Z</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2015-12-14T15:42:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=91acbeb68ab10c0c0f65f30b5b7fddbde4c97dd2'/>
<id>urn:sha1:91acbeb68ab10c0c0f65f30b5b7fddbde4c97dd2</id>
<content type='text'>
This fixes a random corruption under memory pressure. We need to fence
the BO for the user fence as well, otherwise it might be swapped out
and the GPU could write the fence value to an undesired location.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>drm/amdgpu: fix the lost duplicates checking</title>
<updated>2015-12-09T05:18:33Z</updated>
<author>
<name>Chunming Zhou</name>
<email>David1.Zhou@amd.com</email>
</author>
<published>2015-12-07T07:02:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e410b5cbabe70b1f1da08146481f6bd7e904643c'/>
<id>urn:sha1:e410b5cbabe70b1f1da08146481f6bd7e904643c</id>
<content type='text'>
Signed-off-by: Chunming Zhou &lt;David1.Zhou@amd.com&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Jammy Zhou &lt;Jammy.Zhou@amd.com&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>drm/amdgpu: Fixup hw vblank counter/ts for new drm_update_vblank_count() (v3)</title>
<updated>2015-12-04T20:15:07Z</updated>
<author>
<name>Alex Deucher</name>
<email>alexander.deucher@amd.com</email>
</author>
<published>2015-12-03T17:31:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8e36f9d33c134d5c6448ad65b423a9fd94e045cf'/>
<id>urn:sha1:8e36f9d33c134d5c6448ad65b423a9fd94e045cf</id>
<content type='text'>
commit 4dfd6486 "drm: Use vblank timestamps to guesstimate how many
vblanks were missed" introduced in Linux 4.4-rc1 makes the drm core
more fragile to drivers which don't update hw vblank counters and
vblank timestamps in sync with firing of the vblank irq and
essentially at leading edge of vblank.

This exposed a problem with radeon-kms/amdgpu-kms which do not
satisfy above requirements:

The vblank irq fires a few scanlines before start of vblank, but
programmed pageflips complete at start of vblank and
vblank timestamps update at start of vblank, whereas the
hw vblank counter increments only later, at start of vsync.

This leads to problems like off by one errors for vblank counter
updates, vblank counters apparently going backwards or vblank
timestamps apparently having time going backwards. The net result
is stuttering of graphics in games, or little hangs, as well as
total failure of timing sensitive applications.

See bug #93147 for an example of the regression on Linux 4.4-rc:

https://bugs.freedesktop.org/show_bug.cgi?id=93147

This patch tries to align all above events better from the
viewpoint of the drm core / of external callers to fix the problem:

1. The apparent start of vblank is shifted a few scanlines earlier,
so the vblank irq now always happens after start of this extended
vblank interval and thereby drm_update_vblank_count() always samples
the updated vblank count and timestamp of the new vblank interval.

To achieve this, the reporting of scanout positions by
radeon_get_crtc_scanoutpos() now operates as if the vblank starts
radeon_crtc-&gt;lb_vblank_lead_lines before the real start of the hw
vblank interval. This means that the vblank timestamps which are based
on these scanout positions will now update at this earlier start of
vblank.

2. The driver-&gt;get_vblank_counter() function will bump the returned
vblank count as read from the hw by +1 if the query happens after
the shifted earlier start of the vblank, but before the real hw increment
at start of vsync, so the counter appears to increment at start of vblank
in sync with the timestamp update.

3. Calls from vblank irq-context and regular non-irq calls are now
treated identical, always simulating the shifted vblank start, to
avoid inconsistent results for queries happening from vblank irq vs.
happening from drm_vblank_enable() or vblank_disable_fn().

4. The radeon_flip_work_func will delay mmio programming a pageflip until
the start of the real vblank iff it happens to execute inside the shifted
earlier start of the vblank, so pageflips now also appear to execute at
start of the shifted vblank, in sync with vblank counter and timestamp
updates. This to avoid some races between updates of vblank count and
timestamps that are used for swap scheduling and pageflip execution which
could cause pageflips to execute before the scheduled target vblank.

The lb_vblank_lead_lines "fudge" value is calculated as the size of
the display controllers line buffer in scanlines for the given video
mode: Vblank irq's are triggered by the line buffer logic when the line
buffer refill for a video frame ends, ie. when the line buffer source read
position enters the hw vblank. This means that a vblank irq could fire at
most as many scanlines before the current reported scanout position of the
crtc timing generator as the number of scanlines the line buffer can
maximally hold for a given video mode.

This patch has been successfully tested on a RV730 card with DCE-3 display
engine and on a evergreen card with DCE-4 display engine, in single-display
and dual-display configuration, with different video modes.

A similar patch is needed for amdgpu-kms to fix the same problem.

Limitations:

- Maybe replace the udelay() in the flip_work_func() by a suitable
  usleep_range() for a bit better efficiency? Will try that.

- Line buffer sizes in pixels are hard-coded on &lt; DCE-4 to a value
  i just guessed to be high enough to work ok, lacking info on the true
  sizes atm.

Probably fixes: fdo#93147

Port of Mario's radeon fix to amdgpu.

Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(v1) Reviewed-by: Mario Kleiner &lt;mario.kleiner.de@gmail.com&gt;

(v2) Refine amdgpu_flip_work_func() for better efficiency.

     In amdgpu_flip_work_func, replace the busy waiting udelay(5)
     with event lock held by a more performance and energy efficient
     usleep_range() until at least predicted true start of hw vblank,
     with some slack for scheduler happiness. Release the event lock
     during waits to not delay other outputs in doing their stuff, as
     the waiting can last up to 200 usecs in some cases.

     Also small fix to code comment and formatting in that function.

(v2) Signed-off-by: Mario Kleiner &lt;mario.kleiner.de@gmail.com&gt;

(v3) Fix crash in crtc disabled case
</content>
</entry>
<entry>
<title>drm/amdgpu: add spin lock to protect freed list in vm (v2)</title>
<updated>2015-12-04T18:08:13Z</updated>
<author>
<name>jimqu</name>
<email>Jim.Qu@amd.com</email>
</author>
<published>2015-12-04T09:17:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=81d75a30c6ed006a314f5c760196d04758660ca6'/>
<id>urn:sha1:81d75a30c6ed006a314f5c760196d04758660ca6</id>
<content type='text'>
there is a protection fault about freed list when OCL test.
add a spin lock to protect it.

v2: drop changes in vm_fini

Signed-off-by: JimQu &lt;jim.qu@amd.com&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu: partially revert "drm/amdgpu: fix VM_CONTEXT*_PAGE_TABLE_END_ADDR" v2</title>
<updated>2015-12-04T18:06:59Z</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2015-12-03T19:54:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9c97b5ab4a91c18c2e7654f044cbff446cfd979b'/>
<id>urn:sha1:9c97b5ab4a91c18c2e7654f044cbff446cfd979b</id>
<content type='text'>
The gtt_end is already inclusive, we don't need to subtract one here.

v2 (chk): keep the fix for the VM code, cause here it really applies.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Anatoli Antonovitch &lt;anatoli.antonovitch@amd.com&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu: take a BO reference for the user fence</title>
<updated>2015-12-04T18:05:44Z</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2015-12-03T18:55:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f3f1769283b8dbf047c678da95b72194ac2477a1'/>
<id>urn:sha1:f3f1769283b8dbf047c678da95b72194ac2477a1</id>
<content type='text'>
No need for a GEM reference here.

Reviewed-by: Michel Dänzer &lt;michel.daenzer@amd.com&gt;
Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu: take a BO reference in the display code</title>
<updated>2015-12-04T17:32:47Z</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2015-12-03T18:55:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e9d951a832d9a5db33f9d981a810a37f851f8b39'/>
<id>urn:sha1:e9d951a832d9a5db33f9d981a810a37f851f8b39</id>
<content type='text'>
No need for the GEM reference here.

Reviewed-by: Michel Dänzer &lt;michel.daenzer@amd.com&gt;
Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu: set snooped flags only on system addresses v2</title>
<updated>2015-12-04T17:31:46Z</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2015-12-04T12:32:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6d99905a8c887f6c878f14af1475c3eefdcb0b3e'/>
<id>urn:sha1:6d99905a8c887f6c878f14af1475c3eefdcb0b3e</id>
<content type='text'>
Not necessary for VRAM.

v2: no need to check if ttm is NULL.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu: fix race condition in amd_sched_entity_push_job</title>
<updated>2015-12-02T20:04:04Z</updated>
<author>
<name>Nicolai Hähnle</name>
<email>Nicolai.Haehnle@amd.com</email>
</author>
<published>2015-12-02T16:35:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=07df04dfcfe51a45239d056d43cbc09702262c82'/>
<id>urn:sha1:07df04dfcfe51a45239d056d43cbc09702262c82</id>
<content type='text'>
As soon as we leave the spinlock after the job has been added to the job
queue, we can no longer rely on the job's data to be available.

I have seen a null-pointer dereference due to sched == NULL in
amd_sched_wakeup via amd_sched_entity_push_job and
amd_sched_ib_submit_kernel_helper. Since the latter initializes
sched_job-&gt;sched with the address of the ring scheduler, which is
guaranteed to be non-NULL, this race appears to be a likely culprit.

Signed-off-by: Nicolai Hähnle &lt;nicolai.haehnle@amd.com&gt;
Bugzilla: https://bugs.freedesktop.org/attachment.cgi?bugid=93079
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu: add err check for pin userptr</title>
<updated>2015-12-02T20:03:54Z</updated>
<author>
<name>Chunming Zhou</name>
<email>David1.Zhou@amd.com</email>
</author>
<published>2015-11-26T08:33:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e2f784fa8a3b1fbf6999ba44f7327bd9d29f2c5b'/>
<id>urn:sha1:e2f784fa8a3b1fbf6999ba44f7327bd9d29f2c5b</id>
<content type='text'>
Missing error check if the operation failed.

Signed-off-by: Chunming Zhou &lt;David1.Zhou@amd.com&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
</content>
</entry>
</feed>
