I'm trying to build Linux 5.10 for the XU4 and it works great, however as panfrost still has some quirks (artifacts) I'd like to keep using the old wayland/gbm blob from ARM.
So I'm trying to port the mali driver to the kernel.
With some small changes (mostly around timestamps and some tmp= functions) I can get it to build.
Except for the below code in: drivers/gpu/arm/midgard/mali_kbase_softjobs.c
Code: Select all
#ifdef CONFIG_DMA_SHARED_BUFFER
case KBASE_MEM_TYPE_IMPORTED_UMM: {
struct dma_buf *dma_buf = gpu_alloc->imported.umm.dma_buf;
KBASE_DEBUG_ASSERT(dma_buf != NULL);
if (dma_buf->size > buf_data->nr_extres_pages * PAGE_SIZE)
dev_warn(kctx->kbdev->dev, "External resources buffer size mismatch");
dma_to_copy = min(dma_buf->size,
(size_t)(buf_data->nr_extres_pages * PAGE_SIZE));
ret = dma_buf_begin_cpu_access(dma_buf,
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) && !defined(CONFIG_CHROMEOS)
0, dma_to_copy,
#endif
DMA_FROM_DEVICE);
if (ret)
goto out_unlock;
for (i = 0; i < dma_to_copy/PAGE_SIZE; i++) {
void *extres_page = dma_buf_kmap(dma_buf, i);
if (extres_page)
kbase_mem_copy_from_extres_page(kctx,
extres_page, pages,
buf_data->nr_pages,
&target_page_nr,
offset, &to_copy);
dma_buf_kunmap(dma_buf, i, extres_page);
if (target_page_nr >= buf_data->nr_pages)
break;
}
dma_buf_end_cpu_access(dma_buf,
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) && !defined(CONFIG_CHROMEOS)
0, dma_to_copy,
#endif
DMA_FROM_DEVICE);
break;
}
#endif
default:
ret = -EINVAL;
}
However we do have dma_buf_vmap and dma_buf_vunmap which does the same, only it doesn't support pages, so it's like one big buffer.
Is there someone who can rewrite the above code to use dma_buf_v(un)map instead?
Or perhaps someone who already did this?