Commit graph

4064 commits

Author SHA1 Message Date
Eric Engestrom
c0044aa8f1 lavapipe/ci: document fixed tests
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38305>
2025-11-07 12:46:08 +00:00
Antonio Ospite
222b85328e mesa: replace most occurrences of getenv() with os_get_option()
The standard way to query options in mesa is `os_get_option()` which
abstracts platform-specific mechanisms to get config variables.

However in quite a few places `getenv()` is still used and this may
preclude controlling some options on some systems.

For instance it is not generally possible to use `MESA_DEBUG` on
Android.

So replace most `getenv()` occurrences with  `os_get_option()` to
support configuration options more consistently across different
platforms.

Do the same with `secure_getenv()` replacing it with
`os_get_option_secure()`.

The bulk of the proposed changes are mechanically performed by the
following script:

-----------------------------------------------------------------------
  #!/bin/sh

  set -e

  replace() {

    # Don't replace in some files, for example where `os_get_option` is defined,
    # or in external files
    EXCLUDE_FILES_PATTERN='(src/util/os_misc.c|src/util/u_debug.h|src/gtest/include/gtest/internal/gtest-port.h)'

    # Don't replace some "system" variables
    EXCLUDE_VARS_PATTERN='("XDG|"DISPLAY|"HOME|"TMPDIR|"POSIXLY_CORRECT)'

    git grep "[=!( ]$1(" -- src/ | cut -d ':' -f 1 | sort | uniq | \
      grep -v -E "$EXCLUDE_FILES_PATTERN" | \
      while read -r file;
      do
        # Don't replace usages of XDG_* variables or HOME
        sed -E -e "/$EXCLUDE_VARS_PATTERN/!s/([=!\( ])$1\(/\1$2\(/g" -i "$file";
      done
  }

  # Add const to os_get_option results, to avoid warning about discarded qualifier:
  #   warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  # but also errors in some cases:
  #   error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
  add_const_results() {
    git grep -l -P '(?<!const )char.*os_get_option' | \
      while read -r file;
      do
        sed -e '/^\s*const/! s/\(char.*os_get_option\)/const \1/g' -i "$file"
      done
  }

  replace 'secure_getenv' 'os_get_option_secure'

  replace 'getenv' 'os_get_option'

  add_const_results
-----------------------------------------------------------------------

After this, the `#include "util/os_misc.h"` is also added in files where
`os_get_option()` was not used before.

And since the replacements from the script above generated some new
`-Wdiscarded-qualifiers` warnings, those have been addressed as well,
generally by declaring `os_get_option()` results as `const char *` and
adjusting some function declarations.

Finally some replacements caused new errors like:

-----------------------------------------------------------------------
../src/gallium/auxiliary/gallivm/lp_bld_misc.cpp:127:31: error: no matching function for call to 'strtok'
  127 |          for (n = 0, option = strtok(env_llc_options, " "); option; n++, option = strtok(NULL, " ")) {
      |                               ^~~~~~
/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/string.h:124:17: note: candidate function not viable: 1st argument ('const char *') would lose const qualifier
  124 | char* _Nullable strtok(char* _Nullable __s, const char* _Nonnull __delimiter);
      |                 ^      ~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------------

Those have been addressed too, copying the const string returned by
`os_get_option()` so that it could be modified.

In particular, the error above has been fixed  by copying the `const
char *env_llc_options` variable in
`src/gallium/auxiliary/gallivm/lp_bld_misc.cpp` to a `char *` which can
be tokenized using `strtok()`.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38128>
2025-11-06 04:36:13 +00:00
Eric R. Smith
417be4f77e dri: check modifier in dri_create_image_from_winsys
When importing an image, check that the specific combination of
format plus modifier is supported, rather than just checking the
format. This will allow drivers to support some YUV formats in
special cases (specific modifiers, like AFBC for panfrost) while
also allowing us to fall back to generic multi-plane formats when
those modifier+format combinations are not supported by
hardware.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35771>
2025-11-04 22:28:03 +00:00
Eric R. Smith
b11f543c4e mesa: Add R16G16_R16B16_UNORM and related formats
Including the 10 bit variant X6R10X6G10_X6R10X6B10_UNORM. Only the
RG_RB variants seem to have fourccs, so those are the only ones being
added for now, although they would, obviously, be easy to add).

These are used for Y210, Y212, and Y216 fourccs. In particular Y210
is interesting for panfrost, as it is the fourcc used to indicate a
10 bit single plane 4:2:2 encoded as AFBC (similar to how YUYV is
the canonical AFBC for 10 bit 4:2:0).

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35771>
2025-11-04 22:28:03 +00:00
spencer-lunarg
17d8a5d8ae lavapipe: Remove trailing whitespace
Signed-off-by: spencer-lunarg <spencer@lunarg.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38223>
2025-11-04 21:20:47 +00:00
Alyssa Rosenzweig
17355f716b treewide: use UTIL_DYNARRAY_INIT
Instead of util_dynarray_init(&dynarray, NULL), just use
UTIL_DYNARRAY_INIT instead. This is more ergonomic.

Via Coccinelle patch:

    @@
    identifier dynarray;
    @@

    -struct util_dynarray dynarray = {0};
    -util_dynarray_init(&dynarray, NULL);
    +struct util_dynarray dynarray = UTIL_DYNARRAY_INIT;

    @@
    identifier dynarray;
    @@

    -struct util_dynarray dynarray;
    -util_dynarray_init(&dynarray, NULL);
    +struct util_dynarray dynarray = UTIL_DYNARRAY_INIT;

    @@
    expression dynarray;
    @@

    -util_dynarray_init(&(dynarray), NULL);
    +dynarray = UTIL_DYNARRAY_INIT;

    @@
    expression dynarray;
    @@

    -util_dynarray_init(dynarray, NULL);
    +(*dynarray) = UTIL_DYNARRAY_INIT;

Followed by sed:

    bash -c "find . -type f -exec sed -i -e 's/util_dynarray_init(&\(.*\), NULL)/\1 = UTIL_DYNARRAY_INIT/g' \{} \;"
    bash -c "find . -type f -exec sed -i -e 's/util_dynarray_init( &\(.*\), NULL )/\1 = UTIL_DYNARRAY_INIT/g' \{} \;"
    bash -c "find . -type f -exec sed -i -e 's/util_dynarray_init(\(.*\), NULL)/*\1 = UTIL_DYNARRAY_INIT/g' \{} \;"

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38189>
2025-11-04 13:39:48 +00:00
Konstantin Seurer
25e678a37d lavapipe: Bump MAX_DESCRIPTOR_UNIFORM_BLOCK_SIZE
cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38197>
2025-11-03 19:45:21 +01:00
Konstantin Seurer
d6dd96e1c7 lavapipe: Zero image null descriptors
The size queries for images do not use function pointers so we need to
be careful that width, height and depth are 0.

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38197>
2025-11-03 19:45:17 +01:00
Konstantin Seurer
ff145d2ddc lavapipe: Bump maxPrimitiveCount
The vulkan spec requires at least 2^29-1.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14212
cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38197>
2025-11-03 19:44:46 +01:00
Dave Airlie
6a70406bb2 lavapipe: use vk_query_pool as the base for lvp_query_pool
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This just moves to the common code.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38198>
2025-11-02 06:14:22 +10:00
Dave Airlie
3fc9c072b2 lavapipe: drop instance pointer from lvp_device.
This can be gotten elsewhere.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38198>
2025-11-02 06:00:38 +10:00
Dave Airlie
f819e269f6 lavapipe: drop physical device pointer from lvp_device
Use the base pointer.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38198>
2025-11-02 05:53:02 +10:00
Dave Airlie
b2db496ea3 lavapipe: drop unneeded physical device in sparse image format props
This isn't used here.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38198>
2025-11-02 05:50:47 +10:00
Dave Airlie
7aef746de6 lavapipe: drop device pointer from pipeline cache
This is unused

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38198>
2025-11-02 05:43:51 +10:00
Dave Airlie
5875d6cf93 lavapipe: drop device pointer from queue
Just use the copy in the base

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38198>
2025-11-02 05:42:31 +10:00
Dave Airlie
fe5a99175f lavapipe: drop device pointer from pipeline object
Just get it from the base object.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38198>
2025-11-02 05:39:11 +10:00
Dave Airlie
8fae2cb67f lavapipe: drop device pointer from lvp_cmd_buffer
just get it from the vk object.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38198>
2025-11-02 05:38:44 +10:00
Dave Airlie
8e01a11a00 lavapipe: remove image pointer from lvp_image_view
Just use the underlying image pointer and pack the struct a bit
better.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38198>
2025-11-02 05:27:48 +10:00
Dave Airlie
9f0b57ce41 lavapipe: drop unused macro.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38198>
2025-11-02 05:13:29 +10:00
Dave Airlie
49c7b69020 lavapipe: cleanup some whitespace in lvp_private.h
This just has some wierd inconsistent stuff, clean it up.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38198>
2025-11-02 05:10:26 +10:00
Dave Airlie
cde13f3674 lavapipe: drop lavapipe specific macro for generic one.
These can just all use the standard VK macro we define.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38198>
2025-11-02 05:01:12 +10:00
Pohsiang (John) Hsu
59b10dbe80 mediafoundation: add support for initial pool size and max pool size for stats pool
Reviewed-by: Yubo Xie <yuboxie@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38195>
2025-10-31 13:47:08 -07:00
Silvio Vilerino
00700bae45 mediafoundation: Check for PIPE_VIDEO_CODEC_UNIT_LOCATION_FLAG_MAX_SLICE_SIZE_OVERFLOW in calls to get_slice_bitstream_data
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38195>
2025-10-31 13:47:04 -07:00
Silvio Vilerino
087b1f4948 mediafoundation: Remove stale call to MFCreateMemoryBuffer
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38195>
2025-10-31 13:46:54 -07:00
Silvio Vilerino
7fb5c10f65 mediafoundation: Add a min slice buffer size stopgap
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38195>
2025-10-31 13:46:44 -07:00
Silvio Vilerino
027b523398 mediafoundation: Fix num_output_buffers for PIPE_VIDEO_SLICE_MODE_AUTO
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38195>
2025-10-31 13:46:40 -07:00
Pohsiang (John) Hsu
240b9159f4 mediafoundation: setup wpp logging in more of the files and add some error handling on dpb manager and reference frame tracker
Reviewed-by: Yubo Xie <yuboxie@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38144>
2025-10-29 20:27:28 +00:00
Pohsiang (John) Hsu
ab2457591b mediafoundation: periodic clang-format, no code changes
Reviewed-by: Yubo Xie <yuboxie@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38144>
2025-10-29 20:27:28 +00:00
Pohsiang (John) Hsu
d7e2754116 mediafoundation: for low latency, change stats pool size to 2, this is because there is no synchronization btwn returning MF sample and ProcessInput
Reviewed-by: Yubo Xie <yuboxie@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38144>
2025-10-29 20:27:28 +00:00
Silvio Vilerino
4169a7f36a mediafoundation: Add AVEncVideoReconstructedPictureOutputMode and MFSampleExtension_VideoEncodeReconstructedPicture
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Reviewed-by: Yubo Xie <yuboxie@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38144>
2025-10-29 20:27:27 +00:00
Silvio Vilerino
0953924dbe mediafoundation: Add m_bHWSupportReadableReconstructedPicture
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Reviewed-by: Yubo Xie <yuboxie@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38144>
2025-10-29 20:27:26 +00:00
Mike Blumenkrantz
e1a4f53680 lavapipe: maintenance10
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38091>
2025-10-29 18:25:42 +00:00
Job Noorman
e16be20195 rusticl: fix mismatched-lifetime-syntaxes lint warning
This warn-by-default lint introduced in Rust 1.89.0 causes the following
warning:

warning: hiding a lifetime that's elided elsewhere is confusing
   --> ../../src/gallium/frontends/rusticl/core/semaphore.rs:276:14
    |
276 |     fn state(&self) -> MutexGuard<SemaphoreState> {
    |              ^^^^^     -------------------------- the same lifetime is hidden here
    |              |
    |              the lifetime is elided here
    |
    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
    = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: use `'_` for type paths
    |
276 |     fn state(&self) -> MutexGuard<'_, SemaphoreState> {
    |                                   +++

Follow the compiler's suggestion to fix this.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38132>
2025-10-29 10:35:29 +00:00
David Rosca
1232a7a754 frontends/va: Always reset H264 slice ref modification and marking count
This way the driver doesn't need to check the flag.

Reviewed-by: Benjamin Cheng <benjamin.cheng@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38050>
2025-10-28 09:43:26 +00:00
David Rosca
8c2de21090 frontends/va: Support H264 encode pic_order_cnt_type 1
Reviewed-by: Benjamin Cheng <benjamin.cheng@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38052>
2025-10-28 09:14:24 +00:00
Silvio Vilerino
ca3ba3f924 mediafoundation: Remove unused AllocatePipeResourceFromAllocator
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38057>
2025-10-24 19:45:56 +00:00
Silvio Vilerino
e873beb33c mediafoundation: Cleanup MaxL1References variables
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38057>
2025-10-24 19:45:56 +00:00
Silvio Vilerino
4b75fcac47 mediafoundation: Optimize STL usage in reference_frames_tracker_hevc.cpp
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38057>
2025-10-24 19:45:56 +00:00
Silvio Vilerino
2b34f30e00 mediafoundation: encode.cpp: Remove redundant lock() and memset()
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38057>
2025-10-24 19:45:55 +00:00
Silvio Vilerino
9b97a2ef93 mediafoundation: Fix width/height typo in alignment calculation
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38057>
2025-10-24 19:45:55 +00:00
Pohsiang (John) Hsu
80da774734 mediafoundation: fix sporadic build failure with u_inlines.h not found on test target
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38057>
2025-10-24 19:45:54 +00:00
Alyssa Rosenzweig
b824ef83ab util/dynarray: infer type in append
Most of the time, we can infer the type to append in
util_dynarray_append using __typeof__, which is standardized in C23 and
support in Jesse's MSMSVCV. This patch drops the type argument most of
the time, making util_dynarray a little more ergonomic to use.

This is done in four steps.

First, rename util_dynarray_append -> util_dynarray_append_typed

    bash -c "find . -type f -exec sed -i -e 's/util_dynarray_append(/util_dynarray_append_typed(/g' \{} \;"

Then, add a new append that infers the type. This is much more ergonomic
for what you want most of the time.

Next, use type-inferred append as much as possible, via Coccinelle
patch (plus manual fixup):

    @@
    expression dynarray, element;
    type type;
    @@

    -util_dynarray_append_typed(dynarray, type, element);
    +util_dynarray_append(dynarray, element);

Finally, hand fixup cases that Coccinelle missed or incorrectly
translated, of which there were several because we can't used the
untyped append with a literal (since the sizeof won't do what you want).

All four steps are squashed to produce a single patch changing every
util_dynarray_append call site in tree to either drop a type parameter
(if possible) or insert a _typed suffix (if we can't infer). As such,
the final patch is best reviewed by hand even though it was
tool-assisted.

No Long Linguine Meals were involved in the making of this patch.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38038>
2025-10-24 18:32:07 +00:00
Mel Henning
fafb81cd02 treewide: Use vk_collect_dependency_info_src_stages
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37961>
2025-10-22 19:22:17 +00:00
Eric Engestrom
4ab65cdaa4 docs: update/fix vk spec urls
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37993>
2025-10-22 09:23:34 +02:00
Konstantin Seurer
990f1868ec vulkan/cmd_queue: Free all elements of struct arrays
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37710>
2025-10-21 19:50:47 +02:00
Silvio Vilerino
44d8e999e2 mediafoundation: Also set pSyncObjectQueue = m_spStagingQueue when DX11 input sample
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:23:31 -07:00
Silvio Vilerino
d2cbbccaaa mediafoundation: Only wait on pSyncObjectQueue for stats completion if any stat was enabled
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:23:27 -07:00
Silvio Vilerino
4f7aa40222 mediafoundation: Allocate pro-rated buffer sizes for multi-slice encoding
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:23:21 -07:00
Silvio Vilerino
b454c35318 mediafoundation: Only use sliced mode when CODECAPI_AVEncSliceGenerationMode is set, disregarding num slices configured
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:23:11 -07:00
Silvio Vilerino
71aecf4a93 mediafoundation: SliceGeneration=1: Zero copy IMFSample output with wrapped ID3D12Resource frame/slice buffers
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
2025-10-21 09:23:06 -07:00