Repository navigation
video: a GPU index chosen in the menu replaces the remembered device - #19947
Open
Davey-Hughes wants to merge 1 commit into
Open
Davey-Hughes wants to merge 1 commit into
Davey-Hughes wants to merge 1 commit into
Conversation
Since 0e7a56f each GPU index remembers the device it was chosen as, but a change made in the menu left the old name saved. On the next driver init the resolver found that name at its old position and went back to it, so the new choice was ignored, and on EGL contexts the menu value reverted too. Left, Right, the dropdown and reset now save the name of the device at the chosen index, and index 0 clears it. An index past the end of the list leaves the saved name alone. Left no longer sets index -1 on an empty device list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Guidelines
C89_BUILD=1Description
Since 0e7a56f each GPU index (Vulkan, OpenGL/EGL, Direct3D 10/11/12, Metal) remembers the device it was chosen as, in
video_gpu_name_*. Changing the index in the menu left the old name saved, so on the next driver initvideo_driver_gpu_index_resolve()found that name at its old position and went back to it: the log says the old GPUis now #1, not #2; using itand the new choice is ignored. On the EGL contexts (wayland, x/egl, drm) the menu value reverts as well. The only way out was to set the index to 0 first. This is on master only; 1.22.2 predates it.Left, Right, the dropdown and reset now save the name of the device at the chosen index, through a new
video_driver_gpu_index_select(). Index 0 clears the name, and an index past the end of the current list leaves it alone, so a stale out-of-range index still follows its device. Left no longer sets the index to -1 on an empty device list.Testing
samples/gfx/gpu_indexbuilds the production resolver, the Left/Right callbacks and the write-handler case from source and checks, for every API, that a menu change survives a driver reinit and that an out-of-range index keeps its device. It runs in the samples-gfx job, on Linux with ASan/UBSan and-std=c89, and under mingw + Wine. Run against master's callbacks, the same change-then-reinit sequence keeps the old GPU on Vulkan, GL, D3D11, D3D12 and Metal.C89_BUILD=1tools/ci_local.py selftestandtools/ci_apt_check.pypassOn a desktop with an RX 7900 XT, a Radeon 610M iGPU and llvmpipe: start on index 2, press Left once on Settings > Video > Output > GPU Index, quit, relaunch.
GPU "llvmpipe (LLVM 23.1.3, 256 bits)" is now #2, not #1; using it.MESA_VK_DEVICE_SELECT=1002:13c0), llvmpipe → 7900 XTegl_xcontext, 7900 XT → 610Mgl_gpu_indexback to 2Relaunching the 610M config with llvmpipe listed first (
MESA_VK_DEVICE_SELECT=10005:0000) still picks the 610M, now at index 2, with theis now #2, not #1warning. These ran under Xvfb, which can present only from llvmpipe, so the table shows the device each driver selected, from the log.Related Issues
[Any issues this pull request may be addressing]
Related Pull Requests
[Any other PRs from related repositories that might be needed for this pull request to work]
Reviewers
[If possible @mention all the people that should review your pull request]