X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fpanfrost%2Fpan_context.h;h=ac3e07defd403183240e056008fd70cbc0539695;hb=bbaa62e4e156012f05d2ddd9b19610d6465b62e7;hp=b6eb7206b80dff8f17bc04301b31c4629727e929;hpb=e94076f8f59c25ba1ccb5e3409b9587a9d0845e8;p=mesa.git diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index b6eb7206b80..ac3e07defd4 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -82,12 +82,17 @@ struct panfrost_query { struct panfrost_fence { struct pipe_reference reference; - struct util_dynarray syncfds; + uint32_t syncobj; + bool signaled; +}; + +struct panfrost_streamout_target { + struct pipe_stream_output_target base; + uint32_t offset; }; struct panfrost_streamout { struct pipe_stream_output_target *targets[PIPE_MAX_SO_BUFFERS]; - uint32_t offsets[PIPE_MAX_SO_BUFFERS]; unsigned num_targets; }; @@ -95,6 +100,11 @@ struct panfrost_context { /* Gallium context */ struct pipe_context base; + /* Upload manager for small resident GPU-internal data structures, like + * sampler descriptors. We use an upload manager since the minimum BO + * size from the kernel is 4kb */ + struct u_upload_mgr *state_uploader; + /* Bound job batch and map of panfrost_batch_key to job batches */ struct panfrost_batch *batch; struct hash_table *batches; @@ -116,17 +126,9 @@ struct panfrost_context { uint64_t tf_prims_generated; struct panfrost_query *occlusion_query; - /* Each draw has corresponding vertex and tiler payloads */ - struct midgard_payload_vertex_tiler payloads[PIPE_SHADER_TYPES]; - - /* The fragment shader binary itself is pointed here (for the tripipe) but - * also everything else in the shader core, including blending, the - * stencil/depth tests, etc. Refer to the presentations. */ - - struct mali_shader_meta fragment_shader_core; - unsigned vertex_count; unsigned instance_count; + unsigned offset_start; enum pipe_prim_type active_prim; /* If instancing is enabled, vertex count padded for instance; if @@ -170,8 +172,12 @@ struct panfrost_context { struct pipe_viewport_state pipe_viewport; struct pipe_scissor_state scissor; struct pipe_blend_color blend_color; - struct pipe_depth_stencil_alpha_state *depth_stencil; + struct panfrost_zsa_state *depth_stencil; struct pipe_stencil_ref stencil_ref; + unsigned sample_mask; + unsigned min_samples; + + struct panfrost_blend_state blit_blend; }; /* Corresponds to the CSO */ @@ -181,17 +187,28 @@ struct panfrost_rasterizer { }; /* Variants bundle together to form the backing CSO, bundling multiple - * shaders with varying emulated features baked in (alpha test - * parameters, etc) */ + * shaders with varying emulated features baked in */ /* A shader state corresponds to the actual, current variant of the shader */ struct panfrost_shader_state { /* Compiled, mapped descriptor, ready for the hardware */ bool compiled; - struct mali_shader_meta *tripipe; + + /* Uploaded shader descriptor (TODO: maybe stuff the packed unuploaded + * bits in a union to save some memory?) */ + + struct { + struct pipe_resource *rsrc; + uint32_t offset; + } upload; + + struct mali_shader_packed shader; + struct mali_midgard_properties_packed properties; + struct mali_preload_packed preload; /* Non-descript information */ - int uniform_count; + unsigned uniform_count; + unsigned work_reg_count; bool can_discard; bool writes_point_size; bool writes_depth; @@ -199,10 +216,19 @@ struct panfrost_shader_state { bool reads_point_coord; bool reads_face; bool reads_frag_coord; + bool writes_global; unsigned stack_size; unsigned shared_size; - struct mali_attr_meta varyings[PIPE_MAX_ATTRIBS]; + /* Does the fragment shader have side effects? In particular, if output + * is masked out, is it legal to skip shader execution? */ + bool fs_sidefx; + + /* For Bifrost - output type for each RT */ + enum bifrost_shader_type blend_types[BIFROST_MAX_RENDER_TARGET_COUNT]; + + unsigned attribute_count, varying_count, ubo_count; + enum mali_format varyings[PIPE_MAX_ATTRIBS]; gl_varying_slot varyings_loc[PIPE_MAX_ATTRIBS]; struct pipe_stream_output_info stream_output; uint64_t so_mask; @@ -210,16 +236,14 @@ struct panfrost_shader_state { unsigned sysval_count; unsigned sysval[MAX_SYSVAL_COUNT]; - /* Information on this particular shader variant */ - struct pipe_alpha_state alpha_state; - - uint16_t point_sprite_mask; - unsigned point_sprite_upper_left : 1; - /* Should we enable helper invocations */ bool helper_invocations; + /* GPU-executable memory */ struct panfrost_bo *bo; + + BITSET_WORD outputs_read; + enum pipe_format rt_formats[8]; }; /* A collection of varyings (the CSO) */ @@ -245,15 +269,24 @@ struct panfrost_shader_variants { struct panfrost_vertex_state { unsigned num_elements; - unsigned vertexid_index; struct pipe_vertex_element pipe[PIPE_MAX_ATTRIBS]; - struct mali_attr_meta hw[PIPE_MAX_ATTRIBS]; + unsigned formats[PIPE_MAX_ATTRIBS]; +}; + +struct panfrost_zsa_state { + struct pipe_depth_stencil_alpha_state base; + + /* Precomputed stencil state */ + struct mali_stencil_packed stencil_front; + struct mali_stencil_packed stencil_back; + u8 stencil_mask_front; + u8 stencil_mask_back; }; struct panfrost_sampler_state { struct pipe_sampler_state base; - struct mali_sampler_descriptor hw; + struct mali_midgard_sampler_packed hw; }; /* Misnomer: Sampler view corresponds to textures, not samplers */ @@ -261,6 +294,9 @@ struct panfrost_sampler_state { struct panfrost_sampler_view { struct pipe_sampler_view base; struct panfrost_bo *bo; + struct mali_bifrost_texture_packed bifrost_descriptor; + mali_ptr texture_bo; + uint64_t modifier; }; static inline struct panfrost_context * @@ -269,6 +305,12 @@ pan_context(struct pipe_context *pcontext) return (struct panfrost_context *) pcontext; } +static inline struct panfrost_streamout_target * +pan_so_target(struct pipe_stream_output_target *target) +{ + return (struct panfrost_streamout_target *)target; +} + static inline struct panfrost_shader_state * panfrost_get_shader_state(struct panfrost_context *ctx, enum pipe_shader_type st) @@ -284,16 +326,9 @@ panfrost_get_shader_state(struct panfrost_context *ctx, struct pipe_context * panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags); -void -panfrost_invalidate_frame(struct panfrost_context *ctx); - bool panfrost_writes_point_size(struct panfrost_context *ctx); -void -panfrost_patch_shader_state(struct panfrost_context *ctx, - enum pipe_shader_type stage); - struct panfrost_transfer panfrost_vertex_tiler_job(struct panfrost_context *ctx, bool is_tiler); @@ -319,36 +354,27 @@ mali_ptr panfrost_fragment_job(struct panfrost_batch *batch, bool has_draws); void -panfrost_shader_compile( - struct panfrost_context *ctx, - struct mali_shader_meta *meta, - enum pipe_shader_ir ir_type, - const void *ir, - gl_shader_stage stage, - struct panfrost_shader_state *state, - uint64_t *outputs_written); - -unsigned -panfrost_ubo_count(struct panfrost_context *ctx, enum pipe_shader_type stage); +panfrost_shader_compile(struct panfrost_context *ctx, + enum pipe_shader_ir ir_type, + const void *ir, + gl_shader_stage stage, + struct panfrost_shader_state *state, + uint64_t *outputs_written); + +void +panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so, + struct pipe_context *pctx, + struct pipe_resource *texture); /* Instancing */ mali_ptr panfrost_vertex_buffer_address(struct panfrost_context *ctx, unsigned i); -void -panfrost_emit_vertex_data(struct panfrost_batch *batch); - /* Compute */ void panfrost_compute_context_init(struct pipe_context *pctx); -/* Varyings */ - -void -panfrost_emit_varying_descriptor( - struct panfrost_context *ctx, - unsigned vertex_count); #endif