summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-09-14 18:40:53 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2013-09-14 18:40:53 +0200
commit0b3a6f73afdbf98f7bded006f47be5174efbd9d3 (patch)
treebb3841fb4930ab567906ae09b308cf9baf45571e
parent5b55f54802d43a1bb3448d926ce8b760d6c9473d (diff)
driver: viewport scale and offset xy as fixp
Prepare for v4 state delta (context switching) support. The kernel expects these fields to be fixp, so we do too.
-rw-r--r--native/driver/etna_pipe.c24
-rw-r--r--native/driver/etna_pipe.h34
2 files changed, 29 insertions, 29 deletions
diff --git a/native/driver/etna_pipe.c b/native/driver/etna_pipe.c
index c0de3b9..adb1b70 100644
--- a/native/driver/etna_pipe.c
+++ b/native/driver/etna_pipe.c
@@ -147,11 +147,11 @@ static void reset_context(struct pipe_context *restrict pipe)
{
/*0085C*/ EMIT_STATE(VS_RANGE, VS_RANGE);
}
- /*00A00*/ EMIT_STATE(PA_VIEWPORT_SCALE_X, PA_VIEWPORT_SCALE_X);
- /*00A04*/ EMIT_STATE(PA_VIEWPORT_SCALE_Y, PA_VIEWPORT_SCALE_Y);
+ /*00A00*/ EMIT_STATE_FIXP(PA_VIEWPORT_SCALE_X, PA_VIEWPORT_SCALE_X);
+ /*00A04*/ EMIT_STATE_FIXP(PA_VIEWPORT_SCALE_Y, PA_VIEWPORT_SCALE_Y);
/*00A08*/ EMIT_STATE(PA_VIEWPORT_SCALE_Z, PA_VIEWPORT_SCALE_Z);
- /*00A0C*/ EMIT_STATE(PA_VIEWPORT_OFFSET_X, PA_VIEWPORT_OFFSET_X);
- /*00A10*/ EMIT_STATE(PA_VIEWPORT_OFFSET_Y, PA_VIEWPORT_OFFSET_Y);
+ /*00A0C*/ EMIT_STATE_FIXP(PA_VIEWPORT_OFFSET_X, PA_VIEWPORT_OFFSET_X);
+ /*00A10*/ EMIT_STATE_FIXP(PA_VIEWPORT_OFFSET_Y, PA_VIEWPORT_OFFSET_Y);
/*00A14*/ EMIT_STATE(PA_VIEWPORT_OFFSET_Z, PA_VIEWPORT_OFFSET_Z);
/*00A18*/ EMIT_STATE(PA_LINE_WIDTH, PA_LINE_WIDTH);
/*00A1C*/ EMIT_STATE(PA_POINT_SIZE, PA_POINT_SIZE);
@@ -451,11 +451,11 @@ static void sync_context(struct pipe_context *restrict pipe)
}
if(unlikely(dirty & (ETNA_STATE_VIEWPORT)))
{
- /*00A00*/ EMIT_STATE(PA_VIEWPORT_SCALE_X, PA_VIEWPORT_SCALE_X, e->viewport.PA_VIEWPORT_SCALE_X);
- /*00A04*/ EMIT_STATE(PA_VIEWPORT_SCALE_Y, PA_VIEWPORT_SCALE_Y, e->viewport.PA_VIEWPORT_SCALE_Y);
+ /*00A00*/ EMIT_STATE_FIXP(PA_VIEWPORT_SCALE_X, PA_VIEWPORT_SCALE_X, e->viewport.PA_VIEWPORT_SCALE_X);
+ /*00A04*/ EMIT_STATE_FIXP(PA_VIEWPORT_SCALE_Y, PA_VIEWPORT_SCALE_Y, e->viewport.PA_VIEWPORT_SCALE_Y);
/*00A08*/ EMIT_STATE(PA_VIEWPORT_SCALE_Z, PA_VIEWPORT_SCALE_Z, e->viewport.PA_VIEWPORT_SCALE_Z);
- /*00A0C*/ EMIT_STATE(PA_VIEWPORT_OFFSET_X, PA_VIEWPORT_OFFSET_X, e->viewport.PA_VIEWPORT_OFFSET_X);
- /*00A10*/ EMIT_STATE(PA_VIEWPORT_OFFSET_Y, PA_VIEWPORT_OFFSET_Y, e->viewport.PA_VIEWPORT_OFFSET_Y);
+ /*00A0C*/ EMIT_STATE_FIXP(PA_VIEWPORT_OFFSET_X, PA_VIEWPORT_OFFSET_X, e->viewport.PA_VIEWPORT_OFFSET_X);
+ /*00A10*/ EMIT_STATE_FIXP(PA_VIEWPORT_OFFSET_Y, PA_VIEWPORT_OFFSET_Y, e->viewport.PA_VIEWPORT_OFFSET_Y);
/*00A14*/ EMIT_STATE(PA_VIEWPORT_OFFSET_Z, PA_VIEWPORT_OFFSET_Z, e->viewport.PA_VIEWPORT_OFFSET_Z);
}
if(unlikely(dirty & (ETNA_STATE_RASTERIZER)))
@@ -1118,11 +1118,11 @@ static void etna_pipe_set_viewport_states( struct pipe_context *pipe,
* scale' = 2 * scale
* translate' = translate - scale
*/
- cs->PA_VIEWPORT_SCALE_X = etna_f32_to_u32(vs->scale[0]);
- cs->PA_VIEWPORT_SCALE_Y = etna_f32_to_u32(vs->scale[1]);
+ cs->PA_VIEWPORT_SCALE_X = etna_f32_to_fixp16(vs->scale[0]); /* must be fixp as v4 state deltas assume it is */
+ cs->PA_VIEWPORT_SCALE_Y = etna_f32_to_fixp16(vs->scale[1]);
cs->PA_VIEWPORT_SCALE_Z = etna_f32_to_u32(vs->scale[2] * 2.0f);
- cs->PA_VIEWPORT_OFFSET_X = etna_f32_to_u32(vs->translate[0]);
- cs->PA_VIEWPORT_OFFSET_Y = etna_f32_to_u32(vs->translate[1]);
+ cs->PA_VIEWPORT_OFFSET_X = etna_f32_to_fixp16(vs->translate[0]);
+ cs->PA_VIEWPORT_OFFSET_Y = etna_f32_to_fixp16(vs->translate[1]);
cs->PA_VIEWPORT_OFFSET_Z = etna_f32_to_u32(vs->translate[2] - vs->scale[2]);
/* Compute scissor rectangle (fixp) from viewport.
diff --git a/native/driver/etna_pipe.h b/native/driver/etna_pipe.h
index 653dbbd..eaef96c 100644
--- a/native/driver/etna_pipe.h
+++ b/native/driver/etna_pipe.h
@@ -156,7 +156,7 @@ struct etna_pipe_context
struct util_slab_mempool transfer_pool;
struct blitter_context *blitter;
- /* bindable state */
+ /* compiled bindable state */
struct compiled_blend_state blend;
unsigned num_vertex_samplers;
unsigned num_fragment_samplers;
@@ -166,7 +166,20 @@ struct etna_pipe_context
struct compiled_vertex_elements_state vertex_elements;
struct compiled_shader_state shader_state;
- /* pointers to the bound state */
+ /* compiled parameter-like state */
+ struct compiled_blend_color blend_color;
+ struct compiled_stencil_ref stencil_ref;
+ struct compiled_sample_mask sample_mask;
+ struct compiled_framebuffer_state framebuffer;
+ struct compiled_scissor_state scissor;
+ struct compiled_viewport_state viewport;
+ unsigned num_fragment_sampler_views;
+ unsigned num_vertex_sampler_views;
+ struct compiled_sampler_view sampler_view[PIPE_MAX_SAMPLERS];
+ struct compiled_set_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
+ struct compiled_set_index_buffer index_buffer;
+
+ /* pointers to the bound state. these are mainly kept around for the blitter. */
struct compiled_blend_state *blend_p;
struct compiled_sampler_state *sampler_p[PIPE_MAX_SAMPLERS];
struct compiled_rasterizer_state *rasterizer_p;
@@ -175,7 +188,7 @@ struct etna_pipe_context
struct etna_shader_object *vs;
struct etna_shader_object *fs;
- /* saved parameter-like state. this is mainly kept around for the blitter. */
+ /* saved parameter-like state. these are mainly kept around for the blitter. */
struct pipe_framebuffer_state framebuffer_s;
unsigned sample_mask_s;
struct pipe_stencil_ref stencil_ref_s;
@@ -185,20 +198,7 @@ struct etna_pipe_context
struct pipe_vertex_buffer vertex_buffer_s[PIPE_MAX_ATTRIBS];
struct pipe_index_buffer index_buffer_s;
- /* compiled parameter-like state */
- struct compiled_blend_color blend_color;
- struct compiled_stencil_ref stencil_ref;
- struct compiled_sample_mask sample_mask;
- struct compiled_framebuffer_state framebuffer;
- struct compiled_scissor_state scissor;
- struct compiled_viewport_state viewport;
- unsigned num_fragment_sampler_views;
- unsigned num_vertex_sampler_views;
- struct compiled_sampler_view sampler_view[PIPE_MAX_SAMPLERS];
- struct compiled_set_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
- struct compiled_set_index_buffer index_buffer;
-
- /* cached state */
+ /* cached state of entire GPU */
struct etna_3d_state gpu3d;
};