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@collabora.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11745>
This commit is contained in:
Alyssa Rosenzweig 2021-07-06 18:14:11 -04:00 committed by Marge Bot
parent ed56d8f7b7
commit b7975c3e90
3 changed files with 26 additions and 25 deletions

View file

@ -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;
}

View file

@ -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__ */

View file

@ -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;