sna: Prefer to reuse CPU bo if it was last active rather than inplace uploads
This helps short-circuit writes followed by immediate reads. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
7656755c9d
commit
56f532db2c
|
|
@ -1447,23 +1447,38 @@ static inline bool pixmap_inplace(struct sna *sna,
|
|||
if (FORCE_INPLACE)
|
||||
return FORCE_INPLACE > 0;
|
||||
|
||||
if (wedged(sna) && !priv->pinned)
|
||||
if (wedged(sna) && !priv->pinned) {
|
||||
DBG(("%s: no, wedged and unpinned; pull pixmap back to CPU\n", __FUNCTION__));
|
||||
return false;
|
||||
|
||||
if (priv->gpu_bo && kgem_bo_is_busy(priv->gpu_bo)) {
|
||||
if ((flags & (MOVE_WRITE | MOVE_READ)) == (MOVE_WRITE | MOVE_READ))
|
||||
return false;
|
||||
|
||||
if ((flags & MOVE_READ) == 0)
|
||||
return !priv->pinned;
|
||||
}
|
||||
|
||||
if (priv->mapped)
|
||||
if (priv->gpu_bo && kgem_bo_is_busy(priv->gpu_bo)) {
|
||||
if ((flags & (MOVE_WRITE | MOVE_READ)) == (MOVE_WRITE | MOVE_READ)) {
|
||||
DBG(("%s: no, GPU bo is busy\n", __FUNCTION__));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((flags & MOVE_READ) == 0) {
|
||||
DBG(("%s: %s, GPU bo is busy, but not reading\n", __FUNCTION__, priv->pinned ? "no" : "yes"));
|
||||
return !priv->pinned;
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->mapped) {
|
||||
DBG(("%s: %s, already mapped\n", __FUNCTION__, has_coherent_map(sna, priv->gpu_bo, flags) ? "yes" : "no"));
|
||||
return has_coherent_map(sna, priv->gpu_bo, flags);
|
||||
}
|
||||
|
||||
if (priv->cpu_bo && priv->cpu) {
|
||||
DBG(("%s: no, has CPU bo and was last active on CPU, presume future CPU activity\n", __FUNCTION__));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flags & MOVE_READ &&
|
||||
(priv->cpu || priv->cpu_damage || priv->gpu_damage == NULL))
|
||||
(priv->cpu || priv->cpu_damage || priv->gpu_damage == NULL)) {
|
||||
DBG(("%s:, no, reading and has CPU damage\n", __FUNCTION__));
|
||||
return false;
|
||||
}
|
||||
|
||||
return (pixmap->devKind * pixmap->drawable.height >> 12) >
|
||||
sna->kgem.half_cpu_cache_pages;
|
||||
|
|
@ -2206,6 +2221,11 @@ static inline bool region_inplace(struct sna *sna,
|
|||
return true;
|
||||
}
|
||||
|
||||
if (priv->cpu_bo && priv->cpu) {
|
||||
DBG(("%s: no, has CPU bo and was last active on CPU, presume future CPU activity\n", __FUNCTION__));
|
||||
return false;
|
||||
}
|
||||
|
||||
DBG(("%s: (%dx%d), inplace? %d\n",
|
||||
__FUNCTION__,
|
||||
region->extents.x2 - region->extents.x1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue