From: Thomas Zimmermann <tzimmermann@suse.de>
To: Javier Martinez Canillas <javierm@redhat.com>,
linux-kernel@vger.kernel.org
Cc: Peter Robinson <pbrobinson@gmail.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Maxime Ripard <mripard@kernel.org>,
dri-devel@lists.freedesktop.org, Conor Dooley <conor@kernel.org>
Subject: Re: [PATCH v2 2/6] drm/ssd130x: Add a per controller family functions table
Date: Thu, 12 Oct 2023 10:21:44 +0200 [thread overview]
Message-ID: <a61e0eed-0608-42f6-9833-9543ebd3c8ca@suse.de> (raw)
In-Reply-To: <87a5so46as.fsf@minerva.mail-host-address-is-not-set>
[-- Attachment #1.1: Type: text/plain, Size: 2592 bytes --]
Hi Javier
Am 12.10.23 um 10:02 schrieb Javier Martinez Canillas:
> 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.
Thanks a lot. I know you want to make a reference driver for others to
study. So I think at least trying the multi-pipeline way is worth it.
From the mgag200 and ast drivers, I found that the refactoring patch
sets can be large to the point where one wonders whether it's actually
worth it. But the end results turned out ok. (ast still needs more work
though.)
Best regards
Thomas
>
>> Best regards
>> Thomas
>>
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
next prev parent reply other threads:[~2023-10-12 8:21 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
2023-10-12 8:21 ` Thomas Zimmermann [this message]
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=a61e0eed-0608-42f6-9833-9543ebd3c8ca@suse.de \
--to=tzimmermann@suse.de \
--cc=conor@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert@linux-m68k.org \
--cc=javierm@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mripard@kernel.org \
--cc=pbrobinson@gmail.com \
/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®