[PATCH 3/4] drm/plane: add drmm_universal_plane_alloc()

kernel test robot lkp at intel.com
Wed Aug 26 19:47:13 UTC 2020


Hi Philipp,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on tegra-drm/drm/tegra/for-next drm-tip/drm-tip linus/master drm-exynos/exynos-drm-next v5.9-rc2 next-20200826]
[cannot apply to 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/Philipp-Zabel/drm-add-drmm_encoder_alloc/20200826-203629
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-a003-20200826 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 7cfcecece0e0430937cf529ce74d3a071a4dedc6)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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 >>):

>> drivers/gpu/drm/drm_plane.c:156:5: warning: no previous prototype for function '__drm_universal_plane_init' [-Wmissing-prototypes]
   int __drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
       ^
   drivers/gpu/drm/drm_plane.c:156:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int __drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
   ^
   static 
   1 warning generated.

# https://github.com/0day-ci/linux/commit/d809a51da3d2939a84ecf6b4ada8f5be6c3ecb35
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Philipp-Zabel/drm-add-drmm_encoder_alloc/20200826-203629
git checkout d809a51da3d2939a84ecf6b4ada8f5be6c3ecb35
vim +/__drm_universal_plane_init +156 drivers/gpu/drm/drm_plane.c

   155	
 > 156	int __drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
   157				       uint32_t possible_crtcs,
   158				       const struct drm_plane_funcs *funcs,
   159				       const uint32_t *formats, unsigned int format_count,
   160				       const uint64_t *format_modifiers,
   161				       enum drm_plane_type type,
   162				       const char *name, va_list ap)
   163	{
   164		struct drm_mode_config *config = &dev->mode_config;
   165		unsigned int format_modifier_count = 0;
   166		int ret;
   167	
   168		/* plane index is used with 32bit bitmasks */
   169		if (WARN_ON(config->num_total_plane >= 32))
   170			return -EINVAL;
   171	
   172		WARN_ON(drm_drv_uses_atomic_modeset(dev) &&
   173			(!funcs->atomic_destroy_state ||
   174			 !funcs->atomic_duplicate_state));
   175	
   176		ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE);
   177		if (ret)
   178			return ret;
   179	
   180		drm_modeset_lock_init(&plane->mutex);
   181	
   182		plane->base.properties = &plane->properties;
   183		plane->dev = dev;
   184		plane->funcs = funcs;
   185		plane->format_types = kmalloc_array(format_count, sizeof(uint32_t),
   186						    GFP_KERNEL);
   187		if (!plane->format_types) {
   188			DRM_DEBUG_KMS("out of memory when allocating plane\n");
   189			drm_mode_object_unregister(dev, &plane->base);
   190			return -ENOMEM;
   191		}
   192	
   193		/*
   194		 * First driver to need more than 64 formats needs to fix this. Each
   195		 * format is encoded as a bit and the current code only supports a u64.
   196		 */
   197		if (WARN_ON(format_count > 64))
   198			return -EINVAL;
   199	
   200		if (format_modifiers) {
   201			const uint64_t *temp_modifiers = format_modifiers;
   202	
   203			while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID)
   204				format_modifier_count++;
   205		}
   206	
   207		if (format_modifier_count)
   208			config->allow_fb_modifiers = true;
   209	
   210		plane->modifier_count = format_modifier_count;
   211		plane->modifiers = kmalloc_array(format_modifier_count,
   212						 sizeof(format_modifiers[0]),
   213						 GFP_KERNEL);
   214	
   215		if (format_modifier_count && !plane->modifiers) {
   216			DRM_DEBUG_KMS("out of memory when allocating plane\n");
   217			kfree(plane->format_types);
   218			drm_mode_object_unregister(dev, &plane->base);
   219			return -ENOMEM;
   220		}
   221	
   222		if (name) {
   223			plane->name = kvasprintf(GFP_KERNEL, name, ap);
   224		} else {
   225			plane->name = kasprintf(GFP_KERNEL, "plane-%d",
   226						drm_num_planes(dev));
   227		}
   228		if (!plane->name) {
   229			kfree(plane->format_types);
   230			kfree(plane->modifiers);
   231			drm_mode_object_unregister(dev, &plane->base);
   232			return -ENOMEM;
   233		}
   234	
   235		memcpy(plane->format_types, formats, format_count * sizeof(uint32_t));
   236		plane->format_count = format_count;
   237		memcpy(plane->modifiers, format_modifiers,
   238		       format_modifier_count * sizeof(format_modifiers[0]));
   239		plane->possible_crtcs = possible_crtcs;
   240		plane->type = type;
   241	
   242		list_add_tail(&plane->head, &config->plane_list);
   243		plane->index = config->num_total_plane++;
   244	
   245		drm_object_attach_property(&plane->base,
   246					   config->plane_type_property,
   247					   plane->type);
   248	
   249		if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
   250			drm_object_attach_property(&plane->base, config->prop_fb_id, 0);
   251			drm_object_attach_property(&plane->base, config->prop_in_fence_fd, -1);
   252			drm_object_attach_property(&plane->base, config->prop_crtc_id, 0);
   253			drm_object_attach_property(&plane->base, config->prop_crtc_x, 0);
   254			drm_object_attach_property(&plane->base, config->prop_crtc_y, 0);
   255			drm_object_attach_property(&plane->base, config->prop_crtc_w, 0);
   256			drm_object_attach_property(&plane->base, config->prop_crtc_h, 0);
   257			drm_object_attach_property(&plane->base, config->prop_src_x, 0);
   258			drm_object_attach_property(&plane->base, config->prop_src_y, 0);
   259			drm_object_attach_property(&plane->base, config->prop_src_w, 0);
   260			drm_object_attach_property(&plane->base, config->prop_src_h, 0);
   261		}
   262	
   263		if (config->allow_fb_modifiers)
   264			create_in_format_blob(dev, plane);
   265	
   266		return 0;
   267	}
   268	

---
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: 47458 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20200827/685ed903/attachment-0001.gz>


More information about the dri-devel mailing list