1.Update spec file
authorTianhao Ni <tianhao.ni@samsung.com>
Tue, 23 Nov 2021 01:29:36 +0000 (09:29 +0800)
committerXuelian Bai <xuelian.bai@samsung.com>
Tue, 21 Feb 2023 06:50:48 +0000 (14:50 +0800)
2.Fix GLES31 eglSwapBuffers issue:
- GLES31 CTS, TC will call eglSwapBuffers without any draw call,
  in this case tbm_surface will be NULL, but this should not be
  an error.

Change-Id: I2eeda60f9581c40158ebec328024cb8f107dc646
Signed-off-by: Tianhao Ni <tianhao.ni@samsung.com>
packaging/mesa.spec
src/egl/drivers/dri2/platform_tizen.c

index d7d54f0..85c068e 100644 (file)
@@ -1,5 +1,5 @@
 Name:           mesa
-Version:        19.3.0
+Version:        21.2.3
 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
@@ -39,10 +39,32 @@ BuildRequires:  pkgconfig(libdrm_intel) >= 2.4.24
 ExclusiveArch:
 %endif
 
+%define USE_LLVM 0
+%define USE_GBM 0
 %define USE_VULKAN 0
 %define VULKAN_DRIVER broadcom
 
-%define USE_GBM 0
+%define enable_driver() %{expand:%%{?!enable_%{1}: %%global enable_%{1} 1}}
+
+%ifarch %ix86 x86_64
+%define gallium_drivers "i915,swrast"
+%define vulkan_drivers ""
+%define dri_drivers ""
+%else
+%if %{USE_LLVM} == 1
+%enable_driver llvm
+%endif
+%if %{USE_GBM} == 1
+%enable_driver gbm
+%endif
+%if %{USE_VULKAN} == 1
+%enable_driver vulkan
+%endif
+%define gallium_drivers "vc4,v3d,kmsro%{?!enable_llvm:,swrast}"
+%define vulkan_drivers "%{?enable_vulkan:%{VULKAN_DRIVER}}"
+%define dri_drivers "auto"
+%endif
+
 
 %description
 Mesa is a 3-D graphics library with an API which is very similar to
@@ -69,32 +91,22 @@ cp %{SOURCE1002} .
 mkdir build
 
 meson --prefix %{_hal_prefix} build/ \
-                -Dc_link_args="-lttrace" \
-                -Dcpp_link_args="-lttrace" \
-               -Dlibdir=%{_hal_libdir} \
-               -Dgallium-va=false \
-               -Dgallium-vdpau=false \
-               -Dgallium-xa=false \
-               -Dgallium-xvmc=false \
-               -Dglx=disabled \
-               -Ddri3=false \
-                -Dllvm=enabled \
-%if "%{USE_GBM}" == "1"
-               -Dgbm=true \
-%else
-               -Dgbm=false \
-%endif
-               -Dplatforms="tizen" \
-%ifarch %ix86 x86_64
-               -Dgallium-drivers="i915,swrast" \
-               -Ddri-drivers="" \
-               -Dvulkan-drivers=""
-%else
-%if "%{USE_VULKAN}" == "1"
-               -Dvulkan-drivers="%{VULKAN_DRIVER}" \
-%endif
-               -Dgallium-drivers="vc4,v3d,kmsro,swrast"
-%endif
+        -Dc_link_args="-lttrace" \
+        -Dcpp_link_args="-lttrace" \
+        -Dlibdir=%{_hal_libdir} \
+        -Dgallium-va=false \
+        -Dgallium-vdpau=false \
+        -Dgallium-xa=false \
+        -Dgallium-xvmc=false \
+        -Dglx=disabled \
+        -Ddri3=false \
+        -Dllvm=%{?enable_llvm:enabled}%{?!enable_llvm:disabled} \
+        -Dgbm=%{?enable_gbm:enabled}%{?!enable_gbm:disabled} \
+        -Dplatforms="tizen" \
+        -Dgallium-drivers=%{gallium_drivers} \
+        -Ddri-drivers=%{dri_drivers} \
+        -Dvulkan-drivers=%{vulkan_drivers}
+
 
 ninja -C build/
 
index 1b1ee61..83c3b42 100755 (executable)
@@ -773,14 +773,20 @@ tizen_swap_buffers_with_damage(_EGLDisplay *disp,
          dri2_surf->color_buffers[i].age++;
    }
 
-   /* Make sure we have a back buffer in case we're swapping without
-    * ever rendering. */
-   if (get_back_bo(dri2_surf, 0) < 0) {
-      _eglError(EGL_BAD_ALLOC, "dri2_swap_buffers");
-      return EGL_FALSE;
+   /* In case that application didn't draw anything before swapbuffer,
+    * dri2_surf->tbm_surface will be NULL here, but this should not be
+    * an error */
+   if (dri2_surf->tbm_surface) {
+      /* Make sure we have a back buffer in case we're swapping without
+      * ever rendering. */
+      if (get_back_bo(dri2_surf, 0) < 0) {
+         _eglError(EGL_BAD_ALLOC, "dri2_swap_buffers");
+         return EGL_FALSE;
+      }
    }
 
-   dri2_surf->back->age = 1;
+   if (dri2_surf->back)
+      dri2_surf->back->age = 1;
 
    TRACE_BEGIN("DRI2_SWAP_BUFERS");
    /* The buffer to enqueue should be the buffer in which