mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-16 13:40:29 +01:00
Merge remote branch 'origin/mesa_7_7_branch'
Conflicts: configs/default src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c src/mesa/main/version.h
This commit is contained in:
commit
e32487b8a1
13 changed files with 379 additions and 340 deletions
|
|
@ -80,7 +80,7 @@ struct fenced_buffer_list
|
|||
*/
|
||||
struct fenced_buffer
|
||||
{
|
||||
/*
|
||||
/*
|
||||
* Immutable members.
|
||||
*/
|
||||
|
||||
|
|
@ -126,8 +126,8 @@ fenced_buffer(struct pb_buffer *buf)
|
|||
/**
|
||||
* Add the buffer to the fenced list.
|
||||
*
|
||||
* fenced_buffer_list::mutex and fenced_buffer::mutex must be held, in this
|
||||
* order before calling this function.
|
||||
* fenced_buffer_list::mutex and fenced_buffer::mutex must be held, in this
|
||||
* order, before calling this function.
|
||||
*
|
||||
* Reference count should be incremented before calling this function.
|
||||
*/
|
||||
|
|
@ -191,7 +191,7 @@ fenced_buffer_remove_locked(struct fenced_buffer_list *fenced_list,
|
|||
* Wait for the fence to expire, and remove it from the fenced list.
|
||||
*
|
||||
* fenced_buffer::mutex must be held. fenced_buffer_list::mutex must not be
|
||||
* held -- it will
|
||||
* held -- it will be acquired internally.
|
||||
*/
|
||||
static INLINE enum pipe_error
|
||||
fenced_buffer_finish_locked(struct fenced_buffer_list *fenced_list,
|
||||
|
|
@ -207,7 +207,10 @@ fenced_buffer_finish_locked(struct fenced_buffer_list *fenced_list,
|
|||
assert(pipe_is_referenced(&fenced_buf->base.base.reference));
|
||||
assert(fenced_buf->fence);
|
||||
|
||||
/* Acquire the global lock */
|
||||
/*
|
||||
* Acquire the global lock. Must release buffer mutex first to preserve
|
||||
* lock order.
|
||||
*/
|
||||
pipe_mutex_unlock(fenced_buf->mutex);
|
||||
pipe_mutex_lock(fenced_list->mutex);
|
||||
pipe_mutex_lock(fenced_buf->mutex);
|
||||
|
|
@ -217,7 +220,7 @@ fenced_buffer_finish_locked(struct fenced_buffer_list *fenced_list,
|
|||
/* Remove from the fenced list */
|
||||
/* TODO: remove consequents */
|
||||
fenced_buffer_remove_locked(fenced_list, fenced_buf);
|
||||
|
||||
|
||||
p_atomic_dec(&fenced_buf->base.base.reference.count);
|
||||
assert(pipe_is_referenced(&fenced_buf->base.base.reference));
|
||||
|
||||
|
|
@ -238,7 +241,7 @@ fenced_buffer_finish_locked(struct fenced_buffer_list *fenced_list,
|
|||
*/
|
||||
static void
|
||||
fenced_buffer_list_check_free_locked(struct fenced_buffer_list *fenced_list,
|
||||
int wait)
|
||||
int wait)
|
||||
{
|
||||
struct pb_fence_ops *ops = fenced_list->ops;
|
||||
struct list_head *curr, *next;
|
||||
|
|
@ -274,7 +277,6 @@ fenced_buffer_list_check_free_locked(struct fenced_buffer_list *fenced_list,
|
|||
|
||||
pb_buf = &fenced_buf->base;
|
||||
pb_reference(&pb_buf, NULL);
|
||||
|
||||
|
||||
curr = next;
|
||||
next = curr->next;
|
||||
|
|
@ -329,7 +331,7 @@ fenced_buffer_map(struct pb_buffer *buf,
|
|||
if((flags & PIPE_BUFFER_USAGE_DONTBLOCK) &&
|
||||
ops->fence_signalled(ops, fenced_buf->fence, 0) == 0) {
|
||||
/* Don't wait for the GPU to finish writing */
|
||||
goto finish;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Wait for the GPU to finish writing */
|
||||
|
|
@ -350,7 +352,7 @@ fenced_buffer_map(struct pb_buffer *buf,
|
|||
fenced_buf->flags |= flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE;
|
||||
}
|
||||
|
||||
finish:
|
||||
done:
|
||||
pipe_mutex_unlock(fenced_buf->mutex);
|
||||
|
||||
return map;
|
||||
|
|
@ -391,7 +393,7 @@ fenced_buffer_validate(struct pb_buffer *buf,
|
|||
fenced_buf->vl = NULL;
|
||||
fenced_buf->validation_flags = 0;
|
||||
ret = PIPE_OK;
|
||||
goto finish;
|
||||
goto done;
|
||||
}
|
||||
|
||||
assert(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
|
||||
|
|
@ -401,7 +403,7 @@ fenced_buffer_validate(struct pb_buffer *buf,
|
|||
/* Buffer cannot be validated in two different lists */
|
||||
if(fenced_buf->vl && fenced_buf->vl != vl) {
|
||||
ret = PIPE_ERROR_RETRY;
|
||||
goto finish;
|
||||
goto done;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
@ -409,7 +411,7 @@ fenced_buffer_validate(struct pb_buffer *buf,
|
|||
if(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
|
||||
/* TODO: wait for the thread that mapped the buffer to unmap it */
|
||||
ret = PIPE_ERROR_RETRY;
|
||||
goto finish;
|
||||
goto done;
|
||||
}
|
||||
/* Final sanity checking */
|
||||
assert(!(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE));
|
||||
|
|
@ -420,17 +422,17 @@ fenced_buffer_validate(struct pb_buffer *buf,
|
|||
(fenced_buf->validation_flags & flags) == flags) {
|
||||
/* Nothing to do -- buffer already validated */
|
||||
ret = PIPE_OK;
|
||||
goto finish;
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = pb_validate(fenced_buf->buffer, vl, flags);
|
||||
if (ret != PIPE_OK)
|
||||
goto finish;
|
||||
goto done;
|
||||
|
||||
fenced_buf->vl = vl;
|
||||
fenced_buf->validation_flags |= flags;
|
||||
|
||||
finish:
|
||||
done:
|
||||
pipe_mutex_unlock(fenced_buf->mutex);
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -266,8 +266,6 @@ struct svga_hw_draw_state
|
|||
unsigned ts[16][TS_MAX];
|
||||
float cb[PIPE_SHADER_TYPES][CB_MAX][4];
|
||||
|
||||
unsigned shader_id[PIPE_SHADER_TYPES];
|
||||
|
||||
struct svga_shader_result *fs;
|
||||
struct svga_shader_result *vs;
|
||||
struct svga_hw_view_state views[PIPE_MAX_SAMPLERS];
|
||||
|
|
|
|||
|
|
@ -111,6 +111,13 @@ void svga_delete_fs_state(struct pipe_context *pipe, void *shader)
|
|||
util_bitmask_clear( svga->fs_bm, result->id );
|
||||
|
||||
svga_destroy_shader_result( result );
|
||||
|
||||
/*
|
||||
* Remove stale references to this result to ensure a new result on the
|
||||
* same address will be detected as a change.
|
||||
*/
|
||||
if(result == svga->state.hw_draw.fs)
|
||||
svga->state.hw_draw.fs = NULL;
|
||||
}
|
||||
|
||||
FREE((void *)fs->base.tokens);
|
||||
|
|
|
|||
|
|
@ -176,6 +176,13 @@ static void svga_delete_vs_state(struct pipe_context *pipe, void *shader)
|
|||
util_bitmask_clear( svga->vs_bm, result->id );
|
||||
|
||||
svga_destroy_shader_result( result );
|
||||
|
||||
/*
|
||||
* Remove stale references to this result to ensure a new result on the
|
||||
* same address will be detected as a change.
|
||||
*/
|
||||
if(result == svga->state.hw_draw.vs)
|
||||
svga->state.hw_draw.vs = NULL;
|
||||
}
|
||||
|
||||
FREE((void *)vs->base.tokens);
|
||||
|
|
|
|||
|
|
@ -268,16 +268,13 @@ static int emit_hw_fs( struct svga_context *svga,
|
|||
assert(id != SVGA3D_INVALID_ID);
|
||||
|
||||
if (result != svga->state.hw_draw.fs) {
|
||||
if (id != svga->state.hw_draw.shader_id[PIPE_SHADER_FRAGMENT]) {
|
||||
ret = SVGA3D_SetShader(svga->swc,
|
||||
SVGA3D_SHADERTYPE_PS,
|
||||
id );
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
ret = SVGA3D_SetShader(svga->swc,
|
||||
SVGA3D_SHADERTYPE_PS,
|
||||
id );
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
svga->dirty |= SVGA_NEW_FS_RESULT;
|
||||
svga->state.hw_draw.shader_id[PIPE_SHADER_FRAGMENT] = id;
|
||||
svga->state.hw_draw.fs = result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,16 +150,13 @@ static int emit_hw_vs( struct svga_context *svga,
|
|||
}
|
||||
|
||||
if (result != svga->state.hw_draw.vs) {
|
||||
if (id != svga->state.hw_draw.shader_id[PIPE_SHADER_VERTEX]) {
|
||||
ret = SVGA3D_SetShader(svga->swc,
|
||||
SVGA3D_SHADERTYPE_VS,
|
||||
id );
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
ret = SVGA3D_SetShader(svga->swc,
|
||||
SVGA3D_SHADERTYPE_VS,
|
||||
id );
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
svga->dirty |= SVGA_NEW_VS_RESULT;
|
||||
svga->state.hw_draw.shader_id[PIPE_SHADER_VERTEX] = id;
|
||||
svga->state.hw_draw.vs = result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1314,7 +1314,7 @@ SetupDoubleTexEnvVoodoo3(GLcontext *ctx, int tmu0,
|
|||
fxMesa->TexCombine[0].InvertRGB = FXFALSE;
|
||||
fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
|
||||
|
||||
if ((baseFormat0 == GL_RGB) && (baseFormat0 == GL_LUMINANCE)) {
|
||||
if ((baseFormat0 == GL_RGB) || (baseFormat0 == GL_LUMINANCE)) {
|
||||
fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
|
||||
fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE;
|
||||
fxMesa->AlphaCombine.Local = locala;
|
||||
|
|
|
|||
|
|
@ -230,9 +230,8 @@ _mesa_add_named_constant(struct gl_program_parameter_list *paramList,
|
|||
* Add a new unnamed constant to the parameter list. This will be used
|
||||
* when a fragment/vertex program contains something like this:
|
||||
* MOV r, { 0, 1, 2, 3 };
|
||||
* We'll search the parameter list for an existing instance of the
|
||||
* constant. If swizzleOut is non-null, we'll try swizzling when
|
||||
* looking for a match.
|
||||
* If swizzleOut is non-null we'll search the parameter list for an
|
||||
* existing instance of the constant which matches with a swizzle.
|
||||
*
|
||||
* \param paramList the parameter list
|
||||
* \param values four float values
|
||||
|
|
@ -248,7 +247,8 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList,
|
|||
ASSERT(size >= 1);
|
||||
ASSERT(size <= 4);
|
||||
|
||||
if (_mesa_lookup_parameter_constant(paramList, values,
|
||||
if (swizzleOut &&
|
||||
_mesa_lookup_parameter_constant(paramList, values,
|
||||
size, &pos, swizzleOut)) {
|
||||
return pos;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,14 +72,11 @@ copy_indirect_accessed_array(struct gl_program_parameter_list *src,
|
|||
unsigned first, unsigned count)
|
||||
{
|
||||
const int base = dst->NumParameters;
|
||||
unsigned i;
|
||||
unsigned j;
|
||||
|
||||
unsigned i, j;
|
||||
|
||||
for (i = first; i < (first + count); i++) {
|
||||
struct gl_program_parameter *curr = & src->Parameters[i];
|
||||
|
||||
|
||||
if (curr->Type == PROGRAM_CONSTANT) {
|
||||
j = dst->NumParameters;
|
||||
} else {
|
||||
|
|
@ -93,10 +90,15 @@ copy_indirect_accessed_array(struct gl_program_parameter_list *src,
|
|||
|
||||
assert(j == dst->NumParameters);
|
||||
|
||||
/* copy src parameter [i] to dest parameter [j] */
|
||||
memcpy(& dst->Parameters[j], curr,
|
||||
sizeof(dst->Parameters[j]));
|
||||
memcpy(dst->ParameterValues[j], src->ParameterValues[i],
|
||||
sizeof(GLfloat) * 4);
|
||||
|
||||
/* Pointer to the string name was copied. Null-out src param name
|
||||
* to prevent double free later.
|
||||
*/
|
||||
curr->Name = NULL;
|
||||
|
||||
dst->NumParameters++;
|
||||
|
|
@ -117,11 +119,9 @@ _mesa_layout_parameters(struct asm_parser_state *state)
|
|||
struct asm_instruction *inst;
|
||||
unsigned i;
|
||||
|
||||
|
||||
layout =
|
||||
_mesa_new_parameter_list_sized(state->prog->Parameters->NumParameters);
|
||||
|
||||
|
||||
/* PASS 1: Move any parameters that are accessed indirectly from the
|
||||
* original parameter list to the new parameter list.
|
||||
*/
|
||||
|
|
@ -155,7 +155,6 @@ _mesa_layout_parameters(struct asm_parser_state *state)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* PASS 2: Move any parameters that are not accessed indirectly from the
|
||||
* original parameter list to the new parameter list.
|
||||
*/
|
||||
|
|
@ -165,7 +164,6 @@ _mesa_layout_parameters(struct asm_parser_state *state)
|
|||
const int idx = inst->SrcReg[i].Base.Index;
|
||||
unsigned swizzle = SWIZZLE_NOOP;
|
||||
|
||||
|
||||
/* All relative addressed operands were processed on the first
|
||||
* pass. Just skip them here.
|
||||
*/
|
||||
|
|
@ -173,7 +171,6 @@ _mesa_layout_parameters(struct asm_parser_state *state)
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ((inst->SrcReg[i].Base.File <= PROGRAM_VARYING )
|
||||
|| (inst->SrcReg[i].Base.File >= PROGRAM_WRITE_ONLY)) {
|
||||
continue;
|
||||
|
|
@ -209,7 +206,6 @@ _mesa_layout_parameters(struct asm_parser_state *state)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
_mesa_free_parameter_list(state->prog->Parameters);
|
||||
state->prog->Parameters = layout;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -154,7 +154,7 @@ typedef union YYSTYPE
|
|||
{
|
||||
|
||||
/* Line 1676 of yacc.c */
|
||||
#line 125 "program_parse.y"
|
||||
#line 126 "program_parse.y"
|
||||
|
||||
struct asm_instruction *inst;
|
||||
struct asm_symbol *sym;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ static int initialize_symbol_from_param(struct gl_program *prog,
|
|||
struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
|
||||
|
||||
static int initialize_symbol_from_const(struct gl_program *prog,
|
||||
struct asm_symbol *param_var, const struct asm_vector *vec);
|
||||
struct asm_symbol *param_var, const struct asm_vector *vec,
|
||||
GLboolean allowSwizzle);
|
||||
|
||||
static int yyparse(struct asm_parser_state *state);
|
||||
|
||||
|
|
@ -589,7 +590,7 @@ scalarUse: srcReg scalarSuffix
|
|||
|
||||
memset(& temp_sym, 0, sizeof(temp_sym));
|
||||
temp_sym.param_binding_begin = ~0;
|
||||
initialize_symbol_from_const(state->prog, & temp_sym, & $1);
|
||||
initialize_symbol_from_const(state->prog, & temp_sym, & $1, GL_TRUE);
|
||||
|
||||
set_src_reg_swz(& $$, PROGRAM_CONSTANT,
|
||||
temp_sym.param_binding_begin,
|
||||
|
|
@ -1300,7 +1301,7 @@ paramSingleItemDecl: stateSingleItem
|
|||
{
|
||||
memset(& $$, 0, sizeof($$));
|
||||
$$.param_binding_begin = ~0;
|
||||
initialize_symbol_from_const(state->prog, & $$, & $1);
|
||||
initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -1320,7 +1321,7 @@ paramSingleItemUse: stateSingleItem
|
|||
{
|
||||
memset(& $$, 0, sizeof($$));
|
||||
$$.param_binding_begin = ~0;
|
||||
initialize_symbol_from_const(state->prog, & $$, & $1);
|
||||
initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -1340,7 +1341,7 @@ paramMultipleItem: stateMultipleItem
|
|||
{
|
||||
memset(& $$, 0, sizeof($$));
|
||||
$$.param_binding_begin = ~0;
|
||||
initialize_symbol_from_const(state->prog, & $$, & $1);
|
||||
initialize_symbol_from_const(state->prog, & $$, & $1, GL_FALSE);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -2515,9 +2516,12 @@ initialize_symbol_from_param(struct gl_program *prog,
|
|||
assert((state_tokens[1] == STATE_ENV)
|
||||
|| (state_tokens[1] == STATE_LOCAL));
|
||||
|
||||
/*
|
||||
* The param type is STATE_VAR. The program parameter entry will
|
||||
* effectively be a pointer into the LOCAL or ENV parameter array.
|
||||
*/
|
||||
param_var->type = at_param;
|
||||
param_var->param_binding_type = (state_tokens[1] == STATE_ENV)
|
||||
? PROGRAM_ENV_PARAM : PROGRAM_LOCAL_PARAM;
|
||||
param_var->param_binding_type = PROGRAM_STATE_VAR;
|
||||
|
||||
/* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
|
||||
* we need to unroll it and call add_state_reference() for each row
|
||||
|
|
@ -2556,23 +2560,28 @@ initialize_symbol_from_param(struct gl_program *prog,
|
|||
* \param param_var returns info about the parameter/constant's location,
|
||||
* binding, type, etc.
|
||||
* \param vec the vector/constant to add
|
||||
* \param allowSwizzle if true, try to consolidate constants which only differ
|
||||
* by a swizzle. We don't want to do this when building
|
||||
* arrays of constants that may be indexed indirectly.
|
||||
* \return index of the constant in the parameter list.
|
||||
*/
|
||||
int
|
||||
initialize_symbol_from_const(struct gl_program *prog,
|
||||
struct asm_symbol *param_var,
|
||||
const struct asm_vector *vec)
|
||||
const struct asm_vector *vec,
|
||||
GLboolean allowSwizzle)
|
||||
{
|
||||
unsigned swizzle;
|
||||
const int idx = _mesa_add_unnamed_constant(prog->Parameters,
|
||||
vec->data, vec->count, &swizzle);
|
||||
vec->data, vec->count,
|
||||
allowSwizzle ? &swizzle : NULL);
|
||||
|
||||
param_var->type = at_param;
|
||||
param_var->param_binding_type = PROGRAM_CONSTANT;
|
||||
|
||||
if (param_var->param_binding_begin == ~0U) {
|
||||
param_var->param_binding_begin = idx;
|
||||
param_var->param_binding_swizzle = swizzle;
|
||||
param_var->param_binding_swizzle = allowSwizzle ? swizzle : SWIZZLE_XYZW;
|
||||
}
|
||||
param_var->param_binding_length++;
|
||||
|
||||
|
|
|
|||
|
|
@ -160,13 +160,14 @@ dst_register( struct st_translate *t,
|
|||
static struct ureg_src
|
||||
src_register( struct st_translate *t,
|
||||
gl_register_file file,
|
||||
GLuint index )
|
||||
GLint index )
|
||||
{
|
||||
switch( file ) {
|
||||
case PROGRAM_UNDEFINED:
|
||||
return ureg_src_undef();
|
||||
|
||||
case PROGRAM_TEMPORARY:
|
||||
ASSERT(index >= 0);
|
||||
if (ureg_dst_is_undef(t->temps[index]))
|
||||
t->temps[index] = ureg_DECL_temporary( t->ureg );
|
||||
return ureg_src(t->temps[index]);
|
||||
|
|
@ -174,9 +175,15 @@ src_register( struct st_translate *t,
|
|||
case PROGRAM_STATE_VAR:
|
||||
case PROGRAM_NAMED_PARAM:
|
||||
case PROGRAM_ENV_PARAM:
|
||||
case PROGRAM_LOCAL_PARAM:
|
||||
case PROGRAM_UNIFORM:
|
||||
case PROGRAM_CONSTANT: /* ie, immediate */
|
||||
ASSERT(index >= 0);
|
||||
return t->constants[index];
|
||||
case PROGRAM_CONSTANT: /* ie, immediate */
|
||||
if (index < 0)
|
||||
return ureg_DECL_constant( t->ureg, 0 );
|
||||
else
|
||||
return t->constants[index];
|
||||
|
||||
case PROGRAM_INPUT:
|
||||
return t->inputs[t->inputMapping[index]];
|
||||
|
|
@ -263,9 +270,14 @@ translate_src( struct st_translate *t,
|
|||
if (SrcReg->Abs)
|
||||
src = ureg_abs(src);
|
||||
|
||||
if (SrcReg->RelAddr)
|
||||
if (SrcReg->RelAddr) {
|
||||
src = ureg_src_indirect( src, ureg_src(t->address[0]));
|
||||
|
||||
/* If SrcReg->Index was negative, it was set to zero in
|
||||
* src_register(). Reassign it now.
|
||||
*/
|
||||
src.Index = SrcReg->Index;
|
||||
}
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
|
|
@ -859,6 +871,7 @@ st_translate_mesa_program(
|
|||
for (i = 0; i < program->Parameters->NumParameters; i++) {
|
||||
switch (program->Parameters->Parameters[i].Type) {
|
||||
case PROGRAM_ENV_PARAM:
|
||||
case PROGRAM_LOCAL_PARAM:
|
||||
case PROGRAM_STATE_VAR:
|
||||
case PROGRAM_NAMED_PARAM:
|
||||
case PROGRAM_UNIFORM:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue