mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
	Daniel Stone <daniel@fooishbar.org>
Cc: Javier Martinez Canillas <javierm@redhat.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 5/8] drm/client: Convert drm_client_buffer_addfb() to drm_mode_addfb2()
Date: Thu, 31 Aug 2023 10:15:23 +0200	[thread overview]
Message-ID: <619a8ad9-724c-16d0-482f-dc7cb75a44f6@suse.de> (raw)
In-Reply-To: <CAMuHMdWyMNZJ3seWWHqigLfXwCnp47Xwzs1B6ixOyY+n7cir-A@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2828 bytes --]

Hi

Am 24.08.23 um 17:22 schrieb Geert Uytterhoeven:
> Hi Daniel,
> 
> On Thu, Aug 24, 2023 at 5:12 PM Daniel Stone <daniel@fooishbar.org> wrote:
>> On Thu, 24 Aug 2023 at 16:09, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>>>          struct drm_client_dev *client = buffer->client;
>>> -       struct drm_mode_fb_cmd fb_req = { };
>>> -       const struct drm_format_info *info;
>>> +       struct drm_mode_fb_cmd2 fb_req = { };
>>>          int ret;
>>>
>>> -       info = drm_format_info(format);
>>> -       fb_req.bpp = drm_format_info_bpp(info, 0);
>>> -       fb_req.depth = info->depth;
>>>          fb_req.width = width;
>>>          fb_req.height = height;
>>> -       fb_req.handle = handle;
>>> -       fb_req.pitch = buffer->pitch;
>>> +       fb_req.pixel_format = format;
>>> +       fb_req.handles[0] = handle;
>>> +       fb_req.pitches[0] = buffer->pitch;
>>>
>>> -       ret = drm_mode_addfb(client->dev, &fb_req, client->file);
>>> +       ret = drm_mode_addfb2(client->dev, &fb_req, client->file);
>>>          if (ret)
>>>                  return ret;
>>
>> This should explicitly set the LINEAR modifier (and the modifier flag)
>> if the driver supports modifiers.
> 
> Thanks for your comment!
> 
> I have no idea how to do that, and I do not know what the impact
> would be.  All I know is that the current implementation of
> drm_client_buffer_addfb() does not do that, so changing that in this
> patch would mean that this would no longer be a trivial conversion.

I agree. That change is too large and invasive for this patchset. Rather 
add a comment or TODO item.

The correct way for adding the modifier is to extend the 
drm_client_buffer_addfb() and pass in the information from the caller. 
That caller is fbdev code. We currently detect the format from (bpp, 
depth) values and forward the format to _addfb(). [1] Here we'd have to 
check the driver for a modifier as well and forward it to _addfb()

[1] 
https://elixir.bootlin.com/linux/v6.5/source/drivers/gpu/drm/drm_fbdev_generic.c#L88

The pair of (bpp, depth) values comes from __drm_fb_helper_find_sizes, 
[2] which looks through the planes' formats and tries to find something 
that fits the user's requested color mode. It would have to look for 
modifiers as well. At some point, I want the helper to return formats 
directly, but that's still a bit away.

[2] 
https://elixir.bootlin.com/linux/v6.5/source/drivers/gpu/drm/drm_fb_helper.c#L1504

Best regards
Thomas

> 
> Gr{oetje,eeting}s,
> 
>                          Geert
> 

-- 
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 --]

  parent reply	other threads:[~2023-08-31  8:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 15:08 [PATCH v2 0/8] drm: fb-helper/ssd130x: Add support for DRM_FORMAT_R1 Geert Uytterhoeven
2023-08-24 15:08 ` [PATCH v2 1/8] drm/dumb-buffers: Fix drm_mode_create_dumb() for bpp < 8 Geert Uytterhoeven
2023-08-31  7:40   ` Thomas Zimmermann
2023-08-31  7:56     ` Geert Uytterhoeven
2023-08-24 15:08 ` [PATCH v2 2/8] drm/ssd130x: Fix screen clearing Geert Uytterhoeven
2023-08-29  8:40   ` Javier Martinez Canillas
2023-08-29 21:12     ` Javier Martinez Canillas
2023-08-24 15:08 ` [PATCH v2 3/8] drm/ssd130x: Use bool for ssd130x_deviceinfo flags Geert Uytterhoeven
2023-08-29  8:44   ` Javier Martinez Canillas
2023-08-29 21:16     ` Javier Martinez Canillas
2023-08-24 15:08 ` [PATCH v2 4/8] drm/ssd130x: Add support for DRM_FORMAT_R1 Geert Uytterhoeven
2023-08-29  9:01   ` Javier Martinez Canillas
2023-08-29 21:12     ` Javier Martinez Canillas
2023-08-31  8:01   ` Thomas Zimmermann
2023-08-31  8:22     ` Geert Uytterhoeven
2023-08-24 15:08 ` [PATCH v2 5/8] drm/client: Convert drm_client_buffer_addfb() to drm_mode_addfb2() Geert Uytterhoeven
2023-08-24 15:11   ` Daniel Stone
2023-08-24 15:22     ` Geert Uytterhoeven
2023-08-29  9:19       ` Javier Martinez Canillas
2023-08-31  8:15       ` Thomas Zimmermann [this message]
2023-08-24 15:08 ` [PATCH v2 6/8] drm/fb-helper: Pass buffer format via drm_fb_helper_surface_size Geert Uytterhoeven
2023-08-31  8:24   ` Thomas Zimmermann
2023-08-24 15:08 ` [PATCH v2 7/8] drm/fb-helper: Add support for DRM_FORMAT_R1 Geert Uytterhoeven
2023-08-31  8:57   ` Thomas Zimmermann
2023-08-24 15:08 ` [PATCH v2 8/8] drm/ssd130x: Switch preferred_bpp/depth to 1 Geert Uytterhoeven

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=619a8ad9-724c-16d0-482f-dc7cb75a44f6@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=daniel@fooishbar.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert@linux-m68k.org \
    --cc=javierm@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    /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®