[PATCH v2 07/19] drm/gem: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()

2025-04-11 Thread Ville Syrjala
From: Ville Syrjälä Pass along the format info from .fb_create() to aliminate the redundant drm_get_format_info() calls from the gem fb code. v2: Fix kernel docs (Laurent) Cc: Dave Airlie Cc: Gerd Hoffmann Cc: Sandy Huang Cc: "Heiko Stübner" Cc: Andy Yan Cc: Oleksandr Andrushchenko Cc: vi

[PATCH v2 04/19] drm: Pass the format info to .fb_create()

2025-04-11 Thread Ville Syrjala
From: Ville Syrjälä 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_framebuf

[PATCH v2 03/19] drm: Look up the format info earlier

2025-04-11 Thread Ville Syrjala
From: Ville Syrjälä Look up the format info already in drm_internal_framebuffer_create() so that we can later pass it along to .fb_create(). Currently various drivers are doing additional lookups in their .fb_create() implementations, and these lookups are rather expensive now (given how many dif

[PATCH v2 02/19] drm: Pass pixel_format+modifier directly to drm_get_format_info()

2025-04-11 Thread Ville Syrjala
From: Ville Syrjälä Decouple drm_get_format_info() from struct drm_mode_fb_cmd2 and just pass the pixel format+modifier combo in by hand. We may want to use drm_get_format_info() outside of the normal addfb paths where we won't have a struct drm_mode_fb_cmd2, and creating a temporary one just fo

[PATCH v2 01/19] drm: Pass pixel_format+modifier to .get_format_info()

2025-04-11 Thread Ville Syrjala
From: Ville Syrjälä Decouple .get_format_info() from struct drm_mode_fb_cmd2 and just pass the pixel format+modifier combo in by hand. We may want to use .get_format_info() outside of the normal addfb paths where we won't have a struct drm_mode_fb_cmd2, and creating a temporary one just for this

[PATCH v3 2/6] drm/tilcdc: Allow build with COMPILE_TEST=y

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Allow tilcdc to be built with COMPILE_TEST=y for greater coverage. Builds fine on x86/x86_64 at least. Acked-by: Jyri Sarha Reviewed-by: Tomi Valkeinen Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/tilcdc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) d

[PATCH v3 0/6] drm: Increase COMPILE_TEST=y coverage

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Another repost of some COMPILE_TEST=y stragglers. Cc: Tomi Valkeinen Cc: Jyri Sarha Cc: Russell King Cc: Stefan Agner Cc: Alison Wang Ville Syrjälä (6): drm/tilcdc: Allow build without __iowmb() drm/tilcdc: Allow build with COMPILE_TEST=y drm/armada: Fix printk ar

[PATCH 19/19] drm: Make passing of format info to drm_helper_mode_fill_fb_struct() mandatory

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Now that everyone passes along the format info to drm_helper_mode_fill_fb_struct() we can make this behaviour mandatory and drop the extra lookup. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_modeset_helper.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)

[PATCH 16/19] drm/tegra: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Plumb the format info from .fb_create() all the way to drm_helper_mode_fill_fb_struct() to avoid the redundant lookup. For the fbdev case a manual drm_get_format_info() lookup is needed. Cc: Thierry Reding Cc: Mikko Perttunen Cc: linux-te...@vger.kernel.org Signed-off-by:

[PATCH 18/19] drm/vmwgfx: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Plumb the format info from .fb_create() all the way to drm_helper_mode_fill_fb_struct() to avoid the redundant lookup. Cc: Zack Rusin Cc: Broadcom internal kernel review list Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 14 +- drivers

[PATCH 17/19] drm/virtio: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Plumb the format info from .fb_create() all the way to drm_helper_mode_fill_fb_struct() to avoid the redundant lookup. Cc: David Airlie Cc: Gerd Hoffmann Cc: Dmitry Osipenko Cc: Gurchetan Singh Cc: Chia-I Wu Cc: virtualizat...@lists.linux.dev Signed-off-by: Ville Syrjälä

[PATCH 10/19] drm/armada: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Plumb the format info from .fb_create() all the way to drm_helper_mode_fill_fb_struct() to avoid the redundant lookup. For the fbdev case a manual drm_get_format_info() lookup is needed. Cc: Russell King Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/armada/armada_fb.c

[PATCH 15/19] drm/msm: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Plumb the format info from .fb_create() all the way to drm_helper_mode_fill_fb_struct() to avoid the redundant lookups. For the fbdev case a manual drm_get_format_info() lookup is needed. Cc: Rob Clark Cc: Abhinav Kumar Cc: Dmitry Baryshkov Cc: Sean Paul Cc: Marijn Suijt

[PATCH 14/19] drm/komeda: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Plumb the format info from .fb_create() all the way to drm_helper_mode_fill_fb_struct() to avoid the redundant lookup. Cc: Liviu Dudau Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletio

[PATCH 13/19] drm/i915: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Plumb the format info from .fb_create() all the way to drm_helper_mode_fill_fb_struct() to avoid the redundant lookup. For the fbdev case a manual drm_get_format_info() lookup is needed. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_fb.c|

[PATCH 12/19] drm/gma500: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Plumb the format info from .fb_create() all the way to drm_helper_mode_fill_fb_struct() to avoid the redundant lookup. For the fbdev case a manual drm_get_format_info() lookup is needed. Cc: Patrik Jakobsson Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/gma500/fbdev.c

[PATCH 11/19] drm/exynos: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Plumb the format info from .fb_create() all the way to drm_helper_mode_fill_fb_struct() to avoid the redundant lookup. For the fbdev case a manual drm_get_format_info() lookup is needed. Cc: Inki Dae Cc: Seung-Woo Kim Cc: Kyungmin Park Signed-off-by: Ville Syrjälä --- d

[PATCH 09/19] drm/amdgpu: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Plumb the format info from .fb_create() all the way to drm_helper_mode_fill_fb_struct() to avoid the redundant lookup. Cc: Alex Deucher Cc: amd-...@lists.freedesktop.org Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 5 +++-- 1 file changed,

[PATCH 08/19] drm/gem/afbc: Eliminate redundant drm_get_format_info()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Pass along the format info from .fb_create() to aliminate the redundant drm_get_format_info() calls from the afbc code. Cc: Sandy Huang Cc: "Heiko Stübner" Cc: Andy Yan Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 18 ++

[PATCH 07/19] drm/gem: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Pass along the format info from .fb_create() to aliminate the redundant drm_get_format_info() calls from the gem fb code. Cc: Dave Airlie Cc: Gerd Hoffmann Cc: Sandy Huang Cc: "Heiko Stübner" Cc: Andy Yan Cc: Oleksandr Andrushchenko Cc: virtualizat...@lists.linux.dev Cc

[PATCH 06/19] drm/malidp: Pass along the format info from .fb_create() malidp_verify_afbc_framebuffer_size()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Plumb the format info from .fb_create() all the way to malidp_verify_afbc_framebuffer_size() to avoid the redundant lookup. Cc: Liviu Dudau Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/arm/malidp_drv.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) d

[PATCH 05/19] drm: Allow the caller to pass in the format info to drm_helper_mode_fill_fb_struct()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Soon all drivers should have the format info already available in the places where they call drm_helper_mode_fill_fb_struct(). Allow it to be passed along into drm_helper_mode_fill_fb_struct() instead of doing yet another redundant lookup. Start by always passing in NULL and

[PATCH 04/19] drm: Pass the format info to .fb_create()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Pass long 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_framebuff

[PATCH 03/19] drm: Look up the format info earlier

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Looks up the format info in already drm_internal_framebuffer_create() so that we can later pass it along to .fb_create(). Currently various drivers are doing additional lookups in their .fb_create() implementations, and these lookups are rather expensive now (given how many di

[PATCH 02/19] drm: Pass pixel_format+modifier directly to drm_get_format_info()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Decouple drm_get_format_info() from struct drm_mode_fb_cmd2 and just pass the pixel format+modifier combo in by hand. We may want to use drm_get_format_info() outside of the normal addfb paths where we won't have a struct drm_mode_fb_cmd2, and creating a temporary one just fo

[PATCH 01/19] drm: Pass pixel_format+modifier to .get_format_info()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Decouple .get_format_info() from struct drm_mode_fb_cmd2 and just pass the pixel format+modifier combo in by hand. We may want to use .get_format_info() outside of the normal addfb paths where we won't have a struct drm_mode_fb_cmd2, and creating a temporary one just for this

[PATCH 00/19] drm: Eliminate redundant drm_format_info lookups

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä I noticed a bunch of redundant (and rather expensive) drm_format_info lookups in some traces recently. This series is an attempt to eliminate them. Ville Syrjälä (19): drm: Pass pixel_format+modifier to .get_format_info() drm: Pass pixel_format+modifier directly to drm_ge

[PATCH v3 4/6] drm/armada: Fix armada_debugfs_crtc_reg_write() return type

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Change the armada_debugfs_crtc_reg_write() return type to the correct ssize_t. This makes the code actually build on certain architectures. Cc: Russell King Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/armada/armada_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 d

[PATCH v3 1/6] drm/tilcdc: Allow build without __iowmb()

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä __iowmb() isn't available on most architectures. Make its use optional so that the driver can be built on other architectures with COMPILE_TEST=y. v2: Add a comment stating this is for COMPILE_TEST (Tomi) Cc: Tomi Valkeinen Acked-by: Jyri Sarha Signed-off-by: Ville Syrjälä

[PATCH v3 6/6] drm/fsl-dcu: Allow build with COMPILE_TEST=y

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Allow fsl-dcu to be built with COMPILE_TEST=y for greater coverage. Builds fine on x86/x86_64 at least. Cc: Stefan Agner Cc: Alison Wang Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/fsl-dcu/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dr

[PATCH v3 5/6] drm/armada: Allow build with COMPILE_TEST=y

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä Allow armada to be built with COMPILE_TEST=y for greater coverage. Builds fine on x86/x86_64 at least. Cc: Russell King Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/armada/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/armad

[PATCH v3 3/6] drm/armada: Fix printk arguments

2025-04-10 Thread Ville Syrjala
From: Ville Syrjälä ../drivers/gpu/drm/armada/armada_gem.c: In function ‘armada_gem_pwrite_ioctl’: ../drivers/gpu/drm/armada/armada_gem.c:367:27: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=] 367 |

[PATCH] drm/client: Build the tests with CONFIG_DRM_KUNIT_TEST=m

2025-03-03 Thread Ville Syrjala
From: Ville Syrjälä Use IS_ENABLED() to check for CONFIG_DRM_KUNIT_TEST so that it picks up the modular case as well. Cc: Maxime Ripard Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm

[PATCH v3 1/8] drm/client: Constify modes

2025-03-03 Thread Ville Syrjala
From: Ville Syrjälä The modes used by the client code live on the connectors' mode lists, which are not owned by the client code, and thus it has no business modifying the modes. Mark the modes const to make that fact abundantly clear. v2: Fix up the kunit test Reviewed-by: Jani Nikula Reviewe

[PATCH v2 5/8] drm/client: Stop using the legacy crtc->mode

2025-03-01 Thread Ville Syrjala
From: Ville Syrjälä crtc->mode is legacy junk and shouldn't really be used with atomic drivers. Most (all?) atomic drivers do end up still calling drm_atomic_helper_update_legacy_modeset_state() at some point, so crtc->mode does still get populated, and this does work for now. But now that the m

[PATCH v2 3/8] drm/client: Streamline mode selection debugs

2025-02-28 Thread Ville Syrjala
From: Ville Syrjälä Get rid of all the redundant debugs and just wait until the end to print which mode (and of which type) we picked. Reviewed-by: Thomas Zimmermann Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 70 +--- 1 file changed, 33 ins

[PATCH v2 2/8] drm/client: Use array notation for function arguments

2025-02-28 Thread Ville Syrjala
From: Ville Syrjälä Use the array notation rather that the pointer notation for function arguments. This makes it clear to the reader that we are in fact dealing with an array rather than a single pointer. Functionally the two are equivalent. Reviewed-by: Jani Nikula Reviewed-by: Thomas Zimmerm

[PATCH v2 7/8] drm/client: Move variables to tighter scope

2025-02-28 Thread Ville Syrjala
From: Ville Syrjälä Bunch of variables are only needed inside loops and whatnot. Move them to a tighter scope to make the code less confusing. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 33 +++- 1 file changed, 18 insertions(+), 15 deletions

[PATCH v2 1/8] drm/client: Constify modes

2025-02-28 Thread Ville Syrjala
From: Ville Syrjälä The modes used by the client code live on the connectors' mode lists, which are not owned by the client code, and thus it has no business modifying the modes. Mark the modes const to make that fact abundantly clear. Reviewed-by: Jani Nikula Reviewed-by: Thomas Zimmermann Si

[PATCH v2 8/8] drm/client: s/unsigned int i/int i/

2025-02-28 Thread Ville Syrjala
From: Ville Syrjälä Replace the 'unsigned int i' footguns with plain old signed int. Avoids accidents if/when someone decides they need to iterate backwards. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

[PATCH v2 6/8] drm/client: s/new_crtc/crtc/

2025-02-28 Thread Ville Syrjala
From: Ville Syrjälä Rename the 'new_crtc' variable to just 'crtc' in drm_client_firmware_config(). We don't call any of the other stuff in here new or old so this feels out of place. v2: Rebase Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 12 ++-- 1 file cha

[PATCH v2 4/8] drm/client: Make copies of modes

2025-02-28 Thread Ville Syrjala
From: Ville Syrjälä drm_client_firmware_config() is currently picking up the current mode of the crtc via the legacy crtc->mode, which is not supposed to be used by atomic drivers at all. We can't simply switch over to the proper crtc->state->mode because we drop the crtc->mutex (which protects c

[PATCH v2 0/8] drm/client: Stop using legacy crtc->mode and a bunch of cleanups

2025-02-28 Thread Ville Syrjala
From: Ville Syrjälä The most interesting part is the change to modes[] to solve the lifetime issue so that we can stop using the legacy crtc->mode for atomic drivers. Additionally I included a bunch of cleanups, some of which were inherited from https://patchwork.freedesktop.org/series/132051/

[PATCH v2 1/9] drm/dp: Add definitions for POST_LT_ADJ training sequence

2025-02-27 Thread Ville Syrjala
From: Ville Syrjälä Add the bit definitions needed for POST_LT_ADJ sequence. v2: DP_POST_LT_ADJ_REQ_IN_PROGRESS is bit 1 not 5 (Jani) Signed-off-by: Ville Syrjälä --- include/drm/display/drm_dp.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/drm/display/drm_dp.h b/include/drm

[PATCH 3/9] drm/i915/dp: Clear DPCD training pattern before transmitting the idle pattern

2025-02-24 Thread Ville Syrjala
From: Ville Syrjälä We are supposed to switch off the training pattern in DPCD before we start transmitting the idle pattern. For LTTPRs we do that correctly, but for the sink DPRX we only do this correctly for some platforms. On pre-HSW (where we don't implement the .set_idle_link_train() hook)

[PATCH 9/9] hax: drm/i915: Disable TPS4 support to force POST_LT_ADJ_REQ usage

2025-02-24 Thread Ville Syrjala
From: Ville Syrjälä Disable TPS4 in favor of POST_LT_ADJ_REQ for testing purposes. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_dp_link_training.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/

[PATCH 4/9] drm/i915/dp: Have intel_dp_get_adjust_train() tell us if anything changed

2025-02-24 Thread Ville Syrjala
From: Ville Syrjälä In order to implement the POST_LT_ADJ_REQ sequence we need to know whether the sink actually requested a changed to the vswing/pre-emph values. Signed-off-by: Ville Syrjälä --- .../drm/i915/display/intel_dp_link_training.c | 18 +- .../drm/i915/display/inte

[PATCH 7/9] drm/i915/dp: Implement .set_idle_link_train() for everyone

2025-02-24 Thread Ville Syrjala
From: Ville Syrjälä All platforms are capable of explicitly transmitting the idle pattern. Implement it for everyone (so far it as implemented only for HSW+). The immediate benefit is that we gain support for the POST_LT_ADJ_REQ sequence for all platforms. Another potential future use would be

[PATCH 8/9] drm/i915/dp: Make .set_idle_link_train() mandatory

2025-02-24 Thread Ville Syrjala
From: Ville Syrjälä Everyone implements the .set_idle_link_train() hook now. Just make it mandatory. Signed-off-by: Ville Syrjälä --- .../gpu/drm/i915/display/intel_dp_link_training.c| 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/displ

[PATCH 6/9] drm/i915/dp: Move intel_dp_training_pattern()

2025-02-24 Thread Ville Syrjala
From: Ville Syrjälä Move intel_dp_training_pattern() upwards to avoid the forward declaration for the POST_LT_ADJ_REQ stuff. Signed-off-by: Ville Syrjälä --- .../drm/i915/display/intel_dp_link_training.c | 112 +- 1 file changed, 54 insertions(+), 58 deletions(-) diff --git a/

[PATCH 5/9] drm/i915/dp: Implement the POST_LT_ADJ_REQ sequence

2025-02-24 Thread Ville Syrjala
From: Ville Syrjälä Implement the POST_LT_ADJ_REQ sequence, which should be used to further fine tune the link if TPS4 is not supported. The POST_LT_ADJ_REQ sequence will be performed after the normal link training has succeeded. Only the final hop between the last LTTPR and DPRX will perform th

[PATCH 2/9] drm/dp: Add POST_LT_ADJ_REQ helpers

2025-02-24 Thread Ville Syrjala
From: Ville Syrjälä Add small helpers (drm_dp_post_lt_adj_req_supported() and drm_dp_post_lt_adj_req_in_progress()) to help with implementing the POST_LT_ADJ_REQ sequence. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/display/drm_dp_helper.c | 8 include/drm/display/drm_dp_helper.h

[PATCH 1/9] drm/dp: Add definitions for POST_LT_ADJ training sequence

2025-02-24 Thread Ville Syrjala
From: Ville Syrjälä Add the bit definitions needed for POST_LT_ADJ sequence. Signed-off-by: Ville Syrjälä --- include/drm/display/drm_dp.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/drm/display/drm_dp.h b/include/drm/display/drm_dp.h index c413ef68f9a3..260948a8f550 100644

[PATCH 0/9] drm/i915/dp: Implement POST_LT_ADJ_REQ

2025-02-24 Thread Ville Syrjala
From: Ville Syrjälä Implement the POST_LT_ADJ_REQ sequence, which is supposed to be used to further tune the link vswing/pre-emphasis when TPS4 is not supported. Unfortunately I don't have any displays/dongles that support this so I wasn't able to test anything. Hopefully CI has something... Vi

[PATCH] drm/atomic: Filter out redundant DPMS calls

2025-02-19 Thread Ville Syrjala
From: Ville Syrjälä Video players (eg. mpv) do periodic XResetScreenSaver() calls to keep the screen on while the video playing. The modesetting ddx plumbs these straight through into the kernel as DPMS setproperty ioctls, without any filtering whatsoever. When implemented via atomic these end up

[PATCH 2/2] drm/modes: Fix drm_mode_vrefres() docs

2024-11-28 Thread Ville Syrjala
From: Ville Syrjälä We no longer store a cache vrefresh value in the mode. Remove the stale information from drm_vrefresh() docs. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_modes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_modes.c b/dri

[PATCH 1/2] drm/modes: Avoid divide by zero harder in drm_mode_vrefresh()

2024-11-28 Thread Ville Syrjala
From: Ville Syrjälä drm_mode_vrefresh() is trying to avoid divide by zero by checking whether htotal or vtotal are zero. But we may still end up with a div-by-zero of vtotal*htotal*... Cc: sta...@vger.kernel.org Reported-by: syzbot+622bba18029bcde67...@syzkaller.appspotmail.com Closes: https://s

[PATCH 0/2] drm/modes: Fix div-by-zero in drm_mode_vrefresh()

2024-11-28 Thread Ville Syrjala
From: Ville Syrjälä Fix a potential div-by-zero in drm_mode_vrefresh() TODO: should probably make drm_mode_setcrtc() not even print the (potentially partially) converted mode, and instead print the original umode.. Test-with: 20241128190927.26033-1-ville.syrj...@linux.intel.com Vil

[PATCH] drm/radeon: Fix encoder->possible_clones

2024-10-14 Thread Ville Syrjala
From: Ville Syrjälä Include the encoder itself in its possible_clones bitmask. In the past nothing validated that drivers were populating possible_clones correctly, but that changed in commit 74d2aacbe840 ("drm: Validate encoder->possible_clones"). Looks like radeon never got the memo and is stil

[PATCH v2 6/8] drm/client: s/new_crtc/crtc/

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Rename the 'new_crtc' variable to just 'crtc' in drm_client_firmware_config(). We don't call any of the other stuff in here new or old so this feels out of place. v2: Rebase Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 12 ++-- 1 file cha

[PATCH v2 5/8] drm/client: Stop using the legacy crtc->mode

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä crtc->mode is legacy junk and shouldn't really be used with atomic drivers. Most (all?) atomic drivers do end up still calling drm_atomic_helper_update_legacy_modeset_state() at some point, so crtc->mode does still get populated, and this does work for now. But now that the m

[PATCH v2 4/8] drm/client: Make copies of modes

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä drm_client_firmware_config() is currently picking up the current mode of the crtc via the legacy crtc->mode, which is not supposed to be used by atomic drivers at all. We can't simply switch over to the proper crtc->state->mode because we drop the crtc->mutex (which protects c

[PATCH 8/8] drm/client: s/unsigned int i/int i/

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Replace the 'unsigned int i' footguns with plain old signed int. Avoids accidents if/when someone decides they need to iterate backwards. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

[PATCH 3/8] drm/client: Streamline mode selection debugs

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Get rid of all the redundant debugs and just wait until the end to print which mode (and of which type) we picked. Reviewed-by: Thomas Zimmermann Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 70 +--- 1 file changed, 33 ins

[PATCH 7/8] drm/client: Move variables to tighter scope

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Bunch of variables are only needed inside loops and whatnot. Move them to a tighter scope to make the code less confusing. Also replace the 'unsigned int i' footguns with plain signed ints. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 33

[PATCH 5/8] drm/client: Stop using the legacy crtc->mode

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä crtc->mode is legacy junk and shouldn't really be used with atomic drivers. Most (all?) atomic drivers do end up still calling drm_atomic_helper_update_legacy_modeset_state() at some point, so crtc->mode does still get populated, and this does work for now. But now that the m

[PATCH 6/8] drm/client: s/new_crtc/crtc/

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Rename the 'new_crtc' variable to just 'crtc' in drm_client_firmware_config(). We don't call any of the other stuff in here new or old so this feels out of place. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 12 ++-- 1 file changed, 6 inse

[PATCH 4/8] drm/client: Make copies of modes

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä drm_client_firmware_config() is currently picking up the current mode of the crtc via the legacy crtc->mode, which is not supposed to be used by atomic drivers at all. We can't simply switch over to the proper crtc->state->mode because we drop the crtc->mutex (which protects c

[PATCH 2/8] drm/client: Use array notation for function arguments

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Use the array notation rather that the pointer notation for function arguments. This makes it clear to the reader that we are in fact dealing with an array rather than a single pointer. Functionally the two are equivalent. Reviewed-by: Jani Nikula Reviewed-by: Thomas Zimmerm

[PATCH 1/8] drm/client: Constify modes

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä The modes used by the client code live on the connectors' mode lists, which are not owned by the client code, and thus it has no business modifying the modes. Mark the modes const to make that fact abundantly clear. Reviewed-by: Jani Nikula Reviewed-by: Thomas Zimmermann Si

[PATCH 0/8] drm/client: Stop using legacy crtc->mode and a bunch of cleanups

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä The most interesting part is the change to modes[] to solve the lifetime issue so that we can stop using the legacy crtc->mode for atomic drivers. Additionally I included a bunch of cleanups, some of which were inherited from https://patchwork.freedesktop.org/series/132051/

[PATCH v2 10/10] drm/meson: Allow build with COMPILE_TEST=y

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Allow meson to be built with COMPILE_TEST=y for greater coverage. Builds fine on x86/x86_64 at least. Cc: Neil Armstrong Cc: linux-amlo...@lists.infradead.org Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/meson/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(

[PATCH v2 09/10] drm/mediatek: Allow build with COMPILE_TEST=y

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Allow mediatek to be built with COMPILE_TEST=y for greater coverage. Builds fine on x86/x86_64 at least. Cc: Chun-Kuang Hu Cc: Philipp Zabel Cc: linux-media...@lists.infradead.org Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/mediatek/Kconfig | 4 ++-- 1 file changed,

[PATCH v2 08/10] drm/fsl-dcu: Allow build with COMPILE_TEST=y

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Allow fsl-dcu to be built with COMPILE_TEST=y for greater coverage. Builds fine on x86/x86_64 at least. Cc: Stefan Agner Cc: Alison Wang Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/fsl-dcu/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dr

[PATCH v2 07/10] drm/imx/dcss: Allow build with COMPILE_TEST=y

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Allow imx/dcss to be built with COMPILE_TEST=y for greater coverage. Builds fine on x86/x86_64 at least. Cc: Laurentiu Palcu Cc: Lucas Stach Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/imx/dcss/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v2 06/10] drm/imx/dcss: Fix 64bit divisions

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Use the appropriate 64bit division helpers to make the code build on 32bit architectures. Cc: Laurentiu Palcu Cc: Lucas Stach Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/imx/dcss/dcss-scaler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dr

[PATCH v2 05/10] drm/armada: Allow build with COMPILE_TEST=y

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Allow armada to be built with COMPILE_TEST=y for greater coverage. Builds fine on x86/x86_64 at least. Cc: Russell King Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/armada/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/armad

[PATCH v2 03/10] drm/armada: Fix printk arguments

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä ../drivers/gpu/drm/armada/armada_gem.c: In function ‘armada_gem_pwrite_ioctl’: ../drivers/gpu/drm/armada/armada_gem.c:367:27: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=] 367 |

[PATCH v2 04/10] drm/armada: Fix armada_debugfs_crtc_reg_write() return type

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Change the armada_debugfs_crtc_reg_write() return type to the correct ssize_t. This makes the code actually build on certain architectures. Cc: Russell King Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/armada/armada_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 d

[PATCH v2 02/10] drm/tilcdc: Allow build with COMPILE_TEST=y

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Allow tilcdc to be built with COMPILE_TEST=y for greater coverage. Builds fine on x86/x86_64 at least. Acked-by: Jyri Sarha Reviewed-by: Tomi Valkeinen Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/tilcdc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) d

[PATCH v2 01/10] drm/tilcdc: Allow build without __iowmb()

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä __iowmb() isn't available on most architectures. Make its use optional so that the driver can be built on other architectures with COMPILE_TEST=y. v2: Add a comment stating this is for COMPILE_TEST (Tomi) Cc: Tomi Valkeinen Acked-by: Jyri Sarha Signed-off-by: Ville Syrjälä

[PATCH v2 00/10] drm: Increase COMPILE_TEST=y coverage

2024-10-03 Thread Ville Syrjala
From: Ville Syrjälä Repost of the stragglers from https://patchwork.freedesktop.org/series/132164/ Cc: Alison Wang Cc: Chun-Kuang Hu Cc: Laurentiu Palcu Cc: linux-amlo...@lists.infradead.org Cc: linux-media...@lists.infradead.org Cc: Lucas Stach Cc: Neil Armstrong Cc: Philipp Zabel Cc: Rus

[PATCH 2/2] drm: Move crtc->{x, y, mode, enabled} to legacy sub-structure

2024-10-02 Thread Ville Syrjala
From: Ville Syrjälä Atomic drivers shouldn't be using the legacy state stored directly under drm_crtc. Move that junk into a 'legacy' sub structure to highlight the offenders, of which there are quite a few unfortunately. I'm hoping we could get all these fixed and then declare the legacy state

[PATCH 1/2] drm: Move plane->{fb, old_fb, crtc} to legacy sub-structure

2024-10-02 Thread Ville Syrjala
From: Ville Syrjälä Hide the plane->fb/etc. footguns better by stashing them inside a "legacy" sub struct. Eventually maybe we could turn 'legacy' into a pointer that only exists on legacy drivers to completely prevent any abuse by atomic drivers... Side note: _dpu_plane_set_danger_state() look

[PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping

2024-10-02 Thread Ville Syrjala
From: Ville Syrjälä An attempt to hide the drm_plane/crtc legacy state better. This also highlights the fact that a lot of supposedly atomic drivers are poking around in the legacy crtc state, which is rather questionable. For planes we did force the legacy state to NULL already to force drivers

[PATCH v2 6/6] fbcon: Use 'bool' where appopriate

2024-09-23 Thread Ville Syrjala
From: Ville Syrjälä Use 'bool' type where it makes more sense than 'int'. v2: Rebase due to corrected 'fbcon_cursor_blink' initial value Acked-by: Helge Deller Signed-off-by: Ville Syrjälä --- drivers/video/fbdev/core/fbcon.c | 23 --- 1 file changed, 12 insertions(+), 11

[PATCH v2 3/6] fbcon: fbcon_cursor_noblink -> fbcon_cursor_blink

2024-09-23 Thread Ville Syrjala
From: Ville Syrjälä Invert fbcon_cursor_noblink into fbcon_cursor_blink so that: - it matches the sysfs attribute exactly - avoids having to do these NOT operations all over the place v2: Set the initial value to 1 to keep the same default behaviour (Helge) Cc: Helge Deller Signed-off-by:

[PATCH 6/6] fbcon: Use 'bool' where appopriate

2024-09-23 Thread Ville Syrjala
From: Ville Syrjälä Use 'bool' type where it makes more sense than 'int'. Signed-off-by: Ville Syrjälä --- drivers/video/fbdev/core/fbcon.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/

[PATCH 4/6] fbcon: fbcon_is_inactive() -> fbcon_is_active()

2024-09-23 Thread Ville Syrjala
From: Ville Syrjälä Invert fbcon_is_inactive() into fbcon_is_active(). Much easier on the poor brain when you don't have to do dobule negations all over the place. Signed-off-by: Ville Syrjälä --- drivers/video/fbdev/core/fbcon.c | 30 +++--- 1 file changed, 15 insertio

[PATCH 5/6] fbcon: Introduce get_{fg,bg}_color()

2024-09-23 Thread Ville Syrjala
From: Ville Syrjälä Make the code more legible by adding get_{fg,bg}_color() which hide the obscure 'is_fg' parameter of get_color() from the caller. Signed-off-by: Ville Syrjälä --- drivers/video/fbdev/core/fbcon.c | 24 ++-- 1 file changed, 18 insertions(+), 6 deletions(-

[PATCH 3/6] fbcon: fbcon_cursor_noblink -> fbcon_cursor_blink

2024-09-23 Thread Ville Syrjala
From: Ville Syrjälä Invert fbcon_cursor_noblink into fbcon_cursor_blink so that: - it matches the sysfs attribute exactly - avoids having to do these NOT operations all over the place Signed-off-by: Ville Syrjälä --- drivers/video/fbdev/core/fbcon.c | 8 1 file changed, 4 insertions(+

[PATCH 2/6] fbcon: Add sysfs attributes before registering the device

2024-09-23 Thread Ville Syrjala
From: Ville Syrjälä Currently fbcon adds the attributes after registering the device, which means the attributes may not be there by the time udev gets the ADD uevent. Fix the race by switching over to device_create_with_groups(). With this one can reliably turn off the power wasting cursor blin

[PATCH 1/6] fbcon: Make cursor_blink=0 work when configured before fb devices appear

2024-09-23 Thread Ville Syrjala
From: Ville Syrjälä Currently setting cursor_blink attribute to 0 before any fb devices are around does absolutely nothing. When fb devices appear and fbcon becomes active the cursor starts blinking. Fix the problem by recoding the desired state of the attribute even if no fb devices are present

[PATCH 0/6] fbcon: Fix 'cursor_blink' sysfs attribute

2024-09-23 Thread Ville Syrjala
From: Ville Syrjälä Make the 'cursor_blink' sysfs attribute actually usable from udev rules. I also took the opportinity to some cleanups t the code after getting annoyed by it. Ville Syrjälä (6): fbcon: Make cursor_blink=0 work when configured before fb devices appear fbcon: Add sysfs a

[PATCH v3 2/9] drm: Export drm_plane_has_format()

2024-06-19 Thread Ville Syrjala
From: Ville Syrjälä Export drm_plane_has_format() so that drivers can use it. v2: add kerneldoc Reviewed-by: Jani Nikula Reviewed-by: Daniel Vetter Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_crtc_internal.h | 2 -- drivers/gpu/drm/drm_plane.c | 10 ++ include/drm/

[PATCH v2 9/9] drm/i915: Nuke the TGL+ chroma plane tile row alignment stuff

2024-06-12 Thread Ville Syrjala
From: Ville Syrjälä I don't think the display hardware really has such chroma plane tile row alignment requirements as outlined in commit d156135e6a54 ("drm/i915/tgl: Make sure a semiplanar UV plane is tile row size aligned") Bspec had the same exact thing to say about earlier hardware as well,

[PATCH v2 8/9] drm/i915: Update plane alignment requirements for TGL+

2024-06-12 Thread Ville Syrjala
From: Ville Syrjälä Currently we still use the SKL+ PLANE_SURF alignment even for TGL+ even though the hardware no longer needs it. Introduce a separate tgl_plane_min_alignment() and update it to more accurately reflect the hardware requirements. v2: Don't screw up DPT+semiplanar 2MiB alignment

[PATCH v2 7/9] drm/i915: Move intel_surf_alignment() into skl_univerals_plane.c

2024-06-12 Thread Ville Syrjala
From: Ville Syrjälä Now that all pre-skl platforms have their own .min_alignment() functions the remainder of intel_surf_alignment() can be hoisted into skl_univerals_plane.c (and renamed appropriately). Reviewed-by: Imre Deak Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/inte

[PATCH v2 6/9] drm/i915: Split pre-skl platforms out from intel_surf_alignment()

2024-06-12 Thread Ville Syrjala
From: Ville Syrjälä Extract the necessary chunks from intel_surf_alignment() into per-platform variants for all pre-skl primary/sprite planes. Reviewed-by: Imre Deak Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/i9xx_plane.c | 69 - drivers/gpu/drm/i915/d

[PATCH v2 5/9] drm/i915: Split cursor alignment to per-platform vfuncs

2024-06-12 Thread Ville Syrjala
From: Ville Syrjälä Split intel_cursor_alignment() into per-platform variants. Reviewed-by: Imre Deak Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_cursor.c | 40 +++-- drivers/gpu/drm/i915/display/intel_fb.c | 16 - drivers/gpu/drm/i915/displ

  1   2   3   4   5   6   7   8   9   10   >