drm/panthor: Flush shmem writes before mapping buffers CPU-uncached (#422)
This commit is contained in:
parent
b908c7339f
commit
3bfbb94a2a
1 changed files with 18 additions and 0 deletions
|
|
@ -291,6 +291,23 @@ panthor_gem_create_with_handle(struct drm_file *file,
|
|||
|
||||
panthor_gem_debugfs_set_usage_flags(bo, 0);
|
||||
|
||||
/* If this is a write-combine mapping, we query the sgt to force a CPU
|
||||
* cache flush (dma_map_sgtable() is called when the sgt is created).
|
||||
* This ensures the zero-ing is visible to any uncached mapping created
|
||||
* by vmap/mmap.
|
||||
* FIXME: Ideally this should be done when pages are allocated, not at
|
||||
* BO creation time.
|
||||
*/
|
||||
if (shmem->map_wc) {
|
||||
struct sg_table *sgt;
|
||||
|
||||
sgt = drm_gem_shmem_get_pages_sgt(shmem);
|
||||
if (IS_ERR(sgt)) {
|
||||
ret = PTR_ERR(sgt);
|
||||
goto out_put_gem;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate an id of idr table where the obj is registered
|
||||
* and handle has the id what user can see.
|
||||
|
|
@ -299,6 +316,7 @@ panthor_gem_create_with_handle(struct drm_file *file,
|
|||
if (!ret)
|
||||
*size = bo->base.base.size;
|
||||
|
||||
out_put_gem:
|
||||
/* drop reference from allocate - handle holds it now. */
|
||||
drm_gem_object_put(&shmem->base);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue