1. 03 5月, 2022 1 次提交
    • K
      drm/ast: Create the driver for ASPEED proprietory Display-Port · 594e9c04
      KuoHsiang Chou 提交于
      V1:
      1. The MCU FW controling ASPEED DP is loaded by BMC boot loader.
      2. Driver starts after CR[3:1] == 111b that indicates Tx is ASTDP,
         and CRD1[5] has been asserted by BMVC boot loader.
      3. EDID is prioritized by DP monitor.
      4. DP's EDID has high priority to decide resolution supporting.
      
      V2:
      Modules description:
      1. ASTDP (ASPEED DisplayPort) is controlled by dedicated
         AST-MCU (ASPEED propriatary MCU).
      2. MCU is looping in charged of HPD, Read EDID, Link Training with
         DP sink.
      3. ASTDP and AST-MUC reside in BMC (Baseboard Management controller)
         addressing-space.
      4. ASPEED DRM driver requests MCU to get HPD and EDID by CR-scratched
         register.
      
      Booting sequence:
      1. Check if TX is ASTDP					// ast_dp_launch()
      2. Check if DP-MCU FW has loaded					// ast_dp_launch()
      3. Read EDID					// ast_dp_read_edid()
      4. Resolution switch					// ast_dp_SetOutput()
      
      V3:
      1. Remove unneeded semicolon.
      2. Apply to git://anongit.freedesktop.org/drm/drm, instead of
         git://anongit.freedesktop.org/drm/drm-misc
      3. Resolve auto build test WARNINGs on V1 patch.
      
      V4:
      1. Sync code-base with kernel 5.17_rc6
      2. Remove the define of DPControlPower, because DP chips need to be
         powered on to be used.
      3. Remove the switches of PHY and Display from EDID procedure.
      4. Revise increaing delay to fixed delay, because this version kernel
         doesn't detect minitor consistenntly.
      5. Create clean-up code used for reset of power state on errors with
         -EIO manner.
      6. Revise the DP detection by TX type and its DP-FW status during
         booting and resume.
      7. Correct the CamelCase Style.
      8. Use register reading while needing, and remove to hold full
         register.
      9. Instead of 'u8', revise to 'bool' on swwitch of PHY and video.
      10.Correct typo
      11.Remove the duplicated copy of TX definition.
      12.Use EDID_LENGTH as the constant of 128.
      Signed-off-by: NKuoHsiang Chou <kuohsiang_chou@aspeedtech.com>
      Reviewed-by: NThomas Zimmermann <tzimmermann@suse.de>
      Signed-off-by: NThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220428075603.20904-1-kuohsiang_chou@aspeedtech.com
      594e9c04
  2. 08 2月, 2022 9 次提交
  3. 19 1月, 2022 1 次提交
  4. 16 12月, 2021 3 次提交
  5. 14 12月, 2021 1 次提交
  6. 22 10月, 2021 1 次提交
    • K
      Revert "drm/ast: Add detect function support" · 595cb5e0
      Kim Phillips 提交于
      This reverts commit aae74ff9,
      since it prevents my AMD Milan system from booting, with:
      
      [   27.189558] BUG: kernel NULL pointer dereference, address: 0000000000000000
      [   27.197506] #PF: supervisor write access in kernel mode
      [   27.203333] #PF: error_code(0x0002) - not-present page
      [   27.209064] PGD 0 P4D 0
      [   27.211885] Oops: 0002 [#1] PREEMPT SMP NOPTI
      [   27.216744] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.0-rc6+ #15
      [   27.223928] Hardware name: AMD Corporation ETHANOL_X/ETHANOL_X, BIOS RXM1006B 08/20/2021
      [   27.232955] RIP: 0010:run_timer_softirq+0x38b/0x4a0
      [   27.238397] Code: 4c 89 f7 e8 37 27 ac 00 49 c7 46 08 00 00 00 00 49 8b 04 24 48 85 c0 74 71 4d 8b 3c 24 4d 89 7e 08 66 90 49 8b 07 49 8b 57 08 <48> 89 02 48 85 c0 74 04 48 89 50 08 49 8b 77 18 41 f6 47 22 20 4c
      [   27.259350] RSP: 0018:ffffc42d00003ee8 EFLAGS: 00010086
      [   27.265176] RAX: dead000000000122 RBX: 0000000000000000 RCX: 0000000000000101
      [   27.273134] RDX: 0000000000000000 RSI: 0000000000000087 RDI: 0000000000000001
      [   27.281084] RBP: ffffc42d00003f70 R08: 0000000000000000 R09: 00000000000003eb
      [   27.289043] R10: ffffa0860cb300d0 R11: ffffa0c44de290b0 R12: ffffc42d00003ef8
      [   27.297002] R13: 00000000fffef200 R14: ffffa0c44de18dc0 R15: ffffa0867a882350
      [   27.304961] FS:  0000000000000000(0000) GS:ffffa0c44de00000(0000) knlGS:0000000000000000
      [   27.313988] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   27.320396] CR2: 0000000000000000 CR3: 000000014569c001 CR4: 0000000000770ef0
      [   27.328346] PKRU: 55555554
      [   27.331359] Call Trace:
      [   27.334073]  <IRQ>
      [   27.336314]  ? __queue_work+0x420/0x420
      [   27.340589]  ? lapic_next_event+0x21/0x30
      [   27.345060]  ? clockevents_program_event+0x8f/0xe0
      [   27.350402]  __do_softirq+0xfb/0x2db
      [   27.354388]  irq_exit_rcu+0x98/0xd0
      [   27.358275]  sysvec_apic_timer_interrupt+0xac/0xd0
      [   27.363620]  </IRQ>
      [   27.365955]  asm_sysvec_apic_timer_interrupt+0x12/0x20
      [   27.371685] RIP: 0010:cpuidle_enter_state+0xcc/0x390
      [   27.377292] Code: 3d 01 79 0a 50 e8 44 ed 77 ff 49 89 c6 0f 1f 44 00 00 31 ff e8 f5 f8 77 ff 80 7d d7 00 0f 85 e6 01 00 00 fb 66 0f 1f 44 00 00 <45> 85 ff 0f 88 17 01 00 00 49 63 c7 4c 2b 75 c8 48 8d 14 40 48 8d
      [   27.398243] RSP: 0018:ffffffffb0e03dc8 EFLAGS: 00000246
      [   27.404069] RAX: ffffa0c44de00000 RBX: 0000000000000001 RCX: 000000000000001f
      [   27.412028] RDX: 0000000000000000 RSI: ffffffffb0bafc1f RDI: ffffffffb0bbdb81
      [   27.419986] RBP: ffffffffb0e03e00 R08: 00000006549f8f3f R09: ffffffffb1065200
      [   27.427935] R10: ffffa0c44de27ae4 R11: ffffa0c44de27ac4 R12: ffffa0c5634cb000
      [   27.435894] R13: ffffffffb1065200 R14: 00000006549f8f3f R15: 0000000000000001
      [   27.443854]  ? cpuidle_enter_state+0xbb/0x390
      [   27.448712]  cpuidle_enter+0x2e/0x40
      [   27.452695]  call_cpuidle+0x23/0x40
      [   27.456584]  do_idle+0x1f0/0x270
      [   27.460181]  cpu_startup_entry+0x20/0x30
      [   27.464553]  rest_init+0xd4/0xe0
      [   27.468149]  arch_call_rest_init+0xe/0x1b
      [   27.472619]  start_kernel+0x6bc/0x6e2
      [   27.476764]  x86_64_start_reservations+0x24/0x26
      [   27.481912]  x86_64_start_kernel+0x75/0x79
      [   27.486477]  secondary_startup_64_no_verify+0xb0/0xbb
      [   27.492111] Modules linked in: kvm_amd(+) kvm ipmi_si(+) ipmi_devintf rapl wmi_bmof ipmi_msghandler input_leds ccp k10temp mac_hid sch_fq_codel msr ip_tables x_tables autofs4 btrfs blake2b_generic zstd_compress raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear ast i2c_algo_bit drm_vram_helper drm_ttm_helper ttm drm_kms_helper crct10dif_pclmul crc32_pclmul ghash_clmulni_intel syscopyarea aesni_intel sysfillrect crypto_simd sysimgblt fb_sys_fops cryptd hid_generic cec nvme ahci usbhid drm e1000e nvme_core hid libahci i2c_piix4 wmi
      [   27.551789] CR2: 0000000000000000
      [   27.555482] ---[ end trace 897987dfe93dccc6 ]---
      [   27.560630] RIP: 0010:run_timer_softirq+0x38b/0x4a0
      [   27.566069] Code: 4c 89 f7 e8 37 27 ac 00 49 c7 46 08 00 00 00 00 49 8b 04 24 48 85 c0 74 71 4d 8b 3c 24 4d 89 7e 08 66 90 49 8b 07 49 8b 57 08 <48> 89 02 48 85 c0 74 04 48 89 50 08 49 8b 77 18 41 f6 47 22 20 4c
      [   27.587021] RSP: 0018:ffffc42d00003ee8 EFLAGS: 00010086
      [   27.592848] RAX: dead000000000122 RBX: 0000000000000000 RCX: 0000000000000101
      [   27.600808] RDX: 0000000000000000 RSI: 0000000000000087 RDI: 0000000000000001
      [   27.608765] RBP: ffffc42d00003f70 R08: 0000000000000000 R09: 00000000000003eb
      [   27.616716] R10: ffffa0860cb300d0 R11: ffffa0c44de290b0 R12: ffffc42d00003ef8
      [   27.624673] R13: 00000000fffef200 R14: ffffa0c44de18dc0 R15: ffffa0867a882350
      [   27.632624] FS:  0000000000000000(0000) GS:ffffa0c44de00000(0000) knlGS:0000000000000000
      [   27.641650] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   27.648159] CR2: 0000000000000000 CR3: 000000014569c001 CR4: 0000000000770ef0
      [   27.656119] PKRU: 55555554
      [   27.659133] Kernel panic - not syncing: Fatal exception in interrupt
      [   29.030411] Shutting down cpus with NMI
      [   29.034699] Kernel Offset: 0x2e600000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
      [   29.046790] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
      
      Since unreliable, found by bisecting for KASAN's use-after-free in
      enqueue_timer+0x4f/0x1e0, where the timer callback is called.
      Reported-by: NKim Phillips <kim.phillips@amd.com>
      Signed-off-by: NKim Phillips <kim.phillips@amd.com>
      Fixes: aae74ff9 ("drm/ast: Add detect function support")
      Link: https://lore.kernel.org/lkml/0f7871be-9ca6-5ae4-3a40-5db9a8fb2365@amd.com/
      Cc: Ainux <ainux.wang@gmail.com>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: David Airlie <airlied@redhat.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: sterlingteng@gmail.com
      Cc: chenhuacai@kernel.org
      Cc: Chuck Lever III <chuck.lever@oracle.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Jon Grimm <jon.grimm@amd.com>
      Cc: dri-devel <dri-devel@lists.freedesktop.org>
      Cc: linux-kernel <linux-kernel@vger.kernel.org>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20211021153006.92983-1-kim.phillips@amd.com
      595cb5e0
  7. 09 8月, 2021 1 次提交
  8. 01 8月, 2021 1 次提交
  9. 20 7月, 2021 1 次提交
  10. 24 6月, 2021 1 次提交
  11. 15 6月, 2021 1 次提交
  12. 25 2月, 2021 6 次提交
    • 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 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
    • M
      drm/atomic: Pass the full state to planes atomic_check · 7c11b99a
      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 all the remaining helpers to provide a consistent
      interface, starting with the planes atomic_check.
      
      The conversion was done using the coccinelle script below plus some
      manual changes for vmwgfx, built tested on all the drivers.
      
      @@
      identifier plane, plane_state;
      symbol state;
      @@
      
       struct drm_plane_helper_funcs {
       	...
      	int (*atomic_check)(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_check = 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_check(plane, plane_state)
      +	FUNCS->atomic_check(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, new_plane_state;
      @@
      
       func(struct drm_plane *plane,
      -     struct drm_plane_state *new_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/...>
      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-4-maxime@cerno.tech
      7c11b99a
    • M
      drm: Rename plane atomic_check state names · ba5c1649
      Maxime Ripard 提交于
      Most drivers call the argument to the plane atomic_check hook simply
      state, which is going to conflict with the global atomic state in a
      later rework. Let's rename it to new_plane_state (or new_state depending
      on the convention used in the driver).
      
      This was done using the coccinelle script below, and built tested:
      
      @ plane_atomic_func @
      identifier helpers;
      identifier func;
      @@
      
       static const struct drm_plane_helper_funcs helpers = {
       	.atomic_check = func,
       };
      
      @ has_old_state @
      identifier plane_atomic_func.func;
      identifier plane;
      expression e;
      symbol old_state;
      symbol state;
      @@
      
       func(struct drm_plane *plane, struct drm_plane_state *state)
       {
       	...
       	struct drm_plane_state *old_state = e;
       	...
       }
      
      @ depends on has_old_state @
      identifier plane_atomic_func.func;
      identifier plane;
      symbol old_state;
      @@
      
       func(struct drm_plane *plane,
      -	struct drm_plane_state *state
      +	struct drm_plane_state *new_state
           )
       {
       	<+...
      -	state
      +	new_state
      	...+>
       }
      
      @ has_state @
      identifier plane_atomic_func.func;
      identifier plane;
      symbol state;
      @@
      
       func(struct drm_plane *plane, struct drm_plane_state *state)
       {
       	...
       }
      
      @ depends on has_state @
      identifier plane_atomic_func.func;
      identifier plane;
      symbol old_state;
      @@
      
       func(struct drm_plane *plane,
      -	struct drm_plane_state *state
      +	struct drm_plane_state *new_plane_state
           )
       {
       	<+...
      -	state
      +	new_plane_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-2-maxime@cerno.tech
      ba5c1649
  13. 17 2月, 2021 9 次提交
  14. 06 1月, 2021 1 次提交
  15. 15 12月, 2020 1 次提交
  16. 25 11月, 2020 1 次提交
  17. 10 11月, 2020 1 次提交
    • M
      drm: Use state helper instead of CRTC state pointer · 253f28b6
      Maxime Ripard 提交于
      Many drivers reference the crtc->pointer in order to get the current CRTC
      state in their atomic_begin or atomic_flush hooks, which would be the new
      CRTC state in the global atomic state since _swap_state happened when those
      hooks are run.
      
      Use the drm_atomic_get_new_crtc_state helper to get that state to make it
      more obvious.
      
      This was made using the coccinelle script below:
      
      @ crtc_atomic_func @
      identifier helpers;
      identifier func;
      @@
      
      (
      static struct drm_crtc_helper_funcs helpers = {
      	...,
      	.atomic_begin = func,
      	...,
      };
      |
      static struct drm_crtc_helper_funcs helpers = {
      	...,
      	.atomic_flush = func,
      	...,
      };
      )
      
      @@
      identifier crtc_atomic_func.func;
      identifier crtc, state;
      symbol crtc_state;
      expression e;
      @@
      
        func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
        ...
      - struct tegra_dc_state *crtc_state = e;
      + struct tegra_dc_state *dc_state = e;
        <+...
      -       crtc_state
      +	dc_state
        ...+>
        }
      
      @@
      identifier crtc_atomic_func.func;
      identifier crtc, state;
      symbol crtc_state;
      expression e;
      @@
      
        func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
        ...
      - struct mtk_crtc_state *crtc_state = e;
      + struct mtk_crtc_state *mtk_crtc_state = e;
        <+...
      -       crtc_state
      +	mtk_crtc_state
        ...+>
        }
      
      @ replaces_new_state @
      identifier crtc_atomic_func.func;
      identifier crtc, state, crtc_state;
      @@
      
        func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
        ...
      - struct drm_crtc_state *crtc_state = crtc->state;
      + struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
        ...
       }
      
      @@
      identifier crtc_atomic_func.func;
      identifier crtc, state, crtc_state;
      @@
      
        func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
        struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
        ...
      - crtc->state
      + crtc_state
        ...
       }
      
      @ adds_new_state @
      identifier crtc_atomic_func.func;
      identifier crtc, state;
      @@
      
        func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
      + struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
        ...
      - crtc->state
      + crtc_state
        ...
       }
      
      @ include depends on adds_new_state || replaces_new_state @
      @@
      
       #include <drm/drm_atomic.h>
      
      @ no_include depends on !include && (adds_new_state || replaces_new_state) @
      @@
      
      + #include <drm/drm_atomic.h>
        #include <drm/...>
      Suggested-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NMaxime Ripard <maxime@cerno.tech>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Acked-by: NThomas Zimmermann <tzimmermann@suse.de>
      Cc: "James (Qian) Wang" <james.qian.wang@arm.com>
      Cc: Liviu Dudau <liviu.dudau@arm.com>
      Cc: Mihail Atanassov <mihail.atanassov@arm.com>
      Cc: Brian Starkey <brian.starkey@arm.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Paul Cercueil <paul@crapouillou.net>
      Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
      Cc: Philipp Zabel <p.zabel@pengutronix.de>
      Cc: Sandy Huang <hjc@rock-chips.com>
      Cc: "Heiko Stübner" <heiko@sntech.de>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201105164518.392891-1-maxime@cerno.tech
      253f28b6