diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-02-19 04:24:02 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-02-19 04:24:02 +0000 |
commit | cbd6affc1bcf169c184a3241747a6691c9a58bf7 (patch) | |
tree | 2bfc8a9bc5322b924e8558d39140656e1a2a1c05 /lib/mesa/src/gallium/drivers/freedreno | |
parent | df3e736303c669580785ffc3f94a16997685c8df (diff) |
Merge Mesa 18.3.4
Diffstat (limited to 'lib/mesa/src/gallium/drivers/freedreno')
3 files changed, 14 insertions, 5 deletions
diff --git a/lib/mesa/src/gallium/drivers/freedreno/freedreno_resource.c b/lib/mesa/src/gallium/drivers/freedreno/freedreno_resource.c index 54d738589..eeeda1cf6 100644 --- a/lib/mesa/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/lib/mesa/src/gallium/drivers/freedreno/freedreno_resource.c @@ -839,8 +839,7 @@ fd_resource_create(struct pipe_screen *pscreen, rsc->internal_format = format; rsc->cpp = util_format_get_blocksize(format); - prsc->nr_samples = MAX2(1, prsc->nr_samples); - rsc->cpp *= prsc->nr_samples; + rsc->cpp *= fd_resource_nr_samples(prsc); assert(rsc->cpp); @@ -924,9 +923,9 @@ fd_resource_from_handle(struct pipe_screen *pscreen, if (!rsc->bo) goto fail; - prsc->nr_samples = MAX2(1, prsc->nr_samples); rsc->internal_format = tmpl->format; - rsc->cpp = prsc->nr_samples * util_format_get_blocksize(tmpl->format); + rsc->cpp = util_format_get_blocksize(tmpl->format); + rsc->cpp *= fd_resource_nr_samples(prsc); slice->pitch = handle->stride / rsc->cpp; slice->offset = handle->offset; slice->size0 = handle->stride * prsc->height0; diff --git a/lib/mesa/src/gallium/drivers/freedreno/freedreno_resource.h b/lib/mesa/src/gallium/drivers/freedreno/freedreno_resource.h index 09abb512d..6790352f9 100644 --- a/lib/mesa/src/gallium/drivers/freedreno/freedreno_resource.h +++ b/lib/mesa/src/gallium/drivers/freedreno/freedreno_resource.h @@ -178,6 +178,15 @@ fd_resource_level_linear(struct pipe_resource *prsc, int level) return false; } +/* access # of samples, with 0 normalized to 1 (which is what we care about + * most of the time) + */ +static inline unsigned +fd_resource_nr_samples(struct pipe_resource *prsc) +{ + return MAX2(1, prsc->nr_samples); +} + void fd_blitter_pipe_begin(struct fd_context *ctx, bool render_cond, bool discard, enum fd_render_stage stage); void fd_blitter_pipe_end(struct fd_context *ctx); diff --git a/lib/mesa/src/gallium/drivers/freedreno/freedreno_texture.c b/lib/mesa/src/gallium/drivers/freedreno/freedreno_texture.c index d92298d2e..84b4df6c1 100644 --- a/lib/mesa/src/gallium/drivers/freedreno/freedreno_texture.c +++ b/lib/mesa/src/gallium/drivers/freedreno/freedreno_texture.c @@ -31,6 +31,7 @@ #include "freedreno_texture.h" #include "freedreno_context.h" +#include "freedreno_resource.h" #include "freedreno_util.h" static void @@ -83,7 +84,7 @@ static void set_sampler_views(struct fd_texture_stateobj *tex, tex->num_textures = util_last_bit(tex->valid_textures); for (i = 0; i < tex->num_textures; i++) { - uint nr_samples = tex->textures[i]->texture->nr_samples; + uint nr_samples = fd_resource_nr_samples(tex->textures[i]->texture); samplers |= (nr_samples >> 1) << (i * 2); } |