[Intel-gfx] [PATCH 4/7] drm/i915: Pass proper old/new states to intel_plane_atomic_check_with_state()
From: Ville Syrjälä Eliminate plane->state and crtc->state usage from intel_plane_atomic_check_with_state() and its callers. Instead pass the proper states in or dig them up from the top level atomic state. Note that intel_plane_atomic_check_with_state() itself isn't allowed to use the top level atomic state as there is none when it gets called from the legacy cursor short circuit path. v2: Rename some variables for easier comprehension (Maarten) Cc: Maarten Lankhorst Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/intel_atomic_plane.c | 49 +++ drivers/gpu/drm/i915/intel_display.c | 12 drivers/gpu/drm/i915/intel_drv.h | 16 -- 3 files changed, 51 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c index ee76fab7bb6f..8e6dc159f64d 100644 --- a/drivers/gpu/drm/i915/intel_atomic_plane.c +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c @@ -107,7 +107,9 @@ intel_plane_destroy_state(struct drm_plane *plane, drm_atomic_helper_plane_destroy_state(plane, state); } -int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state, +int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state, + struct intel_crtc_state *crtc_state, + const struct intel_plane_state *old_plane_state, struct intel_plane_state *intel_state) { struct drm_plane *plane = intel_state->base.plane; @@ -124,7 +126,7 @@ int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state, * anything driver-specific we need to test in that case, so * just return success. */ - if (!intel_state->base.crtc && !plane->state->crtc) + if (!intel_state->base.crtc && !old_plane_state->base.crtc) return 0; /* Clip all planes to CRTC size, or 0x0 if CRTC is disabled */ @@ -194,16 +196,21 @@ int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state, else crtc_state->active_planes &= ~BIT(intel_plane->id); - return intel_plane_atomic_calc_changes(&crtc_state->base, state); + return intel_plane_atomic_calc_changes(old_crtc_state, + &crtc_state->base, + old_plane_state, + state); } static int intel_plane_atomic_check(struct drm_plane *plane, - struct drm_plane_state *state) + struct drm_plane_state *new_plane_state) { - struct drm_crtc *crtc = state->crtc; - struct drm_crtc_state *drm_crtc_state; - - crtc = crtc ? crtc : plane->state->crtc; + struct drm_atomic_state *state = new_plane_state->state; + const struct drm_plane_state *old_plane_state = + drm_atomic_get_old_plane_state(state, plane); + struct drm_crtc *crtc = new_plane_state->crtc ?: old_plane_state->crtc; + const struct drm_crtc_state *old_crtc_state; + struct drm_crtc_state *new_crtc_state; /* * Both crtc and plane->crtc could be NULL if we're updating a @@ -214,29 +221,33 @@ static int intel_plane_atomic_check(struct drm_plane *plane, if (!crtc) return 0; - drm_crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc); - if (WARN_ON(!drm_crtc_state)) - return -EINVAL; + old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc); + new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc); - return intel_plane_atomic_check_with_state(to_intel_crtc_state(drm_crtc_state), - to_intel_plane_state(state)); + return intel_plane_atomic_check_with_state(to_intel_crtc_state(old_crtc_state), + to_intel_crtc_state(new_crtc_state), + to_intel_plane_state(old_plane_state), + to_intel_plane_state(new_plane_state)); } static void intel_plane_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { + struct intel_atomic_state *state = to_intel_atomic_state(old_state->state); struct intel_plane *intel_plane = to_intel_plane(plane); - struct intel_plane_state *intel_state = - to_intel_plane_state(plane->state); - struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc; + const struct intel_plane_state *new_plane_state = + intel_atomic_get_new_plane_state(state, intel_plane); + struct drm_crtc *crtc = new_plane_state->base.crtc ?: old_state->crtc; + + if (ne
Re: [Intel-gfx] [PATCH 4/7] drm/i915: Pass proper old/new states to intel_plane_atomic_check_with_state()
On Wed, Aug 23, 2017 at 06:22:23PM +0300, ville.syrj...@linux.intel.com wrote: > From: Ville Syrjälä > > Eliminate plane->state and crtc->state usage from > intel_plane_atomic_check_with_state() and its callers. Instead pass the > proper states in or dig them up from the top level atomic state. > > Note that intel_plane_atomic_check_with_state() itself isn't allowed to > use the top level atomic state as there is none when it gets called from > the legacy cursor short circuit path. > > v2: Rename some variables for easier comprehension (Maarten) > > Cc: Maarten Lankhorst > Signed-off-by: Ville Syrjälä This patch would still need some review love... In the meantime I pushed the first three patches from the series. Thanks for the reviews thus far. > --- > drivers/gpu/drm/i915/intel_atomic_plane.c | 49 > +++ > drivers/gpu/drm/i915/intel_display.c | 12 > drivers/gpu/drm/i915/intel_drv.h | 16 -- > 3 files changed, 51 insertions(+), 26 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c > b/drivers/gpu/drm/i915/intel_atomic_plane.c > index ee76fab7bb6f..8e6dc159f64d 100644 > --- a/drivers/gpu/drm/i915/intel_atomic_plane.c > +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c > @@ -107,7 +107,9 @@ intel_plane_destroy_state(struct drm_plane *plane, > drm_atomic_helper_plane_destroy_state(plane, state); > } > > -int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state, > +int intel_plane_atomic_check_with_state(const struct intel_crtc_state > *old_crtc_state, > + struct intel_crtc_state *crtc_state, > + const struct intel_plane_state > *old_plane_state, > struct intel_plane_state *intel_state) > { > struct drm_plane *plane = intel_state->base.plane; > @@ -124,7 +126,7 @@ int intel_plane_atomic_check_with_state(struct > intel_crtc_state *crtc_state, >* anything driver-specific we need to test in that case, so >* just return success. >*/ > - if (!intel_state->base.crtc && !plane->state->crtc) > + if (!intel_state->base.crtc && !old_plane_state->base.crtc) > return 0; > > /* Clip all planes to CRTC size, or 0x0 if CRTC is disabled */ > @@ -194,16 +196,21 @@ int intel_plane_atomic_check_with_state(struct > intel_crtc_state *crtc_state, > else > crtc_state->active_planes &= ~BIT(intel_plane->id); > > - return intel_plane_atomic_calc_changes(&crtc_state->base, state); > + return intel_plane_atomic_calc_changes(old_crtc_state, > +&crtc_state->base, > +old_plane_state, > +state); > } > > static int intel_plane_atomic_check(struct drm_plane *plane, > - struct drm_plane_state *state) > + struct drm_plane_state *new_plane_state) > { > - struct drm_crtc *crtc = state->crtc; > - struct drm_crtc_state *drm_crtc_state; > - > - crtc = crtc ? crtc : plane->state->crtc; > + struct drm_atomic_state *state = new_plane_state->state; > + const struct drm_plane_state *old_plane_state = > + drm_atomic_get_old_plane_state(state, plane); > + struct drm_crtc *crtc = new_plane_state->crtc ?: old_plane_state->crtc; > + const struct drm_crtc_state *old_crtc_state; > + struct drm_crtc_state *new_crtc_state; > > /* >* Both crtc and plane->crtc could be NULL if we're updating a > @@ -214,29 +221,33 @@ static int intel_plane_atomic_check(struct drm_plane > *plane, > if (!crtc) > return 0; > > - drm_crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc); > - if (WARN_ON(!drm_crtc_state)) > - return -EINVAL; > + old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc); > + new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc); > > - return > intel_plane_atomic_check_with_state(to_intel_crtc_state(drm_crtc_state), > -to_intel_plane_state(state)); > + return > intel_plane_atomic_check_with_state(to_intel_crtc_state(old_crtc_state), > + > to_intel_crtc_state(new_crtc_state), > + > to_intel_plane_state(old_plane_state), > + > to_intel_plane_state(new_plane_state)); > } > > static void intel_plane_atomic_update(struct drm_plane *plane, > struct drm_plane_state *old_state) > { > + struct intel_atomic_state *state = > to_intel_atomic_state(old_state->state); > struct intel_plane *intel_plane = to_intel_plane(plane); > - struct intel_plane_state *intel_state
Re: [Intel-gfx] [PATCH 4/7] drm/i915: Pass proper old/new states to intel_plane_atomic_check_with_state()
Op 31-08-17 om 20:50 schreef Ville Syrjälä: > On Wed, Aug 23, 2017 at 06:22:23PM +0300, ville.syrj...@linux.intel.com wrote: >> From: Ville Syrjälä >> >> Eliminate plane->state and crtc->state usage from >> intel_plane_atomic_check_with_state() and its callers. Instead pass the >> proper states in or dig them up from the top level atomic state. >> >> Note that intel_plane_atomic_check_with_state() itself isn't allowed to >> use the top level atomic state as there is none when it gets called from >> the legacy cursor short circuit path. >> >> v2: Rename some variables for easier comprehension (Maarten) >> >> Cc: Maarten Lankhorst >> Signed-off-by: Ville Syrjälä > This patch would still need some review love... In the meantime I > pushed the first three patches from the series. Thanks for the reviews > thus far. I love it. Reviewed-by: Maarten Lankhorst ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 4/7] drm/i915: Pass proper old/new states to intel_plane_atomic_check_with_state()
On Fri, Sep 01, 2017 at 07:15:55AM +0200, Maarten Lankhorst wrote: > Op 31-08-17 om 20:50 schreef Ville Syrjälä: > > On Wed, Aug 23, 2017 at 06:22:23PM +0300, ville.syrj...@linux.intel.com > > wrote: > >> From: Ville Syrjälä > >> > >> Eliminate plane->state and crtc->state usage from > >> intel_plane_atomic_check_with_state() and its callers. Instead pass the > >> proper states in or dig them up from the top level atomic state. > >> > >> Note that intel_plane_atomic_check_with_state() itself isn't allowed to > >> use the top level atomic state as there is none when it gets called from > >> the legacy cursor short circuit path. > >> > >> v2: Rename some variables for easier comprehension (Maarten) > >> > >> Cc: Maarten Lankhorst > >> Signed-off-by: Ville Syrjälä > > This patch would still need some review love... In the meantime I > > pushed the first three patches from the series. Thanks for the reviews > > thus far. > I love it. > > Reviewed-by: Maarten Lankhorst Thank you. Pushed the rest of the series to dinq. -- Ville Syrjälä Intel OTC ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx