summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i965/brw_pipe_flush.c
blob: d5b7bd3b83ff22b98c96703144827e4536f620a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

/**
 * called from intel_batchbuffer_flush and children before sending a
 * batchbuffer off.
 */
static void brw_finish_batch(struct intel_context *intel)
{
   struct brw_context *brw = brw_context(&intel->ctx);
   brw_emit_query_end(brw);
}


/**
 * called from intelFlushBatchLocked
 */
static void brw_new_batch( struct brw_context *brw )
{
   /* Check that we didn't just wrap our batchbuffer at a bad time. */
   assert(!brw->no_batch_wrap);

   brw->curbe.need_new_bo = GL_TRUE;

   /* Mark all context state as needing to be re-emitted.
    * This is probably not as severe as on 915, since almost all of our state
    * is just in referenced buffers.
    */
   brw->state.dirty.brw |= BRW_NEW_CONTEXT;

   brw->state.dirty.mesa |= ~0;
   brw->state.dirty.brw |= ~0;
   brw->state.dirty.cache |= ~0;

   /* Move to the end of the current upload buffer so that we'll force choosing
    * a new buffer next time.
    */
   if (brw->vb.upload.bo != NULL) {
      brw->sws->bo_unreference(brw->vb.upload.bo);
      brw->vb.upload.bo = NULL;
      brw->vb.upload.offset = 0;
   }
}


static void brw_note_fence( struct brw_context *brw, GLuint fence )
{
   brw_context(&intel->ctx)->state.dirty.brw |= BRW_NEW_FENCE;
}

/* called from intelWaitForIdle() and intelFlush()
 *
 * For now, just flush everything.  Could be smarter later.
 */
static GLuint brw_flush_cmd( void )
{
   struct brw_mi_flush flush;
   flush.opcode = CMD_MI_FLUSH;
   flush.pad = 0;
   flush.flags = BRW_FLUSH_STATE_CACHE;
   return *(GLuint *)&flush;
}