Commit aabd4d2e authored by Rocky Automation's avatar Rocky Automation 📺
Browse files

import mesa-21.1.5-1.el8

parent 7013e348
SOURCES/mesa-20.3.3.tar.xz
SOURCES/mesa-21.1.5.tar.xz
c0e42fada2b306a6d9740376398c0d8b0a130427 SOURCES/mesa-20.3.3.tar.xz
6962198a822b83195065611e253cde98f627e904 SOURCES/mesa-21.1.5.tar.xz
VERSION ?= 20.3.3
VERSION ?= 21.1.5
SANITIZE ?= 1
DIRNAME = mesa-${VERSION}
......
diff -up mesa-20.3.0-rc1/src/gallium/frontends/lavapipe/lvp_device.c.dma mesa-20.3.0-rc1/src/gallium/frontends/lavapipe/lvp_device.c
--- mesa-20.3.0-rc1/src/gallium/frontends/lavapipe/lvp_device.c.dma 2020-11-19 15:11:42.483134826 +1000
+++ mesa-20.3.0-rc1/src/gallium/frontends/lavapipe/lvp_device.c 2020-11-19 15:13:08.556425782 +1000
@@ -118,6 +118,9 @@ VkResult lvp_CreateInstance(
client_version = VK_API_VERSION_1_0;
}
diff -up mesa-21.1.1/src/gallium/frontends/lavapipe/lvp_device.c.dma mesa-21.1.1/src/gallium/frontends/lavapipe/lvp_device.c
--- mesa-21.1.1/src/gallium/frontends/lavapipe/lvp_device.c.dma 2021-05-20 13:08:02.207217380 +1000
+++ mesa-21.1.1/src/gallium/frontends/lavapipe/lvp_device.c 2021-05-20 13:08:35.868127094 +1000
@@ -224,6 +224,9 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_Creat
if (pAllocator == NULL)
pAllocator = &default_alloc;
+ if (!getenv("RH_SW_VULKAN"))
+ return VK_ERROR_INITIALIZATION_FAILED;
+
instance = vk_zalloc2(&default_alloc, pAllocator, sizeof(*instance), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
instance = vk_zalloc(pAllocator, sizeof(*instance), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!instance)
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index e2a7d337ecf..bc4d87611e0 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -31,6 +31,7 @@
#include <string.h>
#include <pthread.h>
#include <poll.h>
+#include <sys/mman.h>
#include "drm-uapi/drm_fourcc.h"
@@ -44,9 +45,15 @@
#include <util/hash_table.h>
#include <util/timespec.h>
#include <util/u_vector.h>
+#include <util/anon_file.h>
struct wsi_wayland;
+struct wsi_wl_display_swrast {
+ struct wl_shm * wl_shm;
+ struct u_vector formats;
+};
+
struct wsi_wl_display_drm {
struct wl_drm * wl_drm;
struct u_vector formats;
@@ -69,6 +76,7 @@ struct wsi_wl_display {
struct wl_display * wl_display_wrapper;
struct wl_event_queue * queue;
+ struct wsi_wl_display_swrast swrast;
struct wsi_wl_display_drm drm;
struct wsi_wl_display_dmabuf dmabuf;
@@ -79,6 +87,8 @@ struct wsi_wl_display {
/* Only used for displays created by wsi_wl_display_create */
uint32_t refcount;
+
+ bool sw;
};
struct wsi_wayland {
@@ -183,6 +193,40 @@ wsi_wl_display_add_wl_format(struct wsi_wl_display *display,
}
}
+static void
+wsi_wl_display_add_wl_shm_format(struct wsi_wl_display *display,
+ struct u_vector *formats,
+ uint32_t wl_shm_format)
+{
+ switch (wl_shm_format) {
+ case WL_SHM_FORMAT_XBGR8888:
+ wsi_wl_display_add_vk_format(display, formats,
+ VK_FORMAT_R8G8B8_SRGB);
+ wsi_wl_display_add_vk_format(display, formats,
+ VK_FORMAT_R8G8B8_UNORM);
+ FALLTHROUGH;
+ case WL_SHM_FORMAT_ABGR8888:
+ wsi_wl_display_add_vk_format(display, formats,
+ VK_FORMAT_R8G8B8A8_SRGB);
+ wsi_wl_display_add_vk_format(display, formats,
+ VK_FORMAT_R8G8B8A8_UNORM);
+ break;
+ case WL_SHM_FORMAT_XRGB8888:
+ wsi_wl_display_add_vk_format(display, formats,
+ VK_FORMAT_B8G8R8_SRGB);
+ wsi_wl_display_add_vk_format(display, formats,
+ VK_FORMAT_B8G8R8_UNORM);
+ FALLTHROUGH;
+ case WL_SHM_FORMAT_ARGB8888:
+ wsi_wl_display_add_vk_format(display, formats,
+ VK_FORMAT_B8G8R8A8_SRGB);
+ wsi_wl_display_add_vk_format(display, formats,
+ VK_FORMAT_B8G8R8A8_UNORM);
+ break;
+ }
+}
+
+
static void
drm_handle_device(void *data, struct wl_drm *drm, const char *name)
{
@@ -232,6 +276,23 @@ wl_drm_format_for_vk_format(VkFormat vk_format, bool alpha)
}
}
+static uint32_t
+wl_shm_format_for_vk_format(VkFormat vk_format, bool alpha)
+{
+ switch (vk_format) {
+ case VK_FORMAT_R8G8B8A8_UNORM:
+ case VK_FORMAT_R8G8B8A8_SRGB:
+ return alpha ? WL_SHM_FORMAT_ABGR8888 : WL_SHM_FORMAT_XBGR8888;
+ case VK_FORMAT_B8G8R8A8_UNORM:
+ case VK_FORMAT_B8G8R8A8_SRGB:
+ return alpha ? WL_SHM_FORMAT_ARGB8888 : WL_SHM_FORMAT_XRGB8888;
+
+ default:
+ assert(!"Unsupported Vulkan format");
+ return 0;
+ }
+}
+
static void
drm_handle_format(void *data, struct wl_drm *drm, uint32_t wl_format)
{
@@ -311,12 +372,34 @@ static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = {
dmabuf_handle_modifier,
};
+static void
+shm_handle_format(void *data, struct wl_shm *shm, uint32_t format)
+{
+ struct wsi_wl_display *display = data;
+ if (display->swrast.formats.element_size == 0)
+ return;
+
+ wsi_wl_display_add_wl_shm_format(display, &display->swrast.formats, format);
+}
+
+static const struct wl_shm_listener shm_listener = {
+ .format = shm_handle_format
+};
+
static void
registry_handle_global(void *data, struct wl_registry *registry,
uint32_t name, const char *interface, uint32_t version)
{
struct wsi_wl_display *display = data;
+ if (display->sw) {
+ if (strcmp(interface, "wl_shm") == 0) {
+ display->swrast.wl_shm = wl_registry_bind(registry, name, &wl_shm_interface, 1);
+ wl_shm_add_listener(display->swrast.wl_shm, &shm_listener, display);
+ }
+ return;
+ }
+
if (strcmp(interface, "wl_drm") == 0) {
assert(display->drm.wl_drm == NULL);
@@ -348,10 +431,13 @@ wsi_wl_display_finish(struct wsi_wl_display *display)
{
assert(display->refcount == 0);
+ u_vector_finish(&display->swrast.formats);
u_vector_finish(&display->drm.formats);
u_vector_finish(&display->dmabuf.formats);
u_vector_finish(&display->dmabuf.modifiers.argb8888);
u_vector_finish(&display->dmabuf.modifiers.xrgb8888);
+ if (display->swrast.wl_shm)
+ wl_shm_destroy(display->swrast.wl_shm);
if (display->drm.wl_drm)
wl_drm_destroy(display->drm.wl_drm);
if (display->dmabuf.wl_dmabuf)
@@ -366,16 +452,18 @@ static VkResult
wsi_wl_display_init(struct wsi_wayland *wsi_wl,
struct wsi_wl_display *display,
struct wl_display *wl_display,
- bool get_format_list)
+ bool get_format_list, bool sw)
{
VkResult result = VK_SUCCESS;
memset(display, 0, sizeof(*display));
display->wsi_wl = wsi_wl;
display->wl_display = wl_display;
+ display->sw = sw;
if (get_format_list) {
- if (!u_vector_init(&display->drm.formats, sizeof(VkFormat), 8) ||
+ if (!u_vector_init(&display->swrast.formats, sizeof(VkFormat), 8) ||
+ !u_vector_init(&display->drm.formats, sizeof(VkFormat), 8) ||
!u_vector_init(&display->dmabuf.formats, sizeof(VkFormat), 8) ||
!u_vector_init(&display->dmabuf.modifiers.argb8888,
sizeof(uint64_t), 32) ||
@@ -414,7 +502,7 @@ wsi_wl_display_init(struct wsi_wayland *wsi_wl,
wl_display_roundtrip_queue(display->wl_display, display->queue);
/* Round-trip again to get formats, modifiers and capabilities */
- if (display->drm.wl_drm || display->dmabuf.wl_dmabuf)
+ if (display->drm.wl_drm || display->dmabuf.wl_dmabuf || display->swrast.wl_shm)
wl_display_roundtrip_queue(display->wl_display, display->queue);
if (wsi_wl->wsi->force_bgra8_unorm_first) {
@@ -432,8 +520,10 @@ wsi_wl_display_init(struct wsi_wayland *wsi_wl,
}
}
+ if (display->sw)
+ display->formats = &display->swrast.formats;
/* We need prime support for wl_drm */
- if (display->drm.wl_drm &&
+ else if (display->drm.wl_drm &&
(display->drm.capabilities & WL_DRM_CAPABILITY_PRIME)) {
display->formats = &display->drm.formats;
} else if (display->dmabuf.wl_dmabuf) {
@@ -463,6 +553,7 @@ fail:
static VkResult
wsi_wl_display_create(struct wsi_wayland *wsi, struct wl_display *wl_display,
+ bool sw,
struct wsi_wl_display **display_out)
{
struct wsi_wl_display *display =
@@ -471,7 +562,8 @@ wsi_wl_display_create(struct wsi_wayland *wsi, struct wl_display *wl_display,
if (!display)
return VK_ERROR_OUT_OF_HOST_MEMORY;
- VkResult result = wsi_wl_display_init(wsi, display, wl_display, true);
+ VkResult result = wsi_wl_display_init(wsi, display, wl_display, true,
+ sw);
if (result != VK_SUCCESS) {
vk_free(wsi->alloc, display);
return result;
@@ -509,7 +601,8 @@ wsi_wl_get_presentation_support(struct wsi_device *wsi_device,
(struct wsi_wayland *)wsi_device->wsi[VK_ICD_WSI_PLATFORM_WAYLAND];
struct wsi_wl_display display;
- VkResult ret = wsi_wl_display_init(wsi, &display, wl_display, false);
+ VkResult ret = wsi_wl_display_init(wsi, &display, wl_display, false,
+ wsi_device->sw);
if (ret == VK_SUCCESS)
wsi_wl_display_finish(&display);
@@ -612,7 +705,8 @@ wsi_wl_surface_get_formats(VkIcdSurfaceBase *icd_surface,
(struct wsi_wayland *)wsi_device->wsi[VK_ICD_WSI_PLATFORM_WAYLAND];
struct wsi_wl_display display;
- if (wsi_wl_display_init(wsi, &display, surface->display, true))
+ if (wsi_wl_display_init(wsi, &display, surface->display, true,
+ wsi_device->sw))
return VK_ERROR_SURFACE_LOST_KHR;
VK_OUTARRAY_MAKE(out, pSurfaceFormats, pSurfaceFormatCount);
@@ -642,7 +736,8 @@ wsi_wl_surface_get_formats2(VkIcdSurfaceBase *icd_surface,
(struct wsi_wayland *)wsi_device->wsi[VK_ICD_WSI_PLATFORM_WAYLAND];
struct wsi_wl_display display;
- if (wsi_wl_display_init(wsi, &display, surface->display, true))
+ if (wsi_wl_display_init(wsi, &display, surface->display, true,
+ wsi_device->sw))
return VK_ERROR_SURFACE_LOST_KHR;
VK_OUTARRAY_MAKE(out, pSurfaceFormats, pSurfaceFormatCount);
@@ -722,10 +817,12 @@ struct wsi_wl_image {
struct wsi_image base;
struct wl_buffer * buffer;
bool busy;
+ void * data_ptr;
+ uint32_t data_size;
};
struct wsi_wl_swapchain {
- struct wsi_swapchain base;
+ struct wsi_swapchain base;
struct wsi_wl_display *display;
@@ -742,6 +839,7 @@ struct wsi_wl_swapchain {
VkExtent2D extent;
VkFormat vk_format;
uint32_t drm_format;
+ uint32_t shm_format;
uint32_t num_drm_modifiers;
const uint64_t * drm_modifiers;
@@ -859,6 +957,23 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain,
{
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
+ if (chain->display->sw) {
+ struct wsi_wl_image *image = &chain->images[image_index];
+ void *dptr = image->data_ptr;
+ void *sptr;
+ chain->base.wsi->MapMemory(chain->base.device,
+ image->base.memory,
+ 0, 0, 0, &sptr);
+
+ for (unsigned r = 0; r < chain->extent.height; r++) {
+ memcpy(dptr, sptr, image->base.row_pitches[0]);
+ dptr += image->base.row_pitches[0];
+ sptr += image->base.row_pitches[0];
+ }
+ chain->base.wsi->UnmapMemory(chain->base.device,
+ image->base.memory);
+
+ }
if (chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR) {
while (!chain->fifo_ready) {
int ret = wl_display_dispatch_queue(chain->display->wl_display,
@@ -928,7 +1043,31 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
if (result != VK_SUCCESS)
return result;
- if (!chain->drm_wrapper) {
+ if (display->sw) {
+ int fd, stride;
+
+ stride = image->base.row_pitches[0];
+ image->data_size = stride * chain->extent.height;
+
+ /* Create a shareable buffer */
+ fd = os_create_anonymous_file(image->data_size, NULL);
+ if (fd < 0)
+ goto fail_image;
+
+ image->data_ptr = mmap(NULL, image->data_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (image->data_ptr == MAP_FAILED) {
+ close(fd);
+ goto fail_image;
+ }
+ /* Share it in a wl_buffer */
+ struct wl_shm_pool *pool = wl_shm_create_pool(display->swrast.wl_shm, fd, image->data_size);
+ wl_proxy_set_queue((struct wl_proxy *)pool, display->queue);
+ image->buffer = wl_shm_pool_create_buffer(pool, 0, chain->extent.width,
+ chain->extent.height, stride,
+ chain->shm_format);
+ wl_shm_pool_destroy(pool);
+ close(fd);
+ } else if (!chain->drm_wrapper) {
/* Only request modifiers if we have dmabuf, else it must be implicit. */
assert(display->dmabuf.wl_dmabuf);
assert(image->base.drm_modifier != DRM_FORMAT_MOD_INVALID);
@@ -995,6 +1134,8 @@ wsi_wl_swapchain_destroy(struct wsi_swapchain *wsi_chain,
if (chain->images[i].buffer) {
wl_buffer_destroy(chain->images[i].buffer);
wsi_destroy_image(&chain->base, &chain->images[i].base);
+ if (chain->images[i].data_ptr)
+ munmap(chain->images[i].data_ptr, chain->images[i].data_size);
}
}
@@ -1049,8 +1190,10 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
/* Mark a bunch of stuff as NULL. This way we can just call
* destroy_swapchain for cleanup.
*/
- for (uint32_t i = 0; i < num_images; i++)
+ for (uint32_t i = 0; i < num_images; i++) {
chain->images[i].buffer = NULL;
+ chain->images[i].data_ptr = NULL;
+ }
chain->surface = NULL;
chain->drm_wrapper = NULL;
chain->frame = NULL;
@@ -1066,7 +1209,10 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain->base.image_count = num_images;
chain->extent = pCreateInfo->imageExtent;
chain->vk_format = pCreateInfo->imageFormat;
- chain->drm_format = wl_drm_format_for_vk_format(chain->vk_format, alpha);
+ if (wsi_device->sw)
+ chain->shm_format = wl_shm_format_for_vk_format(chain->vk_format, alpha);
+ else
+ chain->drm_format = wl_drm_format_for_vk_format(chain->vk_format, alpha);
if (pCreateInfo->oldSwapchain) {
/* If we have an oldSwapchain parameter, copy the display struct over
@@ -1076,7 +1222,8 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain->display = wsi_wl_display_ref(old_chain->display);
} else {
chain->display = NULL;
- result = wsi_wl_display_create(wsi, surface->display, &chain->display);
+ result = wsi_wl_display_create(wsi, surface->display,
+ wsi_device->sw, &chain->display);
if (result != VK_SUCCESS)
goto fail;
}
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 54769b81ccc..fa0c3d997dc 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -439,8 +439,10 @@ VkBool32 wsi_get_physical_device_xcb_presentation_support(
if (!wsi_conn)
return false;
- if (!wsi_x11_check_for_dri3(wsi_conn))
- return false;
+ if (!wsi_device->sw) {
+ if (!wsi_x11_check_for_dri3(wsi_conn))
+ return false;
+ }
unsigned visual_depth;
if (!connection_get_visualtype(connection, visual_id, &visual_depth))
@@ -484,9 +486,11 @@ x11_surface_get_support(VkIcdSurfaceBase *icd_surface,
if (!wsi_conn)
return VK_ERROR_OUT_OF_HOST_MEMORY;
- if (!wsi_x11_check_for_dri3(wsi_conn)) {
- *pSupported = false;
- return VK_SUCCESS;
+ if (!wsi_device->sw) {
+ if (!wsi_x11_check_for_dri3(wsi_conn)) {
+ *pSupported = false;
+ return VK_SUCCESS;
+ }
}
unsigned visual_depth;
......@@ -25,10 +25,6 @@
%define with_xa 1
%endif
%ifnarch %{x86}
%global with_asm 1
%endif
%global dri_drivers %{?platform_drivers}
%if 0%{?with_vulkan_hw}
......@@ -43,8 +39,8 @@
Name: mesa
Summary: Mesa graphics libraries
Version: 20.3.3
Release: 2%{?rctag:.%{rctag}}%{?dist}
Version: 21.1.5
Release: 1%{?rctag:.%{rctag}}%{?dist}
License: MIT
URL: http://www.mesa3d.org
......@@ -59,10 +55,7 @@ Source3: Makefile
Source4: Mesa-MLAA-License-Clarification-Email.txt
Patch0: lavapipe-disable-env-var.patch
Patch1: mesa-20.3.3-stable-fixes.patch
Patch2: anv-remove-warning.patch
Patch10: cpu-affinity-fixes-20.3.3.patch
Patch1: mesa-vk-wsi-sw-fixes.patch
BuildRequires: gcc
BuildRequires: gcc-c++
......@@ -329,8 +322,9 @@ export ASFLAGS="--generate-missing-build-notes=yes"
%meson -Dcpp_std=gnu++14 \
-Db_ndebug=true \
-Dplatforms=x11,wayland \
-Ddri3=true \
-Ddri3=enabled \
-Ddri-drivers=%{?dri_drivers} \
-Dosmesa=true \
%if 0%{?with_hardware}
-Dgallium-drivers=swrast%{?with_iris:,iris},virgl,nouveau%{?with_vmware:,svga},radeonsi,r600%{?with_freedreno:,freedreno}%{?with_etnaviv:,etnaviv}%{?with_tegra:,tegra}%{?with_vc4:,vc4}%{?with_kmsro:,kmsro} \
%else
......@@ -344,22 +338,21 @@ export ASFLAGS="--generate-missing-build-notes=yes"
-Dgallium-nine=%{?with_nine:true}%{!?with_nine:false} \
-Dgallium-opencl=%{?with_opencl:icd}%{!?with_opencl:disabled} \
-Dvulkan-drivers=%{?vulkan_drivers} \
-Dshared-glapi=true \
-Dgles1=false \
-Dgles2=true \
-Dvulkan-layers=device-select \
-Dshared-glapi=enabled \
-Dgles1=disabled \
-Dgles2=enabled \
-Dopengl=true \
-Dgbm=true \
-Dgbm=enabled \
-Dglx=dri \
-Degl=true \
-Dglvnd=true \
-Dasm=%{?with_asm:true}%{!?with_asm:false} \
-Dmicrosoft-clc=disabled \
-Dllvm=true \
-Dshared-llvm=true \
-Dvalgrind=%{?with_valgrind:true}%{!?with_valgrind:false} \
-Dbuild-tests=false \
-Dselinux=true \
-Dosmesa=gallium \
-Dvulkan-device-select-layer=true \
%{nil}
%meson_build
......@@ -551,12 +544,20 @@ done
%if 0%{?with_vulkan_hw}
%files vulkan-devel
%{_includedir}/vulkan/
%endif
%changelog
* Fri Mar 26 2021 Dave Airlie <airlied@redhat.com> - 20.3.3-2
- Fix CPU affinity memory corruption crash (#1938788)
* Thu Jul 22 2021 Dave Airlie <airlied@redhat.com> - 21.1.5-1
- Fix vulkan sw with wayland, pull in .4 + .5 fixes
* Sat Jun 19 2021 Dave Airlie <airlied@redhat.com> - 21.1.3-1
- rebase to 21.1.3
* Tue Jun 01 2021 Dave Airlie <airlied@redhat.com> - 21.1.1-2
- rebuild against llvm 12
* Thu May 20 2021 Dave Airlie <airlied@redhat.com> - 21.1.1-1
- Update to 21.1.1
* Tue Feb 16 2021 Dave Airlie <airlied@redhat.com> - 20.3.3-1
- Update to 20.3.3 + upstream fixes for qemu regression
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment