[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 25/25] drm/xlnx: Compute dumb-buffer sizes with drm_mode_size_dumb()
- To: Thomas Zimmermann <tzimmermann@xxxxxxx>, maarten.lankhorst@xxxxxxxxxxxxxxx, mripard@xxxxxxxxxx, airlied@xxxxxxxxx, simona@xxxxxxxx
- From: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
- Date: Wed, 15 Jan 2025 14:06:22 +0200
- Autocrypt: addr=tomi.valkeinen@xxxxxxxxxxxxxxxx; keydata= xsFNBE6ms0cBEACyizowecZqXfMZtnBniOieTuFdErHAUyxVgtmr0f5ZfIi9Z4l+uUN4Zdw2 wCEZjx3o0Z34diXBaMRJ3rAk9yB90UJAnLtb8A97Oq64DskLF81GCYB2P1i0qrG7UjpASgCA Ru0lVvxsWyIwSfoYoLrazbT1wkWRs8YBkkXQFfL7Mn3ZMoGPcpfwYH9O7bV1NslbmyJzRCMO eYV258gjCcwYlrkyIratlHCek4GrwV8Z9NQcjD5iLzrONjfafrWPwj6yn2RlL0mQEwt1lOvn LnI7QRtB3zxA3yB+FLsT1hx0va6xCHpX3QO2gBsyHCyVafFMrg3c/7IIWkDLngJxFgz6DLiA G4ld1QK/jsYqfP2GIMH1mFdjY+iagG4DqOsjip479HCWAptpNxSOCL6z3qxCU8MCz8iNOtZk DYXQWVscM5qgYSn+fmMM2qN+eoWlnCGVURZZLDjg387S2E1jT/dNTOsM/IqQj+ZROUZuRcF7 0RTtuU5q1HnbRNwy+23xeoSGuwmLQ2UsUk7Q5CnrjYfiPo3wHze8avK95JBoSd+WIRmV3uoO rXCoYOIRlDhg9XJTrbnQ3Ot5zOa0Y9c4IpyAlut6mDtxtKXr4+8OzjSVFww7tIwadTK3wDQv Bus4jxHjS6dz1g2ypT65qnHen6mUUH63lhzewqO9peAHJ0SLrQARAQABzTBUb21pIFZhbGtl aW5lbiA8dG9taS52YWxrZWluZW5AaWRlYXNvbmJvYXJk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Pa4E7lsSdWhSlHYNdG/czhoUkSCN09C0rEK93wxACx3vtxPLjXu6RptBw 3dRq7n+mQChEB1am0BueV1JZaBboIL0AGlSJkm23kw==
- Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx, linux-mediatek@xxxxxxxxxxxxxxxxxxx, freedreno@xxxxxxxxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx, imx@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx, nouveau@xxxxxxxxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxxx, spice-devel@xxxxxxxxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx, linux-rockchip@xxxxxxxxxxxxxxxxxxx, linux-tegra@xxxxxxxxxxxxxxx, intel-xe@xxxxxxxxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>, Andy Yan <andyshrk@xxxxxxx>
- Delivery-date: Wed, 15 Jan 2025 12:06:30 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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?
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".
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
|