diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2017-08-26 16:59:42 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2017-08-26 16:59:42 +0000 |
commit | 81ece42815e80818f160cdd85fab57d65b56ad15 (patch) | |
tree | 1059ff094da1aa50334115952fcb1cfcbda3acc6 /lib/mesa/src/gallium/drivers/vc4/vc4_state.c | |
parent | b0244145d5bb49623d58f6b5cab8143ada692b60 (diff) |
Revert to Mesa 13.0.6 to hopefully address rendering issues a handful of
people have reported with xpdf/fvwm on ivy bridge with modesetting driver.
Diffstat (limited to 'lib/mesa/src/gallium/drivers/vc4/vc4_state.c')
-rw-r--r-- | lib/mesa/src/gallium/drivers/vc4/vc4_state.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/lib/mesa/src/gallium/drivers/vc4/vc4_state.c b/lib/mesa/src/gallium/drivers/vc4/vc4_state.c index 996b158ad..124715895 100644 --- a/lib/mesa/src/gallium/drivers/vc4/vc4_state.c +++ b/lib/mesa/src/gallium/drivers/vc4/vc4_state.c @@ -51,7 +51,9 @@ vc4_set_blend_color(struct pipe_context *pctx, const struct pipe_blend_color *blend_color) { struct vc4_context *vc4 = vc4_context(pctx); - vc4->blend_color = *blend_color; + vc4->blend_color.f = *blend_color; + for (int i = 0; i < 4; i++) + vc4->blend_color.ub[i] = float_to_ubyte(blend_color->color[i]); vc4->dirty |= VC4_DIRTY_BLEND_COLOR; } @@ -77,7 +79,7 @@ static void vc4_set_sample_mask(struct pipe_context *pctx, unsigned sample_mask) { struct vc4_context *vc4 = vc4_context(pctx); - vc4->sample_mask = (uint16_t)sample_mask; + vc4->sample_mask = sample_mask & ((1 << VC4_MAX_SAMPLES) - 1); vc4->dirty |= VC4_DIRTY_SAMPLE_MASK; } @@ -119,6 +121,9 @@ vc4_create_rasterizer_state(struct pipe_context *pctx, so->offset_factor = float_to_187_half(cso->offset_scale); } + if (cso->multisample) + so->config_bits[0] |= VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_4X; + return so; } @@ -303,10 +308,10 @@ vc4_set_index_buffer(struct pipe_context *pctx, struct vc4_context *vc4 = vc4_context(pctx); if (ib) { - assert(!ib->user_buffer); pipe_resource_reference(&vc4->indexbuf.buffer, ib->buffer); vc4->indexbuf.index_size = ib->index_size; vc4->indexbuf.offset = ib->offset; + vc4->indexbuf.user_buffer = ib->user_buffer; } else { pipe_resource_reference(&vc4->indexbuf.buffer, NULL); } @@ -370,7 +375,7 @@ vc4_vertex_state_bind(struct pipe_context *pctx, void *hwcso) static void vc4_set_constant_buffer(struct pipe_context *pctx, uint shader, uint index, - struct pipe_constant_buffer *cb) + const struct pipe_constant_buffer *cb) { struct vc4_context *vc4 = vc4_context(pctx); struct vc4_constbuf_stateobj *so = &vc4->constbuf[shader]; @@ -404,7 +409,7 @@ vc4_set_framebuffer_state(struct pipe_context *pctx, struct pipe_framebuffer_state *cso = &vc4->framebuffer; unsigned i; - vc4_flush(pctx); + vc4->job = NULL; for (i = 0; i < framebuffer->nr_cbufs; i++) pipe_surface_reference(&cso->cbufs[i], framebuffer->cbufs[i]); @@ -442,10 +447,8 @@ vc4_set_framebuffer_state(struct pipe_context *pctx, } static struct vc4_texture_stateobj * -vc4_get_stage_tex(struct vc4_context *vc4, unsigned shader) +vc4_get_stage_tex(struct vc4_context *vc4, enum pipe_shader_type shader) { - vc4->dirty |= VC4_DIRTY_TEXSTATE; - switch (shader) { case PIPE_SHADER_FRAGMENT: vc4->dirty |= VC4_DIRTY_FRAGTEX; @@ -523,7 +526,7 @@ vc4_create_sampler_state(struct pipe_context *pctx, static void vc4_sampler_states_bind(struct pipe_context *pctx, - unsigned shader, unsigned start, + enum pipe_shader_type shader, unsigned start, unsigned nr, void **hwcso) { struct vc4_context *vc4 = vc4_context(pctx); @@ -537,12 +540,10 @@ vc4_sampler_states_bind(struct pipe_context *pctx, if (hwcso[i]) new_nr = i + 1; stage_tex->samplers[i] = hwcso[i]; - stage_tex->dirty_samplers |= (1 << i); } for (; i < stage_tex->num_samplers; i++) { stage_tex->samplers[i] = NULL; - stage_tex->dirty_samplers |= (1 << i); } stage_tex->num_samplers = new_nr; @@ -552,7 +553,7 @@ static struct pipe_sampler_view * vc4_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc, const struct pipe_sampler_view *cso) { - struct vc4_sampler_view *so = malloc(sizeof(*so)); + struct vc4_sampler_view *so = CALLOC_STRUCT(vc4_sampler_view); struct vc4_resource *rsc = vc4_resource(prsc); if (!so) @@ -569,7 +570,8 @@ vc4_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc, * Also, Raspberry Pi doesn't support sampling from raster textures, * so we also have to copy to a temporary then. */ - if (cso->u.tex.first_level || + if ((cso->u.tex.first_level && + (cso->u.tex.first_level != cso->u.tex.last_level)) || rsc->vc4_format == VC4_TEXTURE_TYPE_RGBA32R) { struct vc4_resource *shadow_parent = vc4_resource(prsc); struct pipe_resource tmpl = shadow_parent->base.b; @@ -592,6 +594,8 @@ vc4_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc, clone->writes = shadow_parent->writes - 1; assert(clone->vc4_format != VC4_TEXTURE_TYPE_RGBA32R); + } else if (cso->u.tex.first_level) { + so->force_first_level = true; } so->base.texture = prsc; so->base.reference.count = 1; @@ -600,7 +604,9 @@ vc4_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc, so->texture_p0 = (VC4_SET_FIELD(rsc->slices[0].offset >> 12, VC4_TEX_P0_OFFSET) | VC4_SET_FIELD(rsc->vc4_format & 15, VC4_TEX_P0_TYPE) | - VC4_SET_FIELD(cso->u.tex.last_level - + VC4_SET_FIELD(so->force_first_level ? + cso->u.tex.last_level : + cso->u.tex.last_level - cso->u.tex.first_level, VC4_TEX_P0_MIPLVLS) | VC4_SET_FIELD(cso->target == PIPE_TEXTURE_CUBE, VC4_TEX_P0_CMMODE)); @@ -621,7 +627,8 @@ vc4_sampler_view_destroy(struct pipe_context *pctx, } static void -vc4_set_sampler_views(struct pipe_context *pctx, unsigned shader, +vc4_set_sampler_views(struct pipe_context *pctx, + enum pipe_shader_type shader, unsigned start, unsigned nr, struct pipe_sampler_view **views) { @@ -632,18 +639,14 @@ vc4_set_sampler_views(struct pipe_context *pctx, unsigned shader, assert(start == 0); - vc4->dirty |= VC4_DIRTY_TEXSTATE; - for (i = 0; i < nr; i++) { if (views[i]) new_nr = i + 1; pipe_sampler_view_reference(&stage_tex->textures[i], views[i]); - stage_tex->dirty_samplers |= (1 << i); } for (; i < stage_tex->num_textures; i++) { pipe_sampler_view_reference(&stage_tex->textures[i], NULL); - stage_tex->dirty_samplers |= (1 << i); } stage_tex->num_textures = new_nr; |