All of lore.kernel.org
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
	jfalempe@redhat.com, jose.exposito89@gmail.com,
	arthurgrillo@riseup.net, mairacanal@riseup.net,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	airlied@gmail.com, daniel@ffwll.ch, noralf@tronnes.org
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 6/7] drm/ssd130x: Fix atomic_check for disabled planes
Date: Thu, 05 Oct 2023 14:54:51 +0200	[thread overview]
Message-ID: <874jj58c10.fsf@minerva.mail-host-address-is-not-set> (raw)
In-Reply-To: <c4fd1d91-7d9b-483f-8b1d-10857a6f1016@suse.de>

Thomas Zimmermann <tzimmermann@suse.de> writes:

Hello Thomas,

> Hi Javier
>
> Am 05.10.23 um 13:37 schrieb Javier Martinez Canillas:

[...]

>>> -	ret = drm_plane_helper_atomic_check(plane, state);
>>> +	ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
>>> +						  DRM_PLANE_NO_SCALING,
>>> +						  DRM_PLANE_NO_SCALING,
>>> +						  false, false);
>> 
>> As Geert mentioned you are open coding here what the called helper already
>> does. I prefer to keep doing that, instead of adding boiler plate code.
>
> Please see my other email.
>

Sure, let's continue this discussion there.

>> 
>> One question, the reason to return -EINVAL was to prevent the callback
>> ssd130x_primary_plane_atomic_update() to be executed, since that attempts
>> to get the CRTC state to pass the HW buffer to ssd130x_fb_blit_rect().
>
> Returning an errno code aborts the commit. [1] The CRTC can (maybe 
> should?) be NULL to disable the plane. (It is in sync with 
> plane_state->fb IIRC.)
>

Thanks for the explanation.

> So can you disable the plane now?
>

It does not get disabled now indeed.

> [1] 
> https://elixir.bootlin.com/linux/v6.5/source/drivers/gpu/drm/drm_atomic_helper.c#L997
>
>> 
>> I believe this patch will introduce a regression and cause a NULL pointer
>> dereference when !plane_state->crtc and you should also add a check for
>> plane_state->visible in ssd130x_primary_plane_atomic_update() to bail ?
>
> You have a atomic_disable in that plane, so you're taking the branch at 
> [2] for disabling the plane. No atomic_update then. If the plane has 
> been enabled, you should take the branch at [3]. Without being able to 
> move/scale the primary plane, I don't see how plane_state->visible could 
> be false here. Right?
>
> AFAIKT there should not be a NULL-deref here. Can you do a test?
>

You are correct, there's no NULL-deref and in fact you are fixing the
plane not disable bug, so your fix is correct and should be applied.

I still prefer as mentioned keeping the drm_plane_helper_atomic_check()
call instead of open coding it, but regardless of what is decided:

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


  reply	other threads:[~2023-10-05 12:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05  9:04 [PATCH v4 0/7] drm: Reuse temporary memory for format conversion Thomas Zimmermann
2023-10-05  9:04 ` [PATCH v4 1/7] drm/format-helper: Cache buffers with struct drm_format_conv_state Thomas Zimmermann
2023-10-05 11:01   ` Noralf Trønnes
2023-10-05 13:18   ` Javier Martinez Canillas
2023-10-05 14:55     ` Thomas Zimmermann
2023-10-05 15:26       ` Javier Martinez Canillas
2023-10-05  9:04 ` [PATCH v4 2/7] drm/atomic-helper: Add format-conversion state to shadow-plane state Thomas Zimmermann
2023-10-05 11:02   ` Noralf Trønnes
2023-10-05 13:26   ` Javier Martinez Canillas
2023-10-05  9:04 ` [PATCH v4 3/7] drm/format-helper: Pass format-conversion state to helpers Thomas Zimmermann
2023-10-05 11:06   ` kernel test robot
2023-10-05 11:06     ` kernel test robot
2023-10-05 11:10   ` Noralf Trønnes
2023-10-05 11:15     ` Thomas Zimmermann
2023-10-05 13:28   ` Javier Martinez Canillas
2023-10-05  9:04 ` [PATCH v4 4/7] drm/ofdrm: Preallocate format-conversion buffer in atomic_check Thomas Zimmermann
2023-10-05 13:35   ` Javier Martinez Canillas
2023-10-05  9:04 ` [PATCH v4 5/7] drm/simpledrm: " Thomas Zimmermann
2023-10-05 13:38   ` Javier Martinez Canillas
2023-10-09  8:42     ` Thomas Zimmermann
2023-10-09  8:58       ` Javier Martinez Canillas
2023-10-09  9:16         ` Thomas Zimmermann
2023-10-09  9:24           ` Javier Martinez Canillas
2023-10-05  9:04 ` [PATCH v4 6/7] drm/ssd130x: Fix atomic_check for disabled planes Thomas Zimmermann
2023-10-05  9:15   ` Geert Uytterhoeven
2023-10-05 11:37   ` Javier Martinez Canillas
2023-10-05 11:54     ` Thomas Zimmermann
2023-10-05 12:54       ` Javier Martinez Canillas [this message]
2023-10-05 12:58         ` Javier Martinez Canillas
2023-10-05  9:04 ` [PATCH v4 7/7] drm/ssd130x: Preallocate format-conversion buffer in atomic_check Thomas Zimmermann
2023-10-05 11:43   ` Javier Martinez Canillas
2023-10-06 14:49 ` [PATCH v4 0/7] drm: Reuse temporary memory for format conversion Maxime Ripard
2023-10-09  8:23   ` Thomas Zimmermann
2023-10-10  9:55     ` Maxime Ripard
2023-10-07 12:01 ` Noralf Trønnes
2023-10-09  7:53   ` Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874jj58c10.fsf@minerva.mail-host-address-is-not-set \
    --to=javierm@redhat.com \
    --cc=airlied@gmail.com \
    --cc=arthurgrillo@riseup.net \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert@linux-m68k.org \
    --cc=jfalempe@redhat.com \
    --cc=jose.exposito89@gmail.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mairacanal@riseup.net \
    --cc=mripard@kernel.org \
    --cc=noralf@tronnes.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.