[PATCH 1/6] drm: Add connector atomic_begin/atomic_flush

kernel test robot lkp at intel.com
Wed Aug 12 10:16:19 UTC 2020


Hi Algea,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[also build test WARNING on linus/master drm-exynos/exynos-drm-next v5.8 next-20200812]
[cannot apply to rockchip/for-next drm-intel/for-linux-next tegra-drm/drm/tegra/for-next drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Algea-Cao/Support-change-dw-hdmi-output-color/20200812-164647
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: m68k-randconfig-s032-20200812 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-168-g9554805c-dirty
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=m68k 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/err.h:5,
                    from include/linux/dma-fence.h:16,
                    from drivers/gpu/drm/drm_atomic_helper.c:28:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
     169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
         |                                                 ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |  ^~~~~~
   include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |          ^~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic_helper.c: In function 'drm_atomic_helper_commit_planes':
>> drivers/gpu/drm/drm_atomic_helper.c:2475:52: warning: variable 'new_connector_state' set but not used [-Wunused-but-set-variable]
    2475 |  struct drm_connector_state *old_connector_state, *new_connector_state;
         |                                                    ^~~~~~~~~~~~~~~~~~~

vim +/new_connector_state +2475 drivers/gpu/drm/drm_atomic_helper.c

  2428	
  2429	/**
  2430	 * drm_atomic_helper_commit_planes - commit plane state
  2431	 * @dev: DRM device
  2432	 * @old_state: atomic state object with old state structures
  2433	 * @flags: flags for committing plane state
  2434	 *
  2435	 * This function commits the new plane state using the plane and atomic helper
  2436	 * functions for planes and CRTCs. It assumes that the atomic state has already
  2437	 * been pushed into the relevant object state pointers, since this step can no
  2438	 * longer fail.
  2439	 *
  2440	 * It still requires the global state object @old_state to know which planes and
  2441	 * crtcs need to be updated though.
  2442	 *
  2443	 * Note that this function does all plane updates across all CRTCs in one step.
  2444	 * If the hardware can't support this approach look at
  2445	 * drm_atomic_helper_commit_planes_on_crtc() instead.
  2446	 *
  2447	 * Plane parameters can be updated by applications while the associated CRTC is
  2448	 * disabled. The DRM/KMS core will store the parameters in the plane state,
  2449	 * which will be available to the driver when the CRTC is turned on. As a result
  2450	 * most drivers don't need to be immediately notified of plane updates for a
  2451	 * disabled CRTC.
  2452	 *
  2453	 * Unless otherwise needed, drivers are advised to set the ACTIVE_ONLY flag in
  2454	 * @flags in order not to receive plane update notifications related to a
  2455	 * disabled CRTC. This avoids the need to manually ignore plane updates in
  2456	 * driver code when the driver and/or hardware can't or just don't need to deal
  2457	 * with updates on disabled CRTCs, for example when supporting runtime PM.
  2458	 *
  2459	 * Drivers may set the NO_DISABLE_AFTER_MODESET flag in @flags if the relevant
  2460	 * display controllers require to disable a CRTC's planes when the CRTC is
  2461	 * disabled. This function would skip the &drm_plane_helper_funcs.atomic_disable
  2462	 * call for a plane if the CRTC of the old plane state needs a modesetting
  2463	 * operation. Of course, the drivers need to disable the planes in their CRTC
  2464	 * disable callbacks since no one else would do that.
  2465	 *
  2466	 * The drm_atomic_helper_commit() default implementation doesn't set the
  2467	 * ACTIVE_ONLY flag to most closely match the behaviour of the legacy helpers.
  2468	 * This should not be copied blindly by drivers.
  2469	 */
  2470	void drm_atomic_helper_commit_planes(struct drm_device *dev,
  2471					     struct drm_atomic_state *old_state,
  2472					     uint32_t flags)
  2473	{
  2474		struct drm_connector *connector;
> 2475		struct drm_connector_state *old_connector_state, *new_connector_state;
  2476		struct drm_crtc *crtc;
  2477		struct drm_crtc_state *old_crtc_state, *new_crtc_state;
  2478		struct drm_plane *plane;
  2479		struct drm_plane_state *old_plane_state, *new_plane_state;
  2480		int i;
  2481		bool active_only = flags & DRM_PLANE_COMMIT_ACTIVE_ONLY;
  2482		bool no_disable = flags & DRM_PLANE_COMMIT_NO_DISABLE_AFTER_MODESET;
  2483	
  2484		for_each_oldnew_connector_in_state(old_state, connector,
  2485						   old_connector_state,
  2486						   new_connector_state, i) {
  2487			const struct drm_connector_helper_funcs *funcs;
  2488	
  2489			if (!connector->state->crtc)
  2490				continue;
  2491	
  2492			if (!connector->state->crtc->state->active)
  2493				continue;
  2494	
  2495			funcs = connector->helper_private;
  2496	
  2497			if (!funcs || !funcs->atomic_begin)
  2498				continue;
  2499	
  2500			DRM_DEBUG_ATOMIC("flush beginning [CONNECTOR:%d:%s]\n",
  2501					 connector->base.id, connector->name);
  2502	
  2503			funcs->atomic_begin(connector, old_connector_state);
  2504		}
  2505	
  2506		for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) {
  2507			const struct drm_crtc_helper_funcs *funcs;
  2508	
  2509			funcs = crtc->helper_private;
  2510	
  2511			if (!funcs || !funcs->atomic_begin)
  2512				continue;
  2513	
  2514			if (active_only && !new_crtc_state->active)
  2515				continue;
  2516	
  2517			funcs->atomic_begin(crtc, old_crtc_state);
  2518		}
  2519	
  2520		for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, new_plane_state, i) {
  2521			const struct drm_plane_helper_funcs *funcs;
  2522			bool disabling;
  2523	
  2524			funcs = plane->helper_private;
  2525	
  2526			if (!funcs)
  2527				continue;
  2528	
  2529			disabling = drm_atomic_plane_disabling(old_plane_state,
  2530							       new_plane_state);
  2531	
  2532			if (active_only) {
  2533				/*
  2534				 * Skip planes related to inactive CRTCs. If the plane
  2535				 * is enabled use the state of the current CRTC. If the
  2536				 * plane is being disabled use the state of the old
  2537				 * CRTC to avoid skipping planes being disabled on an
  2538				 * active CRTC.
  2539				 */
  2540				if (!disabling && !plane_crtc_active(new_plane_state))
  2541					continue;
  2542				if (disabling && !plane_crtc_active(old_plane_state))
  2543					continue;
  2544			}
  2545	
  2546			/*
  2547			 * Special-case disabling the plane if drivers support it.
  2548			 */
  2549			if (disabling && funcs->atomic_disable) {
  2550				struct drm_crtc_state *crtc_state;
  2551	
  2552				crtc_state = old_plane_state->crtc->state;
  2553	
  2554				if (drm_atomic_crtc_needs_modeset(crtc_state) &&
  2555				    no_disable)
  2556					continue;
  2557	
  2558				funcs->atomic_disable(plane, old_plane_state);
  2559			} else if (new_plane_state->crtc || disabling) {
  2560				funcs->atomic_update(plane, old_plane_state);
  2561			}
  2562		}
  2563	
  2564		for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) {
  2565			const struct drm_crtc_helper_funcs *funcs;
  2566	
  2567			funcs = crtc->helper_private;
  2568	
  2569			if (!funcs || !funcs->atomic_flush)
  2570				continue;
  2571	
  2572			if (active_only && !new_crtc_state->active)
  2573				continue;
  2574	
  2575			funcs->atomic_flush(crtc, old_crtc_state);
  2576		}
  2577	
  2578		for_each_oldnew_connector_in_state(old_state, connector,
  2579						   old_connector_state,
  2580						   new_connector_state, i) {
  2581			const struct drm_connector_helper_funcs *funcs;
  2582	
  2583			if (!connector->state->crtc)
  2584				continue;
  2585	
  2586			if (!connector->state->crtc->state->active)
  2587				continue;
  2588	
  2589			funcs = connector->helper_private;
  2590	
  2591			if (!funcs || !funcs->atomic_flush)
  2592				continue;
  2593	
  2594			DRM_DEBUG_ATOMIC("flushing [CONNECTOR:%d:%s]\n",
  2595					 connector->base.id, connector->name);
  2596	
  2597			funcs->atomic_flush(connector, old_connector_state);
  2598		}
  2599	}
  2600	EXPORT_SYMBOL(drm_atomic_helper_commit_planes);
  2601	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 22464 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20200812/f0802857/attachment-0001.gz>


More information about the dri-devel mailing list