static int check_fb_gem_memory_type(struct drm_device *drm_dev,
				struct exynos_drm_gem_obj *exynos_gem_obj)
{
	unsigned int flags;

	/*
	 * if exynos drm driver supports iommu then framebuffer can use
	 * all the buffer types.
	 */
	if (is_drm_iommu_supported(drm_dev))
		return 0;

	flags = exynos_gem_obj->flags;

	/*
	 * without iommu support, not support physically non-continuous memory
	 * for framebuffer.
	 */
	if (IS_NONCONTIG_BUFFER(flags)) {
		DRM_ERROR("cannot use this gem memory type for fb.\n");
		return -EINVAL;
	}

	return 0;
}
Exemple #2
0
static int check_fb_gem_memory_type(struct drm_device *drm_dev,
				    struct exynos_drm_gem *exynos_gem)
{
	unsigned int flags;

	/*
	 * if exynos drm driver supports iommu then framebuffer can use
	 * all the buffer types.
	 */
	if (is_drm_iommu_supported(drm_dev))
		return 0;

	flags = exynos_gem->flags;

	/*
	 * Physically non-contiguous memory type for framebuffer is not
	 * supported without IOMMU.
	 */
	if (IS_NONCONTIG_BUFFER(flags)) {
		DRM_ERROR("Non-contiguous GEM memory is not supported.\n");
		return -EINVAL;
	}

	return 0;
}
Exemple #3
0
static int exynos_drm_ump_add_buffer(void *obj,
		unsigned int *handle, unsigned int *id)
{
	struct exynos_drm_gem_obj *gem_obj = obj;
	struct exynos_drm_gem_buf *buf = gem_obj->buffer;
	ump_dd_physical_block *ump_mem_desc;
	unsigned int nblocks;

	DRM_DEBUG_KMS("%s\n", __FILE__);

	if (IS_NONCONTIG_BUFFER(gem_obj->flags)) {
		unsigned int i = 0;

		if (!buf->pages)
			return -EFAULT;

		nblocks = gem_obj->size >> PAGE_SHIFT;
		ump_mem_desc = kzalloc(sizeof(*ump_mem_desc) * nblocks,
				GFP_KERNEL);
		if (!ump_mem_desc) {
			DRM_ERROR("failed to alloc ump_mem_desc.\n");
			return -ENOMEM;
		}

		/*
		 * if EXYNOS_BO_NONCONTIG type, gem object would already
		 * have pages allocated by gem creation so contain page
		 * frame numbers of all pages into ump descriptors.
		 */
		while (i < nblocks) {
			ump_mem_desc[i].addr =
				page_to_pfn(buf->pages[i]) << PAGE_SHIFT;
			ump_mem_desc[i].size = PAGE_SIZE;
			i++;
		}
	} else {
static int lowlevel_buffer_allocate(struct drm_device *dev,
		unsigned int flags, struct exynos_drm_gem_buf *buf)
{
	dma_addr_t start_addr;
	unsigned int npages, page_size, i = 0;
	struct scatterlist *sgl;
	int ret = 0;

	DRM_DEBUG_KMS("%s\n", __FILE__);

	if (IS_NONCONTIG_BUFFER(flags)) {
		DRM_DEBUG_KMS("not support allocation type.\n");
		return -EINVAL;
	}

	if (buf->dma_addr) {
		DRM_DEBUG_KMS("already allocated.\n");
		return 0;
	}

	if (buf->size >= SZ_1M) {
		npages = buf->size >> SECTION_SHIFT;
		page_size = SECTION_SIZE;
	} else if (buf->size >= SZ_64K) {