lima: support rectangle texture

As Vasily discovered, the bit 7 of the word 1 of the texture descriptor
is set when reloading the framebuffer, to use framebuffer-based offset
rather than normalized one. This bit also works for regular textures to
enable accessing with non-normalized offset.

Add support for rectangle texture by setting this bit for
PIPE_TEXTURE_RECT.

Suggested-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
This commit is contained in:
Icenowy Zheng 2019-09-26 11:10:18 +08:00 committed by Vasily Khoruzhick
parent eb03141f52
commit a1ff8dbb1e
4 changed files with 9 additions and 3 deletions

View file

@ -289,7 +289,7 @@ lima_pack_reload_plbu_cmd(struct lima_context *ctx)
lima_tex_desc *td = cpu + lima_reload_tex_desc_offset;
memset(td, 0, lima_min_tex_desc_size);
lima_texture_desc_set_res(ctx, td, fb->base.cbufs[0]->texture, 0, 0);
td->unknown_1_1 = 0x80;
td->unnorm_coords = 1;
td->texture_2d = 1;
td->min_img_filter_nearest = 1;
td->mag_img_filter_nearest = 1;

View file

@ -272,6 +272,7 @@ lima_screen_is_format_supported(struct pipe_screen *pscreen,
case PIPE_BUFFER:
case PIPE_TEXTURE_1D:
case PIPE_TEXTURE_2D:
case PIPE_TEXTURE_RECT:
break;
default:
return false;

View file

@ -127,6 +127,9 @@ lima_update_tex_desc(struct lima_context *ctx, struct lima_sampler_state *sample
/* 2D texture */
desc->texture_2d = 1;
if (!sampler->base.normalized_coords)
desc->unnorm_coords = 1;
first_level = texture->base.u.tex.first_level;
last_level = texture->base.u.tex.last_level;
if (last_level - first_level >= LIMA_MAX_MIP_LEVELS)

View file

@ -37,9 +37,11 @@ typedef struct __attribute__((__packed__)) {
uint32_t unknown_0_2: 1;
/* Word 1-3 */
uint32_t unknown_1_1: 10;
uint32_t unknown_1_1: 7;
uint32_t unnorm_coords: 1;
uint32_t unknown_1_2: 2;
uint32_t texture_2d: 1;
uint32_t unknown_1_2: 13;
uint32_t unknown_1_3: 13;
uint32_t miplevels: 4;
uint32_t min_mipfilter_1: 9; /* 0x0 for linear, 0x1ff for nearest */
uint32_t unknown_2_1: 3;