From: Brian Paul Date: Fri, 1 May 2009 15:37:14 +0000 (-0600) Subject: Merge branch 'const-buffer-changes' X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b9196c1fa39dd566c5d7ab340e353b77714edb5f;p=mesa.git Merge branch 'const-buffer-changes' Conflicts: src/mesa/drivers/dri/i965/brw_curbe.c src/mesa/drivers/dri/i965/brw_vs_emit.c src/mesa/drivers/dri/i965/brw_wm_glsl.c --- b9196c1fa39dd566c5d7ab340e353b77714edb5f diff --cc src/mesa/drivers/dri/i965/brw_curbe.c index 9197fede2d8,f6d2014fb1e..05a685af3da --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@@ -353,21 -347,13 +347,17 @@@ update_constant_buffer(struct brw_conte assert(const_buffer); assert(const_buffer->size >= size); - dri_bo_map(const_buffer, GL_TRUE); - map = const_buffer->virtual; - memcpy(map, params->ParameterValues, size); - dri_bo_unmap(const_buffer); + if (intel->intelScreen->kernel_exec_fencing) { + drm_intel_gem_bo_map_gtt(const_buffer); + memcpy(const_buffer->virtual, params->ParameterValues, size); + drm_intel_gem_bo_unmap_gtt(const_buffer); + } + else { + dri_bo_subdata(const_buffer, 0, size, params->ParameterValues); + } if (0) { - int i; - for (i = 0; i < params->NumParameters; i++) { - float *p = params->ParameterValues[i]; - printf("%d: %f %f %f %f\n", i, p[0], p[1], p[2], p[3]); - } + _mesa_print_parameter_list(params); } } } diff --cc src/mesa/drivers/dri/i965/brw_vs_emit.c index b69616d6e52,b9a338b1cd8..3fdc48583bf --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@@ -69,13 -69,18 +69,18 @@@ static void brw_vs_alloc_regs( struct b { GLuint i, reg = 0, mrf; - #if 0 - if (c->vp->program.Base.Parameters->NumParameters >= 6) - c->vp->use_const_buffer = 1; + /* Determine whether to use a real constant buffer or use a block + * of GRF registers for constants. The later is faster but only + * works if everything fits in the GRF. + * XXX this heuristic/check may need some fine tuning... + */ + if (c->vp->program.Base.Parameters->NumParameters + + c->vp->program.Base.NumTemporaries + 20 > BRW_MAX_GRF) + c->vp->use_const_buffer = GL_TRUE; else - #endif c->vp->use_const_buffer = GL_FALSE; - /*printf("use_const_buffer = %d\n", c->use_const_buffer);*/ + - /*printf("use_const_buffer = %d\n", c->use_const_buffer);*/ ++ /*printf("use_const_buffer = %d\n", c->vp->use_const_buffer);*/ /* r0 -- reserved as usual */ diff --cc src/mesa/drivers/dri/i965/brw_wm_glsl.c index 117460842a3,eca4ca2c821..39ea95f6fc2 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@@ -191,10 -305,16 +305,16 @@@ static void prealloc_reg(struct brw_wm_ /* constants */ { - const int nr_params = c->fp->program.Base.Parameters->NumParameters; + const GLuint nr_params = c->fp->program.Base.Parameters->NumParameters; + const GLuint nr_temps = c->fp->program.Base.NumTemporaries; /* use a real constant buffer, or just use a section of the GRF? */ - c->fp->use_const_buffer = GL_FALSE; /* (nr_params > 8);*/ + /* XXX this heuristic may need adjustment... */ + if ((nr_params + nr_temps) * 4 + reg_index > 80) + c->fp->use_const_buffer = GL_TRUE; + else + c->fp->use_const_buffer = GL_FALSE; - /*printf("WM use_const_buffer = %d\n", c->use_const_buffer);*/ ++ /*printf("WM use_const_buffer = %d\n", c->fp->use_const_buffer);*/ if (c->fp->use_const_buffer) { /* We'll use a real constant buffer and fetch constants from