From: Erik Faye-Lund Date: Fri, 23 Jun 2023 13:49:38 +0000 (+0200) Subject: draw/i915: move hwfmt array to i915 specific struct X-Git-Tag: upstream/23.3.3~6393 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bbcda63564478533ce33a924421a75ab1d042f6e;p=platform%2Fupstream%2Fmesa.git draw/i915: move hwfmt array to i915 specific struct There's no point in bloating the vertex_info struct everywhere with information that's only used by i915 in a single place. Let's explicitly store the hwinfo when needed, instead of piggy-backing on vertex_info. Reviewed-by: Emma Anholt Part-of: --- diff --git a/src/gallium/auxiliary/draw/draw_vertex.h b/src/gallium/auxiliary/draw/draw_vertex.h index 06a6310..87ce0d6 100644 --- a/src/gallium/auxiliary/draw/draw_vertex.h +++ b/src/gallium/auxiliary/draw/draw_vertex.h @@ -67,7 +67,6 @@ enum attrib_emit { struct vertex_info { unsigned num_attribs; - uint32_t hwfmt[4]; /**< hardware format info for this format */ unsigned size; /**< total vertex size in dwords */ /* Keep this small and at the end of the struct to allow quick diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h index 436c699..b85a25b 100644 --- a/src/gallium/drivers/i915/i915_context.h +++ b/src/gallium/drivers/i915/i915_context.h @@ -155,7 +155,10 @@ struct i915_state { unsigned texbuffer[I915_TEX_UNITS][3]; /** Describes the current hardware vertex layout */ - struct vertex_info vertex_info; + struct i915_vertex_info { + struct vertex_info draw; /** vertex_info from draw_module */ + uint32_t hwfmt[4]; /** Hardware format info */ + } vertex_info; /* static state (dst/depth buffer state) */ struct i915_winsys_buffer *cbuf_bo; diff --git a/src/gallium/drivers/i915/i915_prim_emit.c b/src/gallium/drivers/i915/i915_prim_emit.c index 9c7fc17..787c38c 100644 --- a/src/gallium/drivers/i915/i915_prim_emit.c +++ b/src/gallium/drivers/i915/i915_prim_emit.c @@ -63,7 +63,7 @@ setup_stage(struct draw_stage *stage) static inline void emit_hw_vertex(struct i915_context *i915, const struct vertex_header *vertex) { - const struct vertex_info *vinfo = &i915->current.vertex_info; + const struct vertex_info *vinfo = &i915->current.vertex_info.draw; uint32_t i; uint32_t count = 0; /* for debug/sanity */ @@ -129,7 +129,7 @@ emit_prim(struct draw_stage *stage, struct prim_header *prim, unsigned hwprim, i915_emit_hardware_state(i915); /* need to do this after validation! */ - vertex_size = i915->current.vertex_info.size * 4; /* in bytes */ + vertex_size = i915->current.vertex_info.draw.size * 4; /* in bytes */ assert(vertex_size >= 12); /* never smaller than 12 bytes */ if (!BEGIN_BATCH(1 + nr * vertex_size / 4)) { diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c index 1145cb7..af14ff4 100644 --- a/src/gallium/drivers/i915/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915/i915_prim_vbuf.c @@ -131,7 +131,7 @@ i915_vbuf_render_get_vertex_info(struct vbuf_render *render) i915_update_derived(i915); } - return &i915->current.vertex_info; + return &i915->current.vertex_info.draw; } /** diff --git a/src/gallium/drivers/i915/i915_state_derived.c b/src/gallium/drivers/i915/i915_state_derived.c index 9ca0004..512f86c 100644 --- a/src/gallium/drivers/i915/i915_state_derived.c +++ b/src/gallium/drivers/i915/i915_state_derived.c @@ -45,7 +45,7 @@ static void calculate_vertex_layout(struct i915_context *i915) { const struct i915_fragment_shader *fs = i915->fs; - struct vertex_info vinfo; + struct i915_vertex_info vinfo; bool colors[2], fog, needW, face; uint32_t i; int src; @@ -84,20 +84,20 @@ calculate_vertex_layout(struct i915_context *i915) /* pos */ src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_POSITION, 0); if (needW) { - draw_emit_vertex_attr(&vinfo, EMIT_4F, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_4F, src); vinfo.hwfmt[0] |= S4_VFMT_XYZW; - vinfo.attrib[0].emit = EMIT_4F; + vinfo.draw.attrib[0].emit = EMIT_4F; } else { - draw_emit_vertex_attr(&vinfo, EMIT_3F, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_3F, src); vinfo.hwfmt[0] |= S4_VFMT_XYZ; - vinfo.attrib[0].emit = EMIT_3F; + vinfo.draw.attrib[0].emit = EMIT_3F; } /* point size. if not emitted here, then point size comes from LIS4. */ if (i915->rasterizer->templ.point_size_per_vertex) { src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_PSIZE, 0); if (src != -1) { - draw_emit_vertex_attr(&vinfo, EMIT_1F, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_1F, src); vinfo.hwfmt[0] |= S4_VFMT_POINT_WIDTH; } } @@ -105,21 +105,21 @@ calculate_vertex_layout(struct i915_context *i915) /* primary color */ if (colors[0]) { src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_COLOR, 0); - draw_emit_vertex_attr(&vinfo, EMIT_4UB_BGRA, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_4UB_BGRA, src); vinfo.hwfmt[0] |= S4_VFMT_COLOR; } /* secondary color */ if (colors[1]) { src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_COLOR, 1); - draw_emit_vertex_attr(&vinfo, EMIT_4UB_BGRA, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_4UB_BGRA, src); vinfo.hwfmt[0] |= S4_VFMT_SPEC_FOG; } /* fog coord, not fog blend factor */ if (fog) { src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_FOG, 0); - draw_emit_vertex_attr(&vinfo, EMIT_1F, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_1F, src); vinfo.hwfmt[0] |= S4_VFMT_FOG_PARAM; } @@ -135,11 +135,11 @@ calculate_vertex_layout(struct i915_context *i915) * the draw module by adding an extra shader output. */ mesa_loge("Front/back face is broken\n"); - draw_emit_vertex_attr(&vinfo, EMIT_1F, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_1F, src); hwtc = TEXCOORDFMT_1D; } else { hwtc = TEXCOORDFMT_4D; - draw_emit_vertex_attr(&vinfo, EMIT_4F, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_4F, src); } } else { hwtc = TEXCOORDFMT_NOT_PRESENT; @@ -147,7 +147,7 @@ calculate_vertex_layout(struct i915_context *i915) vinfo.hwfmt[1] |= hwtc << (i * 4); } - draw_compute_vertex_size(&vinfo); + draw_compute_vertex_size(&vinfo.draw); if (memcmp(&i915->current.vertex_info, &vinfo, sizeof(vinfo))) { /* Need to set this flag so that the LIS2/4 registers get set. diff --git a/src/gallium/drivers/i915/i915_state_immediate.c b/src/gallium/drivers/i915/i915_state_immediate.c index 886c96e..2972944 100644 --- a/src/gallium/drivers/i915/i915_state_immediate.c +++ b/src/gallium/drivers/i915/i915_state_immediate.c @@ -70,7 +70,7 @@ upload_S0S1(struct i915_context *i915) /* I915_NEW_VERTEX_SIZE */ { - unsigned vertex_size = i915->current.vertex_info.size; + unsigned vertex_size = i915->current.vertex_info.draw.size; LIS1 = ((vertex_size << 24) | (vertex_size << 16)); }