[v1.1,01/13] drm/atomic: Only update crtc->x/y if it's part of the state, v2.
diff mbox

Message ID 55A7B6C5.7090101@linux.intel.com
State New
Headers show

Commit Message

Maarten Lankhorst July 16, 2015, 1:51 p.m. UTC
Universal planes may not be assigned to the current crtc, so only
update crtc->x/y when the primary is part of the state and bound
to the current crtc.

Changes since v1:
- Add the crtc check.

Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---

Comments

Daniel Vetter July 16, 2015, 2:58 p.m. UTC | #1
On Thu, Jul 16, 2015 at 03:51:01PM +0200, Maarten Lankhorst wrote:
> Universal planes may not be assigned to the current crtc, so only
> update crtc->x/y when the primary is part of the state and bound
> to the current crtc.
> 
> Changes since v1:
> - Add the crtc check.
> 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Applied to topic/drm-misc, thanks.
-Daniel

> ---
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index e52dfc828e60..9ede58365ae1 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -665,10 +665,16 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
>  
>  	/* set legacy state in the crtc structure */
>  	for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) {
> +		struct drm_plane *primary = crtc->primary;
> +
>  		crtc->mode = crtc->state->mode;
>  		crtc->enabled = crtc->state->enable;
> -		crtc->x = crtc->primary->state->src_x >> 16;
> -		crtc->y = crtc->primary->state->src_y >> 16;
> +
> +		if (drm_atomic_get_existing_plane_state(old_state, primary) &&
> +		    primary->state->crtc == crtc) {
> +			crtc->x = primary->state->src_x >> 16;
> +			crtc->y = primary->state->src_y >> 16;
> +		}
>  
>  		if (crtc->state->enable)
>  			drm_calc_timestamping_constants(crtc,
>

Patch
diff mbox

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index e52dfc828e60..9ede58365ae1 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -665,10 +665,16 @@  drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
 
 	/* set legacy state in the crtc structure */
 	for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) {
+		struct drm_plane *primary = crtc->primary;
+
 		crtc->mode = crtc->state->mode;
 		crtc->enabled = crtc->state->enable;
-		crtc->x = crtc->primary->state->src_x >> 16;
-		crtc->y = crtc->primary->state->src_y >> 16;
+
+		if (drm_atomic_get_existing_plane_state(old_state, primary) &&
+		    primary->state->crtc == crtc) {
+			crtc->x = primary->state->src_x >> 16;
+			crtc->y = primary->state->src_y >> 16;
+		}
 
 		if (crtc->state->enable)
 			drm_calc_timestamping_constants(crtc,