nv50: implement get_compute_state_info
authorKarol Herbst <kherbst@redhat.com>
Wed, 30 Nov 2022 16:17:48 +0000 (17:17 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 31 Mar 2023 20:29:00 +0000 (20:29 +0000)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19855>

src/gallium/drivers/nouveau/nv50/nv50_state.c

index 3161549..d2a870d 100644 (file)
@@ -877,6 +877,21 @@ nv50_cp_state_bind(struct pipe_context *pipe, void *hwcso)
 }
 
 static void
+nv50_get_compute_state_info(struct pipe_context *pipe, void *hwcso,
+                            struct pipe_compute_state_object_info *info)
+{
+   struct nv50_context *nv50 = nv50_context(pipe);
+   struct nv50_program *prog = (struct nv50_program *)hwcso;
+   uint16_t obj_class = nv50->screen->compute->oclass;
+   uint32_t smregs = obj_class >= NVA3_COMPUTE_CLASS ? 16384 : 8192;
+   uint32_t threads = smregs / align(prog->max_gpr, 4);
+
+   info->max_threads = MIN2(ROUND_DOWN_TO(threads, 32), 512);
+   info->private_memory = prog->tls_space;
+   info->preferred_simd_size = 32;
+}
+
+static void
 nv50_set_constant_buffer(struct pipe_context *pipe,
                          enum pipe_shader_type shader, uint index,
                          bool take_ownership,
@@ -1496,6 +1511,8 @@ nv50_init_state_functions(struct nv50_context *nv50)
    pipe->delete_gs_state = nv50_sp_state_delete;
    pipe->delete_compute_state = nv50_sp_state_delete;
 
+   pipe->get_compute_state_info = nv50_get_compute_state_info;
+
    pipe->set_blend_color = nv50_set_blend_color;
    pipe->set_stencil_ref = nv50_set_stencil_ref;
    pipe->set_clip_state = nv50_set_clip_state;