Upgrade to mesa22.3.5 12/288812/1 accepted/tizen/unified/20230227.042036 accepted/tizen/unified/20230227.152721
authorXuelian Bai <xuelian.bai@samsung.com>
Thu, 23 Feb 2023 09:01:12 +0000 (17:01 +0800)
committerXuelian Bai <xuelian.bai@samsung.com>
Thu, 23 Feb 2023 09:04:29 +0000 (17:04 +0800)
1. Add missing linux header files which is not included in glibc
2. Disable unsupported fence syn  related features
3. Fixed crash in pipeline cases

Change-Id: I64c9b3fcddf119ccc34ad393244f03ec96618942
Signed-off-by: Xuelian Bai <xuelian.bai@samsung.com>
include/EGL/eglext.h
include/linux/dma-buf.h [new file with mode: 0644]
include/linux/sync_file.h [new file with mode: 0644]
packaging/mesa.spec
src/broadcom/vulkan/v3dv_device.c
src/broadcom/vulkan/v3dv_pipeline_cache.c
src/egl/drivers/dri2/platform_tizen.c
src/egl/main/eglapi.c

index 9d5915a..43e9fa7 100644 (file)
@@ -1498,7 +1498,6 @@ EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDTIZEN (EGLDisplay dpy, EGLSyncKHR s
 #endif /* EGL_TIZEN_native_fence_sync */
 
 #include <EGL/eglmesaext.h>
-#include <EGL/eglextchromium.h>
 
 #ifdef __cplusplus
 }
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
new file mode 100644 (file)
index 0000000..7f30393
--- /dev/null
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * Framework for buffer objects that can be shared across devices/subsystems.
+ *
+ * Copyright(C) 2015 Intel Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _DMA_BUF_UAPI_H_
+#define _DMA_BUF_UAPI_H_
+
+#include <linux/types.h>
+
+/* begin/end dma-buf functions used for userspace mmap. */
+struct dma_buf_sync {
+       __u64 flags;
+};
+
+#define DMA_BUF_SYNC_READ      (1 << 0)
+#define DMA_BUF_SYNC_WRITE     (2 << 0)
+#define DMA_BUF_SYNC_RW        (DMA_BUF_SYNC_READ | DMA_BUF_SYNC_WRITE)
+#define DMA_BUF_SYNC_START     (0 << 2)
+#define DMA_BUF_SYNC_END       (1 << 2)
+#define DMA_BUF_SYNC_VALID_FLAGS_MASK \
+       (DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END)
+
+#define DMA_BUF_NAME_LEN       32
+
+#define DMA_BUF_BASE           'b'
+#define DMA_BUF_IOCTL_SYNC     _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
+
+/* 32/64bitness of this uapi was botched in android, there's no difference
+ * between them in actual uapi, they're just different numbers.
+ */
+#define DMA_BUF_SET_NAME       _IOW(DMA_BUF_BASE, 1, const char *)
+#define DMA_BUF_SET_NAME_A     _IOW(DMA_BUF_BASE, 1, u32)
+#define DMA_BUF_SET_NAME_B     _IOW(DMA_BUF_BASE, 1, u64)
+
+#endif
diff --git a/include/linux/sync_file.h b/include/linux/sync_file.h
new file mode 100644 (file)
index 0000000..ee2dcfb
--- /dev/null
@@ -0,0 +1,98 @@
+/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */
+/*
+ * Copyright (C) 2012 Google, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _UAPI_LINUX_SYNC_H
+#define _UAPI_LINUX_SYNC_H
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+/**
+ * struct sync_merge_data - data passed to merge ioctl
+ * @name:      name of new fence
+ * @fd2:       file descriptor of second fence
+ * @fence:     returns the fd of the new fence to userspace
+ * @flags:     merge_data flags
+ * @pad:       padding for 64-bit alignment, should always be zero
+ */
+struct sync_merge_data {
+       char    name[32];
+       __s32   fd2;
+       __s32   fence;
+       __u32   flags;
+       __u32   pad;
+};
+
+/**
+ * struct sync_fence_info - detailed fence information
+ * @obj_name:          name of parent sync_timeline
+* @driver_name:        name of driver implementing the parent
+* @status:             status of the fence 0:active 1:signaled <0:error
+ * @flags:             fence_info flags
+ * @timestamp_ns:      timestamp of status change in nanoseconds
+ */
+struct sync_fence_info {
+       char    obj_name[32];
+       char    driver_name[32];
+       __s32   status;
+       __u32   flags;
+       __u64   timestamp_ns;
+};
+
+/**
+ * struct sync_file_info - data returned from fence info ioctl
+ * @name:      name of fence
+ * @status:    status of fence. 1: signaled 0:active <0:error
+ * @flags:     sync_file_info flags
+ * @num_fences number of fences in the sync_file
+ * @pad:       padding for 64-bit alignment, should always be zero
+ * @sync_fence_info: pointer to array of structs sync_fence_info with all
+ *              fences in the sync_file
+ */
+struct sync_file_info {
+       char    name[32];
+       __s32   status;
+       __u32   flags;
+       __u32   num_fences;
+       __u32   pad;
+
+       __u64   sync_fence_info;
+};
+
+#define SYNC_IOC_MAGIC         '>'
+
+/**
+ * Opcodes  0, 1 and 2 were burned during a API change to avoid users of the
+ * old API to get weird errors when trying to handling sync_files. The API
+ * change happened during the de-stage of the Sync Framework when there was
+ * no upstream users available.
+ */
+
+/**
+ * DOC: SYNC_IOC_MERGE - merge two fences
+ *
+ * Takes a struct sync_merge_data.  Creates a new fence containing copies of
+ * the sync_pts in both the calling fd and sync_merge_data.fd2.  Returns the
+ * new fence's fd in sync_merge_data.fence
+ */
+#define SYNC_IOC_MERGE         _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
+
+/**
+ * DOC: SYNC_IOC_FILE_INFO - get detailed information on a sync_file
+ *
+ * Takes a struct sync_file_info. If num_fences is 0, the field is updated
+ * with the actual number of fences. If num_fences is > 0, the system will
+ * use the pointer provided on sync_fence_info to return up to num_fences of
+ * struct sync_fence_info, with detailed fence information.
+ */
+#define SYNC_IOC_FILE_INFO     _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
+
+#endif /* _UAPI_LINUX_SYNC_H */
index 87e1521..634fa7f 100644 (file)
@@ -1,5 +1,5 @@
 Name:           mesa
-Version:        22.1.7
+Version:        22.3.5
 Release:        0
 License:        MIT and Apache-2.0 and SGI Free Software License B v2.0 and BSD-3-Clause
 Summary:        System for rendering interactive 3-D graphics
@@ -100,7 +100,6 @@ meson --prefix %{_hal_prefix} build/ \
         -Dgallium-va=false \
         -Dgallium-vdpau=false \
         -Dgallium-xa=false \
-        -Dgallium-xvmc=false \
         -Dglx=disabled \
         -Ddri3=false \
         -Dllvm=%{?enable_llvm:enabled}%{?!enable_llvm:disabled} \
index d66db33..a0557ea 100644 (file)
@@ -921,7 +921,10 @@ create_physical_device(struct v3dv_instance *instance,
     */
    device->drm_syncobj_type.features &= ~VK_SYNC_FEATURE_TIMELINE;
 
-#if using_v3d_simulator
+   /* There is still deadlock issue in dEQP-VK.api.external.fence.sync_fd.export* 
+    * cases, so disable external sync for now
+    * xuelian.bai */
+//#if using_v3d_simulator
    /* There are CTS tests which do the following:
     *
     *  1. Create a command buffer with a vkCmdWaitEvents()
@@ -949,7 +952,7 @@ create_physical_device(struct v3dv_instance *instance,
     */
    device->drm_syncobj_type.import_sync_file = NULL;
    device->drm_syncobj_type.export_sync_file = NULL;
-#endif
+//#endif
 
    /* Multiwait is required for emulated timeline semaphores and is supported
     * by the v3d kernel interface.
index 9e0470a..500b13a 100644 (file)
@@ -588,14 +588,14 @@ v3dv_pipeline_shared_data_create_from_blob(struct v3dv_pipeline_cache *cache,
          blob_read_bytes(blob, sizeof(struct v3dv_descriptor_maps));
 
       if (blob->overrun)
-         goto fail;
+         return NULL;
 
       maps[stage] = vk_zalloc2(&cache->device->vk.alloc, NULL,
                                sizeof(struct v3dv_descriptor_maps), 8,
                                VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
 
       if (maps[stage] == NULL)
-         goto fail;
+         return NULL;
 
       memcpy(maps[stage], current_maps, sizeof(struct v3dv_descriptor_maps));
       if (broadcom_shader_stage_is_render_with_binning(stage)) {
@@ -619,25 +619,10 @@ v3dv_pipeline_shared_data_create_from_blob(struct v3dv_pipeline_cache *cache,
       blob_read_bytes(blob, total_assembly_size);
 
    if (blob->overrun)
-      goto fail;
-
-   struct v3dv_pipeline_shared_data *data =
-      v3dv_pipeline_shared_data_new(cache, sha1_key, maps, variants,
-                                    total_assembly, total_assembly_size);
-
-   if (!data)
-      goto fail;
-
-   return data;
+      return NULL;
 
-fail:
-   for (int i = 0; i < BROADCOM_SHADER_STAGES; i++) {
-      if (maps[i])
-         vk_free2(&cache->device->vk.alloc, NULL, maps[i]);
-      if (variants[i])
-         v3dv_shader_variant_destroy(cache->device, variants[i]);
-   }
-   return NULL;
+   return v3dv_pipeline_shared_data_new(cache, sha1_key, maps, variants,
+                                        total_assembly, total_assembly_size);
 }
 
 static void
index 7a2798f..f86cc5e 100755 (executable)
@@ -301,7 +301,7 @@ tizen_window_enqueue_buffer_with_damage(_EGLDisplay *disp,
     * we enter tizen_window_enqueue_buffer() and re-acquire the mutex upon
     * return.
     */
-   mtx_unlock(&disp->Mutex);
+   simple_mtx_unlock(&disp->Mutex);
 
    fence_fd = dri2_surf->out_fence_fd;
 
@@ -325,7 +325,7 @@ tizen_window_enqueue_buffer_with_damage(_EGLDisplay *disp,
    dri2_surf->tbm_surface = NULL;
    dri2_surf->back = NULL;
 
-   mtx_lock(&disp->Mutex);
+   simple_mtx_unlock(&disp->Mutex);
 
    if (dri2_surf->dri_image_back) {
       dri2_dpy->image->destroyImage(dri2_surf->dri_image_back);
index baef5c1..4ccc426 100644 (file)
@@ -2310,7 +2310,7 @@ eglDupNativeFenceFDTIZEN(EGLDisplay dpy, EGLSync sync)
    _EGLSync *s = _eglLookupSync(sync, disp);
    EGLBoolean ret;
 
-   _EGL_FUNC_START(disp, EGL_OBJECT_SYNC_KHR, s, EGL_FALSE);
+   _EGL_FUNC_START(disp, EGL_OBJECT_SYNC_KHR, s);
 
    if (!(s && (s->Type == EGL_SYNC_NATIVE_FENCE_TIZEN)))
       RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_NO_NATIVE_FENCE_FD_TIZEN);