mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-25 09:30:19 +01:00
nouveau: Avoid unnecessary call to CPU_FINI.
nouveau_bo_unmap called the CPU_FINI IOCTL even if it was a NOSYNC mapping. It caused no harmful effects (actually CPU_FINI is a no-op on recent enough kernels) besides the precious CPU cycles being wasted. Signed-off-by: Francisco Jerez <currojerez@riseup.net>
This commit is contained in:
parent
362457715f
commit
d0a4f2e292
2 changed files with 5 additions and 1 deletions
|
|
@ -434,6 +434,8 @@ nouveau_bo_map_range(struct nouveau_bo *bo, uint32_t delta, uint32_t size,
|
|||
(flags & NOUVEAU_BO_NOWAIT), 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
nvbo->map_refcnt++;
|
||||
}
|
||||
|
||||
bo->map = (char *)nvbo->map + delta;
|
||||
|
|
@ -458,13 +460,14 @@ nouveau_bo_unmap(struct nouveau_bo *bo)
|
|||
{
|
||||
struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
|
||||
|
||||
if (bo->map && !nvbo->sysmem) {
|
||||
if (bo->map && !nvbo->sysmem && nvbo->map_refcnt) {
|
||||
struct nouveau_device_priv *nvdev = nouveau_device(bo->device);
|
||||
struct drm_nouveau_gem_cpu_fini req;
|
||||
|
||||
req.handle = nvbo->handle;
|
||||
drmCommandWrite(nvdev->fd, DRM_NOUVEAU_GEM_CPU_FINI,
|
||||
&req, sizeof(req));
|
||||
nvbo->map_refcnt--;
|
||||
}
|
||||
|
||||
bo->map = NULL;
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ struct nouveau_bo_priv {
|
|||
uint32_t global_handle;
|
||||
drm_handle_t handle;
|
||||
uint64_t map_handle;
|
||||
int map_refcnt;
|
||||
void *map;
|
||||
|
||||
/* Last known information from kernel on buffer status */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue