Commit Graph

16 Commits

Author SHA1 Message Date
Alyssa Rosenzweig 09e46aa168 asahi: add agx_push macro
Thanks, Ella!

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Connor Abbott e8b3006bfd util/rb_tree: Add augmented trees and interval trees
An "augmented tree" is a tree with extra data attached which flows from
the leaves to the root. An "interval tree" is a datastructure of
(potentially-overlapping) intervals where, in addition to inserting and
removing intervals, we can quickly lookup all the intervals which
overlap a given interval.

After describing red-black trees, CLRS explains how it's possible to
implement an interval tree using an augmented red-black tree where the
nodes are ordered by interval start and each node also stores the
maximum interval end for its entire subtree.

Implement the interval tree extension described by CLRS. Iterating over
all overlapping intervals is actually an exercise, so we have to solve
the exercise. The recursive solution has been re-written to use the
parent pointers to avoid needing a stack, similarly to rb_tree_first()
and rb_node_next().

For now, we only implement unsigned intervals, but the core algorithms
are all abstracted to allow other types. There's still some boilerplate,
but it's the best that can be done in C.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22071>
2023-11-02 21:03:46 +00:00
Konstantin Seurer ab1310e84d nir: Add nir_foreach_block_in_cf_node_reverse
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23712>
2023-09-22 10:05:58 +00:00
Konstantin Seurer e2a02f3910 clang-format: Disable formatting by default
This should make `git clang-format` usable for patches that modify
clang formatted and manually formatted code.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9492
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24645>
2023-08-13 16:48:49 +02:00
Faith Ekstrand a6be819121 clang-format: Set the default ColumnLimit to 0
This is a better default than any actual limit because it causes
clang-format to mostly leave line wrapping alone.

Suggested-by: Marek Olšák <maraeo@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382>
2023-08-12 19:27:28 +00:00
Faith Ekstrand 54680948a8 clang-format: nir_foreach_src is not a foreach macro
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382>
2023-08-12 19:27:28 +00:00
Faith Ekstrand fe5671e881 clang-format: Add nir_foreach_reg_*
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382>
2023-08-12 19:27:28 +00:00
Faith Ekstrand 04cc8c6f8d clang-format: Set ColumnLimit to 78
This matches the tree-wide .editorconfig.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24429>
2023-08-04 17:46:42 +00:00
Alyssa Rosenzweig 91ae717d0b nir: Remove nir_foreach_def
Leftover.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432>
2023-08-03 22:40:30 +00:00
Alyssa Rosenzweig ed018babf7 nir: Remove nir_foreach_register
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432>
2023-08-03 22:40:27 +00:00
Eric Engestrom f5eec48799 clang-format: add wayland foreach macros
Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23398>
2023-07-07 23:00:06 +00:00
Eric Engestrom d4575d7fcb clang-format: add egl foreach macro
Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23398>
2023-07-07 23:00:05 +00:00
Yonggang Luo c4d3bc03c4 nir: Add nir_foreach_function_safe and use it
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23902>
2023-07-03 21:45:35 +00:00
Yonggang Luo 5f7fb0a720 clang-format: Add nir_foreach_function_impl into src/.clang-format
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23903>
2023-06-29 08:36:03 +00:00
Yonggang Luo b91bff3537 clang-format: Add nir_foreach_function_with_impl into src/.clang-format
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23903>
2023-06-29 08:36:03 +00:00
Konstantin Seurer 155eb72771 treewide: Add a .clang-format file
Add a Mesa base style instead of copying the same rules multiple times.
This is especially annoying with foreach macros, where every
.clang-format file maintains it's own incomplete list of the same
macros.

Adding a tree wide .clang-format allows other drivers to derive their
code style from whatever is considered default Mesa style.

Since clang-format doesn't allow us to derive ForEachMacros, driver
specific foreach macros have to be added to the common file.

Having a tree wide clang format should also help (new) contributers with
working oin parts of the tree that don't have their own .clang-format
file. (With regards to code formatting)

Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23275>
2023-05-29 21:06:12 +00:00