Add a function to bufmgr_fake to evict all buffers in the GTT.

This will be used by the X Server for VT switch.
main
Eric Anholt 2008-06-05 08:44:46 -07:00
parent 0903de0c8f
commit d198e9b091
2 changed files with 35 additions and 1 deletions

View File

@ -85,6 +85,7 @@ void intel_bo_fake_disable_backing_store(dri_bo *bo,
void (*invalidate_cb)(dri_bo *bo,
void *ptr),
void *ptr);
void intel_bufmgr_fake_evict_all(dri_bufmgr *bufmgr);
int intel_bo_emit_reloc(dri_bo *reloc_buf,
uint32_t read_domains, uint32_t write_domain,

View File

@ -125,7 +125,6 @@ typedef struct _bufmgr_fake {
* List of blocks which have an expired fence and are ready to be evicted.
*/
struct block lru;
/* then to bufmgr->lru or free() */
unsigned int last_fence;
@ -1141,6 +1140,40 @@ dri_fake_check_aperture_space(dri_bo *bo)
return 0;
}
/**
* Evicts all buffers, waiting for fences to pass and copying contents out
* as necessary.
*
* Used by the X Server on LeaveVT, when the card memory is no longer our
* own.
*/
void
intel_bufmgr_fake_evict_all(dri_bufmgr *bufmgr)
{
dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bufmgr;
struct block *block, *tmp;
bufmgr_fake->need_fence = 1;
bufmgr_fake->fail = 0;
/* Wait for hardware idle. We don't know where acceleration has been
* happening, so we'll need to wait anyway before letting anything get
* put on the card again.
*/
dri_bufmgr_fake_wait_idle(bufmgr_fake);
/* Check that we hadn't released the lock without having fenced the last
* set of buffers.
*/
assert(DRMLISTEMPTY(&bufmgr_fake->fenced));
assert(DRMLISTEMPTY(&bufmgr_fake->on_hardware));
DRMLISTFOREACHSAFE(block, tmp, &bufmgr_fake->lru) {
/* Releases the memory, and memcpys dirty contents out if necessary. */
free_block(bufmgr_fake, block);
}
}
dri_bufmgr *
intel_bufmgr_fake_init(unsigned long low_offset, void *low_virtual,
unsigned long size,