Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	airlied@gmail.com, simona@ffwll.ch
Cc: dri-devel@lists.freedesktop.org,
	linux-mediatek@lists.infradead.org,
	freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	imx@lists.linux.dev, linux-samsung-soc@vger.kernel.org,
	nouveau@lists.freedesktop.org, virtualization@lists.linux.dev,
	spice-devel@lists.freedesktop.org,
	linux-renesas-soc@vger.kernel.org,
	linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org,
	intel-xe@lists.freedesktop.org, xen-devel@lists.xenproject.org,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Andy Yan <andyshrk@163.com>
Subject: Re: [PATCH v2 25/25] drm/xlnx: Compute dumb-buffer sizes with drm_mode_size_dumb()
Date: Wed, 15 Jan 2025 13:34:12 +0100	[thread overview]
Message-ID: <0ea6be58-0e04-4172-87cd-064a3e4a43bc@suse.de> (raw)
In-Reply-To: <d67adb03-5cd0-4ac9-af58-cf4446dacee3@ideasonboard.com>

Hi


Am 15.01.25 um 13:06 schrieb Tomi Valkeinen:
> Hi,
>
> On 15/01/2025 13:37, Thomas Zimmermann wrote:
>> Hi
>>
>>
>> Am 15.01.25 um 11:58 schrieb Tomi Valkeinen:
>> [...]
>>>> These are all good points. Did you read my discussion with Andy on 
>>>> patch 2? I think it resolves all the points you have. The current 
>>>> CREATE_DUMB 
>>>
>>> I had missed the discussion, and, indeed, the patch you attached 
>>> fixes the problem on Xilinx.
>>
>> Great. Thanks for testing.
>>
>>>
>>>> ioctl is unsuited for anything but the simple RGB formats. The bpp 
>>>
>>> It's a bit difficult to use, but is it really unsuited? 
>>> bitsperpixel, width and height do give an exact pitch and size, do 
>>> they not? It does require the userspace to handle the subsampling 
>>> and planes, though, so far from perfect.
>>
>> The bpp value sets the number of bits per pixel; except for bpp==15 
>> (XRGB1555), where it sets the color depth. OR bpp is the color depth; 
>> except for bpp==32 (XRGB8888), where it is the number of bits per 
>> pixel. It's therefore best to interpret it like a color-mode enum.
>
> Ah, right... That's horrible =).
>
> And I assume it's not really possible to define the bpp to mean bits 
> per pixel, except for a few special cases like 15?
>
> Why do we even really care about color depth here? We're just 
> allocating memory. Doesn't DIV_ROUND_UP(args->bpp, SZ_8) work fine for 
> XRGB1555 too?

Drivers always did that, but it does not work correctly for (bpp < 8). 
As we already have helpers to deal with bpp, it makes sense to use 
them.  This also aligns dumb buffers with the kernel's video= parameter, 
which as the same odd semantics. The fallback that uses bpp directly 
will hopefully be the exception.

>
>>> So, I'm all for a new ioctl, but I don't right away see why the 
>>> current ioctl couldn't be used. Which makes me wonder about the 
>>> drm_warn() in your patch, and the "userspace throws in arbitrary 
>>> values for bpp and relies on the kernel to figure it out". Maybe I'm 
>>> missing something here.
>>
>> I was unsure about the drm_warn() as well. It's not really wrong to 
>> have odd bpp values, but handing in an unknown bpp value might point 
>> to a user-space error. At least there should be a drm_dbg().
>>
>>>
>>>> parameter is not very precise. The solution would be a new ioctl 
>>>> call that receives the DRM format and returns a buffer for each 
>>>> individual plane.
>>>
>>> Yes, I think that makes sense. That's a long road, though =). So my 
>>> question is, is CREATE_DUMB really unsuitable for other than simple 
>>> RGB formats, or can it be suitable if we just define how the 
>>> userspace should use it for multiplanar, subsampled formats?
>>
>> That would duplicate format and hardware information in user-space. Some 
>
> But we already have that, don't we? We have drivers and userspace that 
> support, say, NV12 via dumb buffers. But (correct me if I'm wrong) we 
> don't document how CREATE_DUMB has to be used to allocate multiplanar 
> subsampled buffers, so the userspace devs have to "guess".

Yeah, there are constrains in the scanline and buffer alignments and 
orientation. And if we say that bpp==12 means NV12, it will be a problem 
for all other cases where bpp==12 makes sense.

Best regards
Thomas

>
>> hardware might have odd per-plane limitations that only the driver 
>> knows about. For example, there's another discussion on dri-devel 
>> about pitch- alignment requirements of DRM_FORMAT_MOD_LINEAR on 
>> various hardware. That affects dumb buffers as well. I don't think 
>> that there's an immediate need for a CREATE_DUMB2, but it seems worth 
>> to keep in mind.
>
> Yes, the current CREATE_DUMB can't cover all the hardware. We do need 
> CREATE_DUMB2, sooner or later. I just hope we can define and document 
> a set of rules that allows using CREATE_DUMB for the cases where it 
> sensibly works (and is already being used).
>
>  Tomi
>

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


  reply	other threads:[~2025-01-15 12:34 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 14:56 [PATCH v2 00/25] drm/dumb-buffers: Fix and improve buffer-size calculation Thomas Zimmermann
2025-01-09 14:56 ` [PATCH v2 01/25] drm/dumb-buffers: Sanitize output on errors Thomas Zimmermann
2025-01-09 14:56 ` [PATCH v2 02/25] drm/dumb-buffers: Provide helper to set pitch and size Thomas Zimmermann
2025-01-10  1:49   ` Andy Yan
2025-01-10 13:23     ` [PATCH " Thomas Zimmermann
2025-01-13  3:53       ` Andy Yan
2025-01-13  7:52         ` Thomas Zimmermann
2025-01-09 14:56 ` [PATCH v2 03/25] drm/gem-dma: Compute dumb-buffer sizes with drm_mode_size_dumb() Thomas Zimmermann
2025-01-09 14:56 ` [PATCH v2 04/25] drm/gem-shmem: " Thomas Zimmermann
2025-01-09 14:56 ` [PATCH v2 05/25] drm/gem-vram: " Thomas Zimmermann
2025-01-09 14:57 ` [PATCH v2 06/25] drm/armada: " Thomas Zimmermann
2025-01-09 14:57 ` [PATCH v2 07/25] drm/exynos: " Thomas Zimmermann
2025-01-09 14:57 ` [PATCH v2 08/25] drm/gma500: " Thomas Zimmermann
2025-01-09 14:57 ` [PATCH v2 09/25] drm/hibmc: " Thomas Zimmermann
2025-01-09 14:57 ` [PATCH v2 10/25] drm/imx/ipuv3: " Thomas Zimmermann
2025-01-10  8:06   ` Philipp Zabel
2025-01-09 14:57 ` [PATCH v2 11/25] drm/loongson: " Thomas Zimmermann
2025-01-15  3:50   ` Sui Jingfeng
2025-01-09 14:57 ` [PATCH v2 12/25] drm/mediatek: " Thomas Zimmermann
2025-01-09 14:57 ` [PATCH v2 13/25] drm/msm: " Thomas Zimmermann
2025-01-13  8:25   ` Dmitry Baryshkov
2025-01-09 14:57 ` [PATCH v2 14/25] drm/nouveau: " Thomas Zimmermann
2025-01-09 14:57 ` [PATCH v2 15/25] drm/omapdrm: " Thomas Zimmermann
2025-01-14 14:04   ` Tomi Valkeinen
2025-01-09 14:57 ` [PATCH v2 16/25] drm/qxl: " Thomas Zimmermann
2025-01-09 14:57 ` [PATCH v2 17/25] drm/renesas/rcar-du: " Thomas Zimmermann
2025-01-09 14:57 ` [PATCH v2 18/25] drm/renesas/rz-du: " Thomas Zimmermann
2025-01-09 14:57 ` [PATCH v2 19/25] drm/rockchip: " Thomas Zimmermann
2025-01-09 22:59   ` Heiko Stübner
2025-01-09 14:57 ` [PATCH v2 20/25] drm/tegra: " Thomas Zimmermann
2025-01-09 14:57 ` [PATCH v2 21/25] drm/virtio: " Thomas Zimmermann
2025-02-20 16:10   ` Dmitry Osipenko
2025-01-09 14:57 ` [PATCH v2 22/25] drm/vmwgfx: " Thomas Zimmermann
2025-01-10 18:18   ` Zack Rusin
2025-01-09 14:57 ` [PATCH v2 23/25] drm/xe: " Thomas Zimmermann
2025-01-09 16:05   ` Matthew Auld
2025-01-09 16:26     ` Thomas Zimmermann
2025-01-09 17:15       ` Matthew Auld
2025-01-09 14:57 ` [PATCH v2 24/25] drm/xen: " Thomas Zimmermann
2025-01-09 14:57 ` [PATCH v2 25/25] drm/xlnx: " Thomas Zimmermann
2025-01-15 10:13   ` Tomi Valkeinen
2025-01-15 10:26     ` Thomas Zimmermann
2025-01-15 10:58       ` Tomi Valkeinen
2025-01-15 11:37         ` Thomas Zimmermann
2025-01-15 12:06           ` Tomi Valkeinen
2025-01-15 12:34             ` Thomas Zimmermann [this message]
2025-01-15 13:33               ` Tomi Valkeinen
2025-01-15 13:45                 ` Thomas Zimmermann
2025-01-15 14:20                   ` Tomi Valkeinen
2025-01-15 14:34                     ` Daniel Stone
2025-01-16  8:43                       ` Laurent Pinchart
2025-01-16  9:38                         ` Laurent Pinchart
2025-01-16 10:07                           ` Tomi Valkeinen
2025-01-19 17:08                             ` Laurent Pinchart
2025-01-16  8:09                     ` Thomas Zimmermann
2025-01-16 10:03                       ` Tomi Valkeinen
2025-01-16 10:17                         ` Geert Uytterhoeven
2025-01-16 10:26                           ` Tomi Valkeinen
2025-01-16 10:35                           ` Dmitry Baryshkov
2025-01-16 12:24                             ` Daniel Stone
2025-01-19 11:29                             ` Sui Jingfeng
2025-01-19 12:18                               ` Tomi Valkeinen
2025-01-19 14:59                                 ` Sui Jingfeng
2025-01-19 15:22                                   ` Tomi Valkeinen
2025-01-19 16:26                                     ` Sui Jingfeng
2025-01-19 20:14                                       ` Laurent Pinchart
2025-01-20  7:04                                         ` Sui Jingfeng
2025-01-20  3:34                           ` Sui Jingfeng
2025-01-20  7:49                         ` Thomas Zimmermann
2025-01-20  8:51                           ` Tomi Valkeinen
2025-01-20  8:57                             ` Thomas Zimmermann
2025-01-20  7:54                         ` Thomas Zimmermann
2025-01-09 16:36 ` ✓ CI.Patch_applied: success for drm/dumb-buffers: Fix and improve buffer-size calculation Patchwork
2025-01-09 16:36 ` ✗ CI.checkpatch: warning " Patchwork
2025-01-09 16:39 ` ✓ CI.KUnit: success " Patchwork
2025-01-09 17:01 ` ✓ CI.Build: " Patchwork
2025-01-09 17:03 ` ✓ CI.Hooks: " Patchwork
2025-01-09 17:05 ` ✓ CI.checksparse: " Patchwork
2025-01-09 17:33 ` ✓ Xe.CI.BAT: " Patchwork
2025-01-10 13:29 ` ✗ CI.Patch_applied: failure for drm/dumb-buffers: Fix and improve buffer-size calculation (rev2) Patchwork
2025-01-12  1:54 ` ✗ Xe.CI.Full: failure for drm/dumb-buffers: Fix and improve buffer-size calculation Patchwork

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=0ea6be58-0e04-4172-87cd-064a3e4a43bc@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=andyshrk@163.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=imx@lists.linux.dev \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=simona@ffwll.ch \
    --cc=spice-devel@lists.freedesktop.org \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xen-devel@lists.xenproject.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