Ville Syrjälä
81112eaac5
drm: Pass the format info to .fb_create()
...
Pass along the format information from the top to .fb_create()
so that we can avoid redundant (and somewhat expensive) lookups
in the drivers.
Done with cocci (with some manual fixups):
@@
identifier func =~ ".*create.*";
identifier dev, file, mode_cmd;
@@
struct drm_framebuffer *func(
struct drm_device *dev,
struct drm_file *file,
+ const struct drm_format_info *info,
const struct drm_mode_fb_cmd2 *mode_cmd)
{
...
(
- const struct drm_format_info *info = drm_get_format_info(...);
|
- const struct drm_format_info *info;
...
- info = drm_get_format_info(...);
)
<...
- if (!info)
- return ...;
...>
}
@@
identifier func =~ ".*create.*";
identifier dev, file, mode_cmd;
@@
struct drm_framebuffer *func(
struct drm_device *dev,
struct drm_file *file,
+ const struct drm_format_info *info,
const struct drm_mode_fb_cmd2 *mode_cmd)
{
...
}
@find@
identifier fb_create_func =~ ".*create.*";
identifier dev, file, mode_cmd;
@@
struct drm_framebuffer *fb_create_func(
struct drm_device *dev,
struct drm_file *file,
+ const struct drm_format_info *info,
const struct drm_mode_fb_cmd2 *mode_cmd);
@@
identifier find.fb_create_func;
expression dev, file, mode_cmd;
@@
fb_create_func(dev, file
+ ,info
,mode_cmd)
@@
expression dev, file, mode_cmd;
@@
drm_gem_fb_create(dev, file
+ ,info
,mode_cmd)
@@
expression dev, file, mode_cmd;
@@
drm_gem_fb_create_with_dirty(dev, file
+ ,info
,mode_cmd)
@@
expression dev, file_priv, mode_cmd;
identifier info, fb;
@@
info = drm_get_format_info(...);
...
fb = dev->mode_config.funcs->fb_create(dev, file_priv
+ ,info
,mode_cmd);
@@
identifier dev, file_priv, mode_cmd;
@@
struct drm_mode_config_funcs {
...
struct drm_framebuffer *(*fb_create)(struct drm_device *dev,
struct drm_file *file_priv,
+ const struct drm_format_info *info,
const struct drm_mode_fb_cmd2 *mode_cmd);
...
};
v2: Fix kernel docs (Laurent)
Fix commit msg (Geert)
Cc: Alex Deucher <alexander.deucher@amd.com >
Cc: Liviu Dudau <liviu.dudau@arm.com >
Cc: Maxime Ripard <mripard@kernel.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Inki Dae <inki.dae@samsung.com >
Cc: Seung-Woo Kim <sw0312.kim@samsung.com >
Cc: Kyungmin Park <kyungmin.park@samsung.com >
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com >
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org >
Cc: Philipp Zabel <p.zabel@pengutronix.de >
Cc: Rob Clark <robdclark@gmail.com >
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com >
Cc: Dmitry Baryshkov <lumag@kernel.org >
Cc: Sean Paul <sean@poorly.run >
Cc: Marijn Suijten <marijn.suijten@somainline.org >
Cc: Marek Vasut <marex@denx.de >
Cc: Stefan Agner <stefan@agner.ch >
Cc: Lyude Paul <lyude@redhat.com >
Cc: Danilo Krummrich <dakr@kernel.org >
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com >
Cc: Dave Airlie <airlied@redhat.com >
Cc: Gerd Hoffmann <kraxel@redhat.com >
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com >
Cc: Biju Das <biju.das.jz@bp.renesas.com >
Cc: Sandy Huang <hjc@rock-chips.com >
Cc: "Heiko Stübner" <heiko@sntech.de >
Cc: Andy Yan <andy.yan@rock-chips.com >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Mikko Perttunen <mperttunen@nvidia.com >
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com >
Cc: "Maíra Canal" <mcanal@igalia.com >
Cc: Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com >
Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com >
Cc: Gurchetan Singh <gurchetansingh@chromium.org >
Cc: Chia-I Wu <olvaffe@gmail.com >
Cc: Zack Rusin <zack.rusin@broadcom.com >
Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com >
Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com >
Cc: amd-gfx@lists.freedesktop.org
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Cc: virtualization@lists.linux.dev
Cc: spice-devel@lists.freedesktop.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de >
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com >
Acked-by: Liviu Dudau <liviu.dudau@arm.com >
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com >
Acked-by: Alex Deucher <alexander.deucher@amd.com >
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com >
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20250701090722.13645-5-ville.syrjala@linux.intel.com
2025-07-16 20:03:14 +03:00
Geert Uytterhoeven
7802ca6b23
drm: renesas: shmobile: Improve shmob_drm_format_info table
...
Improve the table containing hardware information related to the
supported plane formats:
1. Move (part of) the overlay format register settings from multiple
switch() statements spread across the code into the table, like is
already done for the primary plane register settings,
2. Remove the .yuv field, as that information can easily be extracted
from the register settings using a new helper macro,
3. Shrink and move the .bpp field to reduce table size.
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com >
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be >
Link: https://lore.kernel.org/r/b41f755e80ffe5fb4adbb2d8f96f2073de5c33bc.1694767209.git.geert+renesas@glider.be
2023-10-16 11:47:44 +02:00