forked from Minki/linux
5ddb0bd4dd
The current atomic helpers have either their object state being passed as an argument or the full atomic state. The former is the pattern that was done at first, before switching to the latter for new hooks or when it was needed. Let's start convert all the remaining helpers to provide a consistent interface, starting with the planes atomic_async_check and atomic_async_update. The conversion was done using the coccinelle script below, built tested on all the drivers. @@ identifier plane, plane_state; symbol state; @@ struct drm_plane_helper_funcs { ... int (*atomic_async_check)(struct drm_plane *plane, - struct drm_plane_state *plane_state); + struct drm_atomic_state *state); ... } @@ identifier plane, plane_state; symbol state; @@ struct drm_plane_helper_funcs { ... void (*atomic_async_update)(struct drm_plane *plane, - struct drm_plane_state *plane_state); + struct drm_atomic_state *state); ... } @ plane_atomic_func @ identifier helpers; identifier func; @@ ( static const struct drm_plane_helper_funcs helpers = { ..., .atomic_async_check = func, ..., }; | static const struct drm_plane_helper_funcs helpers = { ..., .atomic_async_update = func, ..., }; ) @@ struct drm_plane_helper_funcs *FUNCS; identifier f; identifier dev; identifier plane, plane_state, state; @@ f(struct drm_device *dev, struct drm_atomic_state *state) { <+... - FUNCS->atomic_async_check(plane, plane_state) + FUNCS->atomic_async_check(plane, state) ...+> } @@ struct drm_plane_helper_funcs *FUNCS; identifier f; identifier dev; identifier plane, plane_state, state; @@ f(struct drm_device *dev, struct drm_atomic_state *state) { <+... - FUNCS->atomic_async_update(plane, plane_state) + FUNCS->atomic_async_update(plane, state) ...+> } @@ identifier mtk_plane_atomic_async_update; identifier plane; symbol new_state, state; expression e; @@ void mtk_plane_atomic_async_update(struct drm_plane *plane, struct drm_plane_state *new_state) { ... - struct mtk_plane_state *state = e; + struct mtk_plane_state *new_plane_state = e; <+... - state + new_plane_state ...+> } @@ identifier plane_atomic_func.func; identifier plane; symbol state; @@ func(struct drm_plane *plane, - struct drm_plane_state *state) + struct drm_plane_state *new_plane_state) { <... - state + new_plane_state ...> } @ ignores_new_state @ identifier plane_atomic_func.func; identifier plane, new_plane_state; @@ func(struct drm_plane *plane, struct drm_plane_state *new_plane_state) { ... when != new_plane_state } @ adds_new_state depends on plane_atomic_func && !ignores_new_state @ identifier plane_atomic_func.func; identifier plane, new_plane_state; @@ func(struct drm_plane *plane, struct drm_plane_state *new_plane_state) { + struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state, plane); ... } @ depends on plane_atomic_func @ identifier plane_atomic_func.func; identifier plane, plane_state; @@ func(struct drm_plane *plane, - struct drm_plane_state *plane_state + struct drm_atomic_state *state ) { ... } @ include depends on adds_new_state @ @@ #include <drm/drm_atomic.h> @ no_include depends on !include && adds_new_state @ @@ + #include <drm/drm_atomic.h> #include <drm/...> @@ identifier plane_atomic_func.func; identifier plane, state; identifier plane_state; @@ func(struct drm_plane *plane, struct drm_atomic_state *state) { ... struct drm_plane_state *plane_state = drm_atomic_get_new_plane_state(state, plane); <+... - plane_state->state + state ...+> } Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20210219120032.260676-1-maxime@cerno.tech |
||
---|---|---|
.. | ||
bridge | ||
i2c | ||
ttm | ||
amd_asic_type.h | ||
drm_agpsupport.h | ||
drm_atomic_helper.h | ||
drm_atomic_state_helper.h | ||
drm_atomic_uapi.h | ||
drm_atomic.h | ||
drm_audio_component.h | ||
drm_auth.h | ||
drm_blend.h | ||
drm_bridge_connector.h | ||
drm_bridge.h | ||
drm_cache.h | ||
drm_client.h | ||
drm_color_mgmt.h | ||
drm_connector.h | ||
drm_crtc_helper.h | ||
drm_crtc.h | ||
drm_damage_helper.h | ||
drm_debugfs_crc.h | ||
drm_debugfs.h | ||
drm_device.h | ||
drm_displayid.h | ||
drm_dp_dual_mode_helper.h | ||
drm_dp_helper.h | ||
drm_dp_mst_helper.h | ||
drm_drv.h | ||
drm_dsc.h | ||
drm_edid.h | ||
drm_encoder_slave.h | ||
drm_encoder.h | ||
drm_fb_cma_helper.h | ||
drm_fb_helper.h | ||
drm_file.h | ||
drm_fixed.h | ||
drm_flip_work.h | ||
drm_format_helper.h | ||
drm_fourcc.h | ||
drm_framebuffer.h | ||
drm_gem_atomic_helper.h | ||
drm_gem_cma_helper.h | ||
drm_gem_framebuffer_helper.h | ||
drm_gem_shmem_helper.h | ||
drm_gem_ttm_helper.h | ||
drm_gem_vram_helper.h | ||
drm_gem.h | ||
drm_hashtab.h | ||
drm_hdcp.h | ||
drm_ioctl.h | ||
drm_irq.h | ||
drm_lease.h | ||
drm_legacy.h | ||
drm_managed.h | ||
drm_mipi_dbi.h | ||
drm_mipi_dsi.h | ||
drm_mm.h | ||
drm_mode_config.h | ||
drm_mode_object.h | ||
drm_modes.h | ||
drm_modeset_helper_vtables.h | ||
drm_modeset_helper.h | ||
drm_modeset_lock.h | ||
drm_of.h | ||
drm_panel.h | ||
drm_pciids.h | ||
drm_plane_helper.h | ||
drm_plane.h | ||
drm_prime.h | ||
drm_print.h | ||
drm_probe_helper.h | ||
drm_property.h | ||
drm_rect.h | ||
drm_scdc_helper.h | ||
drm_self_refresh_helper.h | ||
drm_simple_kms_helper.h | ||
drm_syncobj.h | ||
drm_sysfs.h | ||
drm_util.h | ||
drm_utils.h | ||
drm_vblank_work.h | ||
drm_vblank.h | ||
drm_vma_manager.h | ||
drm_writeback.h | ||
gma_drm.h | ||
gpu_scheduler.h | ||
i915_component.h | ||
i915_drm.h | ||
i915_mei_hdcp_interface.h | ||
i915_pciids.h | ||
intel_lpe_audio.h | ||
intel-gtt.h | ||
spsc_queue.h | ||
task_barrier.h |