<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/gpu/drm/drm_atomic.c, branch v4.19</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>drm: Get ref on CRTC commit object when waiting for flip_done</title>
<updated>2018-10-18T18:23:13+00:00</updated>
<author>
<name>Leo Li</name>
<email>sunpeng.li@amd.com</email>
</author>
<published>2018-10-15T13:46:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4364bcb2cd21d042bde4776448417ddffbc54045'/>
<id>4364bcb2cd21d042bde4776448417ddffbc54045</id>
<content type='text'>
This fixes a general protection fault, caused by accessing the contents
of a flip_done completion object that has already been freed. It occurs
due to the preemption of a non-blocking commit worker thread W by
another commit thread X. X continues to clear its atomic state at the
end, destroying the CRTC commit object that W still needs. Switching
back to W and accessing the commit objects then leads to bad results.

Worker W becomes preemptable when waiting for flip_done to complete. At
this point, a frequently occurring commit thread X can take over. Here's
an example where W is a worker thread that flips on both CRTCs, and X
does a legacy cursor update on both CRTCs:

        ...
     1. W does flip work
     2. W runs commit_hw_done()
     3. W waits for flip_done on CRTC 1
     4. &gt; flip_done for CRTC 1 completes
     5. W finishes waiting for CRTC 1
     6. W waits for flip_done on CRTC 2

     7. &gt; Preempted by X
     8. &gt; flip_done for CRTC 2 completes
     9. X atomic_check: hw_done and flip_done are complete on all CRTCs
    10. X updates cursor on both CRTCs
    11. X destroys atomic state
    12. X done

    13. &gt; Switch back to W
    14. W waits for flip_done on CRTC 2
    15. W raises general protection fault

The error looks like so:

    general protection fault: 0000 [#1] PREEMPT SMP PTI
    **snip**
    Call Trace:
     lock_acquire+0xa2/0x1b0
     _raw_spin_lock_irq+0x39/0x70
     wait_for_completion_timeout+0x31/0x130
     drm_atomic_helper_wait_for_flip_done+0x64/0x90 [drm_kms_helper]
     amdgpu_dm_atomic_commit_tail+0xcae/0xdd0 [amdgpu]
     commit_tail+0x3d/0x70 [drm_kms_helper]
     process_one_work+0x212/0x650
     worker_thread+0x49/0x420
     kthread+0xfb/0x130
     ret_from_fork+0x3a/0x50
    Modules linked in: x86_pkg_temp_thermal amdgpu(O) chash(O)
    gpu_sched(O) drm_kms_helper(O) syscopyarea sysfillrect sysimgblt
    fb_sys_fops ttm(O) drm(O)

Note that i915 has this issue masked, since hw_done is signaled after
waiting for flip_done. Doing so will block the cursor update from
happening until hw_done is signaled, preventing the cursor commit from
destroying the state.

v2: The reference on the commit object needs to be obtained before
    hw_done() is signaled, since that's the point where another commit
    is allowed to modify the state. Assuming that the
    new_crtc_state-&gt;commit object still exists within flip_done() is
    incorrect.

    Fix by getting a reference in setup_commit(), and releasing it
    during default_clear().

Signed-off-by: Leo Li &lt;sunpeng.li@amd.com&gt;
Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Signed-off-by: Harry Wentland &lt;harry.wentland@amd.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/1539611200-6184-1-git-send-email-sunpeng.li@amd.com
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fixes a general protection fault, caused by accessing the contents
of a flip_done completion object that has already been freed. It occurs
due to the preemption of a non-blocking commit worker thread W by
another commit thread X. X continues to clear its atomic state at the
end, destroying the CRTC commit object that W still needs. Switching
back to W and accessing the commit objects then leads to bad results.

Worker W becomes preemptable when waiting for flip_done to complete. At
this point, a frequently occurring commit thread X can take over. Here's
an example where W is a worker thread that flips on both CRTCs, and X
does a legacy cursor update on both CRTCs:

        ...
     1. W does flip work
     2. W runs commit_hw_done()
     3. W waits for flip_done on CRTC 1
     4. &gt; flip_done for CRTC 1 completes
     5. W finishes waiting for CRTC 1
     6. W waits for flip_done on CRTC 2

     7. &gt; Preempted by X
     8. &gt; flip_done for CRTC 2 completes
     9. X atomic_check: hw_done and flip_done are complete on all CRTCs
    10. X updates cursor on both CRTCs
    11. X destroys atomic state
    12. X done

    13. &gt; Switch back to W
    14. W waits for flip_done on CRTC 2
    15. W raises general protection fault

The error looks like so:

    general protection fault: 0000 [#1] PREEMPT SMP PTI
    **snip**
    Call Trace:
     lock_acquire+0xa2/0x1b0
     _raw_spin_lock_irq+0x39/0x70
     wait_for_completion_timeout+0x31/0x130
     drm_atomic_helper_wait_for_flip_done+0x64/0x90 [drm_kms_helper]
     amdgpu_dm_atomic_commit_tail+0xcae/0xdd0 [amdgpu]
     commit_tail+0x3d/0x70 [drm_kms_helper]
     process_one_work+0x212/0x650
     worker_thread+0x49/0x420
     kthread+0xfb/0x130
     ret_from_fork+0x3a/0x50
    Modules linked in: x86_pkg_temp_thermal amdgpu(O) chash(O)
    gpu_sched(O) drm_kms_helper(O) syscopyarea sysfillrect sysimgblt
    fb_sys_fops ttm(O) drm(O)

Note that i915 has this issue masked, since hw_done is signaled after
waiting for flip_done. Doing so will block the cursor update from
happening until hw_done is signaled, preventing the cursor commit from
destroying the state.

v2: The reference on the commit object needs to be obtained before
    hw_done() is signaled, since that's the point where another commit
    is allowed to modify the state. Assuming that the
    new_crtc_state-&gt;commit object still exists within flip_done() is
    incorrect.

    Fix by getting a reference in setup_commit(), and releasing it
    during default_clear().

Signed-off-by: Leo Li &lt;sunpeng.li@amd.com&gt;
Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Signed-off-by: Harry Wentland &lt;harry.wentland@amd.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/1539611200-6184-1-git-send-email-sunpeng.li@amd.com
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/atomic: Use drm_drv_uses_atomic_modeset() for debugfs creation</title>
<updated>2018-09-17T23:24:37+00:00</updated>
<author>
<name>Lyude Paul</name>
<email>lyude@redhat.com</email>
</author>
<published>2018-09-17T17:37:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3c499ea0c662e2f38aafbd4f516b08aab8cfa0e5'/>
<id>3c499ea0c662e2f38aafbd4f516b08aab8cfa0e5</id>
<content type='text'>
As pointed out by Daniel Vetter, we should be usinng
drm_drv_uses_atomic_modeset() for determining whether or not we want to
make the debugfs nodes for atomic instead of checking DRIVER_ATOMIC, as
the former isn't an accurate representation of whether or not the driver
is actually using atomic modesetting internally (even though it might
not be exposing atomic capabilities).

Signed-off-by: Lyude Paul &lt;lyude@redhat.com&gt;
Cc: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Cc: stable@vger.kernel.org
Reviewed-by: Sean Paul &lt;seanpaul@chromium.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180917173733.21293-1-lyude@redhat.com
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As pointed out by Daniel Vetter, we should be usinng
drm_drv_uses_atomic_modeset() for determining whether or not we want to
make the debugfs nodes for atomic instead of checking DRIVER_ATOMIC, as
the former isn't an accurate representation of whether or not the driver
is actually using atomic modesetting internally (even though it might
not be exposing atomic capabilities).

Signed-off-by: Lyude Paul &lt;lyude@redhat.com&gt;
Cc: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Cc: stable@vger.kernel.org
Reviewed-by: Sean Paul &lt;seanpaul@chromium.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180917173733.21293-1-lyude@redhat.com
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/atomic: Avoid connector to writeback_connector casts</title>
<updated>2018-07-07T05:51:19+00:00</updated>
<author>
<name>Boris Brezillon</name>
<email>boris.brezillon@bootlin.com</email>
</author>
<published>2018-07-03T07:50:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b82c1f8f78b4d273d1bcefe3e805eff61e879a68'/>
<id>b82c1f8f78b4d273d1bcefe3e805eff61e879a68</id>
<content type='text'>
Use container_of() instead of type casting so that it keeps working
even if base is moved inside the drm_writeback_connector struct.

Signed-off-by: Boris Brezillon &lt;boris.brezillon@bootlin.com&gt;
Reviewed-by: Liviu Dudau &lt;liviu.dudau@arm.com&gt;
Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180703075022.15138-2-boris.brezillon@bootlin.com
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use container_of() instead of type casting so that it keeps working
even if base is moved inside the drm_writeback_connector struct.

Signed-off-by: Boris Brezillon &lt;boris.brezillon@bootlin.com&gt;
Reviewed-by: Liviu Dudau &lt;liviu.dudau@arm.com&gt;
Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180703075022.15138-2-boris.brezillon@bootlin.com
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge drm-upstream/drm-next into drm-misc-next</title>
<updated>2018-07-06T16:34:13+00:00</updated>
<author>
<name>Gustavo Padovan</name>
<email>gustavo.padovan@collabora.com</email>
</author>
<published>2018-07-06T16:34:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e22e953189f7b3a3bfc7efb511d2b1d1454adde5'/>
<id>e22e953189f7b3a3bfc7efb511d2b1d1454adde5</id>
<content type='text'>
Pull in the malidp writeback implementation for further work on writeback in drm-misc-next.

Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull in the malidp writeback implementation for further work on writeback in drm-misc-next.

Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm: print plane state normalized zpos value</title>
<updated>2018-07-06T08:15:15+00:00</updated>
<author>
<name>Benjamin Gaignard</name>
<email>benjamin.gaignard@linaro.org</email>
</author>
<published>2018-06-05T13:54:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f8878bb2f8675e3c7716906b9b41bddc9b3bc039'/>
<id>f8878bb2f8675e3c7716906b9b41bddc9b3bc039</id>
<content type='text'>
When dumping plane state print normalized zpos value as done for
the other plane state fields.

Signed-off-by: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Reviewed-by: Philippe Cornu &lt;philippe.cornu@st.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180605135407.20214-2-benjamin.gaignard@linaro.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When dumping plane state print normalized zpos value as done for
the other plane state fields.

Signed-off-by: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Reviewed-by: Philippe Cornu &lt;philippe.cornu@st.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180605135407.20214-2-benjamin.gaignard@linaro.org
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge commit 'refs/for-upstream/mali-dp' of git://linux-arm.org/linux-ld into drm-next</title>
<updated>2018-07-06T00:02:13+00:00</updated>
<author>
<name>Dave Airlie</name>
<email>airlied@redhat.com</email>
</author>
<published>2018-07-06T00:02:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4da1d4c751c9b1b713c13043bad7c4d27cd1418c'/>
<id>4da1d4c751c9b1b713c13043bad7c4d27cd1418c</id>
<content type='text'>
"mali-dp driver changes for drm-next, includes the driver implementation
for writeback, improvements for power management handling in the driver
and a debugfs entry for reporting possible internal errors. Please pull
at your earliest convenience.

Boris Brezillon is also interested in this pull as he is going to change
slightly the parameter for the writeback connector's atomic_commit() and
he needs to fix the mali-dp driver in his series."

Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180705144408.GH15340@e110455-lin.cambridge.arm.com
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
"mali-dp driver changes for drm-next, includes the driver implementation
for writeback, improvements for power management handling in the driver
and a debugfs entry for reporting possible internal errors. Please pull
at your earliest convenience.

Boris Brezillon is also interested in this pull as he is going to change
slightly the parameter for the writeback connector's atomic_commit() and
he needs to fix the mali-dp driver in his series."

Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180705144408.GH15340@e110455-lin.cambridge.arm.com
</pre>
</div>
</content>
</entry>
<entry>
<title>drm: mali-dp: Add writeback connector</title>
<updated>2018-07-05T14:19:03+00:00</updated>
<author>
<name>Brian Starkey</name>
<email>brian.starkey@arm.com</email>
</author>
<published>2017-11-02T16:49:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8cbc5caf36ef7a299b5cbedf55f27fd898d700bf'/>
<id>8cbc5caf36ef7a299b5cbedf55f27fd898d700bf</id>
<content type='text'>
Mali-DP has a memory writeback engine which can be used to write the
composition result to a memory buffer. Expose this functionality as a
DRM writeback connector on supported hardware.

Changes since v1:
 Daniel Vetter:
 - Don't require a modeset when writeback routing changes
 - Make writeback connector always disconnected

Changes since v2:
 - Rebase onto new drm_writeback_connector
 - Add reset callback, allocating subclassed state
 Daniel Vetter:
 - Squash out-fence support into this commit
 Gustavo Padovan:
 - Don't signal fence directly from driver (and drop malidp_mw_job)

Changes since v3:
 - Modifications to fit with Mali-DP commit tail changes

Signed-off-by: Brian Starkey &lt;brian.starkey@arm.com&gt;
[rebased and fixed conflicts]
Signed-off-by: Mihail Atanassov &lt;mihail.atanassov@arm.com&gt;
Signed-off-by: Liviu Dudau &lt;liviu.dudau@arm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Mali-DP has a memory writeback engine which can be used to write the
composition result to a memory buffer. Expose this functionality as a
DRM writeback connector on supported hardware.

Changes since v1:
 Daniel Vetter:
 - Don't require a modeset when writeback routing changes
 - Make writeback connector always disconnected

Changes since v2:
 - Rebase onto new drm_writeback_connector
 - Add reset callback, allocating subclassed state
 Daniel Vetter:
 - Squash out-fence support into this commit
 Gustavo Padovan:
 - Don't signal fence directly from driver (and drop malidp_mw_job)

Changes since v3:
 - Modifications to fit with Mali-DP commit tail changes

Signed-off-by: Brian Starkey &lt;brian.starkey@arm.com&gt;
[rebased and fixed conflicts]
Signed-off-by: Mihail Atanassov &lt;mihail.atanassov@arm.com&gt;
Signed-off-by: Liviu Dudau &lt;liviu.dudau@arm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm: Add drm_connector_mask()</title>
<updated>2018-07-02T15:45:55+00:00</updated>
<author>
<name>Ville Syrjälä</name>
<email>ville.syrjala@linux.intel.com</email>
</author>
<published>2018-06-26T19:47:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=737057321f3c2d30b98fa8006b7af1869c32a68b'/>
<id>737057321f3c2d30b98fa8006b7af1869c32a68b</id>
<content type='text'>
Add drm_connector_mask() which returns the 1&lt;&lt;index for the connector.
We already have an identical drm_crtc_mask() for crtcs.

Mostly performed with coccinelle:
@@
@@
- (1&lt;&lt;drm_connector_index(
+ drm_connector_mask(
  ...)
-  )

@@
@@
- 1&lt;&lt;drm_connector_index(
+ drm_connector_mask(
  ...)

@@
@@
- BIT(drm_connector_index(
+ drm_connector_mask(
  ...)
- )

Signed-off-by: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180626194716.12522-4-ville.syrjala@linux.intel.com
Reviewed-by: Rodrigo Vivi &lt;rodrigo.vivi@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add drm_connector_mask() which returns the 1&lt;&lt;index for the connector.
We already have an identical drm_crtc_mask() for crtcs.

Mostly performed with coccinelle:
@@
@@
- (1&lt;&lt;drm_connector_index(
+ drm_connector_mask(
  ...)
-  )

@@
@@
- 1&lt;&lt;drm_connector_index(
+ drm_connector_mask(
  ...)

@@
@@
- BIT(drm_connector_index(
+ drm_connector_mask(
  ...)
- )

Signed-off-by: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180626194716.12522-4-ville.syrjala@linux.intel.com
Reviewed-by: Rodrigo Vivi &lt;rodrigo.vivi@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm: Add drm_plane_mask()</title>
<updated>2018-07-02T15:45:55+00:00</updated>
<author>
<name>Ville Syrjälä</name>
<email>ville.syrjala@linux.intel.com</email>
</author>
<published>2018-06-26T19:47:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=62f77ad0969594ee428043523bf28329df191b39'/>
<id>62f77ad0969594ee428043523bf28329df191b39</id>
<content type='text'>
Add drm_plane_mask() which returns the 1&lt;&lt;index for the plane.
We already have an identical drm_crtc_mask() for crtcs.

Mostly performed with coccinelle:
@@
@@
- (1&lt;&lt;drm_plane_index(
+ drm_plane_mask(
  ...)
-  )

@@
@@
- 1&lt;&lt;drm_plane_index(
+ drm_plane_mask(
  ...)

@@
@@
- BIT(drm_plane_index(
+ drm_plane_mask(
  ...)
- )

Signed-off-by: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180626194716.12522-1-ville.syrjala@linux.intel.com
Reviewed-by: Rodrigo Vivi &lt;rodrigo.vivi@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add drm_plane_mask() which returns the 1&lt;&lt;index for the plane.
We already have an identical drm_crtc_mask() for crtcs.

Mostly performed with coccinelle:
@@
@@
- (1&lt;&lt;drm_plane_index(
+ drm_plane_mask(
  ...)
-  )

@@
@@
- 1&lt;&lt;drm_plane_index(
+ drm_plane_mask(
  ...)

@@
@@
- BIT(drm_plane_index(
+ drm_plane_mask(
  ...)
- )

Signed-off-by: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180626194716.12522-1-ville.syrjala@linux.intel.com
Reviewed-by: Rodrigo Vivi &lt;rodrigo.vivi@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge drm-upstream/drm-next into drm-misc-next</title>
<updated>2018-06-20T16:22:22+00:00</updated>
<author>
<name>Gustavo Padovan</name>
<email>gustavo.padovan@collabora.com</email>
</author>
<published>2018-06-20T16:22:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d98c71dadc2d0debdb80beb5a478baf1e6f98758'/>
<id>d98c71dadc2d0debdb80beb5a478baf1e6f98758</id>
<content type='text'>
We got a few conflicts in drm_atomic.c after merging the DRM writeback support,
now we need a backmerge to unlock develop development on drm-misc-next.

Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We got a few conflicts in drm_atomic.c after merging the DRM writeback support,
now we need a backmerge to unlock develop development on drm-misc-next.

Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
