sna: Flush the batch if it references a ShmPixmap and the GPU is idle

This helps minimise the stall when syncing with the GPU before sending
the next reply to the Client.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-08-27 11:58:05 +01:00
parent f21079bad6
commit 3c6758fc4a
3 changed files with 14 additions and 4 deletions

View File

@ -3438,6 +3438,8 @@ bool kgem_check_bo(struct kgem *kgem, ...)
int num_exec = 0;
int num_pages = 0;
kgem_flush(kgem);
va_start(ap, kgem);
while ((bo = va_arg(ap, struct kgem_bo *))) {
if (bo->exec)
@ -3472,6 +3474,8 @@ bool kgem_check_bo_fenced(struct kgem *kgem, struct kgem_bo *bo)
{
uint32_t size;
kgem_flush(kgem);
while (bo->proxy)
bo = bo->proxy;
if (bo->exec) {
@ -3515,6 +3519,8 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...)
int num_pages = 0;
int fenced_size = 0;
kgem_flush(kgem);
va_start(ap, kgem);
while ((bo = va_arg(ap, struct kgem_bo *))) {
while (bo->proxy)

View File

@ -277,6 +277,12 @@ static inline void kgem_submit(struct kgem *kgem)
_kgem_submit(kgem);
}
static inline void kgem_flush(struct kgem *kgem)
{
if (kgem->flush && kgem_is_idle(kgem))
_kgem_submit(kgem);
}
static inline void kgem_bo_submit(struct kgem *kgem, struct kgem_bo *bo)
{
if (bo->exec)

View File

@ -1025,10 +1025,8 @@ void sna_add_flush_pixmap(struct sna *sna,
assert(bo);
list_move(&priv->list, &sna->flush_pixmaps);
if (bo->exec == NULL && sna->kgem.need_retire)
kgem_retire(&sna->kgem);
if (bo->exec == NULL || !sna->kgem.need_retire) {
DBG(("%s: flush bo idle, flushing\n", __FUNCTION__));
if (bo->exec == NULL) {
DBG(("%s: new flush bo, flushin before\n", __FUNCTION__));
kgem_submit(&sna->kgem);
}
}