From: Thomas Zimmermann <tzimmermann@suse.de>
To: jfalempe@redhat.com, jani.nikula@linux.intel.com,
simona@ffwll.ch, airlied@gmail.com, mripard@kernel.org,
maarten.lankhorst@linux.intel.com
Cc: dri-devel@lists.freedesktop.org, Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH v2 0/8] drm/format-helper: Add helpers for line conversion
Date: Fri, 28 Mar 2025 15:14:56 +0100 [thread overview]
Message-ID: <20250328141709.217283-1-tzimmermann@suse.de> (raw)
Add helpers for converting the pixel format of scanline. This used
to be implemented for each format individually, but only the per-pixel
code is really different among formats.
Patch 1 moves the per-pixel format helpers from drm_draw.c to an
internal header. These functions have equivalents in the format-helper
code. Just update the interface to make them exportable and add some
comments.
Patches 2 to 5 add generic line-conversion helpers. Each takes a
scanline with pixels with a specific number of bits per pixel and
converts it to a scanline with a specific number of bits per pixel.
Conversion of each individual pixel is done by the provided per-pixel
helper that was extracted from drm_draw.c.
Patches 6 to 8 slightly optimize the line-conversion helpers by
storing multiple pixels at once. With the current code, there are
too many functions to make opimization feasible. But with the new
helpers, there are only a few places to optimize to benefit all use
cases.
Here's a little benchmark for the common use case of watching a
full-screen video under X. The tests measures the average time
to display a single frame. It uses an XRGB8888 framebuffer for each
frame, but displays it to an RGB565 scanout buffer, thus doing format
conversion with the _32to16 helper. The test system is an Intel Core
i5-3470 with an Intel HD2500 graphics card. The graphics driver is
simpledrm at 1024x768 pixels.
- 32-bit memcpy: 510 µs/frame
- Current code: 1640 µs/frame
- New (unoptimized): 1600 µs/frame
- New (no 64-bit): 1580 µs/frame
- New (optimized): 1470 µs/frame
The first line shows the time to memcpy a single frame to video
memory without format conversion. With conversion, the old and new
code takes roughly 3 times as long. Both variants are comparable
in performance. With 64-bit stores added, the new code is even 10%
faster than the current one. (This is not to be considered a full
performance test. The main objective is to see whether the new code
is on par with the old code, which is the case.)
v2:
- simplify address calculation (Jani)
- fix typos (Jocelyn)
Thomas Zimmermann (8):
drm/format-helper: Move helpers for pixel conversion to header file
drm/format-helper: Add generic conversion to 32-bit formats
drm/format-helper: Add generic conversion to 24-bit formats
drm/format-helper: Add generic conversion to 16-bit formats
drm/format-helper: Add generic conversion to 8-bit formats
drm/format-helper: Optimize 32-to-24-bpp conversion
drm/format-helper: Optimize 32-to-16-bpp conversion
drm/format-helper: Optimize 32-to-8-bpp conversion
drivers/gpu/drm/drm_draw.c | 100 +------
drivers/gpu/drm/drm_format_helper.c | 374 +++++++++++---------------
drivers/gpu/drm/drm_format_internal.h | 160 +++++++++++
3 files changed, 335 insertions(+), 299 deletions(-)
create mode 100644 drivers/gpu/drm/drm_format_internal.h
--
2.48.1
next reply other threads:[~2025-03-28 14:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-28 14:14 Thomas Zimmermann [this message]
2025-03-28 14:14 ` [PATCH v2 1/8] drm/format-helper: Move helpers for pixel conversion to header file Thomas Zimmermann
2025-03-28 14:14 ` [PATCH v2 2/8] drm/format-helper: Add generic conversion to 32-bit formats Thomas Zimmermann
2025-03-28 14:14 ` [PATCH v2 3/8] drm/format-helper: Add generic conversion to 24-bit formats Thomas Zimmermann
2025-03-28 14:15 ` [PATCH v2 4/8] drm/format-helper: Add generic conversion to 16-bit formats Thomas Zimmermann
2025-03-28 14:15 ` [PATCH v2 5/8] drm/format-helper: Add generic conversion to 8-bit formats Thomas Zimmermann
2025-03-28 14:15 ` [PATCH v2 6/8] drm/format-helper: Optimize 32-to-24-bpp conversion Thomas Zimmermann
2025-03-28 14:15 ` [PATCH v2 7/8] drm/format-helper: Optimize 32-to-16-bpp conversion Thomas Zimmermann
2025-03-28 14:15 ` [PATCH v2 8/8] drm/format-helper: Optimize 32-to-8-bpp conversion Thomas Zimmermann
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=20250328141709.217283-1-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jfalempe@redhat.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.