1. 04 11月, 2020 1 次提交
  2. 03 11月, 2020 3 次提交
  3. 02 11月, 2020 6 次提交
    • J
      drm: Remove SCATTERLIST_MAX_SEGMENT · 7a60c2dd
      Jason Gunthorpe 提交于
      Since commit 9a40401c ("lib/scatterlist: Do not limit max_segment to
      PAGE_ALIGNED values") the max_segment input to sg_alloc_table_from_pages()
      does not have to be any special value. The new algorithm will always
      create something less than what the user provides. Thus eliminate this
      confusing constant.
      
      - vmwgfx should use the HW capability, not mix in the OS page size for
        calling dma_set_max_seg_size()
      
      - i915 uses i915_sg_segment_size() both for sg_alloc_table_from_pages
        and for some open coded sgl construction. This doesn't change the value
        since rounddown(size, UINT_MAX) == SCATTERLIST_MAX_SEGMENT
      
      - drm_prime_pages_to_sg uses it as a default if max_segment is zero,
        UINT_MAX is fine to use directly.
      
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Thomas Hellstrom <thellstrom@vmware.com>
      Cc: Qian Cai <cai@lca.pw>
      Cc: "Ursulin, Tvrtko" <tvrtko.ursulin@intel.com>
      Suggested-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/0-v1-44733fccd781+13d-rm_scatterlist_max_jgg@nvidia.com
      7a60c2dd
    • B
      gpu/drm: delete same check in if condition · 95d7a1a6
      Bernard Zhao 提交于
      In function drm_bridge_connector_get_modes_edid, drm_edid_is_valid
      will check weather (!edid), no need to check again in the if
      branch.
      Signed-off-by: NBernard Zhao <bernard@vivo.com>
      Signed-off-by: NThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201102030736.3833-1-bernard@vivo.com
      95d7a1a6
    • K
      drm/ast: Support 1600x900 with 108MHz PCLK · 9bb7b689
      KuoHsiang Chou 提交于
      [New] Create the setting for 1600x900 @60Hz refresh rate
            by 108MHz pixel-clock.
      Signed-off-by: NKuoHsiang Chou <kuohsiang_chou@aspeedtech.com>
      Signed-off-by: NThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201030074212.22401-1-kuohsiang_chou@aspeedtech.com
      9bb7b689
    • M
      drm/atomic: Pass the full state to CRTC atomic begin and flush · f6ebe9f9
      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 start convert all the remaining helpers to provide a consistent
      interface, starting with the CRTC's atomic_begin and atomic_flush.
      
      The conversion was done using the coccinelle script below, built tested on
      all the drivers and actually tested on vc4.
      
      virtual report
      
      @@
      struct drm_crtc_helper_funcs *FUNCS;
      identifier old_crtc_state, old_state;
      identifier crtc;
      identifier f;
      @@
      
       f(struct drm_crtc_state *old_crtc_state)
       {
      	...
       	struct drm_atomic_state *old_state = old_crtc_state->state;
      	<...
      -	FUNCS->atomic_begin(crtc, old_crtc_state);
      +	FUNCS->atomic_begin(crtc, old_state);
      	...>
       }
      
      @@
      struct drm_crtc_helper_funcs *FUNCS;
      identifier old_crtc_state, old_state;
      identifier crtc;
      identifier f;
      @@
      
       f(struct drm_crtc_state *old_crtc_state)
       {
      	...
       	struct drm_atomic_state *old_state = old_crtc_state->state;
      	<...
      -	FUNCS->atomic_flush(crtc, old_crtc_state);
      +	FUNCS->atomic_flush(crtc, old_state);
      	...>
       }
      
      @@
      struct drm_crtc_helper_funcs *FUNCS;
      struct drm_crtc *crtc;
      struct drm_crtc_state *crtc_state;
      identifier dev, state;
      identifier f;
      @@
      
       f(struct drm_device *dev, struct drm_atomic_state *state, ...)
       {
      	<...
      -	FUNCS->atomic_begin(crtc, crtc_state);
      +	FUNCS->atomic_begin(crtc, state);
      	...>
       }
      
      @@
      struct drm_crtc_helper_funcs *FUNCS;
      struct drm_crtc *crtc;
      struct drm_crtc_state *crtc_state;
      identifier dev, state;
      identifier f;
      @@
      
       f(struct drm_device *dev, struct drm_atomic_state *state, ...)
       {
      	<...
      -	FUNCS->atomic_flush(crtc, crtc_state);
      +	FUNCS->atomic_flush(crtc, state);
      	...>
       }
      
      @@
      identifier crtc, old_state;
      @@
      
       struct drm_crtc_helper_funcs {
      	...
      -	void (*atomic_begin)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
      +	void (*atomic_begin)(struct drm_crtc *crtc, struct drm_atomic_state *state);
      	...
      -	void (*atomic_flush)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
      +	void (*atomic_flush)(struct drm_crtc *crtc, struct drm_atomic_state *state);
      	...
      }
      
      @ 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,
      	...,
      };
      )
      
      @ ignores_old_state @
      identifier crtc_atomic_func.func;
      identifier crtc, old_state;
      @@
      
      void func(struct drm_crtc *crtc,
      		struct drm_crtc_state *old_state)
      {
      	... when != old_state
      }
      
      @ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
      identifier crtc_atomic_func.func;
      identifier crtc, old_state;
      @@
      
      void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
      {
      +	struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
      	...
      }
      
      @ depends on crtc_atomic_func @
      identifier crtc_atomic_func.func;
      expression E;
      type T;
      @@
      
      void func(...)
      {
      	...
      -	T state = E;
      +	T crtc_state = E;
      	<+...
      -	state
      +	crtc_state
      	...+>
      
      }
      
      @ depends on crtc_atomic_func @
      identifier crtc_atomic_func.func;
      type T;
      @@
      
      void func(...)
      {
      	...
      -	T state;
      +	T crtc_state;
      	<+...
      -	state
      +	crtc_state
      	...+>
      
      }
      
      @@
      identifier old_state;
      identifier crtc;
      @@
      
       void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
      -			   struct drm_crtc_state *old_state
      +			   struct drm_atomic_state *state
      			   )
      {
      +	struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
      	...
      }
      
      @@
      identifier old_state;
      identifier crtc;
      @@
      
       void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
      -			   struct drm_crtc_state *old_state
      +			   struct drm_atomic_state *state
      			   );
      
      @@
      identifier old_state;
      identifier crtc;
      @@
      
       void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
      -			   struct drm_crtc_state *old_state
      +			   struct drm_atomic_state *state
      			   )
      {
      	...
      }
      
      @@
      identifier old_state;
      identifier crtc;
      @@
      
       void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
      -			   struct drm_crtc_state *old_state
      +			   struct drm_atomic_state *state
      			   );
      
      @@
      identifier old_state;
      identifier crtc;
      @@
      
       void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
      -			   struct drm_crtc_state *old_state
      +			   struct drm_atomic_state *state
      			   )
      {
      	...
      }
      
      @@
      identifier old_state;
      identifier crtc;
      @@
      
       void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
      -			   struct drm_crtc_state *old_state
      +			   struct drm_atomic_state *state
      			   );
      
      @ depends on crtc_atomic_func @
      identifier crtc_atomic_func.func;
      identifier old_state;
      identifier crtc;
      @@
      
      void func(struct drm_crtc *crtc,
      -	       struct drm_crtc_state *old_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/...>
      Signed-off-by: NMaxime Ripard <maxime@cerno.tech>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Acked-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Acked-by: NThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-2-maxime@cerno.tech
      f6ebe9f9
    • M
      drm/atomic: Pass the full state to CRTC atomic_check · 29b77ad7
      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 start convert all the remaining helpers to provide a consistent
      interface, starting with the CRTC's atomic_check.
      
      The conversion was done using the coccinelle script below,
      built tested on all the drivers and actually tested on vc4.
      
      virtual report
      
      @@
      struct drm_crtc_helper_funcs *FUNCS;
      struct drm_crtc *crtc;
      struct drm_crtc_state *crtc_state;
      identifier dev, state;
      identifier ret, f;
      @@
      
       f(struct drm_device *dev, struct drm_atomic_state *state)
       {
      	<...
      -	ret = FUNCS->atomic_check(crtc, crtc_state);
      +	ret = FUNCS->atomic_check(crtc, state);
      	...>
       }
      
      @@
      identifier crtc, new_state;
      @@
      
       struct drm_crtc_helper_funcs {
       	...
      -	int (*atomic_check)(struct drm_crtc *crtc, struct drm_crtc_state *new_state);
      +	int (*atomic_check)(struct drm_crtc *crtc, struct drm_atomic_state *state);
       	...
      }
      
      @ crtc_atomic_func @
      identifier helpers;
      identifier func;
      @@
      
      static struct drm_crtc_helper_funcs helpers = {
      	...,
      	.atomic_check = func,
      	...,
      };
      
      @ ignores_new_state @
      identifier crtc_atomic_func.func;
      identifier crtc, new_state;
      @@
      
       int func(struct drm_crtc *crtc,
      		struct drm_crtc_state *new_state)
       {
      	... when != new_state
       }
      
      @ adds_new_state depends on crtc_atomic_func && !ignores_new_state @
      identifier crtc_atomic_func.func;
      identifier crtc, new_state;
      @@
      
       int func(struct drm_crtc *crtc, struct drm_crtc_state *new_state)
       {
      +	struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
       	...
       }
      
      @ depends on crtc_atomic_func @
      identifier crtc_atomic_func.func;
      expression E;
      type T;
      @@
      
       int func(...)
       {
      	...
      -	T state = E;
      +	T crtc_state = E;
       	<+...
      -	state
      +	crtc_state
       	...+>
       }
      
      @ depends on crtc_atomic_func @
      identifier crtc_atomic_func.func;
      type T;
      @@
      
       int func(...)
       {
       	...
      -	T state;
      +	T crtc_state;
       	<+...
      -	state
      +	crtc_state
       	...+>
       }
      
      @ depends on crtc_atomic_func @
      identifier crtc_atomic_func.func;
      identifier new_state;
      identifier crtc;
      @@
      
       int func(struct drm_crtc *crtc,
      -	       struct drm_crtc_state *new_state
      +	       struct drm_atomic_state *state
      	       )
       { ... }
      
      @@
      identifier new_state;
      identifier crtc;
      @@
      
       int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
      -                             struct drm_crtc_state *new_state
      +                             struct drm_atomic_state *state
                     )
       {
      +       struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
      	...
       }
      
      @@
      identifier new_state;
      identifier crtc;
      @@
      
       int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
      -                             struct drm_crtc_state *new_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/...>
      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>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-1-maxime@cerno.tech
      29b77ad7
    • M
      drm/nouveau/ttm: Add limits.h · 95f4f40a
      Maxime Ripard 提交于
      It seems that a recent commit broke the nouveau compilation when swiotlb is
      disabled (which is the case on our ARM defconfig for example).
      
      Daniel says
      
      """
      Since the proper fix is maybe stuck in the usual "drm abuses swiotlb
      internals" bikeshed, maybe best if we push a fix to including limits.h
      in nouveau and call it done?
      """
      
      So let's go down the simplest path to fix our build, and goes back to it
      later if needed.
      
      Link: https://patchwork.freedesktop.org/patch/397835/
      Fixes: 4dbafbd3 ("drm/nouveu: fix swiotlb include")
      Acked-by: NDaniel Vetter <daniel@ffwll.ch>
      Signed-off-by: NMaxime Ripard <maxime@cerno.tech>
      95f4f40a
  4. 31 10月, 2020 1 次提交
  5. 02 11月, 2020 1 次提交
  6. 30 10月, 2020 12 次提交
  7. 29 10月, 2020 12 次提交
  8. 28 10月, 2020 4 次提交
    • D
      drm/shme-helpers: Fix dma_buf_mmap forwarding bug · f49a51bf
      Daniel Vetter 提交于
      When we forward an mmap to the dma_buf exporter, they get to own
      everything. Unfortunately drm_gem_mmap_obj() overwrote
      vma->vm_private_data after the driver callback, wreaking the
      exporter complete. This was noticed because vb2_common_vm_close blew
      up on mali gpu with panfrost after commit 26d3ac3c
      ("drm/shmem-helpers: Redirect mmap for imported dma-buf").
      
      Unfortunately drm_gem_mmap_obj also acquires a surplus reference that
      we need to drop in shmem helpers, which is a bit of a mislayer
      situation. Maybe the entire dma_buf_mmap forwarding should be pulled
      into core gem code.
      
      Note that the only two other drivers which forward mmap in their own
      code (etnaviv and exynos) get this somewhat right by overwriting the
      gem mmap code. But they seem to still have the leak. This might be a
      good excuse to move these drivers over to shmem helpers completely.
      Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
      Acked-by: NChristian König <christian.koenig@amd.com>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Russell King <linux+etnaviv@armlinux.org.uk>
      Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
      Cc: Inki Dae <inki.dae@samsung.com>
      Cc: Joonyoung Shim <jy0922.shim@samsung.com>
      Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
      Cc: Kyungmin Park <kyungmin.park@samsung.com>
      Fixes: 26d3ac3c ("drm/shmem-helpers: Redirect mmap for imported dma-buf")
      Cc: Boris Brezillon <boris.brezillon@collabora.com>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: dri-devel@lists.freedesktop.org
      Cc: linux-media@vger.kernel.org
      Cc: linaro-mm-sig@lists.linaro.org
      Cc: <stable@vger.kernel.org> # v5.9+
      Reported-and-tested-by: piotr.oniszczuk@gmail.com
      Cc: piotr.oniszczuk@gmail.com
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201027214922.3566743-1-daniel.vetter@ffwll.ch
      f49a51bf
    • M
      drm/vc4: hdmi: Avoid sleeping in atomic context · 58d04369
      Maxime Ripard 提交于
      When running the trigger hook, ALSA by default will take a spinlock, and
      thus will run the trigger hook in atomic context.
      
      However, our HDMI driver will send the infoframes as part of the trigger
      hook, and part of that process is to wait for a bit to be cleared for up to
      100ms. To be nicer to the system, that wait has some usleep_range that
      interact poorly with the atomic context.
      
      There's several ways we can fix this, but the more obvious one is to make
      ALSA take a mutex instead by setting the nonatomic flag on the DAI link.
      That doesn't work though, since now the cyclic callback installed by the
      dmaengine helpers in ALSA will take a mutex, while that callback is run by
      dmaengine's virt-chan code in a tasklet where sleeping is not allowed
      either.
      
      Given the delay we need to poll the bit for, changing the usleep_range for
      a udelay and keep running it from a context where interrupts are disabled
      is not really a good option either.
      
      However, we can move the infoframe setup code in the hw_params hook, like
      is usually done in other HDMI controllers, that isn't protected by a
      spinlock and thus where we can sleep. Infoframes will be sent on a regular
      basis anyway, and since hw_params is where the audio parameters that end up
      in the infoframes are setup, this also makes a bit more sense.
      
      Fixes: bb7d7856 ("drm/vc4: Add HDMI audio support")
      Suggested-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NMaxime Ripard <maxime@cerno.tech>
      Reviewed-by: NMark Brown <broonie@kernel.org>
      Reviewed-by: NTakashi Iwai <tiwai@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201027101558.427256-1-maxime@cerno.tech
      58d04369
    • A
      drm/tilcdc: avoid 'make W=2' build failure · 65b7da27
      Arnd Bergmann 提交于
      The -Wmissing-field-initializer warning when building with W=2
      turns into an error because tilcdc is built with -Werror:
      
      drm/tilcdc/tilcdc_drv.c:431:33: error: missing field 'data' initializer [-Werror,-Wmissing-field-initializers] { "regs", tilcdc_regs_show, 0 },
      drm/tilcdc/tilcdc_drv.c:432:33: error: missing field 'data' initializer [-Werror,-Wmissing-field-initializers] { "mm",   tilcdc_mm_show,   0 },
      
      Add the missing field initializers to address the warning.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJyri Sarha <jsarha@ti.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201026194110.3817470-1-arnd@kernel.org
      65b7da27
    • A
      drm/amdgpu/pm: fix the fan speed in fan1_input in manual mode for navi1x · 65d437b8
      Alex Deucher 提交于
      It has been confirmed that the SMU metrics table should always reflect
      the current fan speed even in manual mode.
      
      Fixes: 3033e9f1c2de ("drm/amdgpu/swsmu: handle manual fan readback on SMU11")
      Reviewed-by: NEvan Quan <evan.quan@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      65d437b8