[PATCH v4 8/8] drm/omap: add OMAP_BO flags to affect buffer allocation

kbuild test robot lkp at intel.com
Fri Oct 11 07:57:16 UTC 2019


Hi Jean-Jacques,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.4-rc2 next-20191010]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Jean-Jacques-Hiblot/drm-omap-OMAP_BO-flags/20191011-134859
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=arm 

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

All errors (new ones prefixed by >>):

   drivers/gpu/drm/omapdrm/omap_gem.c: In function 'omap_gem_new':
>> drivers/gpu/drm/omapdrm/omap_gem.c:1310:3: error: implicit declaration of function 'dma_free_writecombine'; did you mean 'pgprot_writecombine'? [-Werror=implicit-function-declaration]
      dma_free_writecombine(dev->dev, size,
      ^~~~~~~~~~~~~~~~~~~~~
      pgprot_writecombine
   cc1: some warnings being treated as errors

vim +1310 drivers/gpu/drm/omapdrm/omap_gem.c

  1179	
  1180	/**
  1181	 * omap_gem_new() - Create a new GEM buffer
  1182	 * @dev: The DRM device
  1183	 * @gsize: The requested size for the GEM buffer. If the buffer is tiled
  1184	 *         (2D buffer), the size is a pair of values: height and width
  1185	 *         expressed in pixels. If the buffers is not tiled, it is expressed
  1186	 *         in bytes.
  1187	 * @flags: Flags give additionnal information about the allocation:
  1188	 *         OMAP_BO_TILED_x: use the TILER (2D buffers). The TILER container
  1189	 *              unit can be 8, 16 or 32 bits. Cache is always disabled for
  1190	 *              tiled buffers.
  1191	 *         OMAP_BO_SCANOUT: Scannout buffer, consummable by the DSS
  1192	 *         OMAP_BO_CACHED: Buffer CPU caching mode: cached
  1193	 *         OMAP_BO_WC: Buffer CPU caching mode: write-combined
  1194	 *         OMAP_BO_UNCACHED: Buffer CPU caching mode: uncached
  1195	 *         OMAP_BO_MEM_CONTIG: The driver will use dma_alloc to get the memory.
  1196	 *              This can be used to avoid DMM if the userspace knows it needs
  1197	 *              more than 128M of memory at the same time.
  1198	 *         OMAP_BO_MEM_DMM: The driver will use DMM to get the memory. There's
  1199	 *              not much use for this flag at the moment, as on platforms with
  1200	 *              DMM it is used by default, but it's here for completeness.
  1201	 *         OMAP_BO_MEM_PIN: The driver will pin the memory at alloc time, and
  1202	 *              keep it pinned. This can be used to 1) get an error at alloc
  1203	 *              time if DMM space is full, and 2) get rid of the constant
  1204	 *              pin/unpin operations which may have some effect on performance.
  1205	 *
  1206	 * Return: The GEM buffer or NULL if the allocation failed
  1207	 */
  1208	struct drm_gem_object *omap_gem_new(struct drm_device *dev,
  1209			union omap_gem_size gsize, u32 flags)
  1210	{
  1211		struct omap_drm_private *priv = dev->dev_private;
  1212		struct omap_gem_object *omap_obj;
  1213		struct drm_gem_object *obj;
  1214		struct address_space *mapping;
  1215		size_t size;
  1216		int ret;
  1217	
  1218		if (!omap_gem_validate_flags(dev, flags))
  1219			return NULL;
  1220	
  1221		/* Validate the flags and compute the memory and cache flags. */
  1222		if (flags & OMAP_BO_TILED_MASK) {
  1223			/*
  1224			 * Tiled buffers are always shmem paged backed. When they are
  1225			 * scanned out, they are remapped into DMM/TILER.
  1226			 */
  1227			flags |= OMAP_BO_MEM_SHMEM;
  1228	
  1229			/*
  1230			 * Currently don't allow cached buffers. There is some caching
  1231			 * stuff that needs to be handled better.
  1232			 */
  1233			flags &= ~(OMAP_BO_CACHED|OMAP_BO_WC|OMAP_BO_UNCACHED);
  1234			flags |= tiler_get_cpu_cache_flags();
  1235		} else if ((flags & OMAP_BO_MEM_CONTIG) ||
  1236			((flags & OMAP_BO_SCANOUT) && !priv->has_dmm)) {
  1237			/*
  1238			 * If we don't have DMM, we must allocate scanout buffers
  1239			 * from contiguous DMA memory.
  1240			 */
  1241			flags |= OMAP_BO_MEM_DMA_API;
  1242		} else if (!(flags & OMAP_BO_MEM_DMABUF)) {
  1243			/*
  1244			 * All other buffers not backed by dma_buf are shmem-backed.
  1245			 */
  1246			flags |= OMAP_BO_MEM_SHMEM;
  1247		}
  1248	
  1249		/* Allocate the initialize the OMAP GEM object. */
  1250		omap_obj = kzalloc(sizeof(*omap_obj), GFP_KERNEL);
  1251		if (!omap_obj)
  1252			return NULL;
  1253	
  1254		obj = &omap_obj->base;
  1255		omap_obj->flags = flags;
  1256		mutex_init(&omap_obj->lock);
  1257	
  1258		if (flags & OMAP_BO_TILED_MASK) {
  1259			/*
  1260			 * For tiled buffers align dimensions to slot boundaries and
  1261			 * calculate size based on aligned dimensions.
  1262			 */
  1263			tiler_align(gem2fmt(flags), &gsize.tiled.width,
  1264				    &gsize.tiled.height);
  1265	
  1266			size = tiler_size(gem2fmt(flags), gsize.tiled.width,
  1267					  gsize.tiled.height);
  1268	
  1269			omap_obj->width = gsize.tiled.width;
  1270			omap_obj->height = gsize.tiled.height;
  1271		} else {
  1272			size = PAGE_ALIGN(gsize.bytes);
  1273		}
  1274	
  1275		/* Initialize the GEM object. */
  1276		if (!(flags & OMAP_BO_MEM_SHMEM)) {
  1277			drm_gem_private_object_init(dev, obj, size);
  1278		} else {
  1279			ret = drm_gem_object_init(dev, obj, size);
  1280			if (ret)
  1281				goto err_free;
  1282	
  1283			mapping = obj->filp->f_mapping;
  1284			mapping_set_gfp_mask(mapping, GFP_USER | __GFP_DMA32);
  1285		}
  1286	
  1287		/* Allocate memory if needed. */
  1288		if (flags & OMAP_BO_MEM_DMA_API) {
  1289			omap_obj->vaddr = dma_alloc_wc(dev->dev, size,
  1290						       &omap_obj->dma_addr,
  1291						       GFP_KERNEL);
  1292			if (!omap_obj->vaddr)
  1293				goto err_release;
  1294		}
  1295	
  1296		if (flags & OMAP_BO_MEM_PIN) {
  1297			ret = omap_gem_pin(obj, NULL);
  1298			if (ret)
  1299				goto err_free_dma;
  1300		}
  1301	
  1302		mutex_lock(&priv->list_lock);
  1303		list_add(&omap_obj->mm_list, &priv->obj_list);
  1304		mutex_unlock(&priv->list_lock);
  1305	
  1306		return obj;
  1307	
  1308	err_free_dma:
  1309		if (flags & OMAP_BO_MEM_DMA_API)
> 1310			dma_free_writecombine(dev->dev, size,
  1311					omap_obj->vaddr, omap_obj->dma_addr);
  1312	err_release:
  1313		drm_gem_object_release(obj);
  1314	err_free:
  1315		kfree(omap_obj);
  1316		return NULL;
  1317	}
  1318	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 71975 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20191011/bc8245e5/attachment-0001.gz>


More information about the dri-devel mailing list