brw_urb.c File Reference

Include dependency graph for brw_urb.c:

Go to the source code of this file.

Defines

#define VS   0
#define GS   1
#define CLP   2
#define SF   3
#define CS   4

Functions

static boolean check_urb_layout (struct brw_context *brw)
static void recalculate_urb_fence (struct brw_context *brw)
void brw_upload_urb_fence (struct brw_context *brw)

Variables

struct {
   unsigned   min_nr_entries
   unsigned   preferred_nr_entries
   unsigned   min_entry_size
   unsigned   max_entry_size
limits [4+1]
struct brw_tracked_state brw_recalculate_urb_fence


Define Documentation

#define CLP   2

Definition at line 40 of file brw_urb.c.

#define CS   4

Definition at line 42 of file brw_urb.c.

#define GS   1

Definition at line 39 of file brw_urb.c.

#define SF   3

Definition at line 41 of file brw_urb.c.

#define VS   0

Definition at line 38 of file brw_urb.c.


Function Documentation

void brw_upload_urb_fence ( struct brw_context brw  ) 

Definition at line 160 of file brw_urb.c.

References brw_urb_fence::bits0, brw_urb_fence::bits1, BRW_BATCH_STRUCT, brw_context::clip_start, brw_urb_fence::clp_fence, brw_urb_fence::clp_realloc, CMD_URB_FENCE, brw_urb_fence::cs_fence, brw_urb_fence::cs_realloc, brw_context::cs_start, brw_urb_fence::gs_fence, brw_urb_fence::gs_realloc, brw_context::gs_start, brw_urb_fence::header, brw_urb_fence::length, brw_urb_fence::opcode, brw_urb_fence::sf_fence, brw_urb_fence::sf_realloc, brw_context::sf_start, brw_context::urb, brw_urb_fence::vfe_realloc, brw_urb_fence::vs_fence, and brw_urb_fence::vs_realloc.

00161 {
00162    struct brw_urb_fence uf;
00163    memset(&uf, 0, sizeof(uf));
00164 
00165    uf.header.opcode = CMD_URB_FENCE;
00166    uf.header.length = sizeof(uf)/4-2;
00167    uf.header.vs_realloc = 1;
00168    uf.header.gs_realloc = 1;
00169    uf.header.clp_realloc = 1;
00170    uf.header.sf_realloc = 1;
00171    uf.header.vfe_realloc = 1;
00172    uf.header.cs_realloc = 1;
00173 
00174    /* The ordering below is correct, not the layout in the
00175     * instruction.
00176     *
00177     * There are 256 urb reg pairs in total.
00178     */
00179    uf.bits0.vs_fence  = brw->urb.gs_start;
00180    uf.bits0.gs_fence  = brw->urb.clip_start;
00181    uf.bits0.clp_fence = brw->urb.sf_start;
00182    uf.bits1.sf_fence  = brw->urb.cs_start;
00183    uf.bits1.cs_fence  = 256;
00184 
00185    BRW_BATCH_STRUCT(brw, &uf);
00186 }

static boolean check_urb_layout ( struct brw_context brw  )  [static]

Definition at line 62 of file brw_urb.c.

References brw_context::clip_start, brw_context::cs_start, brw_context::csize, brw_context::gs_start, brw_context::nr_clip_entries, brw_context::nr_cs_entries, brw_context::nr_gs_entries, brw_context::nr_sf_entries, brw_context::nr_vs_entries, brw_context::sf_start, brw_context::sfsize, brw_context::urb, brw_context::vs_start, and brw_context::vsize.

00063 {
00064    brw->urb.vs_start = 0;
00065    brw->urb.gs_start = brw->urb.nr_vs_entries * brw->urb.vsize;
00066    brw->urb.clip_start = brw->urb.gs_start + brw->urb.nr_gs_entries * brw->urb.vsize;
00067    brw->urb.sf_start = brw->urb.clip_start + brw->urb.nr_clip_entries * brw->urb.vsize;
00068    brw->urb.cs_start = brw->urb.sf_start + brw->urb.nr_sf_entries * brw->urb.sfsize;
00069 
00070    return brw->urb.cs_start + brw->urb.nr_cs_entries * brw->urb.csize <= 256;
00071 }

static void recalculate_urb_fence ( struct brw_context brw  )  [static]

Definition at line 76 of file brw_urb.c.

References brw_state_flags::brw, BRW_DEBUG, BRW_NEW_URB_FENCE, check_urb_layout(), brw_context::clip_start, CLP, brw_context::constrained, CS, brw_context::cs_start, brw_context::csize, brw_context::curbe, DEBUG_FALLBACKS, debug_printf(), DEBUG_URB, brw_context::dirty, GS, brw_context::gs_start, limits, min_entry_size, brw_context::nr_clip_entries, brw_context::nr_cs_entries, brw_context::nr_gs_entries, brw_context::nr_sf_entries, brw_context::nr_vs_entries, brw_context::prog_data, SF, brw_context::sf, brw_context::sf_start, brw_context::sfsize, brw_context::state, brw_context::total_size, brw_context::urb, brw_vs_prog_data::urb_entry_size, VS, brw_context::vs, brw_context::vs_start, and brw_context::vsize.

00077 {
00078    unsigned csize = brw->curbe.total_size;
00079    unsigned vsize = brw->vs.prog_data->urb_entry_size;
00080    unsigned sfsize = brw->sf.prog_data->urb_entry_size;
00081 
00082    if (csize < limits[CS].min_entry_size)
00083       csize = limits[CS].min_entry_size;
00084 
00085    if (vsize < limits[VS].min_entry_size)
00086       vsize = limits[VS].min_entry_size;
00087 
00088    if (sfsize < limits[SF].min_entry_size)
00089       sfsize = limits[SF].min_entry_size;
00090 
00091    if (brw->urb.vsize < vsize ||
00092        brw->urb.sfsize < sfsize ||
00093        brw->urb.csize < csize ||
00094        (brw->urb.constrained && (brw->urb.vsize > brw->urb.vsize ||
00095                                  brw->urb.sfsize > brw->urb.sfsize ||
00096                                  brw->urb.csize > brw->urb.csize))) {
00097 
00098 
00099       brw->urb.csize = csize;
00100       brw->urb.sfsize = sfsize;
00101       brw->urb.vsize = vsize;
00102 
00103       brw->urb.nr_vs_entries = limits[VS].preferred_nr_entries;
00104       brw->urb.nr_gs_entries = limits[GS].preferred_nr_entries;
00105       brw->urb.nr_clip_entries = limits[CLP].preferred_nr_entries;
00106       brw->urb.nr_sf_entries = limits[SF].preferred_nr_entries;
00107       brw->urb.nr_cs_entries = limits[CS].preferred_nr_entries;
00108 
00109       if (!check_urb_layout(brw)) {
00110          brw->urb.nr_vs_entries = limits[VS].min_nr_entries;
00111          brw->urb.nr_gs_entries = limits[GS].min_nr_entries;
00112          brw->urb.nr_clip_entries = limits[CLP].min_nr_entries;
00113          brw->urb.nr_sf_entries = limits[SF].min_nr_entries;
00114          brw->urb.nr_cs_entries = limits[CS].min_nr_entries;
00115 
00116          brw->urb.constrained = 1;
00117 
00118          if (!check_urb_layout(brw)) {
00119             /* This is impossible, given the maximal sizes of urb
00120              * entries and the values for minimum nr of entries
00121              * provided above.
00122              */
00123             debug_printf("couldn't calculate URB layout!\n");
00124             exit(1);
00125          }
00126 
00127          if (BRW_DEBUG & (DEBUG_URB|DEBUG_FALLBACKS))
00128             debug_printf("URB CONSTRAINED\n");
00129       }
00130       else
00131          brw->urb.constrained = 0;
00132 
00133       if (BRW_DEBUG & DEBUG_URB)
00134          debug_printf("URB fence: %d ..VS.. %d ..GS.. %d ..CLP.. %d ..SF.. %d ..CS.. %d\n",
00135                       brw->urb.vs_start,
00136                       brw->urb.gs_start,
00137                       brw->urb.clip_start,
00138                       brw->urb.sf_start,
00139                       brw->urb.cs_start,
00140                       256);
00141 
00142       brw->state.dirty.brw |= BRW_NEW_URB_FENCE;
00143    }
00144 }


Variable Documentation

struct brw_tracked_state brw_recalculate_urb_fence

Initial value:

 {
   .dirty = {
      .brw =  0x40000 ,
      .cache = ( (1<<BRW_VS_PROG)  |
                 (1<<BRW_SF_PROG) )
   },
   .update = recalculate_urb_fence
}

Definition at line 147 of file brw_urb.c.

struct { ... } limits[ 4 +1] [static]

unsigned max_entry_size

Definition at line 52 of file brw_urb.c.

unsigned min_entry_size

Definition at line 51 of file brw_urb.c.

unsigned min_nr_entries

Definition at line 49 of file brw_urb.c.

unsigned preferred_nr_entries

Definition at line 50 of file brw_urb.c.


Generated on Tue Sep 29 06:25:38 2009 for Gallium3D by  doxygen 1.5.4