Commit e02ef555 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Update pipes in reverse order for bigjoiner

With bigjoiner the master crtc is the one that will send out the
uapi event/etc. We want that to happen after all the slaves are
done, so let's try to do the commits in reverse order so that
the master comes last.

Even worse, the modeset helper will simply complete the commit
on the slave pipe immediately as it consider the crtc to be inactive
(it can't see our crtc_state->hw.active/etc.).

With regular sync updates this generally doesn't matter all that
much as the slave pipe should typically finish its work during the
same frame as the master pipe. However in case the slave pipe's commit
slips into the next frame we end up in a bit of trouble. This is most
visible with either async flips (currently disabled with bigjoiner
exactly for this reason), and DSB gamma updates. With DSB the problem
happens because the DSB itself will wait until the next start vblank
before starting to execute. So if the master pipe already finished its
commit and the DSB on the slave pipe is still waiting for the next
vblank we will assume the DSB as gotten stuck and terminate it.

Reversing the commit order should ameliarate this for the most part
as the master pipe is guaranteed to start its commit after the slave
pipe started. The one thing that can still screw us over is the fact
that we aren't necessarily going to commit the pipes in the reverse
order as the actual order is dictated by the DDB overlap avoidance.
But that can only happen while other pipes are being enabled/disabled,
and so in the normal steady state we should be safe.

The full fix will involve making the commit machinery aware of the
slave pipes and not finish their commits prematurely. But that
will involve a bit more work than this. And this commit order
reversal will still be beneficial to avoid userspace getting an
-EBUSY from the following page flip if the second pipe's commit
does stretch into the next frame.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240404213441.17637-2-ville.syrjala@linux.intel.comReviewed-by: default avatarArun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: default avatarVandita Kulkarni <vandita.kulkarni@intel.com>
parent 3a5e09d8
...@@ -6986,8 +6986,12 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state) ...@@ -6986,8 +6986,12 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
intel_dbuf_mbus_pre_ddb_update(state); intel_dbuf_mbus_pre_ddb_update(state);
while (update_pipes) { while (update_pipes) {
for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, /*
new_crtc_state, i) { * Commit in reverse order to make bigjoiner master
* send the uapi events after slaves are done.
*/
for_each_oldnew_intel_crtc_in_state_reverse(state, crtc, old_crtc_state,
new_crtc_state, i) {
enum pipe pipe = crtc->pipe; enum pipe pipe = crtc->pipe;
if ((update_pipes & BIT(pipe)) == 0) if ((update_pipes & BIT(pipe)) == 0)
...@@ -7066,7 +7070,11 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state) ...@@ -7066,7 +7070,11 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
intel_pre_update_crtc(state, crtc); intel_pre_update_crtc(state, crtc);
} }
for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) { /*
* Commit in reverse order to make bigjoiner master
* send the uapi events after slaves are done.
*/
for_each_new_intel_crtc_in_state_reverse(state, crtc, new_crtc_state, i) {
enum pipe pipe = crtc->pipe; enum pipe pipe = crtc->pipe;
if ((update_pipes & BIT(pipe)) == 0) if ((update_pipes & BIT(pipe)) == 0)
......
...@@ -344,6 +344,14 @@ enum phy_fia { ...@@ -344,6 +344,14 @@ enum phy_fia {
(__i)++) \ (__i)++) \
for_each_if(crtc) for_each_if(crtc)
#define for_each_new_intel_crtc_in_state_reverse(__state, crtc, new_crtc_state, __i) \
for ((__i) = (__state)->base.dev->mode_config.num_crtc - 1; \
(__i) >= 0 && \
((crtc) = to_intel_crtc((__state)->base.crtcs[__i].ptr), \
(new_crtc_state) = to_intel_crtc_state((__state)->base.crtcs[__i].new_state), 1); \
(__i)--) \
for_each_if(crtc)
#define for_each_oldnew_intel_plane_in_state(__state, plane, old_plane_state, new_plane_state, __i) \ #define for_each_oldnew_intel_plane_in_state(__state, plane, old_plane_state, new_plane_state, __i) \
for ((__i) = 0; \ for ((__i) = 0; \
(__i) < (__state)->base.dev->mode_config.num_total_plane && \ (__i) < (__state)->base.dev->mode_config.num_total_plane && \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment