v3dv: start to move and wrap hw-version code with v3dv_queue
authorAlejandro Piñeiro <apinheiro@igalia.com>
Thu, 10 Jun 2021 11:39:35 +0000 (13:39 +0200)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Tue, 22 Jun 2021 09:34:06 +0000 (11:34 +0200)
commit83ba3c1020da2ef04db3acf0d6a8fca26fe90e7d
tree47459fea9148f6192a8b67c89641daba7c08f2b8
parentefc363a7ce667c7638c89e282cb4b365a71da894
v3dv: start to move and wrap hw-version code with v3dv_queue

The idea would be to move all the code that uses cl_emit,
cl_emit_with_prepack, v3dx_pack, and any enum/structure definition
defined on the v3d pack headers.

All those methods would be defined on v3dvx_private (that would be the
equivalent to v3dx_context.h on v3d).

This commit includes the definition of v3dX for the current version
supported (42), a function calling wrapper, and the move for v3dv_queue
methods as a reference.

About the function calling wrapper, I took the idea from anv. We don't
have on v3d, but we added it because we foresee that we will need that
functionality more often. So without that macro, in order to call the
correct version of the method from the general code we would need to
do like we do on v3d, and doing something like this:

            if (devinfo->ver >= 42)
                    return v3d42_pack_sampler_state(sampler, pCreateInfo);
            else
                    return v3d33_pack_sampler_state(sampler, pCreateInfo);

So with the macro we can just do this:
            v3dv_X(device, pack_sampler_state)(sampler, pCreateInfo).

Note that as mentioned, that is to be used on the general code, so a
runtime decision. If we are already on version-dependant code (so at
v3dx_queue for example) we just use v3dX, as at that point is a build
time decision.

Also, fwiw, I don't like too much the name of that macro, but I was
not able to think on a better one.

v2: merge job_emit_noop_bin and job_emit_noop_render (Iago)

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11310>
src/broadcom/vulkan/meson.build
src/broadcom/vulkan/v3dv_private.h
src/broadcom/vulkan/v3dv_queue.c
src/broadcom/vulkan/v3dvx_private.h [new file with mode: 0644]
src/broadcom/vulkan/v3dvx_queue.c [new file with mode: 0644]