linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/rockchip: allocate correct crtc state structure on reset
@ 2016-07-14 15:29 John Keeping
  2016-07-14 15:35 ` Sean Paul
  2016-07-15  2:46 ` Mark yao
  0 siblings, 2 replies; 3+ messages in thread
From: John Keeping @ 2016-07-14 15:29 UTC (permalink / raw)
  To: linux-arm-kernel

Because we are using a custom crtc_state structure, we must override the
reset helper to allocate the correct amount of memory.

Cc: stable at vger.kernel.org
Fixes: 4e257d9eee23 ("drm/rockchip: get rid of rockchip_drm_crtc_mode_config")
Signed-off-by: John Keeping <john@metanate.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 1c4d5b5a70a2..21e1247098be 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1048,6 +1048,17 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)
 	drm_crtc_cleanup(crtc);
 }
 
+static void vop_crtc_reset(struct drm_crtc *crtc)
+{
+	if (crtc->state)
+		__drm_atomic_helper_crtc_destroy_state(crtc, crtc->state);
+	kfree(crtc->state);
+
+	crtc->state = kzalloc(sizeof(struct rockchip_crtc_state), GFP_KERNEL);
+	if (crtc->state)
+		crtc->state->crtc = crtc;
+}
+
 static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc *crtc)
 {
 	struct rockchip_crtc_state *rockchip_state;
@@ -1073,7 +1084,7 @@ static const struct drm_crtc_funcs vop_crtc_funcs = {
 	.set_config = drm_atomic_helper_set_config,
 	.page_flip = drm_atomic_helper_page_flip,
 	.destroy = vop_crtc_destroy,
-	.reset = drm_atomic_helper_crtc_reset,
+	.reset = vop_crtc_reset,
 	.atomic_duplicate_state = vop_crtc_duplicate_state,
 	.atomic_destroy_state = vop_crtc_destroy_state,
 };
-- 
2.9.0.465.g8850cbc.dirty

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

* [PATCH] drm/rockchip: allocate correct crtc state structure on reset
  2016-07-14 15:29 [PATCH] drm/rockchip: allocate correct crtc state structure on reset John Keeping
@ 2016-07-14 15:35 ` Sean Paul
  2016-07-15  2:46 ` Mark yao
  1 sibling, 0 replies; 3+ messages in thread
From: Sean Paul @ 2016-07-14 15:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jul 14, 2016 at 8:29 AM, John Keeping <john@metanate.com> wrote:
> Because we are using a custom crtc_state structure, we must override the
> reset helper to allocate the correct amount of memory.
>
> Cc: stable at vger.kernel.org
> Fixes: 4e257d9eee23 ("drm/rockchip: get rid of rockchip_drm_crtc_mode_config")
> Signed-off-by: John Keeping <john@metanate.com>

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 1c4d5b5a70a2..21e1247098be 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -1048,6 +1048,17 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)
>         drm_crtc_cleanup(crtc);
>  }
>
> +static void vop_crtc_reset(struct drm_crtc *crtc)
> +{
> +       if (crtc->state)
> +               __drm_atomic_helper_crtc_destroy_state(crtc, crtc->state);
> +       kfree(crtc->state);
> +
> +       crtc->state = kzalloc(sizeof(struct rockchip_crtc_state), GFP_KERNEL);
> +       if (crtc->state)
> +               crtc->state->crtc = crtc;
> +}
> +
>  static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc *crtc)
>  {
>         struct rockchip_crtc_state *rockchip_state;
> @@ -1073,7 +1084,7 @@ static const struct drm_crtc_funcs vop_crtc_funcs = {
>         .set_config = drm_atomic_helper_set_config,
>         .page_flip = drm_atomic_helper_page_flip,
>         .destroy = vop_crtc_destroy,
> -       .reset = drm_atomic_helper_crtc_reset,
> +       .reset = vop_crtc_reset,
>         .atomic_duplicate_state = vop_crtc_duplicate_state,
>         .atomic_destroy_state = vop_crtc_destroy_state,
>  };
> --
> 2.9.0.465.g8850cbc.dirty
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH] drm/rockchip: allocate correct crtc state structure on reset
  2016-07-14 15:29 [PATCH] drm/rockchip: allocate correct crtc state structure on reset John Keeping
  2016-07-14 15:35 ` Sean Paul
@ 2016-07-15  2:46 ` Mark yao
  1 sibling, 0 replies; 3+ messages in thread
From: Mark yao @ 2016-07-15  2:46 UTC (permalink / raw)
  To: linux-arm-kernel

On 2016?07?14? 23:29, John Keeping wrote:
> Because we are using a custom crtc_state structure, we must override the
> reset helper to allocate the correct amount of memory.
>
> Cc: stable at vger.kernel.org
> Fixes: 4e257d9eee23 ("drm/rockchip: get rid of rockchip_drm_crtc_mode_config")
> Signed-off-by: John Keeping <john@metanate.com>
> ---
>   drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 13 ++++++++++++-
>   1 file changed, 12 insertions(+), 1 deletion(-)
Thanks for the fixes, Applied to my drm-fixes


> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 1c4d5b5a70a2..21e1247098be 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -1048,6 +1048,17 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)
>   	drm_crtc_cleanup(crtc);
>   }
>   
> +static void vop_crtc_reset(struct drm_crtc *crtc)
> +{
> +	if (crtc->state)
> +		__drm_atomic_helper_crtc_destroy_state(crtc, crtc->state);
> +	kfree(crtc->state);
> +
> +	crtc->state = kzalloc(sizeof(struct rockchip_crtc_state), GFP_KERNEL);
> +	if (crtc->state)
> +		crtc->state->crtc = crtc;
> +}
> +
>   static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc *crtc)
>   {
>   	struct rockchip_crtc_state *rockchip_state;
> @@ -1073,7 +1084,7 @@ static const struct drm_crtc_funcs vop_crtc_funcs = {
>   	.set_config = drm_atomic_helper_set_config,
>   	.page_flip = drm_atomic_helper_page_flip,
>   	.destroy = vop_crtc_destroy,
> -	.reset = drm_atomic_helper_crtc_reset,
> +	.reset = vop_crtc_reset,
>   	.atomic_duplicate_state = vop_crtc_duplicate_state,
>   	.atomic_destroy_state = vop_crtc_destroy_state,
>   };


-- 
?ark Yao

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

end of thread, other threads:[~2016-07-15  2:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 15:29 [PATCH] drm/rockchip: allocate correct crtc state structure on reset John Keeping
2016-07-14 15:35 ` Sean Paul
2016-07-15  2:46 ` Mark yao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).