* [PATCH 1/2] drm: Set crtc->invert_dimensions from the atomic helpers
@ 2015-10-15 13:53 ville.syrjala
2015-10-15 13:53 ` [PATCH 2/2] drm: Swap w/h when converting the mode to src coordidates for a rotated primary plane ville.syrjala
2015-10-15 14:29 ` [PATCH 1/2] drm: Set crtc->invert_dimensions from the atomic helpers Daniel Vetter
0 siblings, 2 replies; 3+ messages in thread
From: ville.syrjala @ 2015-10-15 13:53 UTC (permalink / raw)
To: dri-devel
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Pull the crtc->invert_dimensions setting from omapdrm into the atomic
helpers so that all drivers will check viewport correctly in setcrtc()
after rotating the primary plane,
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/drm_atomic_helper.c | 8 ++++++++
drivers/gpu/drm/omapdrm/omap_crtc.c | 3 ---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 87a2a44..d0d11dbf 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1272,6 +1272,11 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,
funcs->atomic_flush(crtc, old_crtc_state);
}
+
+ for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) {
+ crtc->invert_dimensions = (crtc->primary->state->rotation &
+ (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)));
+ }
}
EXPORT_SYMBOL(drm_atomic_helper_commit_planes);
@@ -1330,6 +1335,9 @@ drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state)
if (crtc_funcs && crtc_funcs->atomic_flush)
crtc_funcs->atomic_flush(crtc, old_crtc_state);
+
+ crtc->invert_dimensions = (crtc->primary->state->rotation &
+ (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)));
}
EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc);
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 9a4ba4f..ad09590 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -412,9 +412,6 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
dispc_mgr_go(omap_crtc->channel);
omap_irq_register(crtc->dev, &omap_crtc->vblank_irq);
}
-
- crtc->invert_dimensions = !!(crtc->primary->state->rotation &
- (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)));
}
static int omap_crtc_atomic_set_property(struct drm_crtc *crtc,
--
2.4.9
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] drm: Swap w/h when converting the mode to src coordidates for a rotated primary plane
2015-10-15 13:53 [PATCH 1/2] drm: Set crtc->invert_dimensions from the atomic helpers ville.syrjala
@ 2015-10-15 13:53 ` ville.syrjala
2015-10-15 14:29 ` [PATCH 1/2] drm: Set crtc->invert_dimensions from the atomic helpers Daniel Vetter
1 sibling, 0 replies; 3+ messages in thread
From: ville.syrjala @ 2015-10-15 13:53 UTC (permalink / raw)
To: dri-devel
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
When converting the mode hdisplay/vdisplay to primary plane src
coordinates we need to take into account the current plane
rotation.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/drm_atomic_helper.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index d0d11dbf..b119a29 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1798,8 +1798,13 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
primary_state->crtc_w = set->mode->hdisplay;
primary_state->src_x = set->x << 16;
primary_state->src_y = set->y << 16;
- primary_state->src_h = set->mode->vdisplay << 16;
- primary_state->src_w = set->mode->hdisplay << 16;
+ if (primary_state->rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
+ primary_state->src_h = set->mode->hdisplay << 16;
+ primary_state->src_w = set->mode->vdisplay << 16;
+ } else {
+ primary_state->src_h = set->mode->vdisplay << 16;
+ primary_state->src_w = set->mode->hdisplay << 16;
+ }
commit:
ret = update_output_state(state, set);
--
2.4.9
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] drm: Set crtc->invert_dimensions from the atomic helpers
2015-10-15 13:53 [PATCH 1/2] drm: Set crtc->invert_dimensions from the atomic helpers ville.syrjala
2015-10-15 13:53 ` [PATCH 2/2] drm: Swap w/h when converting the mode to src coordidates for a rotated primary plane ville.syrjala
@ 2015-10-15 14:29 ` Daniel Vetter
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2015-10-15 14:29 UTC (permalink / raw)
To: ville.syrjala; +Cc: dri-devel
On Thu, Oct 15, 2015 at 04:53:00PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Pull the crtc->invert_dimensions setting from omapdrm into the atomic
> helpers so that all drivers will check viewport correctly in setcrtc()
> after rotating the primary plane,
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 8 ++++++++
> drivers/gpu/drm/omapdrm/omap_crtc.c | 3 ---
> 2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 87a2a44..d0d11dbf 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1272,6 +1272,11 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,
>
> funcs->atomic_flush(crtc, old_crtc_state);
> }
> +
> + for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) {
> + crtc->invert_dimensions = (crtc->primary->state->rotation &
> + (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)));
> + }
> }
> EXPORT_SYMBOL(drm_atomic_helper_commit_planes);
>
> @@ -1330,6 +1335,9 @@ drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state)
>
> if (crtc_funcs && crtc_funcs->atomic_flush)
> crtc_funcs->atomic_flush(crtc, old_crtc_state);
> +
> + crtc->invert_dimensions = (crtc->primary->state->rotation &
> + (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)));
This is racy for async atomic commits since it's only set in the tail part
of the commit, but we read it synchronously from ioctl code. So we'd need
to either state-ify this properly or do something else. Best might be to
ditch crtc->invert_dimensions (so no non-atomic driver uses it), push the
check for legacy drivers down into driver callbacks and for atomic drivers
into the generic check parts of drm_atomic_check.
Not pretty, but probably about the best we can do.
-Daniel
> }
> EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc);
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 9a4ba4f..ad09590 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -412,9 +412,6 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
> dispc_mgr_go(omap_crtc->channel);
> omap_irq_register(crtc->dev, &omap_crtc->vblank_irq);
> }
> -
> - crtc->invert_dimensions = !!(crtc->primary->state->rotation &
> - (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)));
> }
>
> static int omap_crtc_atomic_set_property(struct drm_crtc *crtc,
> --
> 2.4.9
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-15 14:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 13:53 [PATCH 1/2] drm: Set crtc->invert_dimensions from the atomic helpers ville.syrjala
2015-10-15 13:53 ` [PATCH 2/2] drm: Swap w/h when converting the mode to src coordidates for a rotated primary plane ville.syrjala
2015-10-15 14:29 ` [PATCH 1/2] drm: Set crtc->invert_dimensions from the atomic helpers Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox