summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVarad Gautam <varadgautam@gmail.com>2016-09-30 12:32:35 (GMT)
committerVarad Gautam <varadgautam@gmail.com>2016-10-21 13:44:38 (GMT)
commit037e7ec00245e135ee443e5b9b3e953fb2482afc (patch)
tree8a44805fafbddeafc318c21793fbd857a1ed7170
parentf37add53c30c4c4fe082e3fbfe477e5c9b389949 (diff)
downloadmesa-037e7ec00245e135ee443e5b9b3e953fb2482afc.tar.gz
mesa-037e7ec00245e135ee443e5b9b3e953fb2482afc.tar.xz
freedreno: use format modifiers during import
Signed-off-by: Varad Gautam <varadgautam@gmail.com>
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_texture.c8
-rw-r--r--src/gallium/drivers/freedreno/freedreno_resource.c1
-rw-r--r--src/gallium/drivers/freedreno/freedreno_resource.h2
3 files changed, 7 insertions, 4 deletions
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
index c89ba64..9e290e2 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
@@ -230,13 +230,13 @@ fd3_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
so->base.reference.count = 1;
so->base.context = pctx;
- odd_y32 = prsc->nv12 ? (prsc->height0 >> 5) & 1 : 0;
+ odd_y32 = rsc->tiled ? (prsc->height0 >> 5) & 1 : 0;
- if(cso->format == PIPE_FORMAT_R8_UNORM && prsc->nv12) {
+ if(cso->format == PIPE_FORMAT_R8_UNORM && rsc->tiled) {
fmt = TFMT_NV12_Y_TILED;
swizz = A3XX_TEX_CONST_0_SWIZ_X(A3XX_TEX_X);
}
- else if(cso->format == PIPE_FORMAT_R8G8_UNORM && prsc->nv12) {
+ else if(cso->format == PIPE_FORMAT_R8G8_UNORM && rsc->tiled) {
fmt = TFMT_NV12_UV_TILED;
swizz = A3XX_TEX_CONST_0_SWIZ_X(A3XX_TEX_Y) |
A3XX_TEX_CONST_0_SWIZ_Y(A3XX_TEX_Z);
@@ -275,7 +275,7 @@ fd3_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
A3XX_TEX_CONST_1_HEIGHT(u_minify(prsc->height0, lvl));
}
/* when emitted, A3XX_TEX_CONST_2_INDX() must be OR'd in: */
- if(prsc->nv12) {
+ if(rsc->tiled) {
/* texconst2 is redefined for nv12mt */
if (cso->format == PIPE_FORMAT_R8_UNORM) {
so->texconst2 = ((((align(prsc->width0, 128) / 128) & 0x1F) |
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index bd5ee9f..d770b0a 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -904,6 +904,7 @@ fd_resource_from_handle(struct pipe_screen *pscreen,
rsc->base.vtbl = &fd_resource_vtbl;
rsc->cpp = util_format_get_blocksize(tmpl->format);
+ rsc->tiled = handle->modifier ? 1 : 0; // TODO: samsung_64_32_tile
slice->pitch = handle->stride / rsc->cpp;
slice->offset = handle->offset;
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.h b/src/gallium/drivers/freedreno/freedreno_resource.h
index 60ba7e6..3d09499 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.h
+++ b/src/gallium/drivers/freedreno/freedreno_resource.h
@@ -96,6 +96,8 @@ struct fd_resource {
* shadowed.
*/
uint32_t bc_batch_mask;
+
+ uint64_t tiled;
};
static inline struct fd_resource *