diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/broadcom/cle/gen_pack_header.py | 7 | ||||
-rw-r--r-- | src/broadcom/cle/v3d_decoder.c | 7 | ||||
-rw-r--r-- | src/broadcom/cle/v3d_decoder.h | 1 | ||||
-rw-r--r-- | src/broadcom/cle/v3d_packet_helpers.h | 9 | ||||
-rw-r--r-- | src/broadcom/cle/v3d_packet_v33.xml | 12 | ||||
-rw-r--r-- | src/gallium/drivers/v3d/v3dx_emit.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/v3d/v3dx_state.c | 18 |
7 files changed, 34 insertions, 22 deletions
diff --git a/src/broadcom/cle/gen_pack_header.py b/src/broadcom/cle/gen_pack_header.py index 8ad54464cb8..f79ee42df5a 100644 --- a/src/broadcom/cle/gen_pack_header.py +++ b/src/broadcom/cle/gen_pack_header.py @@ -152,6 +152,8 @@ class Field(object): type = 'bool' elif self.type == 'float': type = 'float' + elif self.type == 'f187': + type = 'float' elif self.type == 'ufixed': type = 'float' elif self.type == 'sfixed': @@ -317,6 +319,9 @@ class Group(object): (value, start, end) elif field.type == "float": s = "#error %s float value mixed in with other fields" % name + elif field.type == "f187": + s = "__gen_uint(fui(%s) >> 16, %d, %d)" % \ + (value, start, end) elif field.type == "offset": s = "__gen_offset(%s, %d, %d)" % \ (value, start, end) @@ -370,6 +375,8 @@ class Group(object): convert = "__gen_unpack_uint" elif field.type == "float": convert = "__gen_unpack_float" + elif field.type == "f187": + convert = "__gen_unpack_f187" elif field.type == "offset": convert = "__gen_unpack_offset" elif field.type == 'ufixed': diff --git a/src/broadcom/cle/v3d_decoder.c b/src/broadcom/cle/v3d_decoder.c index 7eb963fcf18..22367ca6f76 100644 --- a/src/broadcom/cle/v3d_decoder.c +++ b/src/broadcom/cle/v3d_decoder.c @@ -316,6 +316,8 @@ string_to_type(struct parser_context *ctx, const char *s) return (struct v3d_type) { .kind = V3D_TYPE_BOOL }; else if (strcmp(s, "float") == 0) return (struct v3d_type) { .kind = V3D_TYPE_FLOAT }; + else if (strcmp(s, "f187") == 0) + return (struct v3d_type) { .kind = V3D_TYPE_F187 }; else if (strcmp(s, "address") == 0) return (struct v3d_type) { .kind = V3D_TYPE_ADDRESS }; else if (strcmp(s, "offset") == 0) @@ -887,6 +889,11 @@ v3d_field_iterator_next(struct clif_dump *clif, struct v3d_field_iterator *iter) __gen_unpack_float(iter->p, s, e)); break; + case V3D_TYPE_F187: + snprintf(iter->value, sizeof(iter->value), "%f", + __gen_unpack_f187(iter->p, s, e)); + break; + case V3D_TYPE_ADDRESS: { uint32_t addr = __gen_unpack_uint(iter->p, s, e) << (31 - (e - s)); diff --git a/src/broadcom/cle/v3d_decoder.h b/src/broadcom/cle/v3d_decoder.h index 10a7e50b87f..b5ead383bd8 100644 --- a/src/broadcom/cle/v3d_decoder.h +++ b/src/broadcom/cle/v3d_decoder.h @@ -99,6 +99,7 @@ struct v3d_type { V3D_TYPE_UINT, V3D_TYPE_BOOL, V3D_TYPE_FLOAT, + V3D_TYPE_F187, V3D_TYPE_ADDRESS, V3D_TYPE_OFFSET, V3D_TYPE_STRUCT, diff --git a/src/broadcom/cle/v3d_packet_helpers.h b/src/broadcom/cle/v3d_packet_helpers.h index 4720f643328..f340b790697 100644 --- a/src/broadcom/cle/v3d_packet_helpers.h +++ b/src/broadcom/cle/v3d_packet_helpers.h @@ -26,6 +26,7 @@ #include <stdbool.h> #include <assert.h> #include <math.h> +#include <gallium/auxiliary/util/u_math.h> #ifdef HAVE_VALGRIND #include <valgrind.h> @@ -205,3 +206,11 @@ __gen_unpack_float(const uint8_t *restrict cl, uint32_t start, uint32_t end) return f->f; } +static inline float +__gen_unpack_f187(const uint8_t *restrict cl, uint32_t start, uint32_t end) +{ + assert(end - start == 15); + uint32_t bits = __gen_unpack_uint(cl, start, end); + return uif(bits << 16); +} + diff --git a/src/broadcom/cle/v3d_packet_v33.xml b/src/broadcom/cle/v3d_packet_v33.xml index 1f6d467c92b..e4b7df002df 100644 --- a/src/broadcom/cle/v3d_packet_v33.xml +++ b/src/broadcom/cle/v3d_packet_v33.xml @@ -619,7 +619,7 @@ </packet> <packet code="91" name="Sample State" min_ver="41"> - <field name="Coverage" size="16" start="16" type="uint"/> <!-- float-1-8-7 --> + <field name="Coverage" size="16" start="16" type="f187"/> <field name="Mask" size="4" start="0" type="uint"/> </packet> @@ -672,16 +672,14 @@ </packet> <packet name="Depth Offset" code="106" max_ver="33"> - <!-- these fields are both float-1-8-7 encoded (top 16 bits of a float32) --> - <field name="Depth Offset Units" size="16" start="16" type="uint"/> - <field name="Depth Offset Factor" size="16" start="0" type="uint"/> + <field name="Depth Offset Units" size="16" start="16" type="f187"/> + <field name="Depth Offset Factor" size="16" start="0" type="f187"/> </packet> <packet name="Depth Offset" code="106" min_ver="41"> <field name="Limit" size="32" start="32" type="float"/> - <!-- these fields are both float-1-8-7 encoded (top 16 bits of a float32) --> - <field name="Depth Offset Units" size="16" start="16" type="uint"/> - <field name="Depth Offset Factor" size="16" start="0" type="uint"/> + <field name="Depth Offset Units" size="16" start="16" type="f187"/> + <field name="Depth Offset Factor" size="16" start="0" type="f187"/> </packet> <packet name="Clip Window" code="107"> diff --git a/src/gallium/drivers/v3d/v3dx_emit.c b/src/gallium/drivers/v3d/v3dx_emit.c index ee4849a296f..c371a53a199 100644 --- a/src/gallium/drivers/v3d/v3dx_emit.c +++ b/src/gallium/drivers/v3d/v3dx_emit.c @@ -787,7 +787,7 @@ v3dX(emit_state)(struct pipe_context *pctx) /* Note: SampleCoverage was handled at the * state_tracker level by converting to sample_mask. */ - state.coverage = fui(1.0) >> 16; + state.coverage = 1.0; state.mask = job->msaa ? v3d->sample_mask : 0xf; } } diff --git a/src/gallium/drivers/v3d/v3dx_state.c b/src/gallium/drivers/v3d/v3dx_state.c index 6ee4a2a835f..b7d60846d4a 100644 --- a/src/gallium/drivers/v3d/v3dx_state.c +++ b/src/gallium/drivers/v3d/v3dx_state.c @@ -81,12 +81,6 @@ v3d_set_sample_mask(struct pipe_context *pctx, unsigned sample_mask) v3d->dirty |= VC5_DIRTY_SAMPLE_STATE; } -static uint16_t -float_to_187_half(float f) -{ - return fui(f) >> 16; -} - static void * v3d_create_rasterizer_state(struct pipe_context *pctx, const struct pipe_rasterizer_state *cso) @@ -107,20 +101,16 @@ v3d_create_rasterizer_state(struct pipe_context *pctx, STATIC_ASSERT(sizeof(so->depth_offset) >= cl_packet_length(DEPTH_OFFSET)); v3dx_pack(&so->depth_offset, DEPTH_OFFSET, depth) { - depth.depth_offset_factor = - float_to_187_half(cso->offset_scale); - depth.depth_offset_units = - float_to_187_half(cso->offset_units); + depth.depth_offset_factor = cso->offset_scale; + depth.depth_offset_units = cso->offset_units; } /* The HW treats polygon offset units based on a Z24 buffer, so we * need to scale up offset_units if we're only Z16. */ v3dx_pack(&so->depth_offset_z16, DEPTH_OFFSET, depth) { - depth.depth_offset_factor = - float_to_187_half(cso->offset_scale); - depth.depth_offset_units = - float_to_187_half(cso->offset_units * 256.0); + depth.depth_offset_factor = cso->offset_scale; + depth.depth_offset_units = cso->offset_units * 256.0; } return so; |