From: Javier Martinez Canillas <javierm@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>, linux-kernel@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org,
Maxime Ripard <mripard@kernel.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Conor Dooley <conor@kernel.org>,
Peter Robinson <pbrobinson@gmail.com>
Subject: Re: [PATCH v2 2/6] drm/ssd130x: Add a per controller family functions table
Date: Thu, 12 Oct 2023 10:02:35 +0200 [thread overview]
Message-ID: <87a5so46as.fsf@minerva.mail-host-address-is-not-set> (raw)
In-Reply-To: <e6593ea5-daa1-466a-9d42-0c1872f41a13@suse.de>
Thomas Zimmermann <tzimmermann@suse.de> writes:
Hello Thomas,
Thanks a lot for your feedback.
> Hi Javier
>
> Am 12.10.23 um 08:58 schrieb Javier Martinez Canillas:
> [...]
>>
>> +struct ssd130x_funcs {
>> + int (*init)(struct ssd130x_device *ssd130x);
>> + int (*set_buffer_sizes)(struct ssd130x_device *ssd130x);
>> + void (*align_rect)(struct ssd130x_device *ssd130x, struct drm_rect *rect);
>> + int (*update_rect)(struct ssd130x_device *ssd130x, struct drm_rect *rect,
>> + u8 *buf, u8 *data_array);
>> + void (*clear_screen)(struct ssd130x_device *ssd130x,
>> + u8 *data_array);
>> + void (*fmt_convert)(struct iosys_map *dst, const unsigned int *dst_pitch,
>> + const struct iosys_map *src, const struct drm_framebuffer *fb,
>> + const struct drm_rect *clip);
>> +};
>> +
>
> You are reinventing DRM's atomic helpers. I strongly advised against
> doing that, as it often turns out bad. Maybe see my rant at [1] wrt to
> another driver.
>
> It's much better to create a separate mode-setting pipeline for the
> ssd132x series and share the common code among pipelines. Your driver
> will have a clean and readable implementation for each supported
> chipset. Compare an old version of mgag200 [2] with the current driver
> to see the difference.
>
I see what you mean. The reason why I didn't go that route was to minimize
code duplication, but you are correct that each level of indirection makes
the driver harder to read, to reason about and fragile (modifying a common
callback could have undesired effects on other chip families as you said).
I'll give it a try to what you propose in v3, have separate modesetting
pipeline for SSD130x and SSD132x, even if this could lead to a little more
duplicated code.
> Best regards
> Thomas
>
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
next prev parent reply other threads:[~2023-10-12 8:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-12 6:58 [PATCH v2 0/6] drm/solomon: Add support for the SSD132x controller family Javier Martinez Canillas
2023-10-12 6:58 ` [PATCH v2 1/6] drm/ssd130x: Replace .page_height field in device info with a constant Javier Martinez Canillas
2023-10-12 6:58 ` [PATCH v2 2/6] drm/ssd130x: Add a per controller family functions table Javier Martinez Canillas
2023-10-12 7:39 ` Thomas Zimmermann
2023-10-12 8:02 ` Javier Martinez Canillas [this message]
2023-10-12 8:21 ` Thomas Zimmermann
2023-10-12 6:58 ` [PATCH v2 3/6] drm/ssd130x: Rename commands that are shared across chip families Javier Martinez Canillas
2023-10-12 6:58 ` [PATCH v2 4/6] drm/ssd130x: Add support for the SSD132x OLED controller family Javier Martinez Canillas
2023-10-12 7:57 ` Geert Uytterhoeven
2023-10-12 8:05 ` Javier Martinez Canillas
2023-10-12 6:58 ` [PATCH v2 5/6] dt-bindings: display: Split common Solomon properties in their own schema Javier Martinez Canillas
2023-10-12 7:23 ` Rob Herring
2023-10-12 7:59 ` Geert Uytterhoeven
2023-10-12 8:08 ` Javier Martinez Canillas
2023-10-12 11:52 ` Rob Herring
2023-10-12 6:58 ` [PATCH v2 6/6] dt-bindings: display: Add SSD132x OLED controllers Javier Martinez Canillas
2023-10-12 11:53 ` Rob Herring
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=87a5so46as.fsf@minerva.mail-host-address-is-not-set \
--to=javierm@redhat.com \
--cc=conor@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mripard@kernel.org \
--cc=pbrobinson@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®