From 200859f45cf96b3fdc58667242ec79937072337d Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Sun, 25 Aug 2019 12:54:14 -0700 Subject: [PATCH] lima: fix texture descriptor issues Looks like initial RE was wrong and some fields have different purpose. I.e. there's no "disable_mipmap" field, it's actually part of another field that selects mipmap filtering. Also fix layout position. Reviewed-by: Qiang Yu Signed-off-by: Vasily Khoruzhick --- src/gallium/drivers/lima/lima_texture.c | 15 +++++++-------- src/gallium/drivers/lima/lima_texture.h | 15 ++++++--------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/lima/lima_texture.c b/src/gallium/drivers/lima/lima_texture.c index 379bf387330..6a44253ba58 100644 --- a/src/gallium/drivers/lima/lima_texture.c +++ b/src/gallium/drivers/lima/lima_texture.c @@ -121,7 +121,6 @@ lima_update_tex_desc(struct lima_context *ctx, struct lima_sampler_state *sample lima_tex_desc *desc = pdesc; unsigned first_level; unsigned last_level; - bool mipmapping; memset(desc, 0, desc_size); @@ -133,25 +132,25 @@ lima_update_tex_desc(struct lima_context *ctx, struct lima_sampler_state *sample if (last_level - first_level >= LIMA_MAX_MIP_LEVELS) last_level = first_level + LIMA_MAX_MIP_LEVELS - 1; + desc->miplevels = (last_level - first_level); + switch (sampler->base.min_mip_filter) { case PIPE_TEX_MIPFILTER_LINEAR: - desc->min_mipfilter = 3; + desc->min_mipfilter_1 = 0; + desc->min_mipfilter_2 = 3; + break; case PIPE_TEX_MIPFILTER_NEAREST: - mipmapping = true; - desc->miplevels = (last_level - first_level); + desc->min_mipfilter_1 = 0x1ff; + desc->min_mipfilter_2 = 0; break; case PIPE_TEX_MIPFILTER_NONE: default: - mipmapping = false; break; } switch (sampler->base.mag_img_filter) { case PIPE_TEX_FILTER_LINEAR: desc->mag_img_filter_nearest = 0; - /* no mipmap, filter_mag = linear */ - if (!mipmapping) - desc->disable_mipmap = 1; break; case PIPE_TEX_FILTER_NEAREST: default: diff --git a/src/gallium/drivers/lima/lima_texture.h b/src/gallium/drivers/lima/lima_texture.h index c1bc34f8740..7a185bc75d0 100644 --- a/src/gallium/drivers/lima/lima_texture.h +++ b/src/gallium/drivers/lima/lima_texture.h @@ -36,18 +36,15 @@ typedef struct __attribute__((__packed__)) { uint32_t stride: 13; uint32_t unknown_0_2: 1; - /* Word 1*/ + /* Word 1-3 */ uint32_t unknown_1_1: 10; uint32_t texture_2d: 1; uint32_t unknown_1_2: 13; uint32_t miplevels: 4; - uint32_t unknown_1_3: 3; - uint32_t disable_mipmap: 1; - - /* Word 2-3 */ - uint32_t unknown_2_1: 8; + uint32_t min_mipfilter_1: 9; /* 0x0 for linear, 0x1ff for nearest */ + uint32_t unknown_2_1: 3; uint32_t has_stride: 1; - uint32_t min_mipfilter: 2; /* 0x3 for linear, 0x0 for neares */ + uint32_t min_mipfilter_2: 2; /* 0x3 for linear, 0x0 for nearest */ uint32_t min_img_filter_nearest: 1; uint32_t mag_img_filter_nearest: 1; uint32_t wrap_s_clamp_to_edge: 1; @@ -75,9 +72,9 @@ typedef struct __attribute__((__packed__)) { union { uint32_t va[0]; struct __attribute__((__packed__)) { - uint32_t unknown_6_1: 12; + uint32_t unknown_6_1: 13; uint32_t layout: 2; - uint32_t unknown_6_2: 10; + uint32_t unknown_6_2: 9; uint32_t unknown_6_3: 6; #define VA_BIT_OFFSET 30 #define VA_BIT_SIZE 26 -- 2.30.2