With this pipeline vkd3d automatically gets built on Linux (in an image based on Debian unstable), both in 32 and 64 bit mode. Both builds are tested with radv and llvmpipe. A number of caveats apply, though: * A number of tests currently fail in llvmpipe, so the llvmpipe jobs are marked as allowed to fail. Ideally we'll eventually fix our bugs and mark the llvmpipe ones in the tests, so that the CI tests completely pass and possible problems in the Vulkan driver are recorded at a better granularity (this is the reason why GitLab says that the pipeline is passed with warnings: the warnings are that there are jobs that failed, even if they were allowed to fail). * The runners provided by the GitLab instance don't have a GPU available, so I configured my own computer (equipped with an AMD Radeon RX 5700 RX) to provide a runner with access to the GPU. This setup is not currently satisfying: for me, because I use that computer for other things and I don't like having random code submitted to it (it is theoretically sandboxed, but sandboxes are not always bullet-proof, especially if they have access to a GPU); for the users, because my computer might be unavailable at any time. I'll work on a better solution. For the time being I intend the runner to only accept jobs from the master branch; once a better solution is implemented I'd like to run the pipeline for MRs too. * While the `Dockerfile` and related assets do not necessarily need to be available in this repository, given that the CI accesses the binary image from the Docker hub anyway, I think it's still valuable to have them, so others can improve them (and for sure improvement opportunities are nowhere near missing). However, other ways to make them available can be found, if for some reason it is not liked to have them in this repository (they are not pretty!). * One of the reason they are not pretty is that I have a custom hack to compile `widl` from the Wine sources without compiling (or installing from the distribution) the whole of Wine, in the interest of keeping the Docker image small (well, small-ish: Vulkan drivers, compilers and X libraries are not small anyway). * Again on the subject of the Docker image, I am currently putting the binary image in my own namespace on the Docker hub. Using the GitLab container registry in the namespace of the Wine project would probably be better, so that I am not a bottleneck in the future. * Even if we discount all the points above, this MR cannot be merged yet, because my runner is currently configured for my namespace only. I guess I need the intervention of a GitLab admin to fix that. However, I think there's already material enough for valuable feedback.
-- v2: ci: Introduce a CI pipeline for GitLab. configure: Require widl >= 3.21. vkd3d: Filter devices according to VKD3D_VULKAN_DEVICE_FILTER.
From: Giovanni Mascellani gmascellani@codeweavers.com
--- README | 4 ++++ libs/vkd3d/device.c | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/README b/README index 465d5f915..19b43e40c 100644 --- a/README +++ b/README @@ -62,6 +62,10 @@ commas or semicolons. * VKD3D_VULKAN_DEVICE - a zero-based device index. Use to force the selected Vulkan device.
+ * VKD3D_VULKAN_DEVICE_FILTER - a string to filter devices. Only devices with + this string appearing as a substring of their device name are considered by + VKD3D_VULKAN_DEVICE. + * VKD3D_DISABLE_EXTENSIONS - a list of Vulkan extensions that libvkd3d should not use even if available.
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index b9a8943cc..39047c92e 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -1690,16 +1690,21 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device, static HRESULT vkd3d_select_physical_device(struct vkd3d_instance *instance, unsigned int device_index, VkPhysicalDevice *selected_device) { - VkPhysicalDevice dgpu_device = VK_NULL_HANDLE, igpu_device = VK_NULL_HANDLE; + VkPhysicalDevice dgpu_device = VK_NULL_HANDLE, igpu_device = VK_NULL_HANDLE, first_device = VK_NULL_HANDLE; const struct vkd3d_vk_instance_procs *vk_procs = &instance->vk_procs; VkInstance vk_instance = instance->vk_instance; VkPhysicalDeviceProperties device_properties; VkPhysicalDevice device = VK_NULL_HANDLE; VkPhysicalDevice *physical_devices; + unsigned int i, index = 0; + const char *filter; uint32_t count; - unsigned int i; VkResult vr;
+ filter = getenv("VKD3D_VULKAN_DEVICE_FILTER"); + if (!filter) + filter = ""; + count = 0; if ((vr = VK_CALL(vkEnumeratePhysicalDevices(vk_instance, &count, NULL))) < 0) { @@ -1727,25 +1732,47 @@ static HRESULT vkd3d_select_physical_device(struct vkd3d_instance *instance,
for (i = 0; i < count; ++i) { + bool filtered; + VK_CALL(vkGetPhysicalDeviceProperties(physical_devices[i], &device_properties)); + + filtered = !strstr(device_properties.deviceName, filter); + if (filtered) + TRACE("Ignored because of filter:\n"); + else + TRACE("Index %u:\n", index); vkd3d_trace_physical_device_properties(&device_properties);
- if (i == device_index) + if (filtered) + continue; + + if (index == device_index) device = physical_devices[i];
if (device_properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU && !dgpu_device) dgpu_device = physical_devices[i]; else if (device_properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU && !igpu_device) igpu_device = physical_devices[i]; + + if (!first_device) + first_device = physical_devices[i]; + + ++index; }
if (!device) device = dgpu_device ? dgpu_device : igpu_device; if (!device) - device = physical_devices[0]; + device = first_device;
vkd3d_free(physical_devices);
+ if (!device) + { + ERR("No physical device accepted by filter.\n"); + return E_FAIL; + } + VK_CALL(vkGetPhysicalDeviceProperties(device, &device_properties)); TRACE("Using device: %s, %#x:%#x.\n", device_properties.deviceName, device_properties.vendorID, device_properties.deviceID);
From: Giovanni Mascellani gmascellani@codeweavers.com
Commit b7402ddbbecdfaa81daa657fbb5d37661f401434 from wine is required, which was first released with 3.21, not 3.20. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac index b58c2f4d2..213ab22ee 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ AC_PROG_CC AM_PROG_CC_C_O AC_PROG_SED AC_PROG_MKDIR_P -VKD3D_PROG_WIDL(3, 20) +VKD3D_PROG_WIDL(3, 21) AS_IF([test "x$WIDL" = "xno"], [AC_MSG_WARN([widl is required to build header files.])])
AC_CHECK_PROGS([FLEX], [flex], [none])
From: Giovanni Mascellani gmascellani@codeweavers.com
--- .gitlab-ci.yml | 115 +++++++++++++++++++++++++++++++++++++++++++++++++ ci/Dockerfile | 16 +++++++ 2 files changed, 131 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 ci/Dockerfile
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..d8eec532b --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,115 @@ +image: giomasce/vkd3d + +stages: + - build + - test + +build64: + stage: build + script: + - ./autogen.sh + - mkdir build + - cd build + - ../configure --enable-demos + - make -j$(nproc) + - make -j$(nproc) crosstest + artifacts: + when: always + paths: + - . + +test64-amd: + stage: test + dependencies: + - build64 + needs: + - build64 + tags: + - gpu + script: + - mkdir info + - cat /proc/cpuinfo > info/cpuinfo.txt + - cat /proc/meminfo > info/meminfo.txt + - vulkaninfo > info/vulkaninfo.txt + - cd build + - VKD3D_VULKAN_DEVICE_FILTER=AMD VKD3D_VULKAN_DEVICE=0 make -j$(nproc) check + artifacts: + when: always + paths: + - info + - build + +test64-llvmpipe: + stage: test + dependencies: + - build64 + needs: + - build64 + allow_failure: true + script: + - mkdir info + - cat /proc/cpuinfo > info/cpuinfo.txt + - cat /proc/meminfo > info/meminfo.txt + - vulkaninfo > info/vulkaninfo.txt + - cd build + - VKD3D_VULKAN_DEVICE_FILTER=llvmpipe VKD3D_VULKAN_DEVICE=0 make -j$(nproc) check + artifacts: + when: always + paths: + - info + - build + +build32: + stage: build + script: + - ./autogen.sh + - mkdir build + - cd build + - ../configure --enable-demos CC="gcc -m32" + - make -j$(nproc) + - make -j$(nproc) crosstest + artifacts: + when: always + paths: + - . + +test32-amd: + stage: test + dependencies: + - build32 + needs: + - build32 + tags: + - gpu + script: + - mkdir info + - cat /proc/cpuinfo > info/cpuinfo.txt + - cat /proc/meminfo > info/meminfo.txt + - vulkaninfo > info/vulkaninfo.txt + - cd build + - VKD3D_VULKAN_DEVICE_FILTER=AMD VKD3D_VULKAN_DEVICE=0 make -j$(nproc) check + artifacts: + when: always + paths: + - info + - build + +test32-llvmpipe: + stage: test + dependencies: + - build32 + needs: + - build32 + allow_failure: true + script: + - mkdir info + - cat /proc/cpuinfo > info/cpuinfo.txt + - cat /proc/meminfo > info/meminfo.txt + - vulkaninfo > info/vulkaninfo.txt + - cd build + - VKD3D_VULKAN_DEVICE_FILTER=llvmpipe VKD3D_VULKAN_DEVICE=0 make -j$(nproc) check + artifacts: + when: always + paths: + - info + - build diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 000000000..b58b33f5c --- /dev/null +++ b/ci/Dockerfile @@ -0,0 +1,16 @@ +FROM debian:bookworm +ENV DEBIAN_FRONTEND=noninteractive + +RUN rm /etc/apt/sources.list.d/* +RUN dpkg --add-architecture i386 +RUN printf "deb [arch=amd64,i386] http://deb.debian.org/debian bookworm main\n" > /etc/apt/sources.list +RUN apt-get update +RUN apt-get install -y eatmydata +RUN eatmydata apt-get dist-upgrade -y +RUN eatmydata apt-get install -y build-essential pkg-config locales mesa-vulkan-drivers vulkan-tools autoconf automake libtool flex bison libvulkan-dev spirv-headers gcc-mingw-w64 libncurses-dev libxcb1-dev gcc-multilib doxygen doxygen-latex graphviz libvulkan-dev:i386 mesa-vulkan-drivers:i386 libncurses-dev:i386 libxcb-util-dev libxcb-icccm4-dev libxcb-keysyms1-dev libxcb1-dev:i386 libxcb-util-dev:i386 libxcb-icccm4-dev:i386 libxcb-keysyms1-dev:i386 git +RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen +ENV LANG=en_US.UTF-8 + +# Join everything in a single RUN so that the intermediate state with +# the Wine sources is not saved +RUN cd /root && git clone --depth 1 --branch wine-3.21 https://gitlab.winehq.org/wine/wine.git && cd wine && mkdir build && cd build && ../configure --without-x --without-freetype && make tools/widl/widl && cp tools/widl/widl /usr/local/bin && rm -fr /root/wine
WRT the Debian version, I am somewhat less convinced, mostly because of the Mesa drivers. As I understand it, llvmpipe is evolving quite quickly, so tracking a more recent Mesa version might me more helpful for development. OTOH it's also valuable to check that things didn't break for released software. Maybe this is just a good reason to test on different Debian versions. One could say that in general more variations you test with, more useful the CI is; and that current pipelines are still quite fast, so we still have a few points to spend before the whole thing becomes unwieldy.
My consideration is mostly that "unstable" is not a fixed version, and that may make it harder to reproduce results.
Testing both the latest versions and the oldest supported versions of dependencies makes sense to me; no disagreement from me there. It does probably imply that MRs bumping the minimum supported versions of dependencies are going to require CI changes.
My consideration is mostly that "unstable" is not a fixed version, and that may make it harder to reproduce results.
Well, arguably containers were invented specifically to solve the problem of having deterministic dependencies when running programs, so maybe there is some tooling we can leverage here. For example, instead of pinning to a Debian version (which is still going to change over time, even though released Debian versions are expected to change in more conservative ways than unstable) we can give a permanent tag to each container used in the CI and pin the pipeline to that specific tag (it's not that I expect to update the CI image that often anyway). Would that be better for you?
Testing both the latest versions and the oldest supported versions of dependencies makes sense to me; no disagreement from me there. It does probably imply that MRs bumping the minimum supported versions of dependencies are going to require CI changes.
Yeah. In itself that should be particularly difficult, you would hardly need to do more than update the `Dockerfile` and run `docker build` and `docker push`. As I said the way this is setup is currently not ideal, because the Docker image is in my own namespace on Docker hub. There is apparently some resistance to enable the usage of Docker repositories on this GitLab instance, because of storage/bandwidth concerns. I'm not sure what is the best way forward here, but I would argue that having a less-than-ideally setup CI is still better than no CI at all.