Mesa (main): panfrost: Move sample accessor to pan_cmdstream

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 7 13:34:29 UTC 2021


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Tue Jul  6 18:14:11 2021 -0400

panfrost: Move sample accessor to pan_cmdstream

Not really arch-dependent but technically uses GenXML. This is pretty
trivial anyway.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Acked-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11745>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 26 ++++++++++++++++++++++++++
 src/gallium/drivers/panfrost/pan_cmdstream.h | 12 ------------
 src/gallium/drivers/panfrost/pan_context.c   | 13 -------------
 3 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 1f002cfe2e9..6b5a609ed3d 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -64,6 +64,18 @@ pan_pipe_asserts()
         PIPE_ASSERT(PIPE_FUNC_ALWAYS   == MALI_FUNC_ALWAYS);
 }
 
+static inline enum mali_sample_pattern
+panfrost_sample_pattern(unsigned samples)
+{
+        switch (samples) {
+        case 1:  return MALI_SAMPLE_PATTERN_SINGLE_SAMPLED;
+        case 4:  return MALI_SAMPLE_PATTERN_ROTATED_4X_GRID;
+        case 8:  return MALI_SAMPLE_PATTERN_D3D_8X_GRID;
+        case 16: return MALI_SAMPLE_PATTERN_D3D_16X_GRID;
+        default: unreachable("Unsupported sample count");
+        }
+}
+
 /* Gets a GPU address for the associated index buffer. Only gauranteed to be
  * good for the duration of the draw (transient), could last longer. Also get
  * the bounds on the index buffer for the range accessed by the draw. We do
@@ -3648,6 +3660,18 @@ prepare_rsd(struct panfrost_device *dev,
         }
 }
 
+static void
+panfrost_get_sample_position(struct pipe_context *context,
+                             unsigned sample_count,
+                             unsigned sample_index,
+                             float *out_value)
+{
+        panfrost_query_sample_position(
+                        panfrost_sample_pattern(sample_count),
+                        sample_index,
+                        out_value);
+}
+
 void
 panfrost_cmdstream_screen_init(struct panfrost_screen *screen)
 {
@@ -3669,4 +3693,6 @@ panfrost_cmdstream_context_init(struct pipe_context *pipe)
         pipe->create_sampler_view = panfrost_create_sampler_view;
         pipe->create_sampler_state = panfrost_create_sampler_state;
         pipe->create_blend_state = panfrost_create_blend_state;
+
+        pipe->get_sample_position = panfrost_get_sample_position;
 }
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.h b/src/gallium/drivers/panfrost/pan_cmdstream.h
index 9454689c8cb..dd65bc9a8bc 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.h
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.h
@@ -32,16 +32,4 @@
 
 #include "pan_job.h"
 
-static inline enum mali_sample_pattern
-panfrost_sample_pattern(unsigned samples)
-{
-        switch (samples) {
-        case 1:  return MALI_SAMPLE_PATTERN_SINGLE_SAMPLED;
-        case 4:  return MALI_SAMPLE_PATTERN_ROTATED_4X_GRID;
-        case 8:  return MALI_SAMPLE_PATTERN_D3D_8X_GRID;
-        case 16: return MALI_SAMPLE_PATTERN_D3D_16X_GRID;
-        default: unreachable("Unsupported sample count");
-        }
-}
-
 #endif /* __PAN_CMDSTREAM_H__ */
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 5d8b37d49b1..0c25590b681 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -728,18 +728,6 @@ panfrost_set_min_samples(struct pipe_context *pipe,
         ctx->dirty_shader[PIPE_SHADER_FRAGMENT] |= PAN_DIRTY_STAGE_RENDERER;
 }
 
-static void
-panfrost_get_sample_position(struct pipe_context *context,
-                             unsigned sample_count,
-                             unsigned sample_index,
-                             float *out_value)
-{
-        panfrost_query_sample_position(
-                        panfrost_sample_pattern(sample_count),
-                        sample_index,
-                        out_value);
-}
-
 static void
 panfrost_set_clip_state(struct pipe_context *pipe,
                         const struct pipe_clip_state *clip)
@@ -1093,7 +1081,6 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
 
         gallium->set_sample_mask = panfrost_set_sample_mask;
         gallium->set_min_samples = panfrost_set_min_samples;
-        gallium->get_sample_position = panfrost_get_sample_position;
 
         gallium->set_clip_state = panfrost_set_clip_state;
         gallium->set_viewport_states = panfrost_set_viewport_states;



More information about the mesa-commit mailing list