brw_emit_prim(brw, &prim[i]);
}
+ intel->need_flush = GL_TRUE;
retval = GL_TRUE;
}
int bmValidateBuffers( struct intel_context * );
void bmReleaseBuffers( struct intel_context * );
+GLuint bmCtxId( struct intel_context *intel );
+
GLboolean bmError( struct intel_context * );
void bmEvictAll( struct intel_context * );
struct block fenced; /* after bmFenceBuffers (mi_flush, emit irq, write dword) */
/* then to pool->lru or free() */
+ unsigned ctxId;
unsigned last_fence;
unsigned free_on_hardware;
make_empty_list(&bm.referenced);
make_empty_list(&bm.fenced);
make_empty_list(&bm.on_hardware);
+
+ /* The context id of any of the share group. This won't be used
+ * in communication with the kernel, so it doesn't matter if
+ * this context is eventually deleted.
+ */
+ bm.ctxId = intel->hHWContext;
}
nr_attach++;
LOCK(bm);
{
struct block *block, *tmp;
- assert(intel->locked);
foreach_s (block, tmp, &bm->referenced) {
return retval;
}
+
+
+GLuint bmCtxId( struct intel_context *intel )
+{
+ return intel->bm->ctxId;
+}
}
-static void lost_hardware( struct intel_context *intel )
-{
- bm_fake_NotifyContendedLockTake( intel );
- intel->vtbl.lost_hardware( intel );
-}
-
static void intelContendedLock( struct intel_context *intel, GLuint flags )
{
__DRIdrawablePrivate *dPriv = intel->driDrawable;
__DRIscreenPrivate *sPriv = intel->driScreen;
volatile drmI830Sarea * sarea = intel->sarea;
int me = intel->hHWContext;
+ int my_bufmgr = bmCtxId(intel);
drmGetLock(intel->driFd, intel->hHWContext, flags);
intel->locked = 1;
+ intel->need_flush = 1;
/* Lost context?
*/
if (sarea->ctxOwner != me) {
+ DBG("Lost Context: sarea->ctxOwner %x me %x\n", sarea->ctxOwner, me);
sarea->ctxOwner = me;
- lost_hardware(intel);
+ intel->vtbl.lost_hardware( intel );
+ }
+
+ /* As above, but don't evict the texture data on transitions
+ * between contexts which all share a local buffer manager.
+ */
+ if (sarea->texAge != my_bufmgr) {
+ DBG("Lost Textures: sarea->texAge %x my_bufmgr %x\n", sarea->ctxOwner, my_bufmgr);
+ sarea->texAge = my_bufmgr;
+ bm_fake_NotifyContendedLockTake( intel );
}
/* Drawable changed?
{
struct intel_context *intel = intel_context(ctx);
+ if (intel->need_flush) {
+ LOCK_HARDWARE(intel);
+ intel->vtbl.emit_flush(intel, 0);
+ intel_batchbuffer_flush(intel->batch);
+ intel->need_flush = 0;
+ UNLOCK_HARDWARE(intel);
+ intelFinish(intel);
+ }
+
+
LOCK_HARDWARE(intel);
/* Just map the framebuffer and all textures. Bufmgr code will