Mesa (master): lima: support rectangle texture

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 26 17:27:47 UTC 2019


Module: Mesa
Branch: master
Commit: a1ff8dbb1e4f526605abe94c5631272e4ab5a7db
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1ff8dbb1e4f526605abe94c5631272e4ab5a7db

Author: Icenowy Zheng <icenowy at aosc.io>
Date:   Thu Sep 26 11:10:18 2019 +0800

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 at gmail.com>
Signed-off-by: Icenowy Zheng <icenowy at aosc.io>
Reviewed-by: Vasily Khoruzhick <anarsoul at gmail.com>

---

 src/gallium/drivers/lima/lima_draw.c    | 2 +-
 src/gallium/drivers/lima/lima_screen.c  | 1 +
 src/gallium/drivers/lima/lima_texture.c | 3 +++
 src/gallium/drivers/lima/lima_texture.h | 6 ++++--
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c
index 8d306caf64a..0cb41d2070d 100644
--- a/src/gallium/drivers/lima/lima_draw.c
+++ b/src/gallium/drivers/lima/lima_draw.c
@@ -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;
diff --git a/src/gallium/drivers/lima/lima_screen.c b/src/gallium/drivers/lima/lima_screen.c
index 8db8b7071ee..cd9122672b6 100644
--- a/src/gallium/drivers/lima/lima_screen.c
+++ b/src/gallium/drivers/lima/lima_screen.c
@@ -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;
diff --git a/src/gallium/drivers/lima/lima_texture.c b/src/gallium/drivers/lima/lima_texture.c
index 6a44253ba58..a259a1c7b7a 100644
--- a/src/gallium/drivers/lima/lima_texture.c
+++ b/src/gallium/drivers/lima/lima_texture.c
@@ -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)
diff --git a/src/gallium/drivers/lima/lima_texture.h b/src/gallium/drivers/lima/lima_texture.h
index 7a185bc75d0..82e65df70de 100644
--- a/src/gallium/drivers/lima/lima_texture.h
+++ b/src/gallium/drivers/lima/lima_texture.h
@@ -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;




More information about the mesa-commit mailing list