Commit Graph

11 Commits

Author SHA1 Message Date
Paulo Zanoni 782efa29e6 iris: have a single border color pool per bufmgr
Have a single border color pool per bufmgr instead of per context.

We want to have a single VM shared among every context and the border
color pool is the last feature preventing us from having that.

Previously we had 1024 colors per context but once the buffer was full
we just waited for the buffer to be unused and restarted it. After
this patch we have 4096 colors for every single context and we can't
just flush buffers if they are full, so we simply return black.

There are many strategies we could try to implement to help alleviate
this new 4096 limit, none of which are implemented by this patch:

 - We could just expand the buffer to the full 16MB we can use,
   allowing 262144 colors.
 - We could use multiple buffers and make the contexts refcount them,
   so eventually older buffers would reach zero references and be
   recycled, moving us to a working set maximum from a lifetime
   maximum.
 - We could also make the border color pool be a standard memzone and
   then give smaller buffers to each context when they need, so the
   limit would be in the number of contexts that can use border color
   pools. This was my first implementation but Ken suggested I switch
   to the one provided by this patch, which is simpler.

Keep it like this since border colors don't seem to be used very much
and other Mesa drivers such as radeonsi also seem to employ the
"return black once we reach the limit" strategy.

As a last note, we could also move the contents of iris_border_color.c
to iris_bufmgr.c in order to avoid breaking some abstractions we have
in Iris, like we do with iris_bufmgr_get_border_color_pool(). I can do
this in case we want it.

v2: Switch from standard memzone to a per-screen thing (see above).
v3: Actually make it per bufmgr. Just making it per screen is not
    enough, since screens can share the same VM, an example being the
    gputest benchmark suite.
v4: Rebase.
v5: Remove dead code, lock around hash table lookup (Ken).
v6: Simple rebase.
v7: Another rebase (for_each_batch).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12028>
2022-02-11 01:42:45 +00:00
Kenneth Graunke fd0e4aedeb iris: Make an iris_foreach_batch macro that skips unsupported batches
IRIS_BATCH_BLITTER isn't supported prior to Tigerlake; in general,
batches may not be supported on all hardware.  In most cases, querying
them is harmless (if useless): they reference nothing, have no commands
to flush, and so on.  However, the fence code does need to know that
certain batches don't exist, so it can avoid adding inter-batch fences
involving them.

This patch introduces a new iris_foreach_batch() iterator macro that
walks over all batches that are actually supported on the platform,
while skipping the others.  It provides a central place to update should
we add or reorder more batches in the future.

Fixes various tests in the piglit.spec.ext_external_objects.* category.

Thanks to Tapani Pälli for catching this.

Fixes: a90a1f15 ("iris: Create an IRIS_BATCH_BLITTER for using the BLT command streamer")
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14834>
2022-02-04 08:06:12 +00:00
Kenneth Graunke 32c5d6d1dc iris: Add an alignment parameter to iris_bo_alloc()
This is rarely useful, but after the next patch removes tiling tracking,
this would literally be the only difference between iris_bo_alloc and
iris_bo_alloc_tiled, so we may as well add it.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11169>
2021-06-07 10:35:25 -07:00
Kenneth Graunke 539494e767 iris: Add a flags argument to iris_bo_alloc()
Based on a patch by Rafael Antognolli.

We already had a flags parameter, but omitted it from the simple alloc
interface because most callers were passing 0.  However, we'll want to
use it for selecting between device local memory and system memory, and
possibly mmap cacheability modes, in the future.  At that point, many
more callers will want to specify, so I think we should include flags
in iris_bo_alloc() as well.

A few places used the iris_bo_alloc_tiled() function simply to pass
flags, so this patch converts them to use iris_bo_alloc() instead now
it does everything they want.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11169>
2021-06-07 10:35:25 -07:00
Marcin Ślusarz 90515f90c8 iris: store copy of the border color in the border color hash table
Color can be allocated on the stack since 809a81ec3a.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3909
Fixes: 809a81ec3a ("iris: Properly support alpha and luminance-alpha formats")

Debugged-by: Filip Strömbäck
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7885>
2020-12-04 11:20:34 +00:00
Kenneth Graunke f73fdb4001 iris: Destroy the border color pool
This plugs a 12224 byte leak
2019-02-21 10:26:10 -08:00
Kenneth Graunke f1a7392be1 iris: Put batches in an array
We keep re-making this array all over the place
2019-02-21 10:26:10 -08:00
Kenneth Graunke d918c09975 iris: flush the compute batch too if border pool is redone 2019-02-21 10:26:10 -08:00
Kenneth Graunke 42dccb1233 iris: use consistent copyright formatting
some of them had typos, didn't say 'authors or copyright holders',
or other mistakes.  This is now https://opensource.org/licenses/MIT
text, formatted consistently.
2019-02-21 10:26:08 -08:00
Kenneth Graunke dfe1ee4f6f iris: comment everything
1. Write the code
2. Add comments
3. PROFIT (or just avoid cost of explaining or relearning things...)
2019-02-21 10:26:08 -08:00
Kenneth Graunke ccec5bab5b iris: implement border color, fix other sampler nonsense 2019-02-21 10:26:07 -08:00