1. 06 11月, 2022 1 次提交
  2. 04 11月, 2022 1 次提交
    • Y
      drm/ingenic: Fix missing platform_driver_unregister() call in ingenic_drm_init() · 47078311
      Yuan Can 提交于
      A problem about modprobe ingenic-drm failed is triggered with the following
      log given:
      
       [  303.561088] Error: Driver 'ingenic-ipu' is already registered, aborting...
       modprobe: ERROR: could not insert 'ingenic_drm': Device or resource busy
      
      The reason is that ingenic_drm_init() returns platform_driver_register()
      directly without checking its return value, if platform_driver_register()
      failed, it returns without unregistering ingenic_ipu_driver_ptr, resulting
      the ingenic-drm can never be installed later.
      A simple call graph is shown as below:
      
       ingenic_drm_init()
         platform_driver_register() # ingenic_ipu_driver_ptr are registered
         platform_driver_register()
           driver_register()
             bus_add_driver()
               priv = kzalloc(...) # OOM happened
         # return without unregister ingenic_ipu_driver_ptr
      
      Fixing this problem by checking the return value of
      platform_driver_register() and do platform_unregister_drivers() if
      error happened.
      
      Fixes: fc1acf31 ("drm/ingenic: Add support for the IPU")
      Signed-off-by: NYuan Can <yuancan@huawei.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NPaul Cercueil <paul@crapouillou.net>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221104064512.8569-1-yuancan@huawei.com
      47078311
  3. 04 8月, 2022 2 次提交
    • D
      drm/gem: rename GEM CMA helpers to GEM DMA helpers · 4a83c26a
      Danilo Krummrich 提交于
      Rename "GEM CMA" helpers to "GEM DMA" helpers - considering the
      hierarchy of APIs (mm/cma -> dma -> gem dma) calling them "GEM
      DMA" seems to be more applicable.
      
      Besides that, commit e57924d4 ("drm/doc: Task to rename CMA helpers")
      requests to rename the CMA helpers and implies that people seem to be
      confused about the naming.
      
      In order to do this renaming the following script was used:
      
      ```
      	#!/bin/bash
      
      	DIRS="drivers/gpu include/drm Documentation/gpu"
      
      	REGEX_SYM_UPPER="[0-9A-Z_\-]"
      	REGEX_SYM_LOWER="[0-9a-z_\-]"
      
      	REGEX_GREP_UPPER="(${REGEX_SYM_UPPER}*)(GEM)_CMA_(${REGEX_SYM_UPPER}*)"
      	REGEX_GREP_LOWER="(${REGEX_SYM_LOWER}*)(gem)_cma_(${REGEX_SYM_LOWER}*)"
      
      	REGEX_SED_UPPER="s/${REGEX_GREP_UPPER}/\1\2_DMA_\3/g"
      	REGEX_SED_LOWER="s/${REGEX_GREP_LOWER}/\1\2_dma_\3/g"
      
      	# Find all upper case 'CMA' symbols and replace them with 'DMA'.
      	for ff in $(grep -REHl "${REGEX_GREP_UPPER}" $DIRS)
      	do
      	       sed -i -E "$REGEX_SED_UPPER" $ff
      	done
      
      	# Find all lower case 'cma' symbols and replace them with 'dma'.
      	for ff in $(grep -REHl "${REGEX_GREP_LOWER}" $DIRS)
      	do
      	       sed -i -E "$REGEX_SED_LOWER" $ff
      	done
      
      	# Replace all occurrences of 'CMA' / 'cma' in comments and
      	# documentation files with 'DMA' / 'dma'.
      	for ff in $(grep -RiHl " cma " $DIRS)
      	do
      		sed -i -E "s/ cma / dma /g" $ff
      		sed -i -E "s/ CMA / DMA /g" $ff
      	done
      
      	# Rename all 'cma_obj's to 'dma_obj'.
      	for ff in $(grep -RiHl "cma_obj" $DIRS)
      	do
      		sed -i -E "s/cma_obj/dma_obj/g" $ff
      	done
      ```
      
      Only a few more manual modifications were needed, e.g. reverting the
      following modifications in some DRM Kconfig files
      
          -       select CMA if HAVE_DMA_CONTIGUOUS
          +       select DMA if HAVE_DMA_CONTIGUOUS
      
      as well as manually picking the occurrences of 'CMA'/'cma' in comments and
      documentation which relate to "GEM CMA", but not "FB CMA".
      
      Also drivers/gpu/drm/Makefile was fixed up manually after renaming
      drm_gem_cma_helper.c to drm_gem_dma_helper.c.
      
      This patch is compile-time tested building a x86_64 kernel with
      `make allyesconfig && make drivers/gpu/drm`.
      Acked-by: NSam Ravnborg <sam@ravnborg.org>
      Acked-by: NThomas Zimmermann <tzimmermann@suse.de>
      Reviewed-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NDanilo Krummrich <dakr@redhat.com>
      Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> #drivers/gpu/drm/arm
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220802000405.949236-4-dakr@redhat.com
      4a83c26a
    • D
      drm/fb: rename FB CMA helpers to FB DMA helpers · 6bcfe8ea
      Danilo Krummrich 提交于
      Rename "FB CMA" helpers to "FB DMA" helpers - considering the hierarchy
      of APIs (mm/cma -> dma -> fb dma) calling them "FB DMA" seems to be
      more applicable.
      
      Besides that, commit e57924d4 ("drm/doc: Task to rename CMA helpers")
      requests to rename the CMA helpers and implies that people seem to be
      confused about the naming.
      
      In order to do this renaming the following script was used:
      
      ```
      	#!/bin/bash
      
      	DIRS="drivers/gpu include/drm Documentation/gpu"
      
      	REGEX_SYM_UPPER="[0-9A-Z_\-]"
      	REGEX_SYM_LOWER="[0-9a-z_\-]"
      
      	REGEX_GREP_UPPER="(${REGEX_SYM_UPPER}*)(FB)_CMA_(${REGEX_SYM_UPPER}*)"
      	REGEX_GREP_LOWER="(${REGEX_SYM_LOWER}*)(fb)_cma_(${REGEX_SYM_LOWER}*)"
      
      	REGEX_SED_UPPER="s/${REGEX_GREP_UPPER}/\1\2_DMA_\3/g"
      	REGEX_SED_LOWER="s/${REGEX_GREP_LOWER}/\1\2_dma_\3/g"
      
      	# Find all upper case 'CMA' symbols and replace them with 'DMA'.
      	for ff in $(grep -REHl "${REGEX_GREP_UPPER}" $DIRS)
      	do
      	       sed -i -E "$REGEX_SED_UPPER" $ff
      	done
      
      	# Find all lower case 'cma' symbols and replace them with 'dma'.
      	for ff in $(grep -REHl "${REGEX_GREP_LOWER}" $DIRS)
      	do
      	       sed -i -E "$REGEX_SED_LOWER" $ff
      	done
      
      	# Replace all occurrences of 'CMA' / 'cma' in comments and
      	# documentation files with 'DMA' / 'dma'.
      	for ff in $(grep -RiHl " cma " $DIRS)
      	do
      		sed -i -E "s/ cma / dma /g" $ff
      		sed -i -E "s/ CMA / DMA /g" $ff
      	done
      ```
      
      Only a few more manual modifications were needed, e.g. reverting the
      following modifications in some DRM Kconfig files
      
          -       select CMA if HAVE_DMA_CONTIGUOUS
          +       select DMA if HAVE_DMA_CONTIGUOUS
      
      as well as manually picking the occurrences of 'CMA'/'cma' in comments and
      documentation which relate to "FB CMA", but not "GEM CMA".
      
      This patch is compile-time tested building a x86_64 kernel with
      `make allyesconfig && make drivers/gpu/drm`.
      Acked-by: NSam Ravnborg <sam@ravnborg.org>
      Acked-by: NThomas Zimmermann <tzimmermann@suse.de>
      Reviewed-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NDanilo Krummrich <dakr@redhat.com>
      Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> #drivers/gpu/drm/arm
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220802000405.949236-3-dakr@redhat.com
      6bcfe8ea
  4. 27 7月, 2022 2 次提交
  5. 09 7月, 2022 3 次提交
  6. 06 7月, 2022 1 次提交
  7. 04 7月, 2022 1 次提交
  8. 21 6月, 2022 1 次提交
  9. 11 4月, 2022 1 次提交
  10. 06 4月, 2022 1 次提交
  11. 25 2月, 2022 1 次提交
  12. 14 2月, 2022 1 次提交
  13. 28 1月, 2022 1 次提交
  14. 16 12月, 2021 2 次提交
  15. 31 10月, 2021 1 次提交
  16. 30 10月, 2021 5 次提交
  17. 11 8月, 2021 2 次提交
  18. 28 7月, 2021 1 次提交
  19. 20 7月, 2021 1 次提交
  20. 24 6月, 2021 1 次提交
  21. 25 5月, 2021 1 次提交
  22. 17 5月, 2021 1 次提交
  23. 13 5月, 2021 1 次提交
  24. 29 3月, 2021 1 次提交
  25. 08 3月, 2021 1 次提交
  26. 25 2月, 2021 5 次提交
    • M
      drm: Use state helper instead of the plane state pointer · 37418bf1
      Maxime Ripard 提交于
      Many drivers reference the plane->state pointer in order to get the
      current plane state in their atomic_update or atomic_disable hooks,
      which would be the new plane state in the global atomic state since
      _swap_state happened when those hooks are run.
      
      Use the drm_atomic_get_new_plane_state helper to get that state to make it
      more obvious.
      
      This was made using the coccinelle script below:
      
      @ plane_atomic_func @
      identifier helpers;
      identifier func;
      @@
      
      (
       static const struct drm_plane_helper_funcs helpers = {
       	...,
       	.atomic_disable = func,
      	...,
       };
      |
       static const struct drm_plane_helper_funcs helpers = {
       	...,
       	.atomic_update = func,
      	...,
       };
      )
      
      @ adds_new_state @
      identifier plane_atomic_func.func;
      identifier plane, state;
      identifier new_state;
      @@
      
       func(struct drm_plane *plane, struct drm_atomic_state *state)
       {
       	...
      -	struct drm_plane_state *new_state = plane->state;
      +	struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state, plane);
      	...
       }
      
      @ 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/...>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NMaxime Ripard <maxime@cerno.tech>
      Acked-by: NThomas Zimmermann <tzimmermann@suse.de>
      Link: https://lore.kernel.org/r/20210219120032.260676-1-maxime@cerno.tech
      37418bf1
    • M
      drm/atomic: Pass the full state to planes atomic disable and update · 977697e2
      Maxime Ripard 提交于
      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 convert the remaining helpers to provide a consistent interface,
      this time with the planes atomic_update and atomic_disable.
      
      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 {
       	...
      	void (*atomic_update)(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_disable)(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_update = func,
      	...,
       };
      |
       static const struct drm_plane_helper_funcs helpers = {
       	...,
       	.atomic_disable = func,
      	...,
       };
      )
      
      @@
      struct drm_plane_helper_funcs *FUNCS;
      identifier f;
      identifier crtc_state;
      identifier plane, plane_state, state;
      expression e;
      @@
      
       f(struct drm_crtc_state *crtc_state)
       {
       	...
       	struct drm_atomic_state *state = e;
       	<+...
      (
      -	FUNCS->atomic_disable(plane, plane_state)
      +	FUNCS->atomic_disable(plane, state)
      |
      -	FUNCS->atomic_update(plane, plane_state)
      +	FUNCS->atomic_update(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 *old_plane_state)
       {
      	<...
      -	state
      +	old_plane_state
      	...>
       }
      
      @ ignores_old_state @
      identifier plane_atomic_func.func;
      identifier plane, old_state;
      @@
      
       func(struct drm_plane *plane, struct drm_plane_state *old_state)
       {
      	... when != old_state
       }
      
      @ adds_old_state depends on plane_atomic_func && !ignores_old_state @
      identifier plane_atomic_func.func;
      identifier plane, plane_state;
      @@
      
       func(struct drm_plane *plane, struct drm_plane_state *plane_state)
       {
      +	struct drm_plane_state *plane_state = drm_atomic_get_old_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_old_state @
      @@
      
       #include <drm/drm_atomic.h>
      
      @ no_include depends on !include && adds_old_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_old_plane_state(state, plane);
       	<+...
      -	plane_state->state
      +	state
       	...+>
       }
      Reviewed-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NMaxime Ripard <maxime@cerno.tech>
      Acked-by: NThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210219120032.260676-9-maxime@cerno.tech
      977697e2
    • M
      drm: Rename plane->state variables in atomic update and disable · 41016fe1
      Maxime Ripard 提交于
      Some drivers are storing the plane->state pointer in atomic_update and
      atomic_disable in a variable simply called state, while the state passed
      as an argument is called old_state.
      
      In order to ease subsequent reworks and to avoid confusing or
      inconsistent names, let's rename those variables to new_state.
      
      This was done using the following coccinelle script, plus some manual
      changes for mtk and tegra.
      
      @ plane_atomic_func @
      identifier helpers;
      identifier func;
      @@
      
      (
       static const struct drm_plane_helper_funcs helpers = {
       	...,
       	.atomic_disable = func,
      	...,
       };
      |
       static const struct drm_plane_helper_funcs helpers = {
       	...,
       	.atomic_update = func,
      	...,
       };
      )
      
      @ moves_new_state_old_state @
      identifier plane_atomic_func.func;
      identifier plane;
      symbol old_state;
      symbol state;
      @@
      
       func(struct drm_plane *plane, struct drm_plane_state *old_state)
       {
       	...
      -	struct drm_plane_state *state = plane->state;
      +	struct drm_plane_state *new_state = plane->state;
      	...
       }
      
      @ depends on moves_new_state_old_state @
      identifier plane_atomic_func.func;
      identifier plane;
      identifier old_state;
      symbol state;
      @@
      
       func(struct drm_plane *plane, struct drm_plane_state *old_state)
       {
       	<...
      -	state
      +	new_state
      	...>
       }
      
      @ moves_new_state_oldstate @
      identifier plane_atomic_func.func;
      identifier plane;
      symbol oldstate;
      symbol state;
      @@
      
       func(struct drm_plane *plane, struct drm_plane_state *oldstate)
       {
       	...
      -	struct drm_plane_state *state = plane->state;
      +	struct drm_plane_state *newstate = plane->state;
      	...
       }
      
      @ depends on moves_new_state_oldstate @
      identifier plane_atomic_func.func;
      identifier plane;
      identifier old_state;
      symbol state;
      @@
      
       func(struct drm_plane *plane, struct drm_plane_state *old_state)
       {
       	<...
      -	state
      +	newstate
      	...>
       }
      
      @ moves_new_state_old_pstate @
      identifier plane_atomic_func.func;
      identifier plane;
      symbol old_pstate;
      symbol state;
      @@
      
       func(struct drm_plane *plane, struct drm_plane_state *old_pstate)
       {
       	...
      -	struct drm_plane_state *state = plane->state;
      +	struct drm_plane_state *new_pstate = plane->state;
      	...
       }
      
      @ depends on moves_new_state_old_pstate @
      identifier plane_atomic_func.func;
      identifier plane;
      identifier old_pstate;
      symbol state;
      @@
      
       func(struct drm_plane *plane, struct drm_plane_state *old_pstate)
       {
       	<...
      -	state
      +	new_pstate
      	...>
       }
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NMaxime Ripard <maxime@cerno.tech>
      Acked-by: NThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210219120032.260676-8-maxime@cerno.tech
      41016fe1
    • M
      drm: Use state helper instead of plane state pointer in atomic_check · 0b6aaf9d
      Maxime Ripard 提交于
      Many drivers reference the plane->state pointer in order to get the
      current plane state in their atomic_check hook, which would be the old
      plane state in the global atomic state since _swap_state hasn't happened
      when atomic_check is run.
      
      Use the drm_atomic_get_old_plane_state helper to get that state to make
      it more obvious.
      
      This was made using the coccinelle script below:
      
      @ plane_atomic_func @
      identifier helpers;
      identifier func;
      @@
      
      static struct drm_plane_helper_funcs helpers = {
      	...,
      	.atomic_check = func,
      	...,
      };
      
      @ replaces_old_state @
      identifier plane_atomic_func.func;
      identifier plane, state, plane_state;
      @@
      
       func(struct drm_plane *plane, struct drm_atomic_state *state) {
       	...
      -	struct drm_plane_state *plane_state = plane->state;
      +	struct drm_plane_state *plane_state = drm_atomic_get_old_plane_state(state, plane);
       	...
       }
      
      @@
      identifier plane_atomic_func.func;
      identifier plane, state, plane_state;
      @@
      
       func(struct drm_plane *plane, struct drm_atomic_state *state) {
       	struct drm_plane_state *plane_state = drm_atomic_get_old_plane_state(state, plane);
       	<...
      -	plane->state
      +	plane_state
       	...>
       }
      
      @ adds_old_state @
      identifier plane_atomic_func.func;
      identifier plane, state;
      @@
      
       func(struct drm_plane *plane, struct drm_atomic_state *state) {
      +	struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state, plane);
       	<...
      -	plane->state
      +	old_plane_state
       	...>
       }
      
      @ include depends on adds_old_state || replaces_old_state @
      @@
      
       #include <drm/drm_atomic.h>
      
      @ no_include depends on !include && (adds_old_state || replaces_old_state) @
      @@
      
      + #include <drm/drm_atomic.h>
        #include <drm/...>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NMaxime Ripard <maxime@cerno.tech>
      Acked-by: NThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210219120032.260676-6-maxime@cerno.tech
      0b6aaf9d
    • M
      drm: Use the state pointer directly in planes atomic_check · dec92020
      Maxime Ripard 提交于
      Now that atomic_check takes the global atomic state as a parameter, we
      don't need to go through the pointer in the plane state.
      
      This was done using the following coccinelle script:
      
      @ plane_atomic_func @
      identifier helpers;
      identifier func;
      @@
      
      static struct drm_plane_helper_funcs helpers = {
      	...,
      	.atomic_check = func,
      	...,
      };
      
      @@
      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);
        <... when != plane_state
      - plane_state->state
      + state
        ...>
       }
      
      @@
      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
        ...>
       }
      Reviewed-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NMaxime Ripard <maxime@cerno.tech>
      Acked-by: NThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210219120032.260676-5-maxime@cerno.tech
      dec92020