There is not much to do in freedreno - tile layout and multisample
state for gmem renderings is programmed based on the pfb sample count,
while resolve blits take the destination sample count from the resource.

Signed-off-by: Kristian H. Kristensen <hoegsb...@chromium.org>
---
 src/gallium/drivers/freedreno/freedreno_batch_cache.c | 4 +++-
 src/gallium/drivers/freedreno/freedreno_screen.c      | 3 +++
 src/gallium/drivers/freedreno/freedreno_state.c       | 5 +++++
 src/gallium/drivers/freedreno/freedreno_surface.c     | 1 +
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_batch_cache.c 
b/src/gallium/drivers/freedreno/freedreno_batch_cache.c
index 408d48ccdb6..45cd9c172d3 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch_cache.c
+++ b/src/gallium/drivers/freedreno/freedreno_batch_cache.c
@@ -81,7 +81,8 @@ struct key {
        struct {
                struct pipe_resource *texture;
                union pipe_surface_desc u;
-               uint16_t pos, format;
+               uint8_t pos, samples;
+               uint16_t format;
        } surf[0];
 };
 
@@ -401,6 +402,7 @@ key_surf(struct key *key, unsigned idx, unsigned pos, 
struct pipe_surface *psurf
        key->surf[idx].texture = psurf->texture;
        key->surf[idx].u = psurf->u;
        key->surf[idx].pos = pos;
+       key->surf[idx].samples = psurf->nr_samples;
        key->surf[idx].format = psurf->format;
 }
 
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
b/src/gallium/drivers/freedreno/freedreno_screen.c
index 88d91a91234..3fe59992a26 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -237,6 +237,9 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
        case PIPE_CAP_TEXTURE_MULTISAMPLE:
                return is_a5xx(screen) || is_a6xx(screen);
 
+       case PIPE_CAP_MULTISAMPLED_RENDER_TO_TEXTURE:
+               return is_a6xx(screen);
+
        case PIPE_CAP_DEPTH_CLIP_DISABLE:
                return is_a3xx(screen) || is_a4xx(screen);
 
diff --git a/src/gallium/drivers/freedreno/freedreno_state.c 
b/src/gallium/drivers/freedreno/freedreno_state.c
index 76b54a56044..0da634ea519 100644
--- a/src/gallium/drivers/freedreno/freedreno_state.c
+++ b/src/gallium/drivers/freedreno/freedreno_state.c
@@ -221,6 +221,11 @@ fd_set_framebuffer_state(struct pipe_context *pctx,
        util_copy_framebuffer_state(cso, framebuffer);
 
        cso->samples = util_framebuffer_get_num_samples(cso);
+       for (unsigned i = 0; i < cso->nr_cbufs; i++) {
+               if (cso->cbufs[i]->nr_samples > 0)
+                       cso->samples = cso->cbufs[i]->nr_samples;
+       }
+
 
        if (ctx->screen->reorder) {
                struct fd_batch *old_batch = NULL;
diff --git a/src/gallium/drivers/freedreno/freedreno_surface.c 
b/src/gallium/drivers/freedreno/freedreno_surface.c
index 6f415f69993..24da54798b6 100644
--- a/src/gallium/drivers/freedreno/freedreno_surface.c
+++ b/src/gallium/drivers/freedreno/freedreno_surface.c
@@ -53,6 +53,7 @@ fd_create_surface(struct pipe_context *pctx,
        psurf->format = surf_tmpl->format;
        psurf->width = u_minify(ptex->width0, level);
        psurf->height = u_minify(ptex->height0, level);
+       psurf->nr_samples = surf_tmpl->nr_samples;
 
        if (ptex->target == PIPE_BUFFER) {
                psurf->u.buf.first_element = surf_tmpl->u.buf.first_element;
-- 
2.19.1.930.g4563a0d9d0-goog

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to