* [PATCH] drm/vc4: Allocate the right amount of space for boot-time CRTC state.
@ 2017-03-28 20:13 Eric Anholt
2017-03-29 6:30 ` Daniel Vetter
0 siblings, 1 reply; 3+ messages in thread
From: Eric Anholt @ 2017-03-28 20:13 UTC (permalink / raw)
To: dri-devel; +Cc: linux-kernel, Eric Anholt
Without this, the first modeset would dereference past the allocation
when trying to free the mm node.
Signed-off-by: Eric Anholt <eric@anholt.net>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/gpu/drm/vc4/vc4_crtc.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 24edd0c22cc9..9d91a40e4345 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -845,6 +845,17 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,
drm_atomic_helper_crtc_destroy_state(crtc, state);
}
+static void
+vc4_crtc_reset(struct drm_crtc *crtc)
+{
+ if (crtc->state)
+ __drm_atomic_helper_crtc_destroy_state(crtc->state);
+
+ crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL);
+ if (crtc->state)
+ crtc->state->crtc = crtc;
+}
+
static const struct drm_crtc_funcs vc4_crtc_funcs = {
.set_config = drm_atomic_helper_set_config,
.destroy = vc4_crtc_destroy,
@@ -852,7 +863,7 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = {
.set_property = NULL,
.cursor_set = NULL, /* handled by drm_mode_cursor_universal */
.cursor_move = NULL, /* handled by drm_mode_cursor_universal */
- .reset = drm_atomic_helper_crtc_reset,
+ .reset = vc4_crtc_reset,
.atomic_duplicate_state = vc4_crtc_duplicate_state,
.atomic_destroy_state = vc4_crtc_destroy_state,
.gamma_set = vc4_crtc_gamma_set,
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/vc4: Allocate the right amount of space for boot-time CRTC state.
2017-03-28 20:13 [PATCH] drm/vc4: Allocate the right amount of space for boot-time CRTC state Eric Anholt
@ 2017-03-29 6:30 ` Daniel Vetter
2017-03-31 0:40 ` Eric Anholt
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Vetter @ 2017-03-29 6:30 UTC (permalink / raw)
To: Eric Anholt; +Cc: dri-devel, linux-kernel
On Tue, Mar 28, 2017 at 01:13:43PM -0700, Eric Anholt wrote:
> Without this, the first modeset would dereference past the allocation
> when trying to free the mm node.
>
> Signed-off-by: Eric Anholt <eric@anholt.net>
> Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Fixes: d8dbf44f13b9 ("drm/vc4: Make the CRTCs cooperate on allocating display lists.")
Cc: <stable@vger.kernel.org> # v4.6+
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/vc4/vc4_crtc.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
> index 24edd0c22cc9..9d91a40e4345 100644
> --- a/drivers/gpu/drm/vc4/vc4_crtc.c
> +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
> @@ -845,6 +845,17 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,
> drm_atomic_helper_crtc_destroy_state(crtc, state);
> }
>
> +static void
> +vc4_crtc_reset(struct drm_crtc *crtc)
> +{
> + if (crtc->state)
> + __drm_atomic_helper_crtc_destroy_state(crtc->state);
> +
> + crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL);
> + if (crtc->state)
> + crtc->state->crtc = crtc;
> +}
> +
> static const struct drm_crtc_funcs vc4_crtc_funcs = {
> .set_config = drm_atomic_helper_set_config,
> .destroy = vc4_crtc_destroy,
> @@ -852,7 +863,7 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = {
> .set_property = NULL,
> .cursor_set = NULL, /* handled by drm_mode_cursor_universal */
> .cursor_move = NULL, /* handled by drm_mode_cursor_universal */
> - .reset = drm_atomic_helper_crtc_reset,
> + .reset = vc4_crtc_reset,
> .atomic_duplicate_state = vc4_crtc_duplicate_state,
> .atomic_destroy_state = vc4_crtc_destroy_state,
> .gamma_set = vc4_crtc_gamma_set,
> --
> 2.11.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/vc4: Allocate the right amount of space for boot-time CRTC state.
2017-03-29 6:30 ` Daniel Vetter
@ 2017-03-31 0:40 ` Eric Anholt
0 siblings, 0 replies; 3+ messages in thread
From: Eric Anholt @ 2017-03-31 0:40 UTC (permalink / raw)
To: Daniel Vetter; +Cc: dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 553 bytes --]
Daniel Vetter <daniel@ffwll.ch> writes:
> On Tue, Mar 28, 2017 at 01:13:43PM -0700, Eric Anholt wrote:
>> Without this, the first modeset would dereference past the allocation
>> when trying to free the mm node.
>>
>> Signed-off-by: Eric Anholt <eric@anholt.net>
>> Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
> Fixes: d8dbf44f13b9 ("drm/vc4: Make the CRTCs cooperate on allocating display lists.")
> Cc: <stable@vger.kernel.org> # v4.6+
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Thanks, pushed do drm-misc-next today.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-31 0:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-28 20:13 [PATCH] drm/vc4: Allocate the right amount of space for boot-time CRTC state Eric Anholt
2017-03-29 6:30 ` Daniel Vetter
2017-03-31 0:40 ` Eric Anholt
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).