summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/a3xx
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/freedreno/a3xx')
-rw-r--r--src/gallium/drivers/freedreno/a3xx/a3xx.xml.h15
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_compiler.c4
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_emit.c19
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_gmem.c21
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_texture.c21
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_texture.h1
6 files changed, 57 insertions, 24 deletions
diff --git a/src/gallium/drivers/freedreno/a3xx/a3xx.xml.h b/src/gallium/drivers/freedreno/a3xx/a3xx.xml.h
index d183516067b..834361b837d 100644
--- a/src/gallium/drivers/freedreno/a3xx/a3xx.xml.h
+++ b/src/gallium/drivers/freedreno/a3xx/a3xx.xml.h
@@ -4,16 +4,16 @@
/* Autogenerated file, DO NOT EDIT manually!
This file was generated by the rules-ng-ng headergen tool in this git repository:
-http://0x04.net/cgit/index.cgi/rules-ng-ng
-git clone git://0x04.net/rules-ng-ng
+http://github.com/freedreno/envytools/
+git clone https://github.com/freedreno/envytools.git
The rules-ng-ng source files this header was generated from are:
- /home/robclark/src/freedreno/envytools/rnndb/adreno.xml ( 327 bytes, from 2013-07-05 19:21:12)
- /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2013-03-31 16:51:27)
- /home/robclark/src/freedreno/envytools/rnndb/a2xx/a2xx.xml ( 30005 bytes, from 2013-07-19 21:30:48)
- /home/robclark/src/freedreno/envytools/rnndb/adreno_common.xml ( 8983 bytes, from 2013-07-24 01:38:36)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno_pm4.xml ( 9712 bytes, from 2013-05-26 15:22:37)
-- /home/robclark/src/freedreno/envytools/rnndb/a3xx/a3xx.xml ( 51415 bytes, from 2013-08-03 14:26:05)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno_pm4.xml ( 9759 bytes, from 2013-09-06 12:50:15)
+- /home/robclark/src/freedreno/envytools/rnndb/a3xx/a3xx.xml ( 51536 bytes, from 2013-09-08 13:18:17)
Copyright (C) 2013 by the following authors:
- Rob Clark <[email protected]> (robclark)
@@ -2074,6 +2074,7 @@ static inline uint32_t A3XX_UCHE_CACHE_INVALIDATE1_REG_OPCODE(enum a3xx_cache_op
#define REG_A3XX_TP_PERFCOUNTER5_SELECT 0x00000f09
#define REG_A3XX_TEX_SAMP_0 0x00000000
+#define A3XX_TEX_SAMP_0_MIPFILTER_LINEAR 0x00000002
#define A3XX_TEX_SAMP_0_XY_MAG__MASK 0x0000000c
#define A3XX_TEX_SAMP_0_XY_MAG__SHIFT 2
static inline uint32_t A3XX_TEX_SAMP_0_XY_MAG(enum a3xx_tex_filter val)
@@ -2134,6 +2135,12 @@ static inline uint32_t A3XX_TEX_CONST_0_SWIZ_W(enum a3xx_tex_swiz val)
{
return ((val) << A3XX_TEX_CONST_0_SWIZ_W__SHIFT) & A3XX_TEX_CONST_0_SWIZ_W__MASK;
}
+#define A3XX_TEX_CONST_0_MIPLVLS__MASK 0x000f0000
+#define A3XX_TEX_CONST_0_MIPLVLS__SHIFT 16
+static inline uint32_t A3XX_TEX_CONST_0_MIPLVLS(uint32_t val)
+{
+ return ((val) << A3XX_TEX_CONST_0_MIPLVLS__SHIFT) & A3XX_TEX_CONST_0_MIPLVLS__MASK;
+}
#define A3XX_TEX_CONST_0_FMT__MASK 0x1fc00000
#define A3XX_TEX_CONST_0_FMT__SHIFT 22
static inline uint32_t A3XX_TEX_CONST_0_FMT(enum a3xx_tex_fmt val)
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c b/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c
index 51154113de6..994f71c0d2c 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c
@@ -824,8 +824,10 @@ trans_samp(const struct instr_translater *t,
break;
}
- if (tex == TGSI_TEXTURE_3D)
+ if ((tex == TGSI_TEXTURE_3D) || (tex == TGSI_TEXTURE_CUBE)) {
+ ir3_instr_create(ctx->ir, 0, OPC_NOP)->repeat = 2; // XXX ???
flags |= IR3_INSTR_3D;
+ }
/* The texture sample instructions need to coord in successive
* registers/components (ie. src.xy but not src.yx). And TXP
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
index 5e586185ad9..66dc4a8d0bf 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
@@ -146,7 +146,7 @@ emit_constants(struct fd_ringbuffer *ring,
#define VERT_TEX_OFF 0
#define FRAG_TEX_OFF 16
-#define BASETABLE_SZ 14
+#define BASETABLE_SZ A3XX_MAX_MIP_LEVELS
static void
emit_textures(struct fd_ringbuffer *ring,
@@ -212,12 +212,15 @@ emit_textures(struct fd_ringbuffer *ring,
for (i = 0; i < tex->num_textures; i++) {
struct fd3_pipe_sampler_view *view =
fd3_pipe_sampler_view(tex->textures[i]);
- OUT_RELOC(ring, view->tex_resource->bo, 0, 0, 0);
- /* I think each entry is a ptr to mipmap level.. for now, just
- * pad w/ null's until I get around to actually implementing
- * mipmap support..
- */
- for (j = 1; j < BASETABLE_SZ; j++) {
+ struct fd_resource *rsc = view->tex_resource;
+
+ for (j = 0; j < view->mipaddrs; j++) {
+ struct fd_resource_slice *slice = fd_resource_slice(rsc, j);
+ OUT_RELOC(ring, rsc->bo, slice->offset, 0, 0);
+ }
+
+ /* pad the remaining entries w/ null: */
+ for (; j < BASETABLE_SZ; j++) {
OUT_RING(ring, 0x00000000);
}
}
@@ -284,7 +287,7 @@ fd3_emit_gmem_restore_tex(struct fd_ringbuffer *ring, struct pipe_surface *psurf
OUT_RING(ring, A3XX_TEX_CONST_1_FETCHSIZE(TFETCH_DISABLE) |
A3XX_TEX_CONST_1_WIDTH(psurf->width) |
A3XX_TEX_CONST_1_HEIGHT(psurf->height));
- OUT_RING(ring, A3XX_TEX_CONST_2_PITCH(rsc->pitch * rsc->cpp) |
+ OUT_RING(ring, A3XX_TEX_CONST_2_PITCH(rsc->slices[0].pitch * rsc->cpp) |
A3XX_TEX_CONST_2_INDX(0));
OUT_RING(ring, 0x00000000);
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
index 8d2df47c72a..cdc880ed562 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
@@ -59,25 +59,27 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
for (i = 0; i < 4; i++) {
enum a3xx_color_fmt format = 0;
enum a3xx_color_swap swap = WZYX;
- struct fd_resource *res = NULL;
+ struct fd_resource *rsc = NULL;
+ struct fd_resource_slice *slice = NULL;
uint32_t stride = 0;
uint32_t base = 0;
if (i < nr_bufs) {
struct pipe_surface *psurf = bufs[i];
- res = fd_resource(psurf->texture);
+ rsc = fd_resource(psurf->texture);
+ slice = &rsc->slices[psurf->u.tex.level];
format = fd3_pipe2color(psurf->format);
swap = fd3_pipe2swap(psurf->format);
if (bin_w) {
- stride = bin_w * res->cpp;
+ stride = bin_w * rsc->cpp;
if (bases) {
- base = bases[i] * res->cpp;
+ base = bases[i] * rsc->cpp;
}
} else {
- stride = res->pitch * res->cpp;
+ stride = slice->pitch * rsc->cpp;
}
}
@@ -89,7 +91,7 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
if (bin_w || (i >= nr_bufs)) {
OUT_RING(ring, A3XX_RB_MRT_BUF_BASE_COLOR_BUF_BASE(base));
} else {
- OUT_RELOCW(ring, res->bo, 0, 0, -1);
+ OUT_RELOCW(ring, rsc->bo, slice->offset, 0, -1);
}
OUT_PKT0(ring, REG_A3XX_SP_FS_IMAGE_OUTPUT_REG(i), 1);
@@ -111,13 +113,14 @@ emit_gmem2mem_surf(struct fd_ringbuffer *ring,
uint32_t base, struct pipe_surface *psurf)
{
struct fd_resource *rsc = fd_resource(psurf->texture);
+ struct fd_resource_slice *slice = &rsc->slices[psurf->u.tex.level];
OUT_PKT0(ring, REG_A3XX_RB_COPY_CONTROL, 4);
OUT_RING(ring, A3XX_RB_COPY_CONTROL_MSAA_RESOLVE(MSAA_ONE) |
A3XX_RB_COPY_CONTROL_MODE(mode) |
A3XX_RB_COPY_CONTROL_GMEM_BASE(base));
- OUT_RELOCW(ring, rsc->bo, 0, 0, -1); /* RB_COPY_DEST_BASE */
- OUT_RING(ring, A3XX_RB_COPY_DEST_PITCH_PITCH(rsc->pitch * rsc->cpp));
+ OUT_RELOCW(ring, rsc->bo, slice->offset, 0, -1); /* RB_COPY_DEST_BASE */
+ OUT_RING(ring, A3XX_RB_COPY_DEST_PITCH_PITCH(slice->pitch * rsc->cpp));
OUT_RING(ring, A3XX_RB_COPY_DEST_INFO_TILE(LINEAR) |
A3XX_RB_COPY_DEST_INFO_FORMAT(fd3_pipe2color(psurf->format)) |
A3XX_RB_COPY_DEST_INFO_COMPONENT_ENABLE(0xf) |
@@ -418,7 +421,7 @@ fd3_emit_sysmem_prep(struct fd_context *ctx)
uint32_t pitch = 0;
if (pfb->cbufs[0])
- pitch = fd_resource(pfb->cbufs[0]->texture)->pitch;
+ pitch = fd_resource(pfb->cbufs[0]->texture)->slices[0].pitch;
fd3_emit_restore(ctx);
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
index e56325ba1f1..a44ac46beb1 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
@@ -80,20 +80,34 @@ fd3_sampler_state_create(struct pipe_context *pctx,
const struct pipe_sampler_state *cso)
{
struct fd3_sampler_stateobj *so = CALLOC_STRUCT(fd3_sampler_stateobj);
+ bool miplinear = false;
if (!so)
return NULL;
+ if (cso->min_mip_filter == PIPE_TEX_MIPFILTER_NEAREST)
+ miplinear = true;
+
so->base = *cso;
so->texsamp0 =
COND(!cso->normalized_coords, A3XX_TEX_SAMP_0_UNNORM_COORDS) |
+ COND(miplinear, A3XX_TEX_SAMP_0_MIPFILTER_LINEAR) |
A3XX_TEX_SAMP_0_XY_MAG(tex_filter(cso->mag_img_filter)) |
A3XX_TEX_SAMP_0_XY_MIN(tex_filter(cso->min_img_filter)) |
A3XX_TEX_SAMP_0_WRAP_S(tex_clamp(cso->wrap_s)) |
A3XX_TEX_SAMP_0_WRAP_T(tex_clamp(cso->wrap_t)) |
A3XX_TEX_SAMP_0_WRAP_R(tex_clamp(cso->wrap_r));
- so->texsamp1 = 0x00000000; /* ??? */
+
+ /* when mip-map is not disabled, this gets set.. I guess possibly
+ * it is the LOD related params, but I think I need GLES3 blob driver
+ * to be able to tell..
+ */
+ if (cso->min_mip_filter != PIPE_TEX_MIPFILTER_NONE) {
+ so->texsamp1 = 0x003ff000;
+ } else {
+ so->texsamp1 = 0x00000000;
+ }
return so;
}
@@ -126,6 +140,7 @@ fd3_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
{
struct fd3_pipe_sampler_view *so = CALLOC_STRUCT(fd3_pipe_sampler_view);
struct fd_resource *rsc = fd_resource(prsc);
+ unsigned miplevels = cso->u.tex.last_level - cso->u.tex.first_level;
if (!so)
return NULL;
@@ -137,10 +152,12 @@ fd3_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
so->base.context = pctx;
so->tex_resource = rsc;
+ so->mipaddrs = 1 + miplevels;
so->texconst0 =
A3XX_TEX_CONST_0_TYPE(tex_type(prsc->target)) |
A3XX_TEX_CONST_0_FMT(fd3_pipe2tex(cso->format)) |
+ A3XX_TEX_CONST_0_MIPLVLS(miplevels) |
fd3_tex_swiz(cso->format, cso->swizzle_r, cso->swizzle_g,
cso->swizzle_b, cso->swizzle_a);
so->texconst1 =
@@ -149,7 +166,7 @@ fd3_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
A3XX_TEX_CONST_1_HEIGHT(prsc->height0);
/* when emitted, A3XX_TEX_CONST_2_INDX() must be OR'd in: */
so->texconst2 =
- A3XX_TEX_CONST_2_PITCH(rsc->pitch * rsc->cpp);
+ A3XX_TEX_CONST_2_PITCH(rsc->slices[0].pitch * rsc->cpp);
so->texconst3 = 0x00000000; /* ??? */
return &so->base;
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_texture.h b/src/gallium/drivers/freedreno/a3xx/fd3_texture.h
index a83f527366b..f7e5f0e650f 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_texture.h
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_texture.h
@@ -51,6 +51,7 @@ fd3_sampler_stateobj(struct pipe_sampler_state *samp)
struct fd3_pipe_sampler_view {
struct pipe_sampler_view base;
struct fd_resource *tex_resource;
+ uint32_t mipaddrs;
uint32_t texconst0, texconst1, texconst2, texconst3;
};