All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/rockchip: vop: fix crtc size in plane check
@ 2016-02-22 12:22 ` John Keeping
  0 siblings, 0 replies; 12+ messages in thread
From: John Keeping @ 2016-02-22 12:22 UTC (permalink / raw)
  To: Mark Yao
  Cc: Heiko Stuebner, dri-devel, linux-arm-kernel, linux-rockchip,
	linux-kernel, John Keeping

If the geometry of a crtc is changing in an atomic update then we much
validate the plane size against the new state of the crtc and not the
current size, otherwise if the crtc size is increasing the plane will be
cropped at the previous size and will not fill the screen.

Signed-off-by: John Keeping <john@metanate.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index fd37054..82d55bd 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -549,6 +549,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 			   struct drm_plane_state *state)
 {
 	struct drm_crtc *crtc = state->crtc;
+	struct drm_crtc_state *crtc_state;
 	struct drm_framebuffer *fb = state->fb;
 	struct vop_win *vop_win = to_vop_win(plane);
 	struct vop_plane_state *vop_plane_state = to_vop_plane_state(state);
@@ -563,12 +564,13 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
 					DRM_PLANE_HELPER_NO_SCALING;
 
-	crtc = crtc ? crtc : plane->state->crtc;
-	/*
-	 * Both crtc or plane->state->crtc can be null.
-	 */
 	if (!crtc || !fb)
 		goto out_disable;
+
+	crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
+	if (WARN_ON(!crtc_state))
+		return -EINVAL;
+
 	src->x1 = state->src_x;
 	src->y1 = state->src_y;
 	src->x2 = state->src_x + state->src_w;
@@ -580,8 +582,8 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 
 	clip.x1 = 0;
 	clip.y1 = 0;
-	clip.x2 = crtc->mode.hdisplay;
-	clip.y2 = crtc->mode.vdisplay;
+	clip.x2 = crtc_state->adjusted_mode.hdisplay;
+	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
 	ret = drm_plane_helper_check_update(plane, crtc, state->fb,
 					    src, dest, &clip,
-- 
2.7.0.226.gfe986fe

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] drm/rockchip: vop: fix crtc size in plane check
@ 2016-02-22 12:22 ` John Keeping
  0 siblings, 0 replies; 12+ messages in thread
From: John Keeping @ 2016-02-22 12:22 UTC (permalink / raw)
  To: Mark Yao; +Cc: linux-kernel, dri-devel, linux-rockchip, linux-arm-kernel

If the geometry of a crtc is changing in an atomic update then we much
validate the plane size against the new state of the crtc and not the
current size, otherwise if the crtc size is increasing the plane will be
cropped at the previous size and will not fill the screen.

Signed-off-by: John Keeping <john@metanate.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index fd37054..82d55bd 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -549,6 +549,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 			   struct drm_plane_state *state)
 {
 	struct drm_crtc *crtc = state->crtc;
+	struct drm_crtc_state *crtc_state;
 	struct drm_framebuffer *fb = state->fb;
 	struct vop_win *vop_win = to_vop_win(plane);
 	struct vop_plane_state *vop_plane_state = to_vop_plane_state(state);
@@ -563,12 +564,13 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
 					DRM_PLANE_HELPER_NO_SCALING;
 
-	crtc = crtc ? crtc : plane->state->crtc;
-	/*
-	 * Both crtc or plane->state->crtc can be null.
-	 */
 	if (!crtc || !fb)
 		goto out_disable;
+
+	crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
+	if (WARN_ON(!crtc_state))
+		return -EINVAL;
+
 	src->x1 = state->src_x;
 	src->y1 = state->src_y;
 	src->x2 = state->src_x + state->src_w;
@@ -580,8 +582,8 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 
 	clip.x1 = 0;
 	clip.y1 = 0;
-	clip.x2 = crtc->mode.hdisplay;
-	clip.y2 = crtc->mode.vdisplay;
+	clip.x2 = crtc_state->adjusted_mode.hdisplay;
+	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
 	ret = drm_plane_helper_check_update(plane, crtc, state->fb,
 					    src, dest, &clip,
-- 
2.7.0.226.gfe986fe

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] drm/rockchip: vop: fix crtc size in plane check
@ 2016-02-22 12:22 ` John Keeping
  0 siblings, 0 replies; 12+ messages in thread
From: John Keeping @ 2016-02-22 12:22 UTC (permalink / raw)
  To: linux-arm-kernel

If the geometry of a crtc is changing in an atomic update then we much
validate the plane size against the new state of the crtc and not the
current size, otherwise if the crtc size is increasing the plane will be
cropped at the previous size and will not fill the screen.

Signed-off-by: John Keeping <john@metanate.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index fd37054..82d55bd 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -549,6 +549,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 			   struct drm_plane_state *state)
 {
 	struct drm_crtc *crtc = state->crtc;
+	struct drm_crtc_state *crtc_state;
 	struct drm_framebuffer *fb = state->fb;
 	struct vop_win *vop_win = to_vop_win(plane);
 	struct vop_plane_state *vop_plane_state = to_vop_plane_state(state);
@@ -563,12 +564,13 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
 					DRM_PLANE_HELPER_NO_SCALING;
 
-	crtc = crtc ? crtc : plane->state->crtc;
-	/*
-	 * Both crtc or plane->state->crtc can be null.
-	 */
 	if (!crtc || !fb)
 		goto out_disable;
+
+	crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
+	if (WARN_ON(!crtc_state))
+		return -EINVAL;
+
 	src->x1 = state->src_x;
 	src->y1 = state->src_y;
 	src->x2 = state->src_x + state->src_w;
@@ -580,8 +582,8 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 
 	clip.x1 = 0;
 	clip.y1 = 0;
-	clip.x2 = crtc->mode.hdisplay;
-	clip.y2 = crtc->mode.vdisplay;
+	clip.x2 = crtc_state->adjusted_mode.hdisplay;
+	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
 	ret = drm_plane_helper_check_update(plane, crtc, state->fb,
 					    src, dest, &clip,
-- 
2.7.0.226.gfe986fe

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] drm/rockchip: vop: fix crtc size in plane check
  2016-02-22 12:22 ` John Keeping
  (?)
@ 2016-03-04  1:04   ` Mark yao
  -1 siblings, 0 replies; 12+ messages in thread
From: Mark yao @ 2016-03-04  1:04 UTC (permalink / raw)
  To: John Keeping
  Cc: Heiko Stuebner, dri-devel, linux-arm-kernel, linux-rockchip,
	linux-kernel

On 2016年02月22日 20:22, John Keeping wrote:
> If the geometry of a crtc is changing in an atomic update then we much

I think "we much validate" should be "we must validate".:-)

> validate the plane size against the new state of the crtc and not the
> current size, otherwise if the crtc size is increasing the plane will be
> cropped at the previous size and will not fill the screen.
>
> Signed-off-by: John Keeping<john@metanate.com>

-- 
Mark Yao

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drm/rockchip: vop: fix crtc size in plane check
@ 2016-03-04  1:04   ` Mark yao
  0 siblings, 0 replies; 12+ messages in thread
From: Mark yao @ 2016-03-04  1:04 UTC (permalink / raw)
  To: John Keeping; +Cc: linux-arm-kernel, linux-rockchip, dri-devel, linux-kernel

On 2016年02月22日 20:22, John Keeping wrote:
> If the geometry of a crtc is changing in an atomic update then we much

I think "we much validate" should be "we must validate".:-)

> validate the plane size against the new state of the crtc and not the
> current size, otherwise if the crtc size is increasing the plane will be
> cropped at the previous size and will not fill the screen.
>
> Signed-off-by: John Keeping<john@metanate.com>

-- 
Mark Yao


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] drm/rockchip: vop: fix crtc size in plane check
@ 2016-03-04  1:04   ` Mark yao
  0 siblings, 0 replies; 12+ messages in thread
From: Mark yao @ 2016-03-04  1:04 UTC (permalink / raw)
  To: linux-arm-kernel

On 2016?02?22? 20:22, John Keeping wrote:
> If the geometry of a crtc is changing in an atomic update then we much

I think "we much validate" should be "we must validate".:-)

> validate the plane size against the new state of the crtc and not the
> current size, otherwise if the crtc size is increasing the plane will be
> cropped at the previous size and will not fill the screen.
>
> Signed-off-by: John Keeping<john@metanate.com>

-- 
?ark Yao

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2] drm/rockchip: vop: fix crtc size in plane check
  2016-03-04  1:04   ` Mark yao
  (?)
@ 2016-03-04 11:04     ` John Keeping
  -1 siblings, 0 replies; 12+ messages in thread
From: John Keeping @ 2016-03-04 11:04 UTC (permalink / raw)
  To: Mark yao
  Cc: John Keeping, Heiko Stuebner, dri-devel, linux-arm-kernel,
	linux-rockchip, linux-kernel

If the geometry of a crtc is changing in an atomic update then we must
validate the plane size against the new state of the crtc and not the
current size, otherwise if the crtc size is increasing the plane will be
cropped at the previous size and will not fill the screen.

Signed-off-by: John Keeping <john@metanate.com>
---
On Fri, 04 Mar 2016 09:04:57 +0800, Mark yao wrote:
> On 2016年02月22日 20:22, John Keeping wrote:
> > If the geometry of a crtc is changing in an atomic update then we much  
> 
> I think "we much validate" should be "we must validate".:-)

Yes, here's v2 with that fixed.

> > validate the plane size against the new state of the crtc and not the
> > current size, otherwise if the crtc size is increasing the plane will be
> > cropped at the previous size and will not fill the screen.

 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index fd37054..82d55bd 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -549,6 +549,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 			   struct drm_plane_state *state)
 {
 	struct drm_crtc *crtc = state->crtc;
+	struct drm_crtc_state *crtc_state;
 	struct drm_framebuffer *fb = state->fb;
 	struct vop_win *vop_win = to_vop_win(plane);
 	struct vop_plane_state *vop_plane_state = to_vop_plane_state(state);
@@ -563,12 +564,13 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
 					DRM_PLANE_HELPER_NO_SCALING;
 
-	crtc = crtc ? crtc : plane->state->crtc;
-	/*
-	 * Both crtc or plane->state->crtc can be null.
-	 */
 	if (!crtc || !fb)
 		goto out_disable;
+
+	crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
+	if (WARN_ON(!crtc_state))
+		return -EINVAL;
+
 	src->x1 = state->src_x;
 	src->y1 = state->src_y;
 	src->x2 = state->src_x + state->src_w;
@@ -580,8 +582,8 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 
 	clip.x1 = 0;
 	clip.y1 = 0;
-	clip.x2 = crtc->mode.hdisplay;
-	clip.y2 = crtc->mode.vdisplay;
+	clip.x2 = crtc_state->adjusted_mode.hdisplay;
+	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
 	ret = drm_plane_helper_check_update(plane, crtc, state->fb,
 					    src, dest, &clip,
-- 
2.7.0.226.gfe986fe

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2] drm/rockchip: vop: fix crtc size in plane check
@ 2016-03-04 11:04     ` John Keeping
  0 siblings, 0 replies; 12+ messages in thread
From: John Keeping @ 2016-03-04 11:04 UTC (permalink / raw)
  To: Mark yao; +Cc: linux-kernel, dri-devel, linux-rockchip, linux-arm-kernel

If the geometry of a crtc is changing in an atomic update then we must
validate the plane size against the new state of the crtc and not the
current size, otherwise if the crtc size is increasing the plane will be
cropped at the previous size and will not fill the screen.

Signed-off-by: John Keeping <john@metanate.com>
---
On Fri, 04 Mar 2016 09:04:57 +0800, Mark yao wrote:
> On 2016年02月22日 20:22, John Keeping wrote:
> > If the geometry of a crtc is changing in an atomic update then we much  
> 
> I think "we much validate" should be "we must validate".:-)

Yes, here's v2 with that fixed.

> > validate the plane size against the new state of the crtc and not the
> > current size, otherwise if the crtc size is increasing the plane will be
> > cropped at the previous size and will not fill the screen.

 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index fd37054..82d55bd 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -549,6 +549,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 			   struct drm_plane_state *state)
 {
 	struct drm_crtc *crtc = state->crtc;
+	struct drm_crtc_state *crtc_state;
 	struct drm_framebuffer *fb = state->fb;
 	struct vop_win *vop_win = to_vop_win(plane);
 	struct vop_plane_state *vop_plane_state = to_vop_plane_state(state);
@@ -563,12 +564,13 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
 					DRM_PLANE_HELPER_NO_SCALING;
 
-	crtc = crtc ? crtc : plane->state->crtc;
-	/*
-	 * Both crtc or plane->state->crtc can be null.
-	 */
 	if (!crtc || !fb)
 		goto out_disable;
+
+	crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
+	if (WARN_ON(!crtc_state))
+		return -EINVAL;
+
 	src->x1 = state->src_x;
 	src->y1 = state->src_y;
 	src->x2 = state->src_x + state->src_w;
@@ -580,8 +582,8 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 
 	clip.x1 = 0;
 	clip.y1 = 0;
-	clip.x2 = crtc->mode.hdisplay;
-	clip.y2 = crtc->mode.vdisplay;
+	clip.x2 = crtc_state->adjusted_mode.hdisplay;
+	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
 	ret = drm_plane_helper_check_update(plane, crtc, state->fb,
 					    src, dest, &clip,
-- 
2.7.0.226.gfe986fe

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2] drm/rockchip: vop: fix crtc size in plane check
@ 2016-03-04 11:04     ` John Keeping
  0 siblings, 0 replies; 12+ messages in thread
From: John Keeping @ 2016-03-04 11:04 UTC (permalink / raw)
  To: linux-arm-kernel

If the geometry of a crtc is changing in an atomic update then we must
validate the plane size against the new state of the crtc and not the
current size, otherwise if the crtc size is increasing the plane will be
cropped at the previous size and will not fill the screen.

Signed-off-by: John Keeping <john@metanate.com>
---
On Fri, 04 Mar 2016 09:04:57 +0800, Mark yao wrote:
> On 2016?02?22? 20:22, John Keeping wrote:
> > If the geometry of a crtc is changing in an atomic update then we much  
> 
> I think "we much validate" should be "we must validate".:-)

Yes, here's v2 with that fixed.

> > validate the plane size against the new state of the crtc and not the
> > current size, otherwise if the crtc size is increasing the plane will be
> > cropped at the previous size and will not fill the screen.

 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index fd37054..82d55bd 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -549,6 +549,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 			   struct drm_plane_state *state)
 {
 	struct drm_crtc *crtc = state->crtc;
+	struct drm_crtc_state *crtc_state;
 	struct drm_framebuffer *fb = state->fb;
 	struct vop_win *vop_win = to_vop_win(plane);
 	struct vop_plane_state *vop_plane_state = to_vop_plane_state(state);
@@ -563,12 +564,13 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
 					DRM_PLANE_HELPER_NO_SCALING;
 
-	crtc = crtc ? crtc : plane->state->crtc;
-	/*
-	 * Both crtc or plane->state->crtc can be null.
-	 */
 	if (!crtc || !fb)
 		goto out_disable;
+
+	crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
+	if (WARN_ON(!crtc_state))
+		return -EINVAL;
+
 	src->x1 = state->src_x;
 	src->y1 = state->src_y;
 	src->x2 = state->src_x + state->src_w;
@@ -580,8 +582,8 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 
 	clip.x1 = 0;
 	clip.y1 = 0;
-	clip.x2 = crtc->mode.hdisplay;
-	clip.y2 = crtc->mode.vdisplay;
+	clip.x2 = crtc_state->adjusted_mode.hdisplay;
+	clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
 	ret = drm_plane_helper_check_update(plane, crtc, state->fb,
 					    src, dest, &clip,
-- 
2.7.0.226.gfe986fe

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] drm/rockchip: vop: fix crtc size in plane check
  2016-03-04 11:04     ` John Keeping
  (?)
@ 2016-03-14  2:39       ` Mark yao
  -1 siblings, 0 replies; 12+ messages in thread
From: Mark yao @ 2016-03-14  2:39 UTC (permalink / raw)
  To: John Keeping
  Cc: Heiko Stuebner, dri-devel, linux-arm-kernel, linux-rockchip,
	linux-kernel

On 2016年03月04日 19:04, John Keeping wrote:
> If the geometry of a crtc is changing in an atomic update then we must
> validate the plane size against the new state of the crtc and not the
> current size, otherwise if the crtc size is increasing the plane will be
> cropped at the previous size and will not fill the screen.
>
> Signed-off-by: John Keeping <john@metanate.com>
> ---
> On Fri, 04 Mar 2016 09:04:57 +0800, Mark yao wrote:
>> On 2016年02月22日 20:22, John Keeping wrote:
>>> If the geometry of a crtc is changing in an atomic update then we much
>> I think "we much validate" should be "we must validate".:-)
> Yes, here's v2 with that fixed.
>
>>> validate the plane size against the new state of the crtc and not the
>>> current size, otherwise if the crtc size is increasing the plane will be
>>> cropped at the previous size and will not fill the screen.
>   drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index fd37054..82d55bd 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -549,6 +549,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>   			   struct drm_plane_state *state)
>   {
>   	struct drm_crtc *crtc = state->crtc;
> +	struct drm_crtc_state *crtc_state;
>   	struct drm_framebuffer *fb = state->fb;
>   	struct vop_win *vop_win = to_vop_win(plane);
>   	struct vop_plane_state *vop_plane_state = to_vop_plane_state(state);
> @@ -563,12 +564,13 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>   	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
>   					DRM_PLANE_HELPER_NO_SCALING;
>   
> -	crtc = crtc ? crtc : plane->state->crtc;
> -	/*
> -	 * Both crtc or plane->state->crtc can be null.
> -	 */
>   	if (!crtc || !fb)
>   		goto out_disable;
> +
> +	crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
> +	if (WARN_ON(!crtc_state))
> +		return -EINVAL;
> +
>   	src->x1 = state->src_x;
>   	src->y1 = state->src_y;
>   	src->x2 = state->src_x + state->src_w;
> @@ -580,8 +582,8 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>   
>   	clip.x1 = 0;
>   	clip.y1 = 0;
> -	clip.x2 = crtc->mode.hdisplay;
> -	clip.y2 = crtc->mode.vdisplay;
> +	clip.x2 = crtc_state->adjusted_mode.hdisplay;
> +	clip.y2 = crtc_state->adjusted_mode.vdisplay;
>   
>   	ret = drm_plane_helper_check_update(plane, crtc, state->fb,
>   					    src, dest, &clip,

Looks good for me, applied into my drm-fixes.

Thanks for the fix.

-- 
Mark Yao

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] drm/rockchip: vop: fix crtc size in plane check
@ 2016-03-14  2:39       ` Mark yao
  0 siblings, 0 replies; 12+ messages in thread
From: Mark yao @ 2016-03-14  2:39 UTC (permalink / raw)
  To: John Keeping; +Cc: linux-arm-kernel, linux-rockchip, dri-devel, linux-kernel

On 2016年03月04日 19:04, John Keeping wrote:
> If the geometry of a crtc is changing in an atomic update then we must
> validate the plane size against the new state of the crtc and not the
> current size, otherwise if the crtc size is increasing the plane will be
> cropped at the previous size and will not fill the screen.
>
> Signed-off-by: John Keeping <john@metanate.com>
> ---
> On Fri, 04 Mar 2016 09:04:57 +0800, Mark yao wrote:
>> On 2016年02月22日 20:22, John Keeping wrote:
>>> If the geometry of a crtc is changing in an atomic update then we much
>> I think "we much validate" should be "we must validate".:-)
> Yes, here's v2 with that fixed.
>
>>> validate the plane size against the new state of the crtc and not the
>>> current size, otherwise if the crtc size is increasing the plane will be
>>> cropped at the previous size and will not fill the screen.
>   drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index fd37054..82d55bd 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -549,6 +549,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>   			   struct drm_plane_state *state)
>   {
>   	struct drm_crtc *crtc = state->crtc;
> +	struct drm_crtc_state *crtc_state;
>   	struct drm_framebuffer *fb = state->fb;
>   	struct vop_win *vop_win = to_vop_win(plane);
>   	struct vop_plane_state *vop_plane_state = to_vop_plane_state(state);
> @@ -563,12 +564,13 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>   	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
>   					DRM_PLANE_HELPER_NO_SCALING;
>   
> -	crtc = crtc ? crtc : plane->state->crtc;
> -	/*
> -	 * Both crtc or plane->state->crtc can be null.
> -	 */
>   	if (!crtc || !fb)
>   		goto out_disable;
> +
> +	crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
> +	if (WARN_ON(!crtc_state))
> +		return -EINVAL;
> +
>   	src->x1 = state->src_x;
>   	src->y1 = state->src_y;
>   	src->x2 = state->src_x + state->src_w;
> @@ -580,8 +582,8 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>   
>   	clip.x1 = 0;
>   	clip.y1 = 0;
> -	clip.x2 = crtc->mode.hdisplay;
> -	clip.y2 = crtc->mode.vdisplay;
> +	clip.x2 = crtc_state->adjusted_mode.hdisplay;
> +	clip.y2 = crtc_state->adjusted_mode.vdisplay;
>   
>   	ret = drm_plane_helper_check_update(plane, crtc, state->fb,
>   					    src, dest, &clip,

Looks good for me, applied into my drm-fixes.

Thanks for the fix.

-- 
Mark Yao


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2] drm/rockchip: vop: fix crtc size in plane check
@ 2016-03-14  2:39       ` Mark yao
  0 siblings, 0 replies; 12+ messages in thread
From: Mark yao @ 2016-03-14  2:39 UTC (permalink / raw)
  To: linux-arm-kernel

On 2016?03?04? 19:04, John Keeping wrote:
> If the geometry of a crtc is changing in an atomic update then we must
> validate the plane size against the new state of the crtc and not the
> current size, otherwise if the crtc size is increasing the plane will be
> cropped at the previous size and will not fill the screen.
>
> Signed-off-by: John Keeping <john@metanate.com>
> ---
> On Fri, 04 Mar 2016 09:04:57 +0800, Mark yao wrote:
>> On 2016?02?22? 20:22, John Keeping wrote:
>>> If the geometry of a crtc is changing in an atomic update then we much
>> I think "we much validate" should be "we must validate".:-)
> Yes, here's v2 with that fixed.
>
>>> validate the plane size against the new state of the crtc and not the
>>> current size, otherwise if the crtc size is increasing the plane will be
>>> cropped at the previous size and will not fill the screen.
>   drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index fd37054..82d55bd 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -549,6 +549,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>   			   struct drm_plane_state *state)
>   {
>   	struct drm_crtc *crtc = state->crtc;
> +	struct drm_crtc_state *crtc_state;
>   	struct drm_framebuffer *fb = state->fb;
>   	struct vop_win *vop_win = to_vop_win(plane);
>   	struct vop_plane_state *vop_plane_state = to_vop_plane_state(state);
> @@ -563,12 +564,13 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>   	int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
>   					DRM_PLANE_HELPER_NO_SCALING;
>   
> -	crtc = crtc ? crtc : plane->state->crtc;
> -	/*
> -	 * Both crtc or plane->state->crtc can be null.
> -	 */
>   	if (!crtc || !fb)
>   		goto out_disable;
> +
> +	crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
> +	if (WARN_ON(!crtc_state))
> +		return -EINVAL;
> +
>   	src->x1 = state->src_x;
>   	src->y1 = state->src_y;
>   	src->x2 = state->src_x + state->src_w;
> @@ -580,8 +582,8 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
>   
>   	clip.x1 = 0;
>   	clip.y1 = 0;
> -	clip.x2 = crtc->mode.hdisplay;
> -	clip.y2 = crtc->mode.vdisplay;
> +	clip.x2 = crtc_state->adjusted_mode.hdisplay;
> +	clip.y2 = crtc_state->adjusted_mode.vdisplay;
>   
>   	ret = drm_plane_helper_check_update(plane, crtc, state->fb,
>   					    src, dest, &clip,

Looks good for me, applied into my drm-fixes.

Thanks for the fix.

-- 
?ark Yao

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-03-14  2:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-22 12:22 [PATCH] drm/rockchip: vop: fix crtc size in plane check John Keeping
2016-02-22 12:22 ` John Keeping
2016-02-22 12:22 ` John Keeping
2016-03-04  1:04 ` Mark yao
2016-03-04  1:04   ` Mark yao
2016-03-04  1:04   ` Mark yao
2016-03-04 11:04   ` [PATCH v2] " John Keeping
2016-03-04 11:04     ` John Keeping
2016-03-04 11:04     ` John Keeping
2016-03-14  2:39     ` Mark yao
2016-03-14  2:39       ` Mark yao
2016-03-14  2:39       ` Mark yao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.