diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-02-16 17:01:02 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-02-18 14:44:08 +0000 |
commit | 7d3c48f131ec84aa759a6290a20e2b0c02ad8834 (patch) | |
tree | 8a600f675a61b7e99b7f9fd38aed7abfba8e7921 /src/panfrost/include | |
parent | 027944c7c8ccbff940484b1ed7cc5d75b9593640 (diff) |
panfrost: Debitfieldize mali_uniform_buffer_meta
It fits snugly in a u64, just give a macro for direct computation rather
than fudging around with bitfields. Not sure if this actually matters
with well-optimized compilers but it makes the code subjectively cleaner
so it's worth it for that if nothing else.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3838>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3838>
Diffstat (limited to 'src/panfrost/include')
-rw-r--r-- | src/panfrost/include/panfrost-job.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index 940b5860e95..405440146e6 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -876,20 +876,23 @@ struct mali_attr_meta { /* ORed into an MFBD address to specify the fbx section is included */ #define MALI_MFBD_TAG_EXTRA (0x2) -struct mali_uniform_buffer_meta { - /* This is actually the size minus 1 (MALI_POSITIVE), in units of 16 - * bytes. This gives a maximum of 2^14 bytes, which just so happens to - * be the GL minimum-maximum for GL_MAX_UNIFORM_BLOCK_SIZE. - */ - u64 size : 10; +/* Uniform buffer objects are 64-bit fields divided as: + * + * u64 size : 10; + * mali_ptr ptr : 64 - 10; + * + * The size is actually the size minus 1 (MALI_POSITIVE), in units of 16 bytes. + * This gives a maximum of 2^14 bytes, which just so happens to be the GL + * minimum-maximum for GL_MAX_UNIFORM_BLOCK_SIZE. + * + * The pointer is missing the bottom 2 bits and top 8 bits. The top 8 bits + * should be 0 for userspace pointers, according to + * https://lwn.net/Articles/718895/. By reusing these bits, we can make each + * entry in the table only 64 bits. + */ - /* This is missing the bottom 2 bits and top 8 bits. The top 8 bits - * should be 0 for userspace pointers, according to - * https://lwn.net/Articles/718895/. By reusing these bits, we can make - * each entry in the table only 64 bits. - */ - mali_ptr ptr : 64 - 10; -}; +#define MALI_MAKE_UBO(elements, ptr) \ + (MALI_POSITIVE((elements)) | (((ptr) >> 2) << 10)) /* On Bifrost, these fields are the same between the vertex and tiler payloads. * They also seem to be the same between Bifrost and Midgard. They're shared in |