package/{mesa3d, mesa3d-headers}: bump version to 22.1.3

upgrade the mesa3d and mesa3d-headers to v22.1.3
and copy patch from IMG DDK 1.19

keep the 0002-Force-Mesa-to-use-the-PVR-driver-for-platform-device.patch
to force the pvr driver

Note that the new version mesa3d support gallium driver
and no longer support dri driver

Signed-off-by: Andy Hu <andy.hu@starfivetech.com>
Signed-off-by: Windsome Zeng <Windsome.Zeng@starfivetech.com>
This commit is contained in:
Andy Hu
2023-06-01 21:59:43 +08:00
parent 969f7d13f2
commit 7566503cc1
82 changed files with 6626 additions and 7086 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ endif
# Not possible to directly refer to mesa3d variables, because of
# first/second expansion trickery...
MESA3D_HEADERS_VERSION = 21.1.8
MESA3D_HEADERS_VERSION = 22.1.3
MESA3D_HEADERS_SOURCE = mesa-$(MESA3D_HEADERS_VERSION).tar.xz
MESA3D_HEADERS_SITE = https://archive.mesa3d.org
MESA3D_HEADERS_DL_SUBDIR = mesa3d
@@ -1,135 +1,426 @@
From 1546e69ae9fec54134bc06146143511b4374bf4a Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Tue, 14 Apr 2020 09:47:46 +0100
Subject: [PATCH 01/67] Add pvr dri driver
From c4b06c903526b72a211ae5d90d630bb6c0bafad6 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Mon, 21 Mar 2022 19:08:33 +0000
Subject: [PATCH 01/58] Add PVR Gallium driver
The driver is essentially a Gallium frontend for the proprietary
Imagination Technologies driver. It makes use of the Gallium DRI
infrastructure, but little else.
Commit 9c772de270408c8a9b9e84b734d9fc0cee2d4265, "dri: Fold away
some unused indirection in __DriverAPIRec", has been reverted as
part of this change. The indirection removed by the commit is
needed by the PVR Gallium frontend, which does not use the same
context related code as dri2 and drisw.
---
meson.build | 19 +-
meson_options.txt | 2 +-
src/mesa/drivers/dri/meson.build | 5 +
src/mesa/drivers/dri/pvr/dri_support.h | 581 +++++++++++++++
src/mesa/drivers/dri/pvr/img_drm_fourcc.h | 113 +++
src/mesa/drivers/dri/pvr/imgpixfmts.h | 307 ++++++++
src/mesa/drivers/dri/pvr/imgyuv.h | 58 ++
src/mesa/drivers/dri/pvr/mesa_context.c | 208 ++++++
src/mesa/drivers/dri/pvr/meson.build | 48 ++
src/mesa/drivers/dri/pvr/pvrcb.c | 328 +++++++++
src/mesa/drivers/dri/pvr/pvrcompat.c | 838 ++++++++++++++++++++++
src/mesa/drivers/dri/pvr/pvrdri.c | 613 ++++++++++++++++
src/mesa/drivers/dri/pvr/pvrdri.h | 188 +++++
src/mesa/drivers/dri/pvr/pvrdri_support.h | 206 ++++++
src/mesa/drivers/dri/pvr/pvrext.c | 704 ++++++++++++++++++
src/mesa/drivers/dri/pvr/pvrmesa.h | 36 +
src/mesa/drivers/dri/pvr/pvrutil.c | 239 ++++++
src/meson.build | 1 +
18 files changed, 4485 insertions(+), 9 deletions(-)
create mode 100644 src/mesa/drivers/dri/pvr/dri_support.h
create mode 100644 src/mesa/drivers/dri/pvr/img_drm_fourcc.h
create mode 100644 src/mesa/drivers/dri/pvr/imgpixfmts.h
create mode 100644 src/mesa/drivers/dri/pvr/imgyuv.h
create mode 100644 src/mesa/drivers/dri/pvr/mesa_context.c
create mode 100644 src/mesa/drivers/dri/pvr/meson.build
create mode 100644 src/mesa/drivers/dri/pvr/pvrcb.c
create mode 100644 src/mesa/drivers/dri/pvr/pvrcompat.c
create mode 100644 src/mesa/drivers/dri/pvr/pvrdri.c
create mode 100644 src/mesa/drivers/dri/pvr/pvrdri.h
create mode 100644 src/mesa/drivers/dri/pvr/pvrdri_support.h
create mode 100644 src/mesa/drivers/dri/pvr/pvrext.c
create mode 100644 src/mesa/drivers/dri/pvr/pvrmesa.h
create mode 100644 src/mesa/drivers/dri/pvr/pvrutil.c
meson.build | 18 +-
meson_options.txt | 8 +-
src/gallium/drivers/pvr/meson.build | 23 +
src/gallium/drivers/pvr_alias/meson.build | 23 +
src/gallium/frontends/dri/dri2.c | 8 +
src/gallium/frontends/dri/dri_screen.h | 2 +
src/gallium/frontends/dri/dri_util.c | 41 +-
src/gallium/frontends/dri/dri_util.h | 23 +
src/gallium/frontends/dri/drisw.c | 4 +
src/gallium/frontends/dri/meson.build | 4 +
src/gallium/frontends/pvr/dri_support.h | 587 +++++++++++++++
src/gallium/frontends/pvr/img_drm_fourcc.h | 113 +++
src/gallium/frontends/pvr/imgpixfmts.h | 307 ++++++++
src/gallium/frontends/pvr/imgyuv.h | 58 ++
src/gallium/frontends/pvr/mesa_context.c | 208 +++++
src/gallium/frontends/pvr/meson.build | 46 ++
src/gallium/frontends/pvr/pvrcb.c | 344 +++++++++
src/gallium/frontends/pvr/pvrcompat.c | 838 +++++++++++++++++++++
src/gallium/frontends/pvr/pvrdri.c | 607 +++++++++++++++
src/gallium/frontends/pvr/pvrdri.h | 190 +++++
src/gallium/frontends/pvr/pvrdri_support.h | 206 +++++
src/gallium/frontends/pvr/pvrext.c | 704 +++++++++++++++++
src/gallium/frontends/pvr/pvrmesa.h | 36 +
src/gallium/frontends/pvr/pvrutil.c | 235 ++++++
src/gallium/meson.build | 15 +
src/gallium/targets/dri/meson.build | 8 +-
src/gallium/targets/dri/target.c | 18 +
src/meson.build | 2 +
28 files changed, 4662 insertions(+), 14 deletions(-)
create mode 100644 src/gallium/drivers/pvr/meson.build
create mode 100644 src/gallium/drivers/pvr_alias/meson.build
create mode 100644 src/gallium/frontends/pvr/dri_support.h
create mode 100644 src/gallium/frontends/pvr/img_drm_fourcc.h
create mode 100644 src/gallium/frontends/pvr/imgpixfmts.h
create mode 100644 src/gallium/frontends/pvr/imgyuv.h
create mode 100644 src/gallium/frontends/pvr/mesa_context.c
create mode 100644 src/gallium/frontends/pvr/meson.build
create mode 100644 src/gallium/frontends/pvr/pvrcb.c
create mode 100644 src/gallium/frontends/pvr/pvrcompat.c
create mode 100644 src/gallium/frontends/pvr/pvrdri.c
create mode 100644 src/gallium/frontends/pvr/pvrdri.h
create mode 100644 src/gallium/frontends/pvr/pvrdri_support.h
create mode 100644 src/gallium/frontends/pvr/pvrext.c
create mode 100644 src/gallium/frontends/pvr/pvrmesa.h
create mode 100644 src/gallium/frontends/pvr/pvrutil.c
diff --git a/meson.build b/meson.build
index 155db287796..968b4f5f499 100644
index cdff0312e56..d9fbb1fd8d9 100644
--- a/meson.build
+++ b/meson.build
@@ -171,11 +171,11 @@ if dri_drivers.contains('auto')
if system_has_kms_drm
# TODO: PPC, Sparc
@@ -189,16 +189,16 @@ if gallium_drivers.contains('auto')
if ['x86', 'x86_64'].contains(host_machine.cpu_family())
- dri_drivers = ['i915', 'i965', 'r100', 'r200', 'nouveau']
+ dri_drivers = ['i915', 'i965', 'r100', 'r200', 'nouveau', 'pvr']
elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
- dri_drivers = []
+ dri_drivers = ['pvr']
elif ['mips', 'mips64', 'riscv32', 'riscv64'].contains(host_machine.cpu_family())
- dri_drivers = ['r100', 'r200', 'nouveau']
+ dri_drivers = ['r100', 'r200', 'nouveau', 'pvr']
else
error('Unknown architecture @0@. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.'.format(
host_machine.cpu_family()))
@@ -194,6 +194,7 @@ with_dri_i965 = dri_drivers.contains('i965')
with_dri_r100 = dri_drivers.contains('r100')
with_dri_r200 = dri_drivers.contains('r200')
with_dri_nouveau = dri_drivers.contains('nouveau')
+with_dri_pvr = dri_drivers.contains('pvr')
with_dri = dri_drivers.length() != 0
@@ -1516,14 +1517,16 @@ _drm_amdgpu_ver = '2.4.107'
_drm_radeon_ver = '2.4.71'
_drm_nouveau_ver = '2.4.102'
_drm_intel_ver = '2.4.75'
+_drm_pvr_ver = '2.4.60'
_drm_ver = '2.4.81'
_libdrm_checks = [
- ['intel', with_dri_i915 or with_gallium_i915],
- ['amdgpu', (with_amd_vk and not with_platform_windows) or with_gallium_radeonsi],
+ ['intel', with_dri_i915 or with_gallium_i915, true],
+ ['amdgpu', (with_amd_vk and not with_platform_windows) or with_gallium_radeonsi, true],
['radeon', (with_gallium_radeonsi or with_dri_r100 or with_dri_r200 or
- with_gallium_r300 or with_gallium_r600)],
- ['nouveau', (with_gallium_nouveau or with_dri_nouveau)],
+ with_gallium_r300 or with_gallium_r600), true],
+ ['nouveau', (with_gallium_nouveau or with_dri_nouveau), true],
+ ['pvr', with_dri_pvr, false],
gallium_drivers = [
'r300', 'r600', 'radeonsi', 'nouveau', 'virgl', 'svga', 'swrast',
- 'iris', 'crocus', 'i915'
+ 'iris', 'crocus', 'i915', 'pvr'
]
elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
gallium_drivers = [
'v3d', 'vc4', 'freedreno', 'etnaviv', 'nouveau',
- 'tegra', 'virgl', 'lima', 'panfrost', 'swrast'
+ 'tegra', 'virgl', 'lima', 'panfrost', 'swrast', 'pvr'
]
elif ['mips', 'mips64', 'riscv32', 'riscv64'].contains(host_machine.cpu_family())
gallium_drivers = [
- 'r300', 'r600', 'radeonsi', 'nouveau', 'virgl', 'swrast'
+ 'r300', 'r600', 'radeonsi', 'nouveau', 'virgl', 'swrast', 'pvr'
]
else
error('Unknown architecture @0@. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.'.format(
@@ -231,6 +231,7 @@ with_gallium_lima = gallium_drivers.contains('lima')
with_gallium_zink = gallium_drivers.contains('zink')
with_gallium_d3d12 = gallium_drivers.contains('d3d12')
with_gallium_asahi = gallium_drivers.contains('asahi')
+with_gallium_pvr = gallium_drivers.contains('pvr')
foreach gallium_driver : gallium_drivers
pre_args += '-DHAVE_@0@'.format(gallium_driver.to_upper())
endforeach
@@ -238,6 +239,17 @@ endforeach
with_gallium = gallium_drivers.length() != 0
with_gallium_kmsro = with_gallium_v3d or with_gallium_vc4 or with_gallium_etnaviv or with_gallium_panfrost or with_gallium_lima or with_gallium_freedreno
# VC4 only needs core libdrm support of this version, not a libdrm_vc4
@@ -1553,7 +1556,7 @@ endif
# Then get each libdrm module
foreach d : _libdrm_checks
- if d[1]
+ if d[1] and d[2]
set_variable(
'dep_libdrm_' + d[0],
dependency('libdrm_' + d[0], version : '>=' + _drm_ver)
+if with_gallium_pvr
+ gallium_pvr_alias = get_option('gallium-pvr-alias')
+ if gallium_pvr_alias == 'pvr'
+ gallium_pvr_alias = ''
+ endif
+ with_gallium_pvr_alias = gallium_pvr_alias != ''
+else
+ gallium_pvr_alias = ''
+ with_gallium_pvr_alias = false
+endif
+
if with_gallium and system_has_kms_drm
_glx = get_option('glx')
_egl = get_option('egl')
diff --git a/meson_options.txt b/meson_options.txt
index 29c402c4844..dac791099a1 100644
index 5baa70d051b..3f401d39225 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -55,7 +55,7 @@ option(
'dri-drivers',
type : 'array',
value : ['auto'],
- choices : ['auto', 'i915', 'i965', 'r100', 'r200', 'nouveau'],
+ choices : ['auto', 'i915', 'i965', 'r100', 'r200', 'nouveau', 'pvr'],
description : 'List of dri drivers to build. If this is set to auto all drivers applicable to the target OS/architecture will be built'
@@ -75,10 +75,16 @@ option(
choices : [
'auto', 'kmsro', 'radeonsi', 'r300', 'r600', 'nouveau', 'freedreno',
'swrast', 'v3d', 'vc4', 'etnaviv', 'tegra', 'i915', 'svga', 'virgl',
- 'panfrost', 'iris', 'lima', 'zink', 'd3d12', 'asahi', 'crocus'
+ 'panfrost', 'iris', 'lima', 'zink', 'd3d12', 'asahi', 'crocus', 'pvr'
],
description : 'List of gallium drivers to build. If this is set to auto all drivers applicable to the target OS/architecture will be built'
)
+option(
+ 'gallium-pvr-alias',
+ type : 'string',
+ value : '',
+ description : 'Gallium PVR alias. This must match the name of the kernel display driver.'
+)
option(
diff --git a/src/mesa/drivers/dri/meson.build b/src/mesa/drivers/dri/meson.build
index 239ca962c2a..88a973bb84f 100644
--- a/src/mesa/drivers/dri/meson.build
+++ b/src/mesa/drivers/dri/meson.build
@@ -48,6 +48,11 @@ if with_dri_nouveau
_dri_drivers += libnouveau_vieux
_dri_link += 'nouveau_vieux_dri.so'
endif
+if with_dri_pvr
+ subdir('pvr')
+ _dri_drivers += libpvr
+ _dri_link += 'pvr_dri.so'
+endif
if _dri_drivers != []
libmesa_dri_drivers = shared_library(
diff --git a/src/mesa/drivers/dri/pvr/dri_support.h b/src/mesa/drivers/dri/pvr/dri_support.h
'gallium-extra-hud',
type : 'boolean',
diff --git a/src/gallium/drivers/pvr/meson.build b/src/gallium/drivers/pvr/meson.build
new file mode 100644
index 00000000000..631410438fd
index 00000000000..4f3e2005ee4
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/dri_support.h
@@ -0,0 +1,581 @@
+++ b/src/gallium/drivers/pvr/meson.build
@@ -0,0 +1,23 @@
+# Copyright (c) Imagination Technologies Ltd.
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+driver_pvr = declare_dependency(
+ compile_args : '-DGALLIUM_PVR'
+)
diff --git a/src/gallium/drivers/pvr_alias/meson.build b/src/gallium/drivers/pvr_alias/meson.build
new file mode 100644
index 00000000000..128efd7b5fb
--- /dev/null
+++ b/src/gallium/drivers/pvr_alias/meson.build
@@ -0,0 +1,23 @@
+# Copyright (c) Imagination Technologies Ltd.
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+driver_pvr_alias = declare_dependency(
+ compile_args: '-DGALLIUM_PVR_ALIAS=@0@'.format(gallium_pvr_alias)
+)
diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c
index 63ac9d5c0ee..cfc14dabf28 100644
--- a/src/gallium/frontends/dri/dri2.c
+++ b/src/gallium/frontends/dri/dri2.c
@@ -2594,8 +2594,12 @@ dri2_create_buffer(__DRIscreen * sPriv,
const struct __DriverAPIRec galliumdrm_driver_api = {
.InitScreen = dri2_init_screen,
.DestroyScreen = dri_destroy_screen,
+ .CreateContext = dri_create_context,
+ .DestroyContext = dri_destroy_context,
.CreateBuffer = dri2_create_buffer,
.DestroyBuffer = dri_destroy_buffer,
+ .MakeCurrent = dri_make_current,
+ .UnbindContext = dri_unbind_context,
.AllocateBuffer = dri2_allocate_buffer,
.ReleaseBuffer = dri2_release_buffer,
@@ -2616,8 +2620,12 @@ static const struct __DRIDriverVtableExtensionRec galliumdrm_vtable = {
const struct __DriverAPIRec dri_kms_driver_api = {
.InitScreen = dri_kms_init_screen,
.DestroyScreen = dri_destroy_screen,
+ .CreateContext = dri_create_context,
+ .DestroyContext = dri_destroy_context,
.CreateBuffer = dri2_create_buffer,
.DestroyBuffer = dri_destroy_buffer,
+ .MakeCurrent = dri_make_current,
+ .UnbindContext = dri_unbind_context,
.AllocateBuffer = dri2_allocate_buffer,
.ReleaseBuffer = dri2_release_buffer,
diff --git a/src/gallium/frontends/dri/dri_screen.h b/src/gallium/frontends/dri/dri_screen.h
index 0ee2feb5616..69e59d700df 100644
--- a/src/gallium/frontends/dri/dri_screen.h
+++ b/src/gallium/frontends/dri/dri_screen.h
@@ -178,6 +178,8 @@ extern const struct __DriverAPIRec galliumvk_driver_api;
extern const __DRIextension *galliumvk_driver_extensions[];
extern const __DRIconfigOptionsExtension gallium_config_options;
+extern const struct __DriverAPIRec pvr_driver_api;
+extern const __DRIextension *pvr_driver_extensions[];
#endif
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/frontends/dri/dri_util.c b/src/gallium/frontends/dri/dri_util.c
index 8d60526f45b..b562572a15f 100644
--- a/src/gallium/frontends/dri/dri_util.c
+++ b/src/gallium/frontends/dri/dri_util.c
@@ -41,7 +41,6 @@
#include <stdbool.h>
#include "dri_util.h"
-#include "dri_context.h"
#include "dri_screen.h"
#include "utils.h"
#include "util/u_endian.h"
@@ -191,6 +190,18 @@ swkmsCreateNewScreen(int scrn, int fd,
driver_configs, data);
}
+#if defined(GALLIUM_PVR)
+static __DRIscreen *
+pvrCreateNewScreen(int scrn, int fd,
+ const __DRIextension **extensions,
+ const __DRIconfig ***driver_configs, void *data)
+{
+ return driCreateNewScreen2(scrn, fd, extensions,
+ pvr_driver_extensions,
+ driver_configs, data);
+}
+#endif
+
/** swrast driver createNewScreen entrypoint. */
static __DRIscreen *
driSWRastCreateNewScreen(int scrn, const __DRIextension **extensions,
@@ -476,8 +487,8 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
context->driDrawablePriv = NULL;
context->driReadablePriv = NULL;
- if (!dri_create_context(mesa_api, modes, context, &ctx_config, error,
- shareCtx)) {
+ if (!screen->driver->CreateContext(mesa_api, modes, context,
+ &ctx_config, error, shareCtx)) {
free(context);
return NULL;
}
@@ -516,7 +527,7 @@ static void
driDestroyContext(__DRIcontext *pcp)
{
if (pcp) {
- dri_destroy_context(pcp);
+ pcp->driScreenPriv->driver->DestroyContext(pcp);
free(pcp);
}
}
@@ -569,7 +580,7 @@ static int driBindContext(__DRIcontext *pcp,
dri_get_drawable(prp);
}
- return dri_make_current(pcp, pdp, prp);
+ return pcp->driScreenPriv->driver->MakeCurrent(pcp, pdp, prp);
}
/**
@@ -602,10 +613,10 @@ static int driUnbindContext(__DRIcontext *pcp)
return GL_FALSE;
/*
- ** Call dri_unbind_context before checking for valid drawables
+ ** Call driUnbindContext before checking for valid drawables
** to handle surfaceless contexts properly.
*/
- dri_unbind_context(pcp);
+ pcp->driScreenPriv->driver->UnbindContext(pcp);
pdp = pcp->driDrawablePriv;
prp = pcp->driReadablePriv;
@@ -837,6 +848,22 @@ const __DRIdri2Extension swkmsDRI2Extension = {
.createNewScreen2 = driCreateNewScreen2,
};
+#if defined(GALLIUM_PVR)
+const __DRIdri2Extension pvrDRI2Extension = {
+ .base = { __DRI_DRI2, 4 },
+
+ .createNewScreen = pvrCreateNewScreen,
+ .createNewDrawable = driCreateNewDrawable,
+ .createNewContext = driCreateNewContext,
+ .getAPIMask = driGetAPIMask,
+ .createNewContextForAPI = driCreateNewContextForAPI,
+ .allocateBuffer = dri2AllocateBuffer,
+ .releaseBuffer = dri2ReleaseBuffer,
+ .createContextAttribs = driCreateContextAttribs,
+ .createNewScreen2 = driCreateNewScreen2,
+};
+#endif
+
const __DRIswrastExtension driSWRastExtension = {
.base = { __DRI_SWRAST, 4 },
diff --git a/src/gallium/frontends/dri/dri_util.h b/src/gallium/frontends/dri/dri_util.h
index 6b9a71d6f16..9d11a2b1c6b 100644
--- a/src/gallium/frontends/dri/dri_util.h
+++ b/src/gallium/frontends/dri/dri_util.h
@@ -75,6 +75,10 @@ extern const __DRI2configQueryExtension dri2ConfigQueryExtension;
extern const __DRIcopySubBufferExtension driCopySubBufferExtension;
extern const __DRI2flushControlExtension dri2FlushControlExtension;
+#if defined(GALLIUM_PVR)
+extern const __DRIdri2Extension pvrDRI2Extension;
+#endif
+
/**
* Description of the attributes used to create a config.
*
@@ -118,12 +122,25 @@ struct __DriverContextConfig {
*
* Each DRI driver must have one of these structures with all the pointers set
* to appropriate functions within the driver.
+ *
+ * When glXCreateContext() is called, for example, it'll call a helper function
+ * dri_util.c which in turn will jump through the \a CreateContext pointer in
+ * this structure.
*/
struct __DriverAPIRec {
const __DRIconfig **(*InitScreen) (__DRIscreen * priv);
void (*DestroyScreen)(__DRIscreen *driScrnPriv);
+ GLboolean (*CreateContext)(gl_api api,
+ const struct gl_config *glVis,
+ __DRIcontext *driContextPriv,
+ const struct __DriverContextConfig *ctx_config,
+ unsigned *error,
+ void *sharedContextPrivate);
+
+ void (*DestroyContext)(__DRIcontext *driContextPriv);
+
GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
const struct gl_config *glVis,
@@ -133,6 +150,12 @@ struct __DriverAPIRec {
void (*SwapBuffers)(__DRIdrawable *driDrawPriv);
+ GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv,
+ __DRIdrawable *driDrawPriv,
+ __DRIdrawable *driReadPriv);
+
+ GLboolean (*UnbindContext)(__DRIcontext *driContextPriv);
+
__DRIbuffer *(*AllocateBuffer) (__DRIscreen *screenPrivate,
unsigned int attachment,
unsigned int format,
diff --git a/src/gallium/frontends/dri/drisw.c b/src/gallium/frontends/dri/drisw.c
index fa6769d3b57..0e84bc7ba72 100644
--- a/src/gallium/frontends/dri/drisw.c
+++ b/src/gallium/frontends/dri/drisw.c
@@ -603,9 +603,13 @@ drisw_create_buffer(__DRIscreen * sPriv,
const struct __DriverAPIRec galliumsw_driver_api = {
.InitScreen = drisw_init_screen,
.DestroyScreen = dri_destroy_screen,
+ .CreateContext = dri_create_context,
+ .DestroyContext = dri_destroy_context,
.CreateBuffer = drisw_create_buffer,
.DestroyBuffer = dri_destroy_buffer,
.SwapBuffers = drisw_swap_buffers,
+ .MakeCurrent = dri_make_current,
+ .UnbindContext = dri_unbind_context,
.CopySubBuffer = drisw_copy_sub_buffer,
};
diff --git a/src/gallium/frontends/dri/meson.build b/src/gallium/frontends/dri/meson.build
index cb4f434c775..77a04406b34 100644
--- a/src/gallium/frontends/dri/meson.build
+++ b/src/gallium/frontends/dri/meson.build
@@ -59,6 +59,10 @@ if with_gallium_softpipe
libdri_c_args += '-DGALLIUM_SOFTPIPE'
endif
+if with_gallium_pvr
+ libdri_c_args += '-DGALLIUM_PVR'
+endif
+
libdri = static_library(
'dri',
files_libdri,
diff --git a/src/gallium/frontends/pvr/dri_support.h b/src/gallium/frontends/pvr/dri_support.h
new file mode 100644
index 00000000000..0e6f50727f2
--- /dev/null
+++ b/src/gallium/frontends/pvr/dri_support.h
@@ -0,0 +1,587 @@
+/* -*- mode: c; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* vi: set ts=8 sw=8 sts=8: */
+/*************************************************************************/ /*!
@@ -708,14 +999,20 @@ index 00000000000..631410438fd
+ void (*DrawableRemoveReference)
+ (void *pvReferenceHandle);
+ } v3;
+ /* The v4 interface is an extension of v3, so v3 is required as well */
+ struct {
+ void (*DestroyLoaderImageState)
+ (const struct __DRIscreenRec *psDRIScreen,
+ void *pvLoaderPrivate);
+ } v4;
+};
+
+#endif /* defined(__PVRDRIIFCE_H__) */
diff --git a/src/mesa/drivers/dri/pvr/img_drm_fourcc.h b/src/mesa/drivers/dri/pvr/img_drm_fourcc.h
diff --git a/src/gallium/frontends/pvr/img_drm_fourcc.h b/src/gallium/frontends/pvr/img_drm_fourcc.h
new file mode 100644
index 00000000000..8d570ff8f53
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/img_drm_fourcc.h
+++ b/src/gallium/frontends/pvr/img_drm_fourcc.h
@@ -0,0 +1,113 @@
+/*************************************************************************/ /*!
+@File
@@ -830,11 +1127,11 @@ index 00000000000..8d570ff8f53
+#define DRM_FORMAT_MOD_PVR_FBCDC_16x4_V7 fourcc_mod_code(PVR, 12)
+
+#endif /* IMG_DRM_FOURCC_H */
diff --git a/src/mesa/drivers/dri/pvr/imgpixfmts.h b/src/mesa/drivers/dri/pvr/imgpixfmts.h
diff --git a/src/gallium/frontends/pvr/imgpixfmts.h b/src/gallium/frontends/pvr/imgpixfmts.h
new file mode 100644
index 00000000000..da12a0fb5f6
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/imgpixfmts.h
+++ b/src/gallium/frontends/pvr/imgpixfmts.h
@@ -0,0 +1,307 @@
+/*************************************************************************/ /*!
+@File imgpixfmts.h
@@ -1143,11 +1440,11 @@ index 00000000000..da12a0fb5f6
+} IMG_PIXFMT;
+
+#endif /* IMGPIXFMTS_H */
diff --git a/src/mesa/drivers/dri/pvr/imgyuv.h b/src/mesa/drivers/dri/pvr/imgyuv.h
diff --git a/src/gallium/frontends/pvr/imgyuv.h b/src/gallium/frontends/pvr/imgyuv.h
new file mode 100644
index 00000000000..7ae8fd19ac0
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/imgyuv.h
+++ b/src/gallium/frontends/pvr/imgyuv.h
@@ -0,0 +1,58 @@
+/*************************************************************************/ /*!
+@File
@@ -1207,11 +1504,11 @@ index 00000000000..7ae8fd19ac0
+
+
+#endif /* IMGYUV_H */
diff --git a/src/mesa/drivers/dri/pvr/mesa_context.c b/src/mesa/drivers/dri/pvr/mesa_context.c
diff --git a/src/gallium/frontends/pvr/mesa_context.c b/src/gallium/frontends/pvr/mesa_context.c
new file mode 100644
index 00000000000..d36bae5ac54
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/mesa_context.c
+++ b/src/gallium/frontends/pvr/mesa_context.c
@@ -0,0 +1,208 @@
+/**
+ * \file context.c
@@ -1421,12 +1718,12 @@ index 00000000000..d36bae5ac54
+
+ _glapi_set_dispatch(psTable);
+}
diff --git a/src/mesa/drivers/dri/pvr/meson.build b/src/mesa/drivers/dri/pvr/meson.build
diff --git a/src/gallium/frontends/pvr/meson.build b/src/gallium/frontends/pvr/meson.build
new file mode 100644
index 00000000000..59cccf8add4
index 00000000000..e13b8be687b
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/meson.build
@@ -0,0 +1,48 @@
+++ b/src/gallium/frontends/pvr/meson.build
@@ -0,0 +1,46 @@
+# Copyright (c) Imagination Technologies Ltd.
+#
+# The contents of this file are subject to the MIT license as set out below.
@@ -1449,7 +1746,7 @@ index 00000000000..59cccf8add4
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+files_pvr = files(
+files_libpvr = files(
+ 'mesa_context.c',
+ 'pvrcb.c',
+ 'pvrcompat.c',
@@ -1458,29 +1755,27 @@ index 00000000000..59cccf8add4
+ 'pvrutil.c',
+)
+
+dep_libpvr = [
+ dep_libdrm,
+]
+libpvr_c_args = ['-DGALLIUM_PVR']
+
+if with_platform_tizen
+ dep_libpvr += dep_dlog
+endif
+libpvr_dep = [dep_libdrm]
+
+libpvr = static_library(
+ 'pvr',
+ [files_pvr, main_dispatch_h],
+ include_directories : [inc_include, inc_src, inc_mapi, inc_mesa,
+ inc_dri_common, inc_util, inc_pvr],
+ c_args : [no_override_init_args],
+ [files_libpvr, main_dispatch_h],
+ include_directories : [
+ inc_include, inc_util, inc_mesa, inc_mapi, inc_src, inc_gallium,
+ inc_gallium_aux, inc_pvr,
+ ],
+ c_args : [libpvr_c_args],
+ gnu_symbol_visibility : 'hidden',
+ dependencies : [dep_libpvr],
+ dependencies : [libpvr_dep],
+)
diff --git a/src/mesa/drivers/dri/pvr/pvrcb.c b/src/mesa/drivers/dri/pvr/pvrcb.c
diff --git a/src/gallium/frontends/pvr/pvrcb.c b/src/gallium/frontends/pvr/pvrcb.c
new file mode 100644
index 00000000000..ea8911c64d5
index 00000000000..b6ee53c5954
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/pvrcb.c
@@ -0,0 +1,328 @@
+++ b/src/gallium/frontends/pvr/pvrcb.c
@@ -0,0 +1,344 @@
+/*
+ * Copyright (c) Imagination Technologies Ltd.
+ *
@@ -1809,11 +2104,27 @@ index 00000000000..ea8911c64d5
+
+ PVRDRIDrawableRemoveReference(psPVRDrawable);
+}
diff --git a/src/mesa/drivers/dri/pvr/pvrcompat.c b/src/mesa/drivers/dri/pvr/pvrcompat.c
+
+void
+MODSUPDestroyLoaderImageState(const struct __DRIscreenRec *psDRIScreen,
+ void *pvLoaderPrivate)
+{
+ const __DRIimageLoaderExtension *psImageLoader = psDRIScreen->image.loader;
+ const __DRIdri2LoaderExtension *psDRI2Loader = psDRIScreen->dri2.loader;
+
+ if (psImageLoader && psImageLoader->base.version >= 4 &&
+ psImageLoader->destroyLoaderImageState) {
+ psImageLoader->destroyLoaderImageState(pvLoaderPrivate);
+ } else if (psDRI2Loader && psDRI2Loader->base.version >= 5 &&
+ psDRI2Loader->destroyLoaderImageState) {
+ psDRI2Loader->destroyLoaderImageState(pvLoaderPrivate);
+ }
+}
diff --git a/src/gallium/frontends/pvr/pvrcompat.c b/src/gallium/frontends/pvr/pvrcompat.c
new file mode 100644
index 00000000000..23a57dde682
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/pvrcompat.c
+++ b/src/gallium/frontends/pvr/pvrcompat.c
@@ -0,0 +1,838 @@
+/*
+ * Copyright (c) Imagination Technologies Ltd.
@@ -2653,12 +2964,12 @@ index 00000000000..23a57dde682
+
+ return true;
+}
diff --git a/src/mesa/drivers/dri/pvr/pvrdri.c b/src/mesa/drivers/dri/pvr/pvrdri.c
diff --git a/src/gallium/frontends/pvr/pvrdri.c b/src/gallium/frontends/pvr/pvrdri.c
new file mode 100644
index 00000000000..ab941f71567
index 00000000000..945aafaeaf0
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/pvrdri.c
@@ -0,0 +1,613 @@
+++ b/src/gallium/frontends/pvr/pvrdri.c
@@ -0,0 +1,607 @@
+/*
+ * Copyright (c) Imagination Technologies Ltd.
+ *
@@ -2689,6 +3000,8 @@ index 00000000000..ab941f71567
+#include "util/u_atomic.h"
+#include "utils.h"
+
+#include "dri_screen.h"
+
+#include "pvrdri.h"
+#include "pvrmesa.h"
+
@@ -2853,12 +3166,14 @@ index 00000000000..ab941f71567
+ .v3.DrawableGetReferenceHandle = MODSUPDrawableGetReferenceHandle,
+ .v3.DrawableAddReference = MODSUPDrawableAddReference,
+ .v3.DrawableRemoveReference = MODSUPDrawableRemoveReference,
+ /* Version 4 callbacks */
+ .v4.DestroyLoaderImageState = MODSUPDestroyLoaderImageState,
+ };
+
+ if (!PVRLoaderIsSupported(psDRIScreen))
+ return NULL;
+
+ if (!PVRDRICompatInit(&sDRICallbacksV2, 3, 0))
+ if (!PVRDRICompatInit(&sDRICallbacksV2, 4, 0))
+ return NULL;
+
+ psPVRScreen = calloc(1, sizeof(*psPVRScreen));
@@ -3236,7 +3551,7 @@ index 00000000000..ab941f71567
+ free(psPVRBuffer);
+}
+
+static const struct __DriverAPIRec pvr_driver_api = {
+const struct __DriverAPIRec pvr_driver_api = {
+ .InitScreen = PVRDRIInitScreen,
+ .DestroyScreen = PVRDRIDestroyScreen,
+ .CreateContext = PVRDRICreateContext,
@@ -3255,29 +3570,19 @@ index 00000000000..ab941f71567
+ .vtable = &pvr_driver_api,
+};
+
+static const __DRIextension *pvr_driver_extensions[] = {
+const __DRIextension *pvr_driver_extensions[] = {
+ &driCoreExtension.base,
+ &driImageDriverExtension.base,
+ &driDRI2Extension.base,
+ &pvrDRI2Extension.base,
+ &pvr_vtable.base,
+ NULL
+};
+
+const __DRIextension **__driDriverGetExtensions_pvr(void);
+
+PUBLIC const __DRIextension **
+__driDriverGetExtensions_pvr(void)
+{
+ globalDriverAPI = &pvr_driver_api;
+
+ return pvr_driver_extensions;
+}
diff --git a/src/mesa/drivers/dri/pvr/pvrdri.h b/src/mesa/drivers/dri/pvr/pvrdri.h
diff --git a/src/gallium/frontends/pvr/pvrdri.h b/src/gallium/frontends/pvr/pvrdri.h
new file mode 100644
index 00000000000..fd465bf7f5c
index 00000000000..58591d83fdf
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/pvrdri.h
@@ -0,0 +1,188 @@
+++ b/src/gallium/frontends/pvr/pvrdri.h
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) Imagination Technologies Ltd.
+ *
@@ -3465,12 +3770,14 @@ index 00000000000..fd465bf7f5c
+
+void MODSUPDrawableRemoveReference(void *pvReferenceHandle);
+
+void MODSUPDestroyLoaderImageState(const struct __DRIscreenRec *psDRIScreen,
+ void *pvLoaderPrivate);
+#endif /* defined(__PVRDRI_H__) */
diff --git a/src/mesa/drivers/dri/pvr/pvrdri_support.h b/src/mesa/drivers/dri/pvr/pvrdri_support.h
diff --git a/src/gallium/frontends/pvr/pvrdri_support.h b/src/gallium/frontends/pvr/pvrdri_support.h
new file mode 100644
index 00000000000..58ea3505a4d
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/pvrdri_support.h
+++ b/src/gallium/frontends/pvr/pvrdri_support.h
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) Imagination Technologies Ltd.
@@ -3678,11 +3985,11 @@ index 00000000000..58ea3505a4d
+bool DRISUPHaveGetFenceFromCLEvent(void);
+
+#endif /* defined(__PVRDRI_SUPPORT_H__) */
diff --git a/src/mesa/drivers/dri/pvr/pvrext.c b/src/mesa/drivers/dri/pvr/pvrext.c
diff --git a/src/gallium/frontends/pvr/pvrext.c b/src/gallium/frontends/pvr/pvrext.c
new file mode 100644
index 00000000000..478399618df
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/pvrext.c
+++ b/src/gallium/frontends/pvr/pvrext.c
@@ -0,0 +1,704 @@
+/*
+ * Copyright (c) Imagination Technologies Ltd.
@@ -4388,11 +4695,11 @@ index 00000000000..478399618df
+ break;
+ }
+}
diff --git a/src/mesa/drivers/dri/pvr/pvrmesa.h b/src/mesa/drivers/dri/pvr/pvrmesa.h
diff --git a/src/gallium/frontends/pvr/pvrmesa.h b/src/gallium/frontends/pvr/pvrmesa.h
new file mode 100644
index 00000000000..5e1c9c1b2e6
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/pvrmesa.h
+++ b/src/gallium/frontends/pvr/pvrmesa.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) Imagination Technologies Ltd.
@@ -4430,12 +4737,12 @@ index 00000000000..5e1c9c1b2e6
+void pvrdri_set_dispatch_table(PVRDRIContext *psPVRContext);
+
+#endif /* !defined(__PVRMESA_H__) */
diff --git a/src/mesa/drivers/dri/pvr/pvrutil.c b/src/mesa/drivers/dri/pvr/pvrutil.c
diff --git a/src/gallium/frontends/pvr/pvrutil.c b/src/gallium/frontends/pvr/pvrutil.c
new file mode 100644
index 00000000000..945e18cf220
index 00000000000..4bb114f64ef
--- /dev/null
+++ b/src/mesa/drivers/dri/pvr/pvrutil.c
@@ -0,0 +1,239 @@
+++ b/src/gallium/frontends/pvr/pvrutil.c
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) Imagination Technologies Ltd.
+ *
@@ -4483,10 +4790,6 @@ index 00000000000..945e18cf220
+#include <android/log.h>
+#define err_printf(f, args...) ((void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, f, ##args))
+#define dbg_printf(f, args...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, f, ##args))
+#elif defined(HAVE_TIZEN_PLATFORM)
+#include <dlog.h>
+#define err_printf(f, args...) LOGE(f, ##args)
+#define dbg_printf(f, args...) LOGD(f, ##args)
+#else
+#define err_printf(f, args...) fprintf(stderr, f "\n", ##args)
+#define dbg_printf(f, args...) fprintf(stderr, "LibGL: " f "\n", ##args)
@@ -4513,10 +4816,10 @@ index 00000000000..945e18cf220
+ va_list args;
+
+ /*
+ * On Android and Tizen, always print messages; otherwise, only print if
+ * On Android, always print messages; otherwise, only print if
+ * the environment variable LIBGL_DEBUG=verbose.
+ */
+#if !defined(HAVE_ANDROID_PLATFORM) && !defined(HAVE_TIZEN_PLATFORM)
+#if !defined(HAVE_ANDROID_PLATFORM)
+ char *ev = getenv("LIBGL_DEBUG");
+
+ if (!ev || strcmp(ev, "verbose") != 0)
@@ -4675,18 +4978,118 @@ index 00000000000..945e18cf220
+
+ return 0;
+}
diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index a678dc02705..26575cc38ca 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -150,6 +150,16 @@ if with_gallium_svga
else
driver_svga = declare_dependency()
endif
+if with_gallium_pvr
+ subdir('drivers/pvr')
+else
+ driver_pvr = declare_dependency()
+endif
+if with_gallium_pvr_alias
+ subdir('drivers/pvr_alias')
+else
+ driver_pvr_alias = declare_dependency()
+endif
if with_gallium_virgl
subdir('winsys/virgl/common')
subdir('winsys/virgl/drm')
@@ -182,6 +192,11 @@ if with_gallium_opencl
subdir('frontends/clover')
subdir('targets/opencl')
endif
+if with_gallium_pvr
+ subdir('frontends/pvr')
+else
+ libpvr = []
+endif
if with_dri
subdir('frontends/dri')
subdir('targets/dri')
diff --git a/src/gallium/targets/dri/meson.build b/src/gallium/targets/dri/meson.build
index 8554b15c63a..7640ec1216d 100644
--- a/src/gallium/targets/dri/meson.build
+++ b/src/gallium/targets/dri/meson.build
@@ -50,7 +50,7 @@ libgallium_dri = shared_library(
link_with : [
libdri, libmesa, libgalliumvl,
libgallium, libglapi, libpipe_loader_static, libws_null, libwsw, libswdri,
- libswkmsdri,
+ libswkmsdri, libpvr,
],
dependencies : [
dep_selinux, dep_libdrm, dep_llvm, dep_thread, idep_xmlconfig, idep_mesautil,
@@ -58,7 +58,7 @@ libgallium_dri = shared_library(
driver_kmsro, driver_v3d, driver_vc4, driver_freedreno, driver_etnaviv,
driver_tegra, driver_i915, driver_svga, driver_virgl,
driver_panfrost, driver_iris, driver_lima, driver_zink, driver_d3d12,
- driver_asahi, driver_crocus
+ driver_asahi, driver_crocus, driver_pvr, driver_pvr_alias
],
# Will be deleted during installation, see install_megadrivers.py
install : true,
@@ -114,7 +114,9 @@ foreach d : [[with_gallium_kmsro, [
[with_gallium_lima, 'lima_dri.so'],
[with_gallium_zink, 'zink_dri.so'],
[with_gallium_d3d12, 'd3d12_dri.so'],
- [with_gallium_asahi, 'asahi_dri.so']]
+ [with_gallium_asahi, 'asahi_dri.so'],
+ [with_gallium_pvr, 'pvr_dri.so'],
+ [with_gallium_pvr_alias, gallium_pvr_alias + '_dri.so']]
if d[0]
gallium_dri_drivers += d[1]
endif
diff --git a/src/gallium/targets/dri/target.c b/src/gallium/targets/dri/target.c
index 9b78351fa8f..1e660ecb080 100644
--- a/src/gallium/targets/dri/target.c
+++ b/src/gallium/targets/dri/target.c
@@ -10,6 +10,16 @@ PUBLIC const __DRIextension **__driDriverGetExtensions_##drivername(void) \
return galliumdrm_driver_extensions; \
}
+#define DEFINE_LOADER_PVR_ENTRYPOINT(drivername) \
+const __DRIextension **__driDriverGetExtensions_##drivername(void); \
+PUBLIC const __DRIextension **__driDriverGetExtensions_##drivername(void) \
+{ \
+ return pvr_driver_extensions; \
+}
+
+#define DEFINE_LOADER_PVR_ALIAS_ENTRYPOINT(drivername) \
+ DEFINE_LOADER_PVR_ENTRYPOINT(drivername)
+
#if defined(GALLIUM_SOFTPIPE)
const __DRIextension **__driDriverGetExtensions_swrast(void);
@@ -136,3 +146,11 @@ PUBLIC const __DRIextension **__driDriverGetExtensions_zink(void)
#if defined(GALLIUM_D3D12)
DEFINE_LOADER_DRM_ENTRYPOINT(d3d12);
#endif
+
+#if defined(GALLIUM_PVR)
+DEFINE_LOADER_PVR_ENTRYPOINT(pvr);
+#endif
+
+#if defined(GALLIUM_PVR_ALIAS)
+DEFINE_LOADER_PVR_ALIAS_ENTRYPOINT(GALLIUM_PVR_ALIAS);
+#endif
diff --git a/src/meson.build b/src/meson.build
index acc7fe94abb..c3bab27718d 100644
index 1d42e08df30..91aca307c87 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -25,6 +25,7 @@ inc_gallium = include_directories('gallium/include')
@@ -24,6 +24,8 @@ inc_src = include_directories('.')
inc_gallium = include_directories('gallium/include')
inc_gallium_aux = include_directories('gallium/auxiliary')
inc_amd_common = include_directories('amd/common')
inc_amd_common_llvm = include_directories('amd/llvm')
+inc_pvr = include_directories('mesa/main', 'mapi/glapi')
+inc_pvr = include_directories('mesa/main', 'mapi/glapi',
+ 'gallium/frontends/dri')
inc_tool = include_directories('tool')
inc_virtio_gpu = include_directories('virtio/virtio-gpu')
pps_datasources = []
pps_includes = []
--
2.25.1
@@ -1,7 +1,7 @@
From fec4f46f7cedb6b3e90bf88c3efc3cd5da0d9131 Mon Sep 17 00:00:00 2001
From e7a7ee27d09c79038f5a3772f6d5148d56a15af2 Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Thu, 5 Jun 2014 12:07:01 +0100
Subject: [PATCH 03/67] dri: Add some new DRI formats and fourccs
Subject: [PATCH 02/58] dri: Add some new DRI formats and fourccs
Add ARGB4444 DRI format and fourcc.
Add YVU444_PACK10_IMG DRI format and fourcc.
@@ -10,14 +10,14 @@ Add BGR888 DRI format and fourcc.
include/GL/internal/dri_interface.h | 4 ++++
include/drm-uapi/drm_fourcc.h | 1 +
src/egl/drivers/dri2/egl_dri2.c | 1 +
src/mesa/drivers/dri/common/dri_util.c | 5 +++++
src/gallium/frontends/dri/dri_util.c | 5 +++++
4 files changed, 11 insertions(+)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 66dc0927cb7..510289403d2 100644
index 6099b2a296f..7f8872f48dd 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1367,6 +1367,9 @@ struct __DRIdri2ExtensionRec {
@@ -1211,6 +1211,9 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_FORMAT_ABGR16161616F 0x1015
#define __DRI_IMAGE_FORMAT_SXRGB8 0x1016
#define __DRI_IMAGE_FORMAT_ABGR16161616 0x1017
@@ -27,7 +27,7 @@ index 66dc0927cb7..510289403d2 100644
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
@@ -1397,6 +1400,7 @@ struct __DRIdri2ExtensionRec {
@@ -1242,6 +1245,7 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_FOURCC_SABGR8888 0x84324258
#define __DRI_IMAGE_FOURCC_SXRGB8888 0x85324258
#define __DRI_IMAGE_FOURCC_RGBA16161616 0x38344152 /* fourcc_code('R', 'A', '4', '8' ) */
@@ -36,10 +36,10 @@ index 66dc0927cb7..510289403d2 100644
/**
* Queryable on images created by createImageFromNames.
diff --git a/include/drm-uapi/drm_fourcc.h b/include/drm-uapi/drm_fourcc.h
index cd3ce8a8c60..57657592a38 100644
index e5074162bcd..da592ba023f 100644
--- a/include/drm-uapi/drm_fourcc.h
+++ b/include/drm-uapi/drm_fourcc.h
@@ -344,6 +344,7 @@ extern "C" {
@@ -357,6 +357,7 @@ extern "C" {
#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
@@ -48,10 +48,10 @@ index cd3ce8a8c60..57657592a38 100644
/*
* Format Modifiers:
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 9e5a55a287c..eee28eb4726 100644
index 3682d05be95..a583b913335 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2652,6 +2652,7 @@ dri2_num_fourcc_format_planes(EGLint format)
@@ -2678,6 +2678,7 @@ dri2_num_fourcc_format_planes(EGLint format)
case DRM_FORMAT_Y410:
case DRM_FORMAT_Y412:
case DRM_FORMAT_Y416:
@@ -59,11 +59,11 @@ index 9e5a55a287c..eee28eb4726 100644
return 1;
case DRM_FORMAT_NV12:
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index e2a11240dea..caed5fa6a68 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -904,6 +904,11 @@ static const struct {
diff --git a/src/gallium/frontends/dri/dri_util.c b/src/gallium/frontends/dri/dri_util.c
index b562572a15f..abc84a22ac6 100644
--- a/src/gallium/frontends/dri/dri_util.c
+++ b/src/gallium/frontends/dri/dri_util.c
@@ -912,6 +912,11 @@ static const struct {
.mesa_format = MESA_FORMAT_B5G5R5A1_UNORM,
.internal_format = GL_RGB5_A1,
},
@@ -1,21 +1,21 @@
From e66cd64b65e86a23807260a9a0c73f1355715314 Mon Sep 17 00:00:00 2001
From e82e274b5dc8393e405bce1fc36926f24fc6ee13 Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Wed, 12 Aug 2015 09:11:51 +0100
Subject: [PATCH 04/67] GL_EXT_sparse_texture entry points
Subject: [PATCH 03/58] GL_EXT_sparse_texture entry points
---
src/mapi/glapi/gen/EXT_sparse_texture.xml | 56 +++++++++++++++++++++++
src/mapi/glapi/gen/EXT_sparse_texture.xml | 44 +++++++++++++++++++++++
src/mapi/glapi/gen/es_EXT.xml | 3 ++
src/mapi/glapi/gen/static_data.py | 2 +
3 files changed, 61 insertions(+)
src/mapi/glapi/gen/static_data.py | 1 +
3 files changed, 48 insertions(+)
create mode 100644 src/mapi/glapi/gen/EXT_sparse_texture.xml
diff --git a/src/mapi/glapi/gen/EXT_sparse_texture.xml b/src/mapi/glapi/gen/EXT_sparse_texture.xml
new file mode 100644
index 00000000000..48d03e7b9c0
index 00000000000..ebeab7d1f9a
--- /dev/null
+++ b/src/mapi/glapi/gen/EXT_sparse_texture.xml
@@ -0,0 +1,56 @@
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
@@ -57,26 +57,14 @@ index 00000000000..48d03e7b9c0
+ <param name="commit" type="GLboolean"/>
+ </function>
+
+ <function name="TexturePageCommitmentEXT" es2="3.1" exec="dynamic">
+ <param name="texture" type="GLuint"/>
+ <param name="level" type="GLint"/>
+ <param name="xoffset" type="GLint"/>
+ <param name="yoffset" type="GLint"/>
+ <param name="zoffset" type="GLint"/>
+ <param name="width" type="GLsizei"/>
+ <param name="height" type="GLsizei"/>
+ <param name="depth" type="GLsizei"/>
+ <param name="commit" type="GLboolean"/>
+ </function>
+
+</category>
+
+</OpenGLAPI>
diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index 929b40bbd4a..962170bc58e 100644
index e96f5b83f71..79761210760 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -1433,6 +1433,9 @@
@@ -1459,6 +1459,9 @@
</category>
@@ -87,15 +75,14 @@ index 929b40bbd4a..962170bc58e 100644
<function name="ViewportArrayvOES" es2="3.1" alias="ViewportArrayv">
<param name="first" type="GLuint"/>
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index 6accff1b231..d063930bd81 100644
index c634304d925..82acbf627ef 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1689,6 +1689,8 @@ offsets = {
"VertexAttribs2hvNV": 1653,
"VertexAttribs3hvNV": 1654,
@@ -1691,6 +1691,7 @@ offsets = {
"VertexAttribs4hvNV": 1655,
+ "TexPageCommitmentEXT": 1656,
+ "TexturePageCommitmentEXT" : 1657,
"TexPageCommitmentARB": 1656,
"TexturePageCommitmentEXT": 1657,
+ "TexPageCommitmentEXT": 1658,
}
functions = [
@@ -1,7 +1,7 @@
From 4a1be491de2ea78be95dc4cf08af4b1da5e16d91 Mon Sep 17 00:00:00 2001
From a5e8c3a310f9dac3ccc7537544e5288d1daadf66 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Mon, 10 Mar 2014 12:27:03 +0000
Subject: [PATCH 05/67] Add support for various GLES extensions
Subject: [PATCH 04/58] Add support for various GLES extensions
Add support for:
EXT_occlusion_query_boolean
@@ -13,7 +13,7 @@ Add support for:
2 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index 962170bc58e..e586b0ec19b 100644
index 79761210760..03c78ef9ca5 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -285,28 +285,25 @@
@@ -85,19 +85,19 @@ index 962170bc58e..e586b0ec19b 100644
<category name="GL_OES_EGL_image_external" number="87">
<enum name="TEXTURE_EXTERNAL_OES" value="0x8D65"/>
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index d063930bd81..79b8f19cb75 100644
index 82acbf627ef..21af0789fee 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1691,6 +1691,12 @@ offsets = {
"VertexAttribs4hvNV": 1655,
"TexPageCommitmentEXT": 1656,
"TexturePageCommitmentEXT" : 1657,
+ "CurrentPaletteMatrixOES" : 1658,
+ "LoadPaletteFromModelViewMatrixOES" : 1659,
+ "MatrixIndexPointerOES" : 1660,
+ "WeightPointerOES" : 1661,
+ "RenderbufferStorageMultisampleIMG" : 1662,
+ "FramebufferTexture2DMultisampleIMG" : 1663,
@@ -1692,6 +1692,12 @@ offsets = {
"TexPageCommitmentARB": 1656,
"TexturePageCommitmentEXT": 1657,
"TexPageCommitmentEXT": 1658,
+ "CurrentPaletteMatrixOES" : 1659,
+ "LoadPaletteFromModelViewMatrixOES" : 1660,
+ "MatrixIndexPointerOES" : 1661,
+ "WeightPointerOES" : 1662,
+ "RenderbufferStorageMultisampleIMG" : 1663,
+ "FramebufferTexture2DMultisampleIMG" : 1664,
}
functions = [
@@ -1,7 +1,7 @@
From 7fdeb8bf25be01f122a7cb55dbe2b0e67e4a24a2 Mon Sep 17 00:00:00 2001
From bf3d2c972cd028d906abccd6777968bfd7c21451 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Tue, 11 Mar 2014 11:50:53 +0000
Subject: [PATCH 06/67] Add EGL_IMG_cl_image extension
Subject: [PATCH 05/58] Add EGL_IMG_cl_image extension
Add support for the experimental EGL_IMG_cl_image extension to EGL, and
the DRI2 EGL driver.
@@ -30,13 +30,13 @@ index f0395a8a58c..5d11f3e488e 100644
}
#endif
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 510289403d2..b197092939f 100644
index 7f8872f48dd..ef2f44fad02 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1831,6 +1831,19 @@ struct __DRIimageExtensionRec {
const unsigned int modifier_count,
unsigned int use,
void *loaderPrivate);
@@ -1704,6 +1704,19 @@ struct __DRIimageExtensionRec {
* \since 21
*/
void (*setInFenceFd)(__DRIimage *image, int fd);
+
+ /**
+ * Support for experimental EGL_CL_IMAGE_IMG.
@@ -54,10 +54,10 @@ index 510289403d2..b197092939f 100644
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index eee28eb4726..dea5899b3a8 100644
index a583b913335..d3a8fbe4ef7 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -995,6 +995,10 @@ dri2_setup_screen(_EGLDisplay *disp)
@@ -1007,6 +1007,10 @@ dri2_setup_screen(_EGLDisplay *disp)
disp->Extensions.EXT_image_dma_buf_import_modifiers = EGL_TRUE;
}
#endif
@@ -68,7 +68,7 @@ index eee28eb4726..dea5899b3a8 100644
}
if (dri2_dpy->flush_control)
@@ -2360,17 +2364,13 @@ dri2_get_sync_values_chromium(_EGLDisplay *disp, _EGLSurface *surf,
@@ -2386,17 +2390,13 @@ dri2_get_sync_values_chromium(_EGLDisplay *disp, _EGLSurface *surf,
return dri2_dpy->vtbl->get_sync_values(disp, surf, ust, msc, sbc);
}
@@ -88,7 +88,7 @@ index eee28eb4726..dea5899b3a8 100644
}
static _EGLImage *
@@ -2449,7 +2449,49 @@ dri2_create_image_khr_texture(_EGLDisplay *disp, _EGLContext *ctx,
@@ -2475,7 +2475,49 @@ dri2_create_image_khr_texture(_EGLDisplay *disp, _EGLContext *ctx,
attrs.GLTextureLevel,
&error,
NULL);
@@ -139,7 +139,7 @@ index eee28eb4726..dea5899b3a8 100644
if (!dri2_img->dri_image) {
free(dri2_img);
@@ -2916,7 +2958,7 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
@@ -2942,7 +2984,7 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
&error,
NULL);
}
@@ -148,7 +148,7 @@ index eee28eb4726..dea5899b3a8 100644
if (!dri_image)
return EGL_NO_IMAGE_KHR;
@@ -3152,6 +3194,8 @@ dri2_create_image_khr(_EGLDisplay *disp, _EGLContext *ctx, EGLenum target,
@@ -3178,6 +3220,8 @@ dri2_create_image_khr(_EGLDisplay *disp, _EGLContext *ctx, EGLenum target,
case EGL_WAYLAND_BUFFER_WL:
return dri2_create_image_wayland_wl_buffer(disp, ctx, buffer, attr_list);
#endif
@@ -158,10 +158,10 @@ index eee28eb4726..dea5899b3a8 100644
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr");
return EGL_NO_IMAGE_KHR;
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 17e36af22e1..6ffcff8b2cc 100644
index d0238fe95e4..ddad85d3beb 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -549,6 +549,7 @@ _eglCreateExtensionsString(_EGLDisplay *disp)
@@ -550,6 +550,7 @@ _eglCreateExtensionsString(_EGLDisplay *disp)
_EGL_CHECK_EXTENSION(WL_bind_wayland_display);
_EGL_CHECK_EXTENSION(WL_create_wayland_buffer_from_image);
@@ -170,10 +170,10 @@ index 17e36af22e1..6ffcff8b2cc 100644
}
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 4d2afbc712e..5b05dcc1e6d 100644
index 25b4ea79541..d95c7b9144a 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -150,6 +150,8 @@ struct _egl_extensions
@@ -152,6 +152,8 @@ struct _egl_extensions
EGLBoolean WL_bind_wayland_display;
EGLBoolean WL_create_wayland_buffer_from_image;
@@ -1,7 +1,7 @@
From f556292d5811750d119acea6c7dc0c5ebd3e1af6 Mon Sep 17 00:00:00 2001
From 403a583fd53ac1bcd40179e62bc0692d838cc23b Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Tue, 15 Sep 2015 14:15:31 +0100
Subject: [PATCH 08/67] egl: optimise eglMakeCurrent for the case where nothing
Subject: [PATCH 06/58] egl: optimise eglMakeCurrent for the case where nothing
has changed
When an application calls eglMakeCurrent with a context, draw surface and
@@ -12,10 +12,10 @@ thread don't perform a flush as this is an expensive operation.
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 3cd69b96a0f..234449adf64 100644
index ddad85d3beb..7e2542bae6d 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -853,6 +853,7 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
@@ -858,6 +858,7 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
EGLContext ctx)
{
_EGLDisplay *disp = _eglLockDisplay(dpy);
@@ -23,7 +23,7 @@ index 3cd69b96a0f..234449adf64 100644
_EGLContext *context = _eglLookupContext(ctx, disp);
_EGLSurface *draw_surf = _eglLookupSurface(draw, disp);
_EGLSurface *read_surf = _eglLookupSurface(read, disp);
@@ -909,7 +910,16 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
@@ -911,7 +912,16 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
draw_surf && !draw_surf->ProtectedContent)
RETURN_EGL_ERROR(disp, EGL_BAD_ACCESS, EGL_FALSE);
@@ -1,7 +1,7 @@
From 13e925af5ba3bd763eb4c9e5d0781f92981550f6 Mon Sep 17 00:00:00 2001
From fbc371ceb3e97b829b3e9d3dd55674b156109646 Mon Sep 17 00:00:00 2001
From: Rufus Hamade <rufus.hamade@imgtec.com>
Date: Thu, 4 Feb 2016 14:09:26 +0000
Subject: [PATCH 09/67] GL_EXT_shader_pixel_local_storage2 entry points
Subject: [PATCH 07/58] GL_EXT_shader_pixel_local_storage2 entry points
---
.../gen/EXT_shader_pixel_local_storage2.xml | 35 +++++++++++++++++++
@@ -52,10 +52,10 @@ index 00000000000..20e186c0f0d
+
+</OpenGLAPI>
diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index e586b0ec19b..a3bfe86a888 100644
index 03c78ef9ca5..0ed0e003bae 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -1459,6 +1459,9 @@
@@ -1485,6 +1485,9 @@
<!-- 240. EXT_sparse_texture -->
<xi:include href="EXT_sparse_texture.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
@@ -66,16 +66,16 @@ index e586b0ec19b..a3bfe86a888 100644
<function name="ViewportArrayvOES" es2="3.1" alias="ViewportArrayv">
<param name="first" type="GLuint"/>
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index 79b8f19cb75..99729e21b7f 100644
index 21af0789fee..f89dcf24e4e 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1697,6 +1697,9 @@ offsets = {
"WeightPointerOES" : 1661,
"RenderbufferStorageMultisampleIMG" : 1662,
"FramebufferTexture2DMultisampleIMG" : 1663,
+ "ClearPixelLocalStorageuiEXT" : 1664,
+ "FramebufferPixelLocalStorageSizeEXT" : 1665,
+ "GetFramebufferPixelLocalStorageSizeEXT" : 1666,
@@ -1698,6 +1698,9 @@ offsets = {
"WeightPointerOES" : 1662,
"RenderbufferStorageMultisampleIMG" : 1663,
"FramebufferTexture2DMultisampleIMG" : 1664,
+ "ClearPixelLocalStorageuiEXT" : 1665,
+ "FramebufferPixelLocalStorageSizeEXT" : 1666,
+ "GetFramebufferPixelLocalStorageSizeEXT" : 1667,
}
functions = [
@@ -1,51 +0,0 @@
From fa57726f60bc6fc6e7094f16300cdc41b44ff4f3 Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Wed, 18 Jun 2014 17:10:28 +0100
Subject: [PATCH 07/67] egl: Be stricter when making a context current without
any surfaces
The EGL_KHR_surfaceless_context extension spec states for eglMakeCurrent:
"If <ctx> does not support being bound without read and draw
surfaces, and both <draw> and <read> are EGL_NO_SURFACE, an
EGL_BAD_MATCH error is generated."
Only OpenGLES contexts support this, via the GL_OES_surfaceless_context,
so if EGL_KHR_surfaceless_context is supported and the context isn't an
OpenGLES context then set the EGL error to EGL_BAD_MATCH.
NOTE: This patch can't be upstreamed as is because we set the error to
EGL_BAD_MATCH if we have an OpenGLES 1.x context but the
GL_OES_surfaceless_context extension spec says:
"This extension is written against the OpenGL ES 2.0 Specification
but can apply to OpenGL ES 1.1 with the GL_OES_framebuffer_object
extension."
All Mesa OpenGLES drivers support GL_OES_framebuffer_object, but we
don't, so there would never be a reason to check whether or not this
extension is supported.
In order to upstream this patch the check would need to be changed
to set the error to EGL_BAD_MATCH if EGL_KHR_surfaceless_context is
supported and the context API isn't OpenGLES or the OpenGLES version
is 1.0.
---
src/egl/main/eglapi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 6ffcff8b2cc..3cd69b96a0f 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -888,6 +888,9 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
if (draw_surf || read_surf)
RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE);
+ if (disp->Extensions.KHR_surfaceless_context && context &&
+ (context->ClientAPI != EGL_OPENGL_ES_API || context->ClientMajorVersion == 1))
+ RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE);
}
/* If a native window underlying either draw or read is no longer valid,
--
2.25.1
@@ -1,7 +1,7 @@
From f43a3258b8f4859ff3e0e3d3d356b319dd6a5435 Mon Sep 17 00:00:00 2001
From 3d1c30412a91c9d6f8b824a9850ae1ba3f67be44 Mon Sep 17 00:00:00 2001
From: Rufus Hamade <rufus.hamade@imgtec.com>
Date: Thu, 4 Feb 2016 14:09:26 +0000
Subject: [PATCH 10/67] GL_IMG_framebuffer_downsample entry points
Subject: [PATCH 08/58] GL_IMG_framebuffer_downsample entry points
---
.../glapi/gen/IMG_framebuffer_downsample.xml | 37 +++++++++++++++++++
@@ -54,10 +54,10 @@ index 00000000000..b5ce77dfb08
+
+</OpenGLAPI>
diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index a3bfe86a888..b3432820ba6 100644
index 0ed0e003bae..94696d535b9 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -1462,6 +1462,9 @@
@@ -1488,6 +1488,9 @@
<!-- 253. GL_EXT_shader_pixel_local_storage2 -->
<xi:include href="EXT_shader_pixel_local_storage2.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
@@ -68,15 +68,15 @@ index a3bfe86a888..b3432820ba6 100644
<function name="ViewportArrayvOES" es2="3.1" alias="ViewportArrayv">
<param name="first" type="GLuint"/>
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index 99729e21b7f..c723cb3fab8 100644
index f89dcf24e4e..e363994a298 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1700,6 +1700,8 @@ offsets = {
"ClearPixelLocalStorageuiEXT" : 1664,
"FramebufferPixelLocalStorageSizeEXT" : 1665,
"GetFramebufferPixelLocalStorageSizeEXT" : 1666,
+ "FramebufferTexture2DDownsampleIMG" : 1667,
+ "FramebufferTextureLayerDownsampleIMG" : 1668,
@@ -1701,6 +1701,8 @@ offsets = {
"ClearPixelLocalStorageuiEXT" : 1665,
"FramebufferPixelLocalStorageSizeEXT" : 1666,
"GetFramebufferPixelLocalStorageSizeEXT" : 1667,
+ "FramebufferTexture2DDownsampleIMG" : 1668,
+ "FramebufferTextureLayerDownsampleIMG" : 1669,
}
functions = [
@@ -1,7 +1,7 @@
From cbc7a7501ea4ceffd55ca389deb55d12ff9ceb3f Mon Sep 17 00:00:00 2001
From c6e612d89356cd0df802ebd849108d7124c80427 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Mon, 11 Jul 2016 12:45:30 +0100
Subject: [PATCH 11/67] GL_OVR_multiview entry points
Subject: [PATCH 09/58] GL_OVR_multiview entry points
---
src/mapi/glapi/gen/gl_API.xml | 17 +++++++++++++++++
@@ -9,10 +9,10 @@ Subject: [PATCH 11/67] GL_OVR_multiview entry points
2 files changed, 18 insertions(+)
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index cf5a0f0a0c0..4e35de0f4ea 100644
index cc5d9488d84..f6657e6ffeb 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -13125,6 +13125,23 @@
@@ -12664,6 +12664,23 @@
</function>
</category>
@@ -37,14 +37,14 @@ index cf5a0f0a0c0..4e35de0f4ea 100644
<!-- 520. GL_EXT_shader_framebuffer_fetch -->
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index c723cb3fab8..73625c7fe41 100644
index e363994a298..f97fedabb38 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1702,6 +1702,7 @@ offsets = {
"GetFramebufferPixelLocalStorageSizeEXT" : 1666,
"FramebufferTexture2DDownsampleIMG" : 1667,
"FramebufferTextureLayerDownsampleIMG" : 1668,
+ "FramebufferTextureMultiviewOVR" : 1669,
@@ -1703,6 +1703,7 @@ offsets = {
"GetFramebufferPixelLocalStorageSizeEXT" : 1667,
"FramebufferTexture2DDownsampleIMG" : 1668,
"FramebufferTextureLayerDownsampleIMG" : 1669,
+ "FramebufferTextureMultiviewOVR" : 1670,
}
functions = [
@@ -1,7 +1,7 @@
From 91ea37486db99fd403654ebff2a0a8401f7cd600 Mon Sep 17 00:00:00 2001
From caadab7fb5f2c31b767dd58321b135b78179ed7f Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Mon, 11 Jul 2016 13:29:51 +0100
Subject: [PATCH 12/67] Add OVR_multiview_multisampled_render_to_texture
Subject: [PATCH 10/58] Add OVR_multiview_multisampled_render_to_texture
---
...ltiview_multisampled_render_to_texture.xml | 21 +++++++++++++++++++
@@ -38,10 +38,10 @@ index 00000000000..86bebc728e9
+
+</OpenGLAPI>
diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index b3432820ba6..fe8f27e1e6f 100644
index 94696d535b9..b59e85d3281 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -1459,6 +1459,9 @@
@@ -1485,6 +1485,9 @@
<!-- 240. EXT_sparse_texture -->
<xi:include href="EXT_sparse_texture.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
@@ -52,14 +52,14 @@ index b3432820ba6..fe8f27e1e6f 100644
<xi:include href="EXT_shader_pixel_local_storage2.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index 73625c7fe41..dc6bdc9dcce 100644
index f97fedabb38..fda952a1bdb 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1703,6 +1703,7 @@ offsets = {
"FramebufferTexture2DDownsampleIMG" : 1667,
"FramebufferTextureLayerDownsampleIMG" : 1668,
"FramebufferTextureMultiviewOVR" : 1669,
+ "FramebufferTextureMultisampleMultiviewOVR" : 1670,
@@ -1704,6 +1704,7 @@ offsets = {
"FramebufferTexture2DDownsampleIMG" : 1668,
"FramebufferTextureLayerDownsampleIMG" : 1669,
"FramebufferTextureMultiviewOVR" : 1670,
+ "FramebufferTextureMultisampleMultiviewOVR" : 1671,
}
functions = [
@@ -1,7 +1,7 @@
From b38c4118c7a3a060ef1c8b8477200f5a73305397 Mon Sep 17 00:00:00 2001
From e02408aadb8f9a73c8af428548e1726015669a46 Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Thu, 18 Aug 2016 15:52:28 +0100
Subject: [PATCH 13/67] wayland-drm: install wayland-drm.xml to the configured
Subject: [PATCH 11/58] wayland-drm: install wayland-drm.xml to the configured
pkgdatadir
Add a pkg-config file as well so that it can be located without hardcoding the
@@ -1,7 +1,7 @@
From b80c78b05ebb661e7f088d0a369b0f0d2990afca Mon Sep 17 00:00:00 2001
From 7c77b96ecd34995fb84d009bad0ecb0b144605d4 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Wed, 26 Oct 2016 16:24:28 +0100
Subject: [PATCH 14/67] Enable buffer sharing in the kms_swrast driver
Subject: [PATCH 12/58] Enable buffer sharing in the kms_swrast driver
Enable buffer sharing, so that a DRI driver can be loaded by a
Wayland client when kms_swrast is being used by the compositor.
@@ -10,10 +10,10 @@ Wayland client when kms_swrast is being used by the compositor.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c
index ebc18a73c86..09f4b02e758 100644
index cfc14dabf28..58f25eadbcc 100644
--- a/src/gallium/frontends/dri/dri2.c
+++ b/src/gallium/frontends/dri/dri2.c
@@ -2400,7 +2400,7 @@ dri_kms_init_screen(__DRIscreen * sPriv)
@@ -2538,7 +2538,7 @@ dri_kms_init_screen(__DRIscreen * sPriv)
if (!configs)
goto destroy_screen;
@@ -1,17 +1,17 @@
From 55a15a019dd792477e39f6225f2b4e50a1359b66 Mon Sep 17 00:00:00 2001
From 5b0fbff52f731f510afb48245f9880681aed7b6d Mon Sep 17 00:00:00 2001
From: James Glanville <James.Glanville@imgtec.com>
Date: Tue, 28 Feb 2017 16:08:47 +0000
Subject: [PATCH 15/67] egl/wayland: add support for RGB565 back buffers
Subject: [PATCH 13/58] egl/wayland: add support for RGB565 back buffers
---
src/egl/drivers/dri2/platform_wayland.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index cfff0ade90e..c18edc0de4e 100644
index 5b886f8d62d..6eca68efe41 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -633,18 +633,27 @@ back_bo_to_dri_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
@@ -1096,18 +1096,27 @@ back_bo_to_dri_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
__DRIimage *image;
@@ -40,7 +40,7 @@ index cfff0ade90e..c18edc0de4e 100644
+ }
}
static int
/* Value chosen empirically as a compromise between avoiding frequent
--
2.25.1
@@ -1,7 +1,7 @@
From d98cd46b5841ecb785a801a977a1b341d98d08c4 Mon Sep 17 00:00:00 2001
From eb4fecd3e6ef59580a32801e8689f3071d0a9f00 Mon Sep 17 00:00:00 2001
From: Iosif Antochi <iosif.antochi@imgtec.com>
Date: Wed, 14 Jun 2017 14:49:55 +0100
Subject: [PATCH 17/67] egl: automatically call eglReleaseThread on thread
Subject: [PATCH 14/58] egl: automatically call eglReleaseThread on thread
termination
EGL thread cleanup conformance tests could run out of memory as the contexts
@@ -22,10 +22,10 @@ dEQP-EGL.functional.robustness.create_context.query_robust_access
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c
index 11277d3e4c0..c87eac0d007 100644
index 3a82a2d0d77..6342e00ee45 100644
--- a/src/egl/main/eglcurrent.c
+++ b/src/egl/main/eglcurrent.c
@@ -44,6 +44,7 @@ static mtx_t _egl_TSDMutex = _MTX_INITIALIZER_NP;
@@ -45,6 +45,7 @@ static mtx_t _egl_TSDMutex = _MTX_INITIALIZER_NP;
static EGLBoolean _egl_TSDInitialized;
static tss_t _egl_TSD;
static void _eglDestroyThreadInfo(_EGLThreadInfo *t);
@@ -33,7 +33,7 @@ index 11277d3e4c0..c87eac0d007 100644
#ifdef USE_ELF_TLS
static __THREAD_INITIAL_EXEC const _EGLThreadInfo *_egl_TLS;
@@ -86,7 +87,7 @@ static inline EGLBoolean _eglInitTSD()
@@ -87,7 +88,7 @@ static inline EGLBoolean _eglInitTSD()
/* check again after acquiring lock */
if (!_egl_TSDInitialized) {
@@ -42,7 +42,7 @@ index 11277d3e4c0..c87eac0d007 100644
mtx_unlock(&_egl_TSDMutex);
return EGL_FALSE;
}
@@ -135,6 +136,30 @@ _eglDestroyThreadInfo(_EGLThreadInfo *t)
@@ -142,6 +143,30 @@ _eglDestroyThreadInfo(_EGLThreadInfo *t)
}
@@ -1,7 +1,7 @@
From 54d08798efca8f8929744a238e2b8b2851083317 Mon Sep 17 00:00:00 2001
From 2aa69df0cf419a376581cb48f8cf43cc92d98102 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Wed, 8 Nov 2017 15:15:20 +0000
Subject: [PATCH 20/67] egl/wayland: post maximum damage when blitting
Subject: [PATCH 15/58] egl/wayland: post maximum damage when blitting
When blitting, as part of the "is_different_gpu" case when swapping
buffers, the blit is done using the full surface dimensions, ignoring
@@ -15,10 +15,10 @@ when the number of damage rectangles is 1.
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index c18edc0de4e..c2e428769fe 100644
index 6eca68efe41..17133ca9cd4 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1112,7 +1112,8 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
@@ -1565,7 +1565,8 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
/* If the compositor doesn't support damage_buffer, we deliberately
* ignore the damage region and post maximum damage, due to
* https://bugs.freedesktop.org/78190 */
@@ -1,49 +0,0 @@
From 03f4f18f9edb4090c6aeca16e6f4de602aea68bf Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Thu, 13 Apr 2017 10:12:40 +0100
Subject: [PATCH 16/67] egl/dri3: fix segfault in eglCopyBuffers
The loader_dri3_copy_drawable function expected the drawable to have
a fake front buffer, resulting in a segfault if there wasn't one,
when dri3_fence_reset was called.
If there is no fake front buffer, but there are back buffers, use the
current back buffer.
---
src/loader/loader_dri3_helper.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index 6e825f9a898..ff6d1ffc660 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -863,15 +863,24 @@ loader_dri3_copy_drawable(struct loader_dri3_drawable *draw,
xcb_drawable_t dest,
xcb_drawable_t src)
{
+ struct loader_dri3_buffer *buffer;
+
+ if (draw->have_fake_front)
+ buffer = dri3_fake_front_buffer(draw);
+ else if (draw->have_back)
+ buffer = dri3_back_buffer(draw);
+ else
+ return;
+
loader_dri3_flush(draw, __DRI2_FLUSH_DRAWABLE, __DRI2_THROTTLE_COPYSUBBUFFER);
- dri3_fence_reset(draw->conn, dri3_fake_front_buffer(draw));
+ dri3_fence_reset(draw->conn, buffer);
dri3_copy_area(draw->conn,
src, dest,
dri3_drawable_gc(draw),
0, 0, 0, 0, draw->width, draw->height);
- dri3_fence_trigger(draw->conn, dri3_fake_front_buffer(draw));
- dri3_fence_await(draw->conn, draw, dri3_fake_front_buffer(draw));
+ dri3_fence_trigger(draw->conn, buffer);
+ dri3_fence_await(draw->conn, draw, buffer);
}
void
--
2.25.1
@@ -1,7 +1,7 @@
From a6aa5c866c25f7f334afbbcc3835467d50eb8965 Mon Sep 17 00:00:00 2001
From eddfa511f99790d87c66bdf848052ad065b83650 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Wed, 8 Nov 2017 15:26:25 +0000
Subject: [PATCH 21/67] egl/wayland: flush the drawable before blitting
Subject: [PATCH 16/58] egl/wayland: flush the drawable before blitting
Flush the drawable before blitting in the "is_different_gpu" case when
swapping buffers, and pass the flush flag to the blitImage call. The
@@ -17,10 +17,10 @@ invalid.
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index c2e428769fe..811d28bd669 100644
index 17133ca9cd4..a699f735583 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1117,6 +1117,8 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
@@ -1570,6 +1570,8 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
wl_surface_damage(dri2_surf->wl_surface_wrapper,
0, 0, INT32_MAX, INT32_MAX);
@@ -29,7 +29,7 @@ index c2e428769fe..811d28bd669 100644
if (dri2_dpy->is_different_gpu) {
_EGLContext *ctx = _eglGetCurrentContext();
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
@@ -1126,10 +1128,9 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
@@ -1579,10 +1581,9 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
0, 0, dri2_surf->base.Width,
dri2_surf->base.Height,
0, 0, dri2_surf->base.Width,
@@ -1,27 +1,27 @@
From 1f4a1a21384b00e28b8a9dd2c29f9c261f201c6f Mon Sep 17 00:00:00 2001
From ab34a212ab8980dd68c7022f31c3ddf70f9b2647 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Thu, 23 Nov 2017 15:50:21 +0000
Subject: [PATCH 23/67] dri: use a supported API in driCreateNewContext
Subject: [PATCH 17/58] dri: use a supported API in driCreateNewContext
Don't assume the screen supports OpenGL when creating a new context,
use an API that the screen supports.
---
src/mesa/drivers/dri/common/dri_util.c | 14 +++++++++++++-
src/gallium/frontends/dri/dri_util.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index caed5fa6a68..6c45eb007fc 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -50,6 +50,7 @@
diff --git a/src/gallium/frontends/dri/dri_util.c b/src/gallium/frontends/dri/dri_util.c
index abc84a22ac6..e22a3eb8e6b 100644
--- a/src/gallium/frontends/dri/dri_util.c
+++ b/src/gallium/frontends/dri/dri_util.c
@@ -49,6 +49,7 @@
#include "main/version.h"
#include "main/debug_output.h"
#include "main/errors.h"
#include "main/macros.h"
+#include "util/bitscan.h"
driOptionDescription __dri2ConfigOptions[] = {
DRI_CONF_SECTION_DEBUG
@@ -332,7 +333,11 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
@@ -333,7 +334,11 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
mesa_api = API_OPENGLES;
break;
case __DRI_API_GLES2:
@@ -33,7 +33,7 @@ index caed5fa6a68..6c45eb007fc 100644
mesa_api = API_OPENGLES2;
break;
case __DRI_API_OPENGL_CORE:
@@ -515,7 +520,14 @@ static __DRIcontext *
@@ -512,7 +517,14 @@ static __DRIcontext *
driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
__DRIcontext *shared, void *data)
{
File diff suppressed because it is too large Load Diff
@@ -1,7 +1,7 @@
From 0751612b949f1c90338a14453ff7fa4be8bfd016 Mon Sep 17 00:00:00 2001
From 8c6ad73f1e75aef977cdd06672effa2597597963 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Tue, 28 Nov 2017 16:27:38 +0000
Subject: [PATCH 24/67] gbm: add gbm_bo_blit
Subject: [PATCH 18/58] gbm: add gbm_bo_blit
For the GBM DRI backend, gbm_bo_blit is a wrapper around blitImage in
the DRI Image extension.
@@ -10,14 +10,14 @@ the DRI Image extension.
src/gbm/main/gbm.c | 31 +++++++++++++++++++++++++++++++
src/gbm/main/gbm.h | 21 +++++++++++++++++++++
src/gbm/main/gbm_abi_check.c | 20 +++++++++++++++++++-
src/gbm/main/gbm_backend_abi.h | 10 +++++++++-
5 files changed, 113 insertions(+), 2 deletions(-)
src/gbm/main/gbm_backend_abi.h | 8 ++++++++
5 files changed, 112 insertions(+), 1 deletion(-)
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 96fa9217255..bd8a80cdecf 100644
index 644ea3c5639..00fcc57f512 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -1355,6 +1355,37 @@ gbm_dri_surface_destroy(struct gbm_surface *_surf)
@@ -1400,6 +1400,37 @@ gbm_dri_surface_destroy(struct gbm_surface *_surf)
free(surf);
}
@@ -55,7 +55,7 @@ index 96fa9217255..bd8a80cdecf 100644
static void
dri_destroy(struct gbm_device *gbm)
{
@@ -1416,6 +1447,8 @@ dri_device_create(int fd, uint32_t gbm_backend_version)
@@ -1461,6 +1492,8 @@ dri_device_create(int fd, uint32_t gbm_backend_version)
dri->base.v0.name = "drm";
@@ -65,10 +65,10 @@ index 96fa9217255..bd8a80cdecf 100644
dri->num_visuals = ARRAY_SIZE(gbm_dri_visuals_table);
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
index d81931a7483..e2351d34ad8 100644
index ab685b878e8..3ce816f5169 100644
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -758,6 +758,37 @@ gbm_format_get_name(uint32_t gbm_format, struct gbm_format_name_desc *desc)
@@ -825,6 +825,37 @@ gbm_format_get_name(uint32_t gbm_format, struct gbm_format_name_desc *desc)
return desc->name;
}
@@ -107,10 +107,10 @@ index d81931a7483..e2351d34ad8 100644
* A global table of functions and global variables defined in the core GBM
* code that need to be accessed directly by GBM backends.
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
index 3a0fe73faae..7c82cd661a3 100644
index ea3cc1bac55..57fd1b9ab47 100644
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -246,6 +246,21 @@ enum gbm_bo_flags {
@@ -253,6 +253,21 @@ enum gbm_bo_flags {
GBM_BO_USE_PROTECTED = (1 << 5),
};
@@ -132,7 +132,7 @@ index 3a0fe73faae..7c82cd661a3 100644
int
gbm_device_get_fd(struct gbm_device *gbm);
@@ -425,6 +440,12 @@ gbm_surface_destroy(struct gbm_surface *surface);
@@ -449,6 +464,12 @@ gbm_surface_destroy(struct gbm_surface *surface);
char *
gbm_format_get_name(uint32_t gbm_format, struct gbm_format_name_desc *desc);
@@ -146,10 +146,10 @@ index 3a0fe73faae..7c82cd661a3 100644
}
#endif
diff --git a/src/gbm/main/gbm_abi_check.c b/src/gbm/main/gbm_abi_check.c
index f1137be7baf..02ce23b129e 100644
index feca0998d9d..0153b5a8754 100644
--- a/src/gbm/main/gbm_abi_check.c
+++ b/src/gbm/main/gbm_abi_check.c
@@ -101,6 +101,21 @@ struct gbm_device_abi0 {
@@ -106,6 +106,21 @@ struct gbm_device_abi0 {
struct gbm_device_v0_abi0 v0;
};
@@ -171,7 +171,7 @@ index f1137be7baf..02ce23b129e 100644
/**
* GBM buffer object interface corresponding to GBM_BACKEND_ABI_VERSION = 0
*
@@ -359,8 +374,11 @@ int main(int argc, char **argv)
@@ -364,8 +379,11 @@ int main(int argc, char **argv)
CHECK_MEMBER_CURRENT(gbm_device_v0, _abi0, surface_has_free_buffers);
CHECK_MEMBER_CURRENT(gbm_device_v0, _abi0, surface_destroy);
@@ -185,19 +185,10 @@ index f1137be7baf..02ce23b129e 100644
/* Check current gbm_bo ABI against gbm_bo_abi0*/
diff --git a/src/gbm/main/gbm_backend_abi.h b/src/gbm/main/gbm_backend_abi.h
index 962ee74f003..3abf29faa92 100644
index 222ce3404cb..17f5e0ca808 100644
--- a/src/gbm/main/gbm_backend_abi.h
+++ b/src/gbm/main/gbm_backend_abi.h
@@ -72,7 +72,7 @@ struct gbm_backend_desc;
* Core ABI version: 4
* ABI version of a buffer object created by a device from the backend: 4
*/
-#define GBM_BACKEND_ABI_VERSION 0
+#define GBM_BACKEND_ABI_VERSION 1
/**
* GBM device interface corresponding to GBM_BACKEND_ABI_VERSION = 0
@@ -149,6 +149,13 @@ struct gbm_device_v0 {
@@ -157,6 +157,13 @@ struct gbm_device_v0 {
void (*surface_destroy)(struct gbm_surface *surface);
};
@@ -211,7 +202,7 @@ index 962ee74f003..3abf29faa92 100644
/**
* The device used for the memory allocation.
*
@@ -161,6 +168,7 @@ struct gbm_device {
@@ -169,6 +176,7 @@ struct gbm_device {
/* Hack to make a gbm_device detectable by its first element. */
struct gbm_device *(*dummy)(int);
struct gbm_device_v0 v0;
@@ -1,231 +0,0 @@
From 230a8cb550dc23a46a96b1852720c262bb244665 Mon Sep 17 00:00:00 2001
From: Eric Engestrom <eric.engestrom@imgtec.com>
Date: Mon, 6 Feb 2017 15:54:00 +0000
Subject: [PATCH 19/67] egl: add support for EGL_TIZEN_image_native_surface
---
src/egl/drivers/dri2/egl_dri2.c | 127 ++++++++++++++++++++------
src/egl/drivers/dri2/platform_tizen.c | 1 +
src/egl/main/eglapi.c | 2 +
src/egl/main/egldisplay.h | 2 +
4 files changed, 102 insertions(+), 30 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 6d34395d65d..eaa0baed066 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -58,6 +58,10 @@
#include "X11/Xlibint.h"
#endif
+#ifdef HAVE_TIZEN_PLATFORM
+#include <tpl.h>
+#endif
+
#include "egldefines.h"
#include "egl_dri2.h"
#include "GL/mesa_glinterop.h"
@@ -2311,28 +2315,115 @@ dri2_fourcc_from_tbm_format(tbm_format format)
switch (format) {
case TBM_FORMAT_ARGB8888:
return DRM_FORMAT_ARGB8888;
+ case TBM_FORMAT_ABGR8888:
+ return DRM_FORMAT_ABGR8888;
case TBM_FORMAT_XRGB8888:
return DRM_FORMAT_XRGB8888;
+ case TBM_FORMAT_XBGR8888:
+ return DRM_FORMAT_XBGR8888;
+ case TBM_FORMAT_ARGB4444:
+ return DRM_FORMAT_ARGB4444;
+ case TBM_FORMAT_ARGB1555:
+ return DRM_FORMAT_ARGB1555;
case TBM_FORMAT_RGB565:
return DRM_FORMAT_RGB565;
+ case TBM_FORMAT_YUV420:
+ return DRM_FORMAT_YUV420;
+ case TBM_FORMAT_YVU420:
+ return DRM_FORMAT_YVU420;
+ case TBM_FORMAT_NV12:
+ return DRM_FORMAT_NV12;
+ case TBM_FORMAT_NV21:
+ return DRM_FORMAT_NV21;
default:
_eglLog(_EGL_DEBUG, "%s: unsupported tbm format %#x", __func__, format);
return 0;
}
}
+static _EGLImage *
+dri2_create_image_tbm_surface(_EGLDisplay *disp, _EGLContext *ctx,
+ tbm_surface_h tbm_surf)
+{
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+ __DRIimage *dri_image;
+ tbm_surface_info_s info;
+ int fd[TBM_SURF_PLANE_MAX], pitch[TBM_SURF_PLANE_MAX], offset[TBM_SURF_PLANE_MAX];
+ int fourcc;
+ int i;
+
+ if (tbm_surface_get_info(tbm_surf, &info)) {
+ _eglError(EGL_BAD_PARAMETER, "tbm_surface_get_info");
+ return NULL;
+ }
+
+ fourcc = dri2_fourcc_from_tbm_format(info.format);
+ if (!fourcc) {
+ _eglError(EGL_BAD_PARAMETER, "dri2_fourcc_from_tbm_format");
+ return NULL;
+ }
+
+ for (i = 0; i < info.num_planes; i++) {
+ tbm_bo tbm_buf;
+
+ tbm_buf = tbm_surface_internal_get_bo(tbm_surf, i);
+ if (!tbm_buf) {
+ _eglError(EGL_BAD_PARAMETER, "tbm_surface_internal_get_bo");
+ goto fail_close;
+ }
+
+ pitch[i] = info.planes[i].stride;
+ offset[i] = info.planes[i].offset;
+ fd[i] = tbm_bo_export_fd(tbm_buf);
+ }
+
+ dri_image = dri2_dpy->image->createImageFromFds(dri2_dpy->dri_screen,
+ info.width,
+ info.height,
+ fourcc,
+ &fd[0],
+ info.num_planes,
+ &pitch[0],
+ &offset[0],
+ tbm_surf);
+ for (i = 0; i < info.num_planes; i++) {
+ close(fd[i]);
+ fd[i] = -1;
+ }
+
+ if (!dri_image) {
+ _eglError(EGL_BAD_PARAMETER, "createImageFromFds");
+ return NULL;
+ }
+
+ return dri2_create_image_from_dri(disp, dri_image);
+
+fail_close:
+ while (i--)
+ close(fd[i]);
+
+ return NULL;
+}
+
+static _EGLImage *
+dri2_create_image_tizen(_EGLDisplay *disp, _EGLContext *ctx,
+ EGLClientBuffer _buffer,
+ const EGLint *attr_list)
+{
+ tbm_surface_h tbm_surf = (tbm_surface_h)_buffer;
+
+ return dri2_create_image_tbm_surface(disp, ctx, tbm_surf);
+}
+
static _EGLImage *
dri2_create_image_wayland_wl_buffer_tizen(_EGLDisplay *disp, _EGLContext *ctx,
EGLClientBuffer _buffer,
const EGLint *attr_list)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
- __DRIimage *dri_image;
_EGLImageAttribs attrs;
tbm_surface_h tbm_surf;
- tbm_bo tbm_buf;
tbm_surface_info_s info;
- int fourcc, fd, pitch, offset;
tbm_surf = tpl_display_get_buffer_from_native_pixmap(dri2_dpy->tpl_dpy,
(tpl_handle_t) _buffer);
@@ -2363,33 +2454,7 @@ dri2_create_image_wayland_wl_buffer_tizen(_EGLDisplay *disp, _EGLContext *ctx,
return NULL;
}
- tbm_buf = tbm_surface_internal_get_bo(tbm_surf, attrs.PlaneWL);
- if (!tbm_buf) {
- _eglError(EGL_BAD_PARAMETER, "tbm_surface_internal_get_bo");
- return NULL;
- }
-
- fourcc = dri2_fourcc_from_tbm_format(info.format);
- pitch = info.planes[attrs.PlaneWL].stride;
- offset = info.planes[attrs.PlaneWL].offset;
- fd = tbm_bo_export_fd(tbm_buf);
-
- dri_image = dri2_dpy->image->createImageFromFds(dri2_dpy->dri_screen,
- info.width,
- info.height,
- fourcc,
- &fd,
- 1,
- &pitch,
- &offset,
- tbm_surf);
- close(fd);
- if (dri_image == NULL) {
- _eglError(EGL_BAD_PARAMETER, "createImageFromFds");
- return NULL;
- }
-
- return dri2_create_image_from_dri(disp, dri_image);
+ return dri2_create_image_tbm_surface(disp, ctx, tbm_surf);
}
#endif
@@ -3296,6 +3361,8 @@ dri2_create_image_khr(_EGLDisplay *disp, _EGLContext *ctx, EGLenum target,
#ifdef HAVE_TIZEN_PLATFORM
case EGL_WAYLAND_BUFFER_WL:
return dri2_create_image_wayland_wl_buffer_tizen(disp, ctx, buffer, attr_list);
+ case EGL_NATIVE_SURFACE_TIZEN:
+ return dri2_create_image_tizen(disp, ctx, buffer, attr_list);
#endif
case EGL_CL_IMAGE_IMG:
return dri2_create_image_img_buffer(disp, ctx, target, buffer, attr_list);
diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c
index a08bc8c07bf..ad75c115d7e 100644
--- a/src/egl/drivers/dri2/platform_tizen.c
+++ b/src/egl/drivers/dri2/platform_tizen.c
@@ -965,6 +965,7 @@ dri2_initialize_tizen(_EGLDisplay *dpy)
dpy->Extensions.EXT_swap_buffers_with_damage = EGL_TRUE;
dpy->Extensions.KHR_image_base = EGL_TRUE;
dpy->Extensions.WL_bind_wayland_display = EGL_TRUE;
+ dpy->Extensions.TIZEN_image_native_surface = EGL_TRUE;
/*
* Fill vtbl last to prevent accidentally calling virtual function during
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 43c7b917909..e2a7797d73e 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -553,6 +553,8 @@ _eglCreateExtensionsString(_EGLDisplay *disp)
_EGL_CHECK_EXTENSION(NV_post_sub_buffer);
+ _EGL_CHECK_EXTENSION(TIZEN_image_native_surface);
+
_EGL_CHECK_EXTENSION(WL_bind_wayland_display);
_EGL_CHECK_EXTENSION(WL_create_wayland_buffer_from_image);
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index cbb098331bf..0a7366b7c07 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -149,6 +149,8 @@ struct _egl_extensions
EGLBoolean NV_post_sub_buffer;
+ EGLBoolean TIZEN_image_native_surface;
+
EGLBoolean WL_bind_wayland_display;
EGLBoolean WL_create_wayland_buffer_from_image;
--
2.25.1
@@ -1,7 +1,7 @@
From dbe611e4cb6f0dddc05ead03f0341274a6b018c8 Mon Sep 17 00:00:00 2001
From a553d0541555b879a2f9a9645d0766983855d766 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Fri, 1 Dec 2017 08:31:15 +0000
Subject: [PATCH 25/67] gbm: don't assert if DRI context creation fails
Subject: [PATCH 19/58] gbm: don't assert if DRI context creation fails
If the DRI backend fails to create a DRI context, return an error,
rather than asserting.
@@ -10,10 +10,10 @@ rather than asserting.
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index bd8a80cdecf..2aa9c7c41ad 100644
index 00fcc57f512..fc0bbf5fcf9 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -1245,8 +1245,11 @@ gbm_dri_bo_map(struct gbm_bo *_bo,
@@ -1290,8 +1290,11 @@ gbm_dri_bo_map(struct gbm_bo *_bo,
if (!dri->context)
dri->context = dri->dri2->createNewContext(dri->screen, NULL,
NULL, NULL);
@@ -26,7 +26,7 @@ index bd8a80cdecf..2aa9c7c41ad 100644
/* GBM flags and DRI flags are the same, so just pass them on */
return dri->image->mapImage(dri->context, bo->image, x, y,
@@ -1374,8 +1377,11 @@ gbm_dri_bo_blit(struct gbm_bo *_dst_bo, struct gbm_bo *_src_bo,
@@ -1419,8 +1422,11 @@ gbm_dri_bo_blit(struct gbm_bo *_dst_bo, struct gbm_bo *_src_bo,
if (!dri->context)
dri->context = dri->dri2->createNewContext(dri->screen, NULL,
NULL, NULL);
@@ -1,7 +1,7 @@
From f16ea577ee06375423198dced8231d04e94536af Mon Sep 17 00:00:00 2001
From 18831c70c524c1a14ffedc3038cf76e0d2c64579 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Fri, 17 Mar 2017 16:23:07 +0000
Subject: [PATCH 26/67] egl/wayland: add pbuffer support
Subject: [PATCH 20/58] egl/wayland: add pbuffer support
The pbuffer code is based on that in the Surfaceless platform code.
---
@@ -10,10 +10,10 @@ The pbuffer code is based on that in the Surfaceless platform code.
2 files changed, 236 insertions(+), 38 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 546bc0a0dbc..f41f32cd234 100644
index 89158993efd..35f66ad5453 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -405,6 +405,10 @@ struct dri2_egl_surface
@@ -389,6 +389,10 @@ struct dri2_egl_surface
__DRIimage *front;
unsigned int visual;
@@ -25,10 +25,10 @@ index 546bc0a0dbc..f41f32cd234 100644
EGLBoolean enable_out_fence;
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 811d28bd669..a096d9500c1 100644
index a699f735583..185c52c110f 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -427,6 +427,99 @@ dri2_wl_create_pixmap_surface(_EGLDisplay *disp, _EGLConfig *conf,
@@ -787,6 +787,99 @@ dri2_wl_create_pixmap_surface(_EGLDisplay *disp, _EGLConfig *conf,
return NULL;
}
@@ -59,7 +59,7 @@ index 811d28bd669..a096d9500c1 100644
+ goto cleanup_surf;
+ }
+
+ visual_idx = dri2_wl_visual_idx_from_config(dri2_dpy, config);
+ visual_idx = dri2_wl_visual_idx_from_config(dri2_dpy, config, false);
+ assert(visual_idx != -1);
+
+ if (dri2_dpy->wl_dmabuf || dri2_dpy->wl_drm) {
@@ -128,7 +128,7 @@ index 811d28bd669..a096d9500c1 100644
/**
* Called via eglDestroySurface(), drv->DestroySurface().
*/
@@ -453,6 +546,9 @@ dri2_wl_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
@@ -813,6 +906,9 @@ dri2_wl_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
if (dri2_dpy->dri2)
dri2_egl_surface_free_local_buffers(dri2_surf);
@@ -138,7 +138,7 @@ index 811d28bd669..a096d9500c1 100644
if (dri2_surf->throttle_callback)
wl_callback_destroy(dri2_surf->throttle_callback);
@@ -462,11 +558,14 @@ dri2_wl_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
@@ -822,8 +918,10 @@ dri2_wl_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
dri2_surf->wl_win->destroy_window_callback = NULL;
}
@@ -150,13 +150,18 @@ index 811d28bd669..a096d9500c1 100644
+ wl_proxy_wrapper_destroy(dri2_surf->wl_dpy_wrapper);
if (dri2_surf->wl_drm_wrapper)
wl_proxy_wrapper_destroy(dri2_surf->wl_drm_wrapper);
if (dri2_surf->wl_dmabuf_feedback) {
@@ -831,7 +929,8 @@ dri2_wl_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
dmabuf_feedback_fini(&dri2_surf->dmabuf_feedback);
dmabuf_feedback_fini(&dri2_surf->pending_dmabuf_feedback);
}
- wl_event_queue_destroy(dri2_surf->wl_queue);
+ if (dri2_surf->wl_queue)
+ wl_event_queue_destroy(dri2_surf->wl_queue);
dri2_fini_surface(surf);
free(surf);
@@ -628,20 +727,16 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
@@ -1091,20 +1190,16 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
static void
@@ -180,9 +185,9 @@ index 811d28bd669..a096d9500c1 100644
buffer->name = name;
buffer->pitch = pitch;
buffer->flags = 0;
@@ -656,12 +751,28 @@ back_bo_to_dri_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
}
}
@@ -1125,12 +1220,28 @@ back_bo_to_dri_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
*/
#define BUFFER_TRIM_AGE_HYSTERESIS 20
-static int
-update_buffers(struct dri2_egl_surface *dri2_surf)
@@ -213,7 +218,7 @@ index 811d28bd669..a096d9500c1 100644
if (dri2_surf->wl_win &&
(dri2_surf->base.Width != dri2_surf->wl_win->width ||
dri2_surf->base.Height != dri2_surf->wl_win->height)) {
@@ -703,12 +814,13 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
@@ -1176,12 +1287,13 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
}
static int
@@ -229,7 +234,7 @@ index 811d28bd669..a096d9500c1 100644
}
static __DRIbuffer *
@@ -718,17 +830,25 @@ dri2_wl_get_buffers_with_format(__DRIdrawable * driDrawable,
@@ -1191,17 +1303,25 @@ dri2_wl_get_buffers_with_format(__DRIdrawable * driDrawable,
int *out_count, void *loaderPrivate)
{
struct dri2_egl_surface *dri2_surf = loaderPrivate;
@@ -237,7 +242,7 @@ index 811d28bd669..a096d9500c1 100644
+ dri2_egl_display(dri2_surf->base.Resource.Display);
int i, j;
- if (update_buffers(dri2_surf) < 0)
- if (update_buffers_if_needed(dri2_surf) < 0)
- return NULL;
-
for (i = 0, j = 0; i < 2 * count; i += 2, j++) {
@@ -246,7 +251,7 @@ index 811d28bd669..a096d9500c1 100644
switch (attachments[i]) {
case __DRI_BUFFER_BACK_LEFT:
- back_bo_to_dri_buffer(dri2_surf, &dri2_surf->buffers[j]);
+ if (update_buffers(dri2_dpy, dri2_surf) < 0)
+ if (update_buffers_if_needed(dri2_dpy, dri2_surf) < 0)
+ return NULL;
+
+ back_bo_to_dri_buffer(dri2_dpy, dri2_surf, &dri2_surf->buffers[j]);
@@ -259,14 +264,14 @@ index 811d28bd669..a096d9500c1 100644
break;
default:
local = dri2_egl_surface_alloc_local_buffer(dri2_surf, attachments[i],
@@ -798,12 +918,30 @@ image_get_buffers(__DRIdrawable *driDrawable,
@@ -1271,12 +1391,30 @@ image_get_buffers(__DRIdrawable *driDrawable,
struct __DRIimageList *buffers)
{
struct dri2_egl_surface *dri2_surf = loaderPrivate;
+ struct dri2_egl_display *dri2_dpy =
+ dri2_egl_display(dri2_surf->base.Resource.Display);
- if (update_buffers(dri2_surf) < 0)
- if (update_buffers_if_needed(dri2_surf) < 0)
- return 0;
+ buffers->image_mask = 0;
+ buffers->front = NULL;
@@ -274,11 +279,9 @@ index 811d28bd669..a096d9500c1 100644
+
+ if (buffer_mask & __DRI_IMAGE_BUFFER_BACK)
+ {
+ if (update_buffers(dri2_dpy, dri2_surf) < 0)
+ if (update_buffers_if_needed(dri2_dpy, dri2_surf) < 0)
+ return 0;
- buffers->image_mask = __DRI_IMAGE_BUFFER_BACK;
- buffers->back = dri2_surf->back->dri_image;
+
+ buffers->image_mask |= __DRI_IMAGE_BUFFER_BACK;
+ buffers->back = dri2_surf->back->dri_image;
+ }
@@ -287,14 +290,16 @@ index 811d28bd669..a096d9500c1 100644
+ {
+ if (allocate_front_buffer(dri2_dpy, dri2_surf, EGL_FALSE) < 0)
+ return 0;
+
- buffers->image_mask = __DRI_IMAGE_BUFFER_BACK;
- buffers->back = dri2_surf->back->dri_image;
+ buffers->image_mask |= __DRI_IMAGE_BUFFER_FRONT;
+ buffers->front = dri2_surf->front;
+ }
return 1;
}
@@ -1054,6 +1192,9 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
@@ -1507,6 +1645,9 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
@@ -304,7 +309,7 @@ index 811d28bd669..a096d9500c1 100644
if (!dri2_surf->wl_win)
return _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_swap_buffers");
@@ -1068,7 +1209,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
@@ -1521,7 +1662,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
/* Make sure we have a back buffer in case we're swapping without ever
* rendering. */
@@ -313,7 +318,7 @@ index 811d28bd669..a096d9500c1 100644
return _eglError(EGL_BAD_ALLOC, "dri2_swap_buffers");
if (draw->SwapInterval > 0) {
@@ -1153,9 +1294,13 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
@@ -1606,9 +1747,13 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
static EGLint
dri2_wl_query_buffer_age(_EGLDisplay *disp, _EGLSurface *surface)
{
@@ -328,15 +333,15 @@ index 811d28bd669..a096d9500c1 100644
_eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age");
return -1;
}
@@ -1376,6 +1521,7 @@ static const struct dri2_egl_display_vtbl dri2_wl_display_vtbl = {
@@ -1958,6 +2103,7 @@ static const struct dri2_egl_display_vtbl dri2_wl_display_vtbl = {
.authenticate = dri2_wl_authenticate,
.create_window_surface = dri2_wl_create_window_surface,
.create_pixmap_surface = dri2_wl_create_pixmap_surface,
+ .create_pbuffer_surface = dri2_wl_create_pbuffer_surface,
.destroy_surface = dri2_wl_destroy_surface,
.swap_interval = dri2_wl_swap_interval,
.create_image = dri2_create_image_khr,
.swap_buffers = dri2_wl_swap_buffers,
@@ -1418,7 +1564,7 @@ dri2_wl_add_configs_for_visuals(_EGLDisplay *disp)
@@ -2001,7 +2147,7 @@ dri2_wl_add_configs_for_visuals(_EGLDisplay *disp)
continue;
dri2_conf = dri2_add_config(disp, dri2_dpy->driver_configs[i],
@@ -345,7 +350,7 @@ index 811d28bd669..a096d9500c1 100644
if (dri2_conf) {
if (dri2_conf->base.ConfigID == count + 1)
count++;
@@ -1654,6 +1800,23 @@ dri2_wl_swrast_get_stride_for_format(int format, int w)
@@ -2252,6 +2398,23 @@ dri2_wl_swrast_get_stride_for_format(int format, int w)
return w * (dri2_wl_visuals[visual_idx].bpp / 8);
}
@@ -369,7 +374,7 @@ index 811d28bd669..a096d9500c1 100644
static EGLBoolean
dri2_wl_swrast_allocate_buffer(struct dri2_egl_surface *dri2_surf,
int format, int w, int h,
@@ -1775,8 +1938,24 @@ swrast_update_buffers(struct dri2_egl_surface *dri2_surf)
@@ -2383,8 +2546,24 @@ swrast_update_buffers(struct dri2_egl_surface *dri2_surf)
return 0;
}
@@ -395,7 +400,7 @@ index 811d28bd669..a096d9500c1 100644
{
/* if there has been a resize: */
if (!dri2_surf->current)
@@ -1846,7 +2025,9 @@ dri2_wl_swrast_get_drawable_info(__DRIdrawable * draw,
@@ -2454,7 +2633,9 @@ dri2_wl_swrast_get_drawable_info(__DRIdrawable * draw,
{
struct dri2_egl_surface *dri2_surf = loaderPrivate;
@@ -406,7 +411,7 @@ index 811d28bd669..a096d9500c1 100644
*x = 0;
*y = 0;
*w = dri2_surf->base.Width;
@@ -1865,7 +2046,11 @@ dri2_wl_swrast_get_image(__DRIdrawable * read,
@@ -2473,7 +2654,11 @@ dri2_wl_swrast_get_image(__DRIdrawable * read,
int dst_stride = copy_width;
char *src, *dst;
@@ -419,7 +424,7 @@ index 811d28bd669..a096d9500c1 100644
if (!src) {
memset(data, 0, copy_width * h);
return;
@@ -1903,14 +2088,20 @@ dri2_wl_swrast_put_image2(__DRIdrawable * draw, int op,
@@ -2511,14 +2696,20 @@ dri2_wl_swrast_put_image2(__DRIdrawable * draw, int op,
assert(copy_width <= stride);
@@ -447,7 +452,7 @@ index 811d28bd669..a096d9500c1 100644
dst += x_offset;
dst += y * dst_stride;
@@ -1928,7 +2119,9 @@ dri2_wl_swrast_put_image2(__DRIdrawable * draw, int op,
@@ -2536,7 +2727,9 @@ dri2_wl_swrast_put_image2(__DRIdrawable * draw, int op,
src += stride;
dst += dst_stride;
}
@@ -458,7 +463,7 @@ index 811d28bd669..a096d9500c1 100644
}
static void
@@ -1996,6 +2189,7 @@ static const struct dri2_egl_display_vtbl dri2_wl_swrast_display_vtbl = {
@@ -2608,6 +2801,7 @@ static const struct dri2_egl_display_vtbl dri2_wl_swrast_display_vtbl = {
.authenticate = NULL,
.create_window_surface = dri2_wl_create_window_surface,
.create_pixmap_surface = dri2_wl_create_pixmap_surface,
@@ -1,7 +1,7 @@
From 90c87ad050dd7a4deda3ee1609e6cc27ea7dd616 Mon Sep 17 00:00:00 2001
From 1ae8f535fa7ce80768011d045d17281c264a3ab0 Mon Sep 17 00:00:00 2001
From: Eric Engestrom <eric.engestrom@imgtec.com>
Date: Mon, 25 Sep 2017 15:58:49 +0100
Subject: [PATCH 28/67] egl: eglBindAPI workaround for dEQP bug
Subject: [PATCH 21/58] egl: eglBindAPI workaround for dEQP bug
dEQP relies on eglBindAPI to only return true if the API can
successfully be used to create contexts, which the spec does not
@@ -1,7 +1,7 @@
From a763c01172ee21a26f4c9dbb6055093f78d06fb2 Mon Sep 17 00:00:00 2001
From 663288d629863e919d509df0678bfea6b3be5d51 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Tue, 30 Jan 2018 10:25:11 +0000
Subject: [PATCH 29/67] GL_EXT_multi_draw_indirect entry points
Subject: [PATCH 22/58] GL_EXT_multi_draw_indirect entry points
---
src/mapi/glapi/gen/es_EXT.xml | 19 +++++++++++++++++++
@@ -9,7 +9,7 @@ Subject: [PATCH 29/67] GL_EXT_multi_draw_indirect entry points
2 files changed, 21 insertions(+)
diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index fe8f27e1e6f..e0d60faa9d2 100644
index b59e85d3281..6ff5432e029 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -1140,6 +1140,25 @@
@@ -39,15 +39,15 @@ index fe8f27e1e6f..e0d60faa9d2 100644
<function name="CopyImageSubDataEXT" alias="CopyImageSubData" es2="3.0">
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index dc6bdc9dcce..e231c176264 100644
index fda952a1bdb..53f381e9297 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1704,6 +1704,8 @@ offsets = {
"FramebufferTextureLayerDownsampleIMG" : 1668,
"FramebufferTextureMultiviewOVR" : 1669,
"FramebufferTextureMultisampleMultiviewOVR" : 1670,
+ "MultiDrawArraysIndirectEXT" : 1671,
+ "MultiDrawElementsIndirectEXT" : 1672,
@@ -1705,6 +1705,8 @@ offsets = {
"FramebufferTextureLayerDownsampleIMG" : 1669,
"FramebufferTextureMultiviewOVR" : 1670,
"FramebufferTextureMultisampleMultiviewOVR" : 1671,
+ "MultiDrawArraysIndirectEXT" : 1672,
+ "MultiDrawElementsIndirectEXT" : 1673,
}
functions = [
@@ -1,380 +0,0 @@
From 404c0e915de381c2337c79657f80b0aa95c1c995 Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Wed, 25 Oct 2017 18:15:00 +0100
Subject: [PATCH 22/67] egl/tizen: create an internal _EGLImage for each tbm
surface
Create an internal _EGLImage the first time a tbm surface is seen
by eglCreateImageKHR (with either the EGL_WAYLAND_BUFFER_WL or
EGL_NATIVE_SURFACE_TIZEN target) and return a copy of it to the
caller. This avoids some tbm surfaces being frequently mapped and
then unmapped from the GPU.
---
src/egl/drivers/dri2/egl_dri2.c | 236 +++++++++++++++++++++++++-
src/egl/drivers/dri2/egl_dri2.h | 12 ++
src/egl/drivers/dri2/platform_tizen.c | 6 +
3 files changed, 251 insertions(+), 3 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index eaa0baed066..db993f8f059 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1264,6 +1264,10 @@ dri2_display_destroy(_EGLDisplay *disp)
break;
#ifdef HAVE_TIZEN_PLATFORM
case _EGL_PLATFORM_TIZEN:
+ if (dri2_dpy->image_list_mutex_initialized) {
+ pthread_mutex_destroy(&dri2_dpy->image_list_mutex);
+ dri2_dpy->image_list_mutex_initialized = false;
+ }
if (dri2_dpy->tpl_dpy)
tpl_object_unreference((tpl_object_t *) dri2_dpy->tpl_dpy);
break;
@@ -1320,6 +1324,60 @@ dri2_egl_surface_free_local_buffers(struct dri2_egl_surface *dri2_surf)
}
}
+static void
+dri2_display_release_resources_tizen(_EGLDisplay *disp)
+{
+#ifdef HAVE_TIZEN_PLATFORM
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+ _EGLResource *image_elem;
+
+ /* Destroy _EGLImages in the image_list */
+ pthread_mutex_lock(&dri2_dpy->image_list_mutex);
+ image_elem = dri2_dpy->image_list;
+ dri2_dpy->image_list = NULL;
+ pthread_mutex_unlock(&dri2_dpy->image_list_mutex);
+
+ while (image_elem) {
+ _EGLImage *img = (_EGLImage *) image_elem;
+ struct dri2_egl_image *dri2_img = dri2_egl_image(img);
+
+ image_elem = image_elem->Next;
+
+ /*
+ * Delete the tbm surface user data (_EGLImage), unless the tbm surface
+ * was destroyed since we started processing the image_list.
+ */
+ if (dri2_img->tbm_surf)
+ tbm_surface_internal_delete_user_data(dri2_img->tbm_surf,
+ (unsigned long) disp);
+
+ /*
+ * dri2_orphan_tbm_surf_egl_image won't be able to transfer the
+ * _EGLImage to the orphan_image_list once we have started processing
+ * the image_list so we must destroy it ourselves.
+ */
+ dri2_dpy->image->destroyImage(dri2_img->dri_image);
+ free(dri2_img);
+ }
+
+ /* Destroy _EGLimages in the orphan_image_list*/
+ pthread_mutex_lock(&dri2_dpy->image_list_mutex);
+ image_elem = dri2_dpy->orphan_image_list;
+ dri2_dpy->orphan_image_list = NULL;
+ pthread_mutex_unlock(&dri2_dpy->image_list_mutex);
+
+ while (image_elem) {
+ _EGLImage *img = (_EGLImage *) image_elem;
+ struct dri2_egl_image *dri2_img = dri2_egl_image(img);
+
+ image_elem = image_elem->Next;
+
+ dri2_dpy->image->destroyImage(dri2_img->dri_image);
+ free(dri2_img);
+ }
+#endif
+}
+
/**
* Called via eglTerminate(), drv->Terminate().
*
@@ -1332,6 +1390,8 @@ dri2_terminate(_EGLDisplay *disp)
/* Release all non-current Context/Surfaces. */
_eglReleaseDisplayResources(disp);
+ dri2_display_release_resources_tizen(disp);
+
dri2_display_release(disp);
return EGL_TRUE;
@@ -2309,6 +2369,9 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx,
}
#ifdef HAVE_TIZEN_PLATFORM
+static EGLBoolean
+dri2_destroy_image_khr(_EGLDisplay *disp, _EGLImage *image);
+
int
dri2_fourcc_from_tbm_format(tbm_format format)
{
@@ -2405,14 +2468,145 @@ fail_close:
return NULL;
}
+static void
+dri2_orphan_tbm_surf_egl_image(void *user_data)
+{
+ _EGLImage *img = user_data;
+ struct dri2_egl_image *dri2_img = dri2_egl_image(img);
+ _EGLDisplay *disp = img->Resource.Display;
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+
+ /*
+ * Transfer the passed in _EGLImage from the image_list to the
+ * orphan_image_list so that it can be cleaned up at some later
+ * point. This is necessary as the disp->Mutex needs to be held
+ * in order destroy the _EGLImage and this could potentially cause
+ * a deadlock in the event that the tbm surface is destroyed.
+ */
+ pthread_mutex_lock(&dri2_dpy->image_list_mutex);
+ /*
+ * This may be NULL if called via dri2_terminate or if dri2_terminate is
+ * running in another thread.
+ */
+ if (dri2_dpy->image_list) {
+ _EGLResource *image_elem;
+
+ /* Remove the _EGLImage from the image_list */
+ image_elem = dri2_dpy->image_list;
+ if (image_elem != &img->Resource) {
+ while (image_elem) {
+ if (image_elem->Next == &img->Resource)
+ break;
+ image_elem = image_elem->Next;
+ }
+ image_elem->Next = img->Resource.Next;
+ } else {
+ dri2_dpy->image_list = img->Resource.Next;
+ }
+
+ /* Add the _EGLImage to the orphan_image_list */
+ img->Resource.Next = dri2_dpy->orphan_image_list;
+ dri2_dpy->orphan_image_list = &img->Resource;
+ }
+
+ /*
+ * This function may have been called via tbm_surface_destroy so tbm_surf
+ * may be invalid after this function returns.
+ */
+ dri2_img->tbm_surf = NULL;
+ pthread_mutex_unlock(&dri2_dpy->image_list_mutex);
+}
+
+static _EGLImage *
+dri2_get_tbm_surf_egl_image(_EGLDisplay *disp, _EGLContext *ctx,
+ tbm_surface_h tbm_surf)
+{
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+ struct dri2_egl_image *dri2_img;
+ _EGLImage *img;
+ int ret;
+
+ ret = tbm_surface_internal_get_user_data(tbm_surf, (unsigned long) disp,
+ (void **) &img);
+ if (ret)
+ return img;
+
+ img = dri2_create_image_tbm_surface(disp, ctx, tbm_surf);
+ if (!img) {
+ _eglError(EGL_BAD_PARAMETER, "dri2_create_image_tbm_surface failed");
+ goto fail_exit;
+ }
+ dri2_img = dri2_egl_image(img);
+
+ /* Use 'disp' as the 'key' as the _EGLimage is tied to it */
+ ret = tbm_surface_internal_add_user_data(tbm_surf, (unsigned long) disp,
+ dri2_orphan_tbm_surf_egl_image);
+ if (!ret) {
+ _eglError(EGL_BAD_PARAMETER, "dri2_get_tbm_surf_egl_image");
+ goto fail_destroy_image;
+ }
+
+ ret = tbm_surface_internal_set_user_data(tbm_surf, (unsigned long) disp, img);
+ if (!ret) {
+ _eglError(EGL_BAD_PARAMETER, "dri2_get_tbm_surf_egl_image");
+ goto fail_delete_user_data;
+ }
+
+ /*
+ * Store the tbm surface so that the user data (_EGLImage) can be destroyed
+ * in dri2_terminate. We don't take a reference on the surface as this would
+ * prevent it from being destroyed until eglTerminate is called. This isn't
+ * an issue since it will be set to NULL, via dri2_orphan_tbm_surf_egl_image,
+ * once the surface is destroyed (although it's actually safe to call tbm
+ * surface functions with stale/NULL pointers).
+ */
+ dri2_img->tbm_surf = tbm_surf;
+
+ /*
+ * Add to the list of _EGLImages that are associated with tbm surfaces.
+ * This allows the _EGLImage to be destroyed if the application calls
+ * eglTerminate before the tbm surface is destroyed.
+ */
+ pthread_mutex_lock(&dri2_dpy->image_list_mutex);
+ img->Resource.Next = dri2_dpy->image_list;
+ dri2_dpy->image_list = &img->Resource;
+ pthread_mutex_unlock(&dri2_dpy->image_list_mutex);
+
+ return img;
+
+fail_delete_user_data:
+ tbm_surface_internal_delete_user_data(tbm_surf, (unsigned long) disp);
+fail_destroy_image:
+ dri2_destroy_image_khr(disp, img);
+fail_exit:
+ return NULL;
+}
+
static _EGLImage *
dri2_create_image_tizen(_EGLDisplay *disp, _EGLContext *ctx,
EGLClientBuffer _buffer,
const EGLint *attr_list)
{
- tbm_surface_h tbm_surf = (tbm_surface_h)_buffer;
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+ tbm_surface_h tbm_surf = (tbm_surface_h) _buffer;
+ _EGLImage *img;
+ struct dri2_egl_image *dri2_img;
+ __DRIimage *dri_image;
+
+ img = dri2_get_tbm_surf_egl_image(disp, ctx, tbm_surf);
+ if (!img) {
+ _eglError(EGL_BAD_PARAMETER, "dri2_create_image_tizen");
+ return NULL;
+ }
+ dri2_img = dri2_egl_image(img);
+
+ dri_image = dri2_dpy->image->fromPlanar(dri2_img->dri_image, 0, NULL);
+ if (!dri_image) {
+ _eglError(EGL_BAD_PARAMETER, "dri2_create_image_tizen");
+ return NULL;
+ }
- return dri2_create_image_tbm_surface(disp, ctx, tbm_surf);
+ return dri2_create_image_from_dri(disp, dri_image);
}
static _EGLImage *
@@ -2424,6 +2618,9 @@ dri2_create_image_wayland_wl_buffer_tizen(_EGLDisplay *disp, _EGLContext *ctx,
_EGLImageAttribs attrs;
tbm_surface_h tbm_surf;
tbm_surface_info_s info;
+ _EGLImage *img;
+ struct dri2_egl_image *dri2_img;
+ __DRIimage *dri_image;
tbm_surf = tpl_display_get_buffer_from_native_pixmap(dri2_dpy->tpl_dpy,
(tpl_handle_t) _buffer);
@@ -2454,7 +2651,21 @@ dri2_create_image_wayland_wl_buffer_tizen(_EGLDisplay *disp, _EGLContext *ctx,
return NULL;
}
- return dri2_create_image_tbm_surface(disp, ctx, tbm_surf);
+ img = dri2_get_tbm_surf_egl_image(disp, ctx, tbm_surf);
+ if (!img) {
+ _eglError(EGL_BAD_PARAMETER, "dri2_create_image_wayland_wl_buffer_tizen");
+ return NULL;
+ }
+ dri2_img = dri2_egl_image(img);
+
+ dri_image =
+ dri2_dpy->image->fromPlanar(dri2_img->dri_image, attrs.PlaneWL, NULL);
+ if (!dri_image) {
+ _eglError(EGL_BAD_PARAMETER, "dri2_create_image_wayland_wl_buffer_tizen");
+ return NULL;
+ }
+
+ return dri2_create_image_from_dri(disp, dri_image);
}
#endif
@@ -3377,10 +3588,29 @@ dri2_destroy_image_khr(_EGLDisplay *disp, _EGLImage *image)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_image *dri2_img = dri2_egl_image(image);
+#ifdef HAVE_TIZEN_PLATFORM
+ _EGLResource *image_elem;
+#endif
dri2_dpy->image->destroyImage(dri2_img->dri_image);
free(dri2_img);
+#ifdef HAVE_TIZEN_PLATFORM
+ /* Take the opportunity to destroy orphaned tbm surface _EGLImages */
+ pthread_mutex_lock(&dri2_dpy->image_list_mutex);
+ image_elem = dri2_dpy->orphan_image_list;
+ dri2_dpy->orphan_image_list = NULL;
+ pthread_mutex_unlock(&dri2_dpy->image_list_mutex);
+
+ while (image_elem) {
+ dri2_img = dri2_egl_image((_EGLImage *) image_elem);
+ image_elem = image_elem->Next;
+
+ dri2_dpy->image->destroyImage(dri2_img->dri_image);
+ free(dri2_img);
+ }
+#endif
+
return EGL_TRUE;
}
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index a8bfe45b1f5..546bc0a0dbc 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -268,6 +268,15 @@ struct dri2_egl_display
#ifdef HAVE_TIZEN_PLATFORM
tpl_display_t *tpl_dpy;
+ /*
+ * The image_list_mutex protects the image_list and orphan_image_list. It
+ * should never be held while calling a libtbm function as this may result
+ * in a deadlock.
+ */
+ pthread_mutex_t image_list_mutex;
+ bool image_list_mutex_initialized;
+ _EGLResource *image_list;
+ _EGLResource *orphan_image_list;
#endif
};
@@ -413,6 +422,9 @@ struct dri2_egl_image
{
_EGLImage base;
__DRIimage *dri_image;
+#ifdef HAVE_TIZEN_PLATFORM
+ tbm_surface_h tbm_surf;
+#endif
};
struct dri2_egl_sync {
diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c
index ad75c115d7e..49462152beb 100644
--- a/src/egl/drivers/dri2/platform_tizen.c
+++ b/src/egl/drivers/dri2/platform_tizen.c
@@ -891,6 +891,7 @@ dri2_initialize_tizen(_EGLDisplay *dpy)
{
struct dri2_egl_display *dri2_dpy;
int i;
+ int err;
dri2_dpy = calloc(1, sizeof(*dri2_dpy));
if (!dri2_dpy)
@@ -906,6 +907,11 @@ dri2_initialize_tizen(_EGLDisplay *dpy)
goto cleanup;
}
+ err = pthread_mutex_init(&dri2_dpy->image_list_mutex, NULL);
+ if (err)
+ goto cleanup;
+ dri2_dpy->image_list_mutex_initialized = true;
+
for (i = TIZEN_DRM_RENDER_MINOR_START; i <= TIZEN_DRM_RENDER_MINOR_MAX; i++) {
char *render_path;
--
2.25.1
@@ -1,33 +1,31 @@
From 389e1a41360160bf56182a87cc52b5df9dc1265d Mon Sep 17 00:00:00 2001
From bfda2098179b9b79124d267b312948f5b9c7b5cf Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Fri, 22 Dec 2017 17:17:50 +0000
Subject: [PATCH 30/67] dri: add support for YUV DRI config
Subject: [PATCH 23/58] dri: add support for YUV DRI config
This is prerequisite for adding support for EGL_EXT_yuv_surface.
This also adds support for NV12 and NV21 EGL configs.
---
include/GL/internal/dri_interface.h | 42 ++++++++-
include/GL/internal/dri_interface.h | 48 ++++++++-
src/gallium/frontends/dri/dri_screen.c | 8 +-
src/gallium/include/pipe/p_format.h | 2 +
src/mesa/drivers/dri/common/utils.c | 88 +++++++++++++++++--
src/mesa/drivers/dri/common/utils.h | 3 +-
src/mesa/drivers/dri/i915/intel_screen.c | 8 +-
src/mesa/drivers/dri/i965/brw_screen.c | 12 ++-
src/mesa/drivers/dri/nouveau/nouveau_screen.c | 4 +-
src/mesa/drivers/dri/radeon/radeon_screen.c | 4 +-
src/gallium/frontends/dri/utils.c | 133 ++++++++++++++++++++++--
src/gallium/frontends/dri/utils.h | 3 +-
src/gallium/frontends/pvr/dri_support.h | 5 +
src/gallium/frontends/pvr/pvrutil.c | 34 ++++++
src/gallium/include/pipe/p_format.h | 9 ++
src/mesa/main/format_info.py | 2 +-
src/mesa/main/formats.c | 9 ++
src/mesa/main/formats.csv | 2 +
src/mesa/main/formats.h | 7 ++
src/mesa/main/mtypes.h | 9 ++
14 files changed, 181 insertions(+), 19 deletions(-)
src/mesa/main/formats.c | 13 +++
src/mesa/main/formats.csv | 6 ++
src/mesa/main/formats.h | 15 +++
src/mesa/main/glconfig.h | 9 ++
12 files changed, 273 insertions(+), 12 deletions(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 16cc095ea29..4d5a1874dc2 100644
index ef2f44fad02..24ccf864f74 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -826,7 +826,13 @@ struct __DRIuseInvalidateExtensionRec {
@@ -720,7 +720,13 @@ struct __DRIuseInvalidateExtensionRec {
#define __DRI_ATTRIB_GREEN_SHIFT 51
#define __DRI_ATTRIB_BLUE_SHIFT 52
#define __DRI_ATTRIB_ALPHA_SHIFT 53
@@ -42,7 +40,7 @@ index 16cc095ea29..4d5a1874dc2 100644
/* __DRI_ATTRIB_RENDER_TYPE */
#define __DRI_ATTRIB_RGBA_BIT 0x01
@@ -834,6 +840,7 @@ struct __DRIuseInvalidateExtensionRec {
@@ -728,6 +734,7 @@ struct __DRIuseInvalidateExtensionRec {
#define __DRI_ATTRIB_LUMINANCE_BIT 0x04
#define __DRI_ATTRIB_FLOAT_BIT 0x08
#define __DRI_ATTRIB_UNSIGNED_FLOAT_BIT 0x10
@@ -50,7 +48,7 @@ index 16cc095ea29..4d5a1874dc2 100644
/* __DRI_ATTRIB_CONFIG_CAVEAT */
#define __DRI_ATTRIB_SLOW_BIT 0x01
@@ -860,6 +867,39 @@ struct __DRIuseInvalidateExtensionRec {
@@ -754,6 +761,39 @@ struct __DRIuseInvalidateExtensionRec {
#define __DRI_ATTRIB_SWAP_COPY 0x8062
#define __DRI_ATTRIB_SWAP_UNDEFINED 0x8063
@@ -90,11 +88,24 @@ index 16cc095ea29..4d5a1874dc2 100644
/**
* This extension defines the core DRI functionality.
*
@@ -1214,6 +1254,12 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_FORMAT_ARGB4444 0x1018
#define __DRI_IMAGE_FORMAT_YVU444_PACK10_IMG 0x1019
#define __DRI_IMAGE_FORMAT_BGR888 0x101a
+#define __DRI_IMAGE_FORMAT_NV12 0x101b
+#define __DRI_IMAGE_FORMAT_NV21 0x101c
+#define __DRI_IMAGE_FORMAT_YU12 0x101d
+#define __DRI_IMAGE_FORMAT_YV12 0x101e
+#define __DRI_IMAGE_FORMAT_YVYU 0x101f
+#define __DRI_IMAGE_FORMAT_VYUY 0x1020
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
diff --git a/src/gallium/frontends/dri/dri_screen.c b/src/gallium/frontends/dri/dri_screen.c
index b565a1fe8ec..37a0d4add0c 100644
index e68a8c19eec..903162aab8c 100644
--- a/src/gallium/frontends/dri/dri_screen.c
+++ b/src/gallium/frontends/dri/dri_screen.c
@@ -324,7 +324,9 @@ dri_fill_in_modes(struct dri_screen *screen)
@@ -273,7 +273,9 @@ dri_fill_in_modes(struct dri_screen *screen)
depth_buffer_factor, back_buffer_modes,
ARRAY_SIZE(back_buffer_modes),
msaa_modes, 1,
@@ -105,7 +116,7 @@ index b565a1fe8ec..37a0d4add0c 100644
configs = driConcatConfigs(configs, new_configs);
/* Multi-sample configs without an accumulation buffer. */
@@ -334,7 +336,9 @@ dri_fill_in_modes(struct dri_screen *screen)
@@ -283,7 +285,9 @@ dri_fill_in_modes(struct dri_screen *screen)
depth_buffer_factor, back_buffer_modes,
ARRAY_SIZE(back_buffer_modes),
msaa_modes+1, num_msaa_modes-1,
@@ -116,24 +127,11 @@ index b565a1fe8ec..37a0d4add0c 100644
configs = driConcatConfigs(configs, new_configs);
}
}
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index 0c93d7df6e2..fd653379b7a 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -513,6 +513,8 @@ enum pipe_format {
PIPE_FORMAT_R4G4B4X4_UNORM,
PIPE_FORMAT_B10G10R10X2_SNORM,
PIPE_FORMAT_R5G6B5_SRGB,
+ PIPE_FORMAT_YUV420_2PLANE,
+ PIPE_FORMAT_YVU420_2PLANE,
PIPE_FORMAT_COUNT
};
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index a3f2bc57f46..d268dc41fbb 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -163,6 +163,21 @@ driGetRendererString( char * buffer, const char * hardware_name,
diff --git a/src/gallium/frontends/dri/utils.c b/src/gallium/frontends/dri/utils.c
index 9fb940cf12f..c27d150d7e5 100644
--- a/src/gallium/frontends/dri/utils.c
+++ b/src/gallium/frontends/dri/utils.c
@@ -108,6 +108,21 @@
* This forces 32-bit color to have 24-bit depth, and
* 16-bit color to have 16-bit depth.
*
@@ -155,7 +153,7 @@ index a3f2bc57f46..d268dc41fbb 100644
* \returns
* Pointer to any array of pointers to the \c __DRIconfig structures created
* for the specified formats. If there is an error, \c NULL is returned.
@@ -175,7 +190,8 @@ driCreateConfigs(mesa_format format,
@@ -120,7 +135,8 @@ driCreateConfigs(mesa_format format,
unsigned num_depth_stencil_bits,
const GLenum * db_modes, unsigned num_db_modes,
const uint8_t * msaa_samples, unsigned num_msaa_modes,
@@ -165,7 +163,7 @@ index a3f2bc57f46..d268dc41fbb 100644
{
static const struct {
uint32_t masks[4];
@@ -214,6 +230,9 @@ driCreateConfigs(mesa_format format,
@@ -159,6 +175,9 @@ driCreateConfigs(mesa_format format,
/* MESA_FORMAT_RGBA_FLOAT16 */
{{ 0, 0, 0, 0},
{ 0, 16, 32, 48 }},
@@ -175,7 +173,7 @@ index a3f2bc57f46..d268dc41fbb 100644
};
const uint32_t * masks;
@@ -227,6 +246,11 @@ driCreateConfigs(mesa_format format,
@@ -172,6 +191,11 @@ driCreateConfigs(mesa_format format,
int green_bits;
int blue_bits;
int alpha_bits;
@@ -187,7 +185,7 @@ index a3f2bc57f46..d268dc41fbb 100644
bool is_srgb;
bool is_float;
@@ -279,6 +303,33 @@ driCreateConfigs(mesa_format format,
@@ -224,6 +248,78 @@ driCreateConfigs(mesa_format format,
masks = format_table[8].masks;
shifts = format_table[8].shifts;
break;
@@ -217,11 +215,56 @@ index a3f2bc57f46..d268dc41fbb 100644
+ yuv_num_planes = 2;
+ yuv_subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_0_BIT;
+ yuv_plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT;
+ break;
+ case MESA_FORMAT_YUV420_3PLANE:
+ masks = format_table[11].masks;
+ shifts = format_table[11].shifts;
+ is_yuv = true; /* FIXME: This should come from formats_info.py */
+ yuv_order = __DRI_ATTRIB_YUV_ORDER_YUV_BIT;
+ yuv_num_planes = 3;
+ yuv_subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_0_BIT;
+ yuv_plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT;
+ break;
+ case MESA_FORMAT_YVU420_3PLANE:
+ masks = format_table[11].masks;
+ shifts = format_table[11].shifts;
+ is_yuv = true; /* FIXME: This should come from formats_info.py */
+ yuv_order = __DRI_ATTRIB_YUV_ORDER_YVU_BIT;
+ yuv_num_planes = 3;
+ yuv_subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_0_BIT;
+ yuv_plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT;
+ break;
+ case MESA_FORMAT_YCBCR_REV:
+ masks = format_table[11].masks;
+ shifts = format_table[11].shifts;
+ is_yuv = true; /* FIXME: This should come from formats_info.py */
+ yuv_order = __DRI_ATTRIB_YUV_ORDER_UYVY_BIT;
+ yuv_num_planes = 1;
+ yuv_subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_2_BIT;
+ yuv_plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT;
+ break;
+ case MESA_FORMAT_VYUY:
+ masks = format_table[11].masks;
+ shifts = format_table[11].shifts;
+ is_yuv = true; /* FIXME: This should come from formats_info.py */
+ yuv_order = __DRI_ATTRIB_YUV_ORDER_VYUY_BIT;
+ yuv_num_planes = 1;
+ yuv_subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_2_BIT;
+ yuv_plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT;
+ break;
+ case MESA_FORMAT_YVYU:
+ masks = format_table[11].masks;
+ shifts = format_table[11].shifts;
+ is_yuv = true; /* FIXME: This should come from formats_info.py */
+ yuv_order = __DRI_ATTRIB_YUV_ORDER_YVYU_BIT;
+ yuv_num_planes = 1;
+ yuv_subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_2_BIT;
+ yuv_plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT;
+ break;
default:
fprintf(stderr, "[%s:%u] Unknown framebuffer type %s (%d).\n",
__func__, __LINE__,
@@ -334,8 +385,12 @@ driCreateConfigs(mesa_format format,
@@ -279,8 +375,12 @@ driCreateConfigs(mesa_format format,
modes->greenShift = shifts[1];
modes->blueShift = shifts[2];
modes->alphaShift = shifts[3];
@@ -236,7 +279,7 @@ index a3f2bc57f46..d268dc41fbb 100644
modes->accumRedBits = 16 * j;
modes->accumGreenBits = 16 * j;
@@ -345,6 +400,8 @@ driCreateConfigs(mesa_format format,
@@ -290,6 +390,8 @@ driCreateConfigs(mesa_format format,
modes->stencilBits = stencil_bits[k];
modes->depthBits = depth_bits[k];
@@ -245,7 +288,7 @@ index a3f2bc57f46..d268dc41fbb 100644
if (db_modes[i] == __DRI_ATTRIB_SWAP_NONE) {
modes->doubleBufferMode = GL_FALSE;
modes->swapMethod = __DRI_ATTRIB_SWAP_UNDEFINED;
@@ -357,6 +414,13 @@ driCreateConfigs(mesa_format format,
@@ -302,6 +404,13 @@ driCreateConfigs(mesa_format format,
modes->samples = msaa_samples[h];
modes->sRGBCapable = is_srgb;
@@ -259,7 +302,7 @@ index a3f2bc57f46..d268dc41fbb 100644
}
}
}
@@ -436,10 +500,14 @@ driGetConfigAttribIndex(const __DRIconfig *config,
@@ -381,10 +490,14 @@ driGetConfigAttribIndex(const __DRIconfig *config,
break;
__ATTRIB(__DRI_ATTRIB_SAMPLES, samples);
case __DRI_ATTRIB_RENDER_TYPE:
@@ -278,7 +321,7 @@ index a3f2bc57f46..d268dc41fbb 100644
break;
case __DRI_ATTRIB_CONFIG_CAVEAT:
if (config->modes.accumRedBits != 0)
@@ -505,6 +573,12 @@ driGetConfigAttribIndex(const __DRIconfig *config,
@@ -450,6 +563,12 @@ driGetConfigAttribIndex(const __DRIconfig *config,
__ATTRIB(__DRI_ATTRIB_GREEN_SHIFT, greenShift);
__ATTRIB(__DRI_ATTRIB_BLUE_SHIFT, blueShift);
__ATTRIB(__DRI_ATTRIB_ALPHA_SHIFT, alphaShift);
@@ -291,11 +334,11 @@ index a3f2bc57f46..d268dc41fbb 100644
default:
/* XXX log an error or smth */
return GL_FALSE;
diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h
index 7be0465c261..ebd98d9dc33 100644
--- a/src/mesa/drivers/dri/common/utils.h
+++ b/src/mesa/drivers/dri/common/utils.h
@@ -45,7 +45,8 @@ driCreateConfigs(mesa_format format,
diff --git a/src/gallium/frontends/dri/utils.h b/src/gallium/frontends/dri/utils.h
index c30c8faab54..8e2b5e9671a 100644
--- a/src/gallium/frontends/dri/utils.h
+++ b/src/gallium/frontends/dri/utils.h
@@ -43,7 +43,8 @@ driCreateConfigs(mesa_format format,
unsigned num_depth_stencil_bits,
const GLenum * db_modes, unsigned num_db_modes,
const uint8_t * msaa_samples, unsigned num_msaa_modes,
@@ -305,123 +348,150 @@ index 7be0465c261..ebd98d9dc33 100644
__DRIconfig **driConcatConfigs(__DRIconfig **a,
__DRIconfig **b);
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 6135357c2a0..a94c6de0a06 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -1083,7 +1083,9 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
num_depth_stencil_bits,
back_buffer_modes, 2,
singlesample_samples, 1,
- false, false);
+ false, false,
+ __DRI_ATTRIB_YUV_DEPTH_RANGE_NONE,
+ __DRI_ATTRIB_YUV_CSC_STANDARD_NONE);
configs = driConcatConfigs(configs, new_configs);
}
diff --git a/src/gallium/frontends/pvr/dri_support.h b/src/gallium/frontends/pvr/dri_support.h
index 631410438fd..ca928cf9cef 100644
--- a/src/gallium/frontends/pvr/dri_support.h
+++ b/src/gallium/frontends/pvr/dri_support.h
@@ -92,6 +92,11 @@ typedef enum
#define PVRDRI_MESA_FORMAT_YVU420_2PLANE 8
#define PVRDRI_MESA_FORMAT_B8G8R8A8_SRGB 9
#define PVRDRI_MESA_FORMAT_R8G8B8A8_SRGB 10
+#define PVRDRI_MESA_FORMAT_YUV420_3PLANE 11
+#define PVRDRI_MESA_FORMAT_YVU420_3PLANE 12
+#define PVRDRI_MESA_FORMAT_YCBCR_REV 13
+#define PVRDRI_MESA_FORMAT_YVYU 14
+#define PVRDRI_MESA_FORMAT_VYUY 15
@@ -1105,7 +1107,9 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
depth_bits, stencil_bits, 1,
back_buffer_modes, 1,
singlesample_samples, 1,
- true, false);
+ true, false,
+ __DRI_ATTRIB_YUV_DEPTH_RANGE_NONE,
+ __DRI_ATTRIB_YUV_CSC_STANDARD_NONE);
configs = driConcatConfigs(configs, new_configs);
}
typedef struct __DRIimageRec __DRIimage;
diff --git a/src/mesa/drivers/dri/i965/brw_screen.c b/src/mesa/drivers/dri/i965/brw_screen.c
index 56811110567..c450bae1054 100644
--- a/src/mesa/drivers/dri/i965/brw_screen.c
+++ b/src/mesa/drivers/dri/i965/brw_screen.c
@@ -2292,7 +2292,9 @@ brw_screen_make_configs(__DRIscreen *dri_screen)
num_depth_stencil_bits,
back_buffer_modes, 2,
singlesample_samples, 1,
- false, false);
+ false, false,
+ __DRI_ATTRIB_YUV_DEPTH_RANGE_NONE,
+ __DRI_ATTRIB_YUV_CSC_STANDARD_NONE);
configs = driConcatConfigs(configs, new_configs);
}
@@ -2325,7 +2327,9 @@ brw_screen_make_configs(__DRIscreen *dri_screen)
depth_bits, stencil_bits, 1,
back_buffer_modes, 1,
singlesample_samples, 1,
- true, false);
+ true, false,
+ __DRI_ATTRIB_YUV_DEPTH_RANGE_NONE,
+ __DRI_ATTRIB_YUV_CSC_STANDARD_NONE);
configs = driConcatConfigs(configs, new_configs);
}
@@ -2390,7 +2394,9 @@ brw_screen_make_configs(__DRIscreen *dri_screen)
back_buffer_modes, 1,
multisample_samples,
num_msaa_modes,
- false, false);
+ false, false,
+ __DRI_ATTRIB_YUV_DEPTH_RANGE_NONE,
+ __DRI_ATTRIB_YUV_CSC_STANDARD_NONE);
configs = driConcatConfigs(configs, new_configs);
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index c92efcd7b20..fc87d5eb395 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -79,7 +79,9 @@ nouveau_get_configs(uint32_t chipset)
ARRAY_SIZE(back_buffer_modes),
msaa_samples,
ARRAY_SIZE(msaa_samples),
- GL_TRUE, chipset < 0x10);
+ GL_TRUE, chipset < 0x10,
+ __DRI_ATTRIB_YUV_DEPTH_RANGE_NONE,
+ __DRI_ATTRIB_YUV_CSC_STANDARD_NONE);
assert(config);
configs = driConcatConfigs(configs, config);
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 3764a5d6538..f7628555b8f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -838,7 +838,9 @@ __DRIconfig **radeonInitScreen2(__DRIscreen *psp)
ARRAY_SIZE(back_buffer_modes),
msaa_samples_array,
ARRAY_SIZE(msaa_samples_array),
- GL_TRUE, GL_FALSE);
+ GL_TRUE, GL_FALSE,
+ __DRI_ATTRIB_YUV_DEPTH_RANGE_NONE,
+ __DRI_ATTRIB_YUV_CSC_STANDARD_NONE);
configs = driConcatConfigs(configs, new_configs);
}
diff --git a/src/gallium/frontends/pvr/pvrutil.c b/src/gallium/frontends/pvr/pvrutil.c
index 4bb114f64ef..2706b02d7bc 100644
--- a/src/gallium/frontends/pvr/pvrutil.c
+++ b/src/gallium/frontends/pvr/pvrutil.c
@@ -114,6 +114,16 @@ PVRDRIMesaFormatToMesaFormat(int pvrdri_mesa_format)
return MESA_FORMAT_B8G8R8A8_SRGB;
case PVRDRI_MESA_FORMAT_R8G8B8A8_SRGB:
return MESA_FORMAT_R8G8B8A8_SRGB;
+ case PVRDRI_MESA_FORMAT_YUV420_3PLANE:
+ return MESA_FORMAT_YUV420_3PLANE;
+ case PVRDRI_MESA_FORMAT_YVU420_3PLANE:
+ return MESA_FORMAT_YVU420_3PLANE;
+ case PVRDRI_MESA_FORMAT_YCBCR_REV:
+ return MESA_FORMAT_YCBCR_REV;
+ case PVRDRI_MESA_FORMAT_YVYU:
+ return MESA_FORMAT_YVYU;
+ case PVRDRI_MESA_FORMAT_VYUY:
+ return MESA_FORMAT_VYUY;
default:
__driUtilMessage("%s: Unknown format: %d", __func__, pvrdri_mesa_format);
break;
@@ -170,6 +180,18 @@ PVRDRIFormatToFourCC(int dri_format)
return DRM_FORMAT_YVU444_PACK10_IMG;
case __DRI_IMAGE_FORMAT_BGR888:
return DRM_FORMAT_BGR888;
+ case __DRI_IMAGE_FORMAT_NV12:
+ return DRM_FORMAT_NV12;
+ case __DRI_IMAGE_FORMAT_NV21:
+ return DRM_FORMAT_NV21;
+ case __DRI_IMAGE_FORMAT_YU12:
+ return DRM_FORMAT_YUV420;
+ case __DRI_IMAGE_FORMAT_YV12:
+ return DRM_FORMAT_YVU420;
+ case __DRI_IMAGE_FORMAT_YVYU:
+ return DRM_FORMAT_YVYU;
+ case __DRI_IMAGE_FORMAT_VYUY:
+ return DRM_FORMAT_VYUY;
default:
__driUtilMessage("%s: Unknown format: %d", __func__, dri_format);
break;
@@ -226,6 +248,18 @@ PVRDRIFourCCToDRIFormat(int iFourCC)
return __DRI_IMAGE_FORMAT_YVU444_PACK10_IMG;
case DRM_FORMAT_BGR888:
return __DRI_IMAGE_FORMAT_BGR888;
+ case DRM_FORMAT_NV12:
+ return __DRI_IMAGE_FORMAT_NV12;
+ case DRM_FORMAT_NV21:
+ return __DRI_IMAGE_FORMAT_NV21;
+ case DRM_FORMAT_YUV420:
+ return __DRI_IMAGE_FORMAT_YU12;
+ case DRM_FORMAT_YVU420:
+ return __DRI_IMAGE_FORMAT_YV12;
+ case DRM_FORMAT_YVYU:
+ return __DRI_IMAGE_FORMAT_YVYU;
+ case DRM_FORMAT_VYUY:
+ return __DRI_IMAGE_FORMAT_VYUY;
default:
__driUtilMessage("%s: Unknown format: %d", __func__, iFourCC);
break;
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index 7dcbe7bb42b..7436f10dcf3 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -178,6 +178,8 @@ enum pipe_format {
PIPE_FORMAT_L16_UNORM, /**< ushort luminance */
PIPE_FORMAT_UYVY,
PIPE_FORMAT_YUYV,
+ PIPE_FORMAT_YVYU,
+ PIPE_FORMAT_VYUY,
PIPE_FORMAT_Z16_UNORM,
PIPE_FORMAT_Z16_UNORM_S8_UINT,
PIPE_FORMAT_Z32_UNORM,
@@ -520,6 +522,11 @@ enum pipe_format {
PIPE_FORMAT_R4G4B4X4_UNORM,
PIPE_FORMAT_B10G10R10X2_SNORM,
PIPE_FORMAT_R5G6B5_SRGB,
+ PIPE_FORMAT_YUV420_2PLANE,
+ PIPE_FORMAT_YVU420_2PLANE,
+
+ PIPE_FORMAT_YUV420_3PLANE,
+ PIPE_FORMAT_YVU420_3PLANE,
PIPE_FORMAT_COUNT
};
@@ -622,6 +629,8 @@ pipe_format_to_chroma_format(enum pipe_format format)
return PIPE_VIDEO_CHROMA_FORMAT_420;
case PIPE_FORMAT_UYVY:
case PIPE_FORMAT_YUYV:
+ case PIPE_FORMAT_VYUY:
+ case PIPE_FORMAT_YVYU:
case PIPE_FORMAT_YV16:
case PIPE_FORMAT_Y8_U8_V8_422_UNORM:
case PIPE_FORMAT_Y8_U8V8_422_UNORM:
diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py
index edc0324e60b..d58403ea85e 100644
index 37b46a27c31..9aa1bb9fc63 100644
--- a/src/mesa/main/format_info.py
+++ b/src/mesa/main/format_info.py
@@ -29,7 +29,7 @@ import sys
@@ -27,7 +27,7 @@ import sys
def get_gl_base_format(fmat):
if fmat.name == 'MESA_FORMAT_NONE':
return 'GL_NONE'
- elif fmat.name in ['MESA_FORMAT_YCBCR', 'MESA_FORMAT_YCBCR_REV']:
+ elif fmat.name in ['MESA_FORMAT_YCBCR', 'MESA_FORMAT_YCBCR_REV', 'MESA_FORMAT_YUV420_2PLANE', 'MESA_FORMAT_YVU420_2PLANE']:
+ elif fmat.name in ['MESA_FORMAT_YCBCR', 'MESA_FORMAT_YCBCR_REV', 'MESA_FORMAT_YUV420_2PLANE', 'MESA_FORMAT_YVU420_2PLANE', 'MESA_FORMAT_YUV420_3PLANE', 'MESA_FORMAT_YVU420_3PLANE', 'MESA_FORMAT_YVYU', 'MESA_FORMAT_VYUY']:
return 'GL_YCBCR_MESA'
elif fmat.has_channel('r'):
if fmat.has_channel('g'):
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 9cd026f7507..f81caeceff4 100644
index 9cd026f7507..c63e1677717 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -1452,6 +1452,15 @@ _mesa_format_matches_format_and_type(mesa_format mformat,
@@ -1024,6 +1024,8 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format,
case MESA_FORMAT_YCBCR:
case MESA_FORMAT_YCBCR_REV:
+ case MESA_FORMAT_YVYU:
+ case MESA_FORMAT_VYUY:
case MESA_FORMAT_RG_RB_UNORM8:
case MESA_FORMAT_GR_BR_UNORM8:
*datatype = GL_UNSIGNED_SHORT;
@@ -1452,6 +1454,17 @@ _mesa_format_matches_format_and_type(mesa_format mformat,
if (error)
*error = GL_NO_ERROR;
+ switch (mformat) {
+ case MESA_FORMAT_YUV420_2PLANE:
+ case MESA_FORMAT_YVU420_2PLANE:
+ case MESA_FORMAT_YUV420_3PLANE:
+ case MESA_FORMAT_YVU420_3PLANE:
+ return false;
+
+ default:
@@ -432,41 +502,53 @@ index 9cd026f7507..f81caeceff4 100644
if (error)
*error = GL_INVALID_ENUM;
diff --git a/src/mesa/main/formats.csv b/src/mesa/main/formats.csv
index 21cdea26e08..b2d476577e0 100644
index 21cdea26e08..d1532b19b06 100644
--- a/src/mesa/main/formats.csv
+++ b/src/mesa/main/formats.csv
@@ -92,6 +92,8 @@ MESA_FORMAT_A2R10G10B10_UNORM , packed, 1, 1, 1, un2 , un10, un10, u
@@ -92,6 +92,12 @@ MESA_FORMAT_A2R10G10B10_UNORM , packed, 1, 1, 1, un2 , un10, un10, u
MESA_FORMAT_YCBCR , other , 1, 1, 1, x16 , , , , xyzw, yuv
MESA_FORMAT_YCBCR_REV , other , 1, 1, 1, x16 , , , , xyzw, yuv
+MESA_FORMAT_YUV420_2PLANE , other , 1, 1, 1, x8 , , , , y___, yuv
+MESA_FORMAT_YVU420_2PLANE , other , 1, 1, 1, x8 , , , , y___, yuv
+MESA_FORMAT_YUV420_3PLANE , other , 1, 1, 1, x8 , , , , y___, yuv
+MESA_FORMAT_YVU420_3PLANE , other , 1, 1, 1, x8 , , , , y___, yuv
+MESA_FORMAT_YVYU , other , 1, 1, 1, x16 , , , , xyzw, yuv
+MESA_FORMAT_VYUY , other , 1, 1, 1, x16 , , , , xyzw, yuv
MESA_FORMAT_RG_RB_UNORM8 , other , 2, 1, 1, x16 , , , , xyz1, rgb
MESA_FORMAT_GR_BR_UNORM8 , other , 2, 1, 1, x16 , , , , xyz1, rgb
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 508c9c342d2..0e778d64467 100644
index 18139680ef2..37a53949fae 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -617,6 +617,13 @@ typedef enum pipe_format mesa_format;
@@ -617,6 +617,21 @@ typedef enum pipe_format mesa_format;
#define MESA_FORMAT_ATC_RGB PIPE_FORMAT_ATC_RGB
#define MESA_FORMAT_ATC_RGBA_EXPLICIT PIPE_FORMAT_ATC_RGBA_EXPLICIT
#define MESA_FORMAT_ATC_RGBA_INTERPOLATED PIPE_FORMAT_ATC_RGBA_INTERPOLATED
+#define MESA_FORMAT_YVYU PIPE_FORMAT_YVYU
+#define MESA_FORMAT_VYUY PIPE_FORMAT_VYUY
+
+#define HAVE_MESA_FORMAT_YUV420_2PLANE
+#define MESA_FORMAT_YUV420_2PLANE PIPE_FORMAT_YUV420_2PLANE
+
+#define HAVE_MESA_FORMAT_YVU420_2PLANE
+#define MESA_FORMAT_YVU420_2PLANE PIPE_FORMAT_YVU420_2PLANE
+
+#define HAVE_MESA_FORMAT_YUV420_3PLANE
+#define MESA_FORMAT_YUV420_3PLANE PIPE_FORMAT_YUV420_3PLANE
+
+#define HAVE_MESA_FORMAT_YVU420_3PLANE
+#define MESA_FORMAT_YVU420_3PLANE PIPE_FORMAT_YVU420_3PLANE
+
#define MESA_FORMAT_COUNT PIPE_FORMAT_COUNT
/* Packed to array format adapters */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 32528a5f16b..8f77d4c58dd 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -158,6 +158,7 @@ _mesa_varying_slot_in_fs(gl_varying_slot slot)
diff --git a/src/mesa/main/glconfig.h b/src/mesa/main/glconfig.h
index 80414d5d78e..d54a4f75cfd 100644
--- a/src/mesa/main/glconfig.h
+++ b/src/mesa/main/glconfig.h
@@ -10,6 +10,7 @@
*/
struct gl_config
{
@@ -474,7 +556,7 @@ index 32528a5f16b..8f77d4c58dd 100644
GLboolean floatMode;
GLuint doubleBufferMode;
GLuint stereoMode;
@@ -179,6 +180,14 @@ struct gl_config
@@ -31,6 +32,14 @@ struct gl_config
/* EXT_framebuffer_sRGB */
GLint sRGBCapable;
@@ -1,7 +1,7 @@
From 4e65ae659b775259b4f703eb563feffc623c17b7 Mon Sep 17 00:00:00 2001
From c8cf03b4aee762cca6498be16156a914d62d4895 Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Wed, 20 Dec 2017 17:41:38 +0000
Subject: [PATCH 31/67] egl: add support for EXT_yuv_surface
Subject: [PATCH 24/58] egl: add support for EXT_yuv_surface
This implements EXT_yuv_surface but doesn't expose it for any platform.
---
@@ -14,10 +14,10 @@ This implements EXT_yuv_surface but doesn't expose it for any platform.
6 files changed, 348 insertions(+), 5 deletions(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 4d5a1874dc2..62517e4004a 100644
index 24ccf864f74..b1b5937a012 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1154,6 +1154,7 @@ enum dri_loader_cap {
@@ -1013,6 +1013,7 @@ enum dri_loader_cap {
*/
DRI_LOADER_CAP_RGBA_ORDERING,
DRI_LOADER_CAP_FP16,
@@ -26,10 +26,10 @@ index 4d5a1874dc2..62517e4004a 100644
struct __DRIdri2LoaderExtensionRec {
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index db993f8f059..ee3bcda4d12 100644
index d3a8fbe4ef7..b8e7bb08619 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -306,6 +306,7 @@ static const EGLint dri2_to_egl_attribute_map[__DRI_ATTRIB_MAX] = {
@@ -302,6 +302,7 @@ static const EGLint dri2_to_egl_attribute_map[__DRI_ATTRIB_MAX] = {
[__DRI_ATTRIB_MAX_SWAP_INTERVAL] = EGL_MAX_SWAP_INTERVAL,
[__DRI_ATTRIB_MIN_SWAP_INTERVAL] = EGL_MIN_SWAP_INTERVAL,
[__DRI_ATTRIB_YINVERTED] = EGL_Y_INVERTED_NOK,
@@ -37,7 +37,7 @@ index db993f8f059..ee3bcda4d12 100644
};
const __DRIconfig *
@@ -432,6 +433,8 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
@@ -428,6 +429,8 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
value = EGL_RGB_BUFFER;
else if (value & __DRI_ATTRIB_LUMINANCE_BIT)
value = EGL_LUMINANCE_BUFFER;
@@ -46,7 +46,7 @@ index db993f8f059..ee3bcda4d12 100644
else
return NULL;
base.ColorBufferType = value;
@@ -536,6 +539,73 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
@@ -532,6 +535,73 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
if (disp->Extensions.KHR_mutable_render_buffer)
surface_type |= EGL_MUTABLE_RENDER_BUFFER_BIT_KHR;
break;
@@ -120,7 +120,7 @@ index db993f8f059..ee3bcda4d12 100644
default:
key = dri2_to_egl_attribute_map[attrib];
if (key != 0)
@@ -583,6 +653,17 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
@@ -570,6 +640,17 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
base.RenderableType = disp->ClientAPIs;
base.Conformant = disp->ClientAPIs;
@@ -138,7 +138,7 @@ index db993f8f059..ee3bcda4d12 100644
base.MinSwapInterval = dri2_dpy->min_swap_interval;
base.MaxSwapInterval = dri2_dpy->max_swap_interval;
@@ -1014,6 +1095,8 @@ dri2_setup_screen(_EGLDisplay *disp)
@@ -1022,6 +1103,8 @@ dri2_setup_screen(_EGLDisplay *disp)
disp->Extensions.EXT_protected_surface =
dri2_renderer_query_integer(dri2_dpy,
__DRI2_RENDERER_HAS_PROTECTED_CONTENT);
@@ -148,10 +148,10 @@ index db993f8f059..ee3bcda4d12 100644
void
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index e2a7797d73e..6d7f62c6851 100644
index 7e2542bae6d..b7e0d0f53a5 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -512,6 +512,7 @@ _eglCreateExtensionsString(_EGLDisplay *disp)
@@ -506,6 +506,7 @@ _eglCreateExtensionsString(_EGLDisplay *disp)
_EGL_CHECK_EXTENSION(EXT_surface_CTA861_3_metadata);
_EGL_CHECK_EXTENSION(EXT_surface_SMPTE2086_metadata);
_EGL_CHECK_EXTENSION(EXT_swap_buffers_with_damage);
@@ -160,10 +160,10 @@ index e2a7797d73e..6d7f62c6851 100644
_EGL_CHECK_EXTENSION(IMG_context_priority);
diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 17d8f3555d4..5e56948ab72 100644
index eff7733c071..bc4313adcc5 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -258,6 +258,24 @@ static const struct {
@@ -259,6 +259,24 @@ static const struct {
{ EGL_COLOR_COMPONENT_TYPE_EXT, ATTRIB_TYPE_ENUM,
ATTRIB_CRITERION_EXACT,
EGL_COLOR_COMPONENT_TYPE_FIXED_EXT },
@@ -188,7 +188,7 @@ index 17d8f3555d4..5e56948ab72 100644
};
@@ -296,6 +314,28 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
@@ -297,6 +315,28 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
if (val > 1 || val < 0)
valid = EGL_FALSE;
break;
@@ -217,7 +217,7 @@ index 17d8f3555d4..5e56948ab72 100644
default:
if (val < 0)
valid = EGL_FALSE;
@@ -318,7 +358,43 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
@@ -319,7 +359,43 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
valid = EGL_FALSE;
break;
case EGL_COLOR_BUFFER_TYPE:
@@ -262,7 +262,7 @@ index 17d8f3555d4..5e56948ab72 100644
valid = EGL_FALSE;
break;
case EGL_COLOR_COMPONENT_TYPE_EXT:
@@ -404,6 +480,11 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
@@ -405,6 +481,11 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
if (conf->LuminanceSize + conf->AlphaSize != conf->BufferSize)
valid = EGL_FALSE;
break;
@@ -274,7 +274,7 @@ index 17d8f3555d4..5e56948ab72 100644
}
if (!valid) {
_eglLog(_EGL_DEBUG, "conflicting color buffer type and channel sizes");
@@ -430,6 +511,88 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
@@ -431,6 +512,88 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
return EGL_FALSE;
}
@@ -363,7 +363,7 @@ index 17d8f3555d4..5e56948ab72 100644
return valid;
}
@@ -509,6 +672,28 @@ _eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr)
@@ -510,6 +673,28 @@ _eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr)
return conf->Display->Extensions.ANDROID_framebuffer_target;
case EGL_RECORDABLE_ANDROID:
return conf->Display->Extensions.ANDROID_recordable;
@@ -392,7 +392,7 @@ index 17d8f3555d4..5e56948ab72 100644
default:
break;
}
@@ -543,6 +728,9 @@ _eglParseConfigAttribList(_EGLConfig *conf, _EGLDisplay *disp,
@@ -544,6 +729,9 @@ _eglParseConfigAttribList(_EGLConfig *conf, _EGLDisplay *disp,
if (!_eglIsConfigAttribValid(conf, attr))
return EGL_FALSE;
@@ -402,7 +402,7 @@ index 17d8f3555d4..5e56948ab72 100644
_eglSetConfigKey(conf, attr, val);
}
@@ -617,6 +805,7 @@ _eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
@@ -618,6 +806,7 @@ _eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
/* the enum values have the desired ordering */
STATIC_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER);
@@ -410,7 +410,7 @@ index 17d8f3555d4..5e56948ab72 100644
val1 = conf1->ColorBufferType - conf2->ColorBufferType;
if (val1)
return val1;
@@ -636,16 +825,42 @@ _eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
@@ -637,16 +826,42 @@ _eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
val1 += conf1->BlueSize;
val2 += conf2->BlueSize;
}
@@ -457,7 +457,7 @@ index 17d8f3555d4..5e56948ab72 100644
}
}
else {
@@ -664,6 +879,36 @@ _eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
@@ -665,6 +880,36 @@ _eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
return (val1 - val2);
}
@@ -525,10 +525,10 @@ index 1f2a4008f12..d4a748970b5 100644
default:
return -1;
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 0a7366b7c07..020529c57e2 100644
index d95c7b9144a..f59d43325a6 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -112,6 +112,7 @@ struct _egl_extensions
@@ -113,6 +113,7 @@ struct _egl_extensions
EGLBoolean EXT_surface_CTA861_3_metadata;
EGLBoolean EXT_surface_SMPTE2086_metadata;
EGLBoolean EXT_swap_buffers_with_damage;
@@ -1,7 +1,7 @@
From 5a22280c13e98932ad45fa6a131217abdffd16b4 Mon Sep 17 00:00:00 2001
From 77e3d423ff883b892fb146f5b8cb3dc8869dcc22 Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Fri, 2 Feb 2018 16:59:52 +0000
Subject: [PATCH 32/67] dri: add missing __DRI_IMAGE_COMPONENTS define for
Subject: [PATCH 25/58] dri: add missing __DRI_IMAGE_COMPONENTS define for
EGL_TEXTURE_EXTERNAL_WL
The __DRI_IMAGE_COMPONENTS defines have been re-ordered, to make it
@@ -12,10 +12,10 @@ existing ones.
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 62517e4004a..6490f6e80e2 100644
index b1b5937a012..80acaf3a7b1 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1461,11 +1461,12 @@ struct __DRIdri2ExtensionRec {
@@ -1312,11 +1312,12 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_COMPONENTS_Y_U_V 0x3003
#define __DRI_IMAGE_COMPONENTS_Y_UV 0x3004
#define __DRI_IMAGE_COMPONENTS_Y_XUXV 0x3005
@@ -1,7 +1,7 @@
From 3d47285da42c76fe36ae67c62e8d0a0d76d18da0 Mon Sep 17 00:00:00 2001
From 61658c083ff6704357075e857923a2901301f642 Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Thu, 11 Jan 2018 09:38:47 +0000
Subject: [PATCH 33/67] egl/wayland: expose EXT_yuv_surface support
Subject: [PATCH 26/58] egl/wayland: expose EXT_yuv_surface support
This adds support for YUYV configs.
---
@@ -10,10 +10,10 @@ This adds support for YUYV configs.
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index ee3bcda4d12..d511d73f2ed 100644
index b8e7bb08619..635c445d234 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2769,6 +2769,7 @@ static const struct wl_drm_components_descriptor {
@@ -2420,6 +2420,7 @@ static const struct wl_drm_components_descriptor {
{ __DRI_IMAGE_COMPONENTS_Y_U_V, EGL_TEXTURE_Y_U_V_WL, 3 },
{ __DRI_IMAGE_COMPONENTS_Y_UV, EGL_TEXTURE_Y_UV_WL, 2 },
{ __DRI_IMAGE_COMPONENTS_Y_XUXV, EGL_TEXTURE_Y_XUXV_WL, 2 },
@@ -22,10 +22,10 @@ index ee3bcda4d12..d511d73f2ed 100644
static _EGLImage *
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index a096d9500c1..72456d5d748 100644
index 185c52c110f..10a90ff963f 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -135,6 +135,13 @@ static const struct dri2_wl_visual {
@@ -151,6 +151,13 @@ static const struct dri2_wl_visual {
{ 11, 5, 0, -1 },
{ 5, 6, 5, 0 },
},
@@ -38,16 +38,16 @@ index a096d9500c1..72456d5d748 100644
+ },
};
static_assert(ARRAY_SIZE(dri2_wl_visuals) <= EGL_DRI2_MAX_FORMATS,
@@ -958,6 +965,7 @@ dri2_wl_get_capability(void *loaderPrivate, enum dri_loader_cap cap)
static int
@@ -1431,6 +1438,7 @@ dri2_wl_get_capability(void *loaderPrivate, enum dri_loader_cap cap)
{
switch (cap) {
case DRI_LOADER_CAP_FP16:
+ case DRI_LOADER_CAP_YUV_SURFACE_IMG:
return 1;
default:
return 0;
@@ -1552,6 +1560,7 @@ dri2_wl_add_configs_for_visuals(_EGLDisplay *disp)
case DRI_LOADER_CAP_RGBA_ORDERING:
return 1;
@@ -2135,6 +2143,7 @@ dri2_wl_add_configs_for_visuals(_EGLDisplay *disp)
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
unsigned int format_count[ARRAY_SIZE(dri2_wl_visuals)] = { 0 };
unsigned int count = 0;
@@ -55,8 +55,8 @@ index a096d9500c1..72456d5d748 100644
bool assigned;
for (unsigned i = 0; dri2_dpy->driver_configs[i]; i++) {
@@ -1563,8 +1572,12 @@ dri2_wl_add_configs_for_visuals(_EGLDisplay *disp)
if (!BITSET_TEST(dri2_dpy->formats, j))
@@ -2146,8 +2155,12 @@ dri2_wl_add_configs_for_visuals(_EGLDisplay *disp)
if (!BITSET_TEST(dri2_dpy->formats.formats_bitmap, j))
continue;
+ surface_type = EGL_WINDOW_BIT;
@@ -1,121 +0,0 @@
From 48fe256681d8d7d3892393b102bf0a3ebc697c51 Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Mon, 18 Dec 2017 19:22:50 +0000
Subject: [PATCH 27/67] egl/tizen: support DRI driver handling of swap preserve
This adds a new flag (__DRI_IMAGE_BUFFER_PREV) to the __DRIimageBufferMask
enum that allows a DRI driver to request the previous back buffer. This
will only be returned if the swap behaviour is EGL_BUFFER_PRESERVED and
should result in the DRI driver preserving the previous content instead of
this being done in the platform code. For hardware that supports it, this
should avoid a blit being performed every frame, although this will still
be necessary under certain conditions, e.g. an empty swap.
---
include/GL/internal/dri_interface.h | 3 +++
src/egl/drivers/dri2/platform_tizen.c | 29 +++++++++++++++++++++------
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index b197092939f..16cc095ea29 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -2073,12 +2073,15 @@ enum __DRIimageBufferMask {
* OpenGL ES API and little change to the SurfaceFlinger API.
*/
__DRI_IMAGE_BUFFER_SHARED = (1 << 2),
+#define DRI_IMAGE_HAS_BUFFER_PREV
+ __DRI_IMAGE_BUFFER_PREV = (1 << 31),
};
struct __DRIimageList {
uint32_t image_mask;
__DRIimage *back;
__DRIimage *front;
+ __DRIimage *prev;
};
#define __DRI_IMAGE_LOADER "DRI_IMAGE_LOADER"
diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c
index 49462152beb..2bc9b3e7c64 100644
--- a/src/egl/drivers/dri2/platform_tizen.c
+++ b/src/egl/drivers/dri2/platform_tizen.c
@@ -147,7 +147,8 @@ create_image_from_native(struct dri2_egl_surface *dri2_surf,
}
static int
-get_back_bo(struct dri2_egl_surface *dri2_surf, bool allow_update)
+get_back_bo(struct dri2_egl_surface *dri2_surf, bool allow_update,
+ bool allow_preserve)
{
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
@@ -277,7 +278,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf, bool allow_update)
dri2_surf->back->locked = true;
if (dri2_surf->base.SwapBehavior == EGL_BUFFER_PRESERVED &&
- dri2_surf->current) {
+ allow_preserve && dri2_surf->current) {
_EGLContext *ctx = _eglGetCurrentContext();
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
@@ -609,7 +610,7 @@ dri2_tizen_swap_buffers_with_damage(_EGLDisplay *dpy, _EGLSurface *draw,
* Make sure we have a back buffer in case we're swapping without ever
* rendering.
*/
- if (get_back_bo(dri2_surf, false) < 0) {
+ if (get_back_bo(dri2_surf, false, true) < 0) {
_eglError(EGL_BAD_ALLOC, "DRI2: failed to get back buffer");
return EGL_FALSE;
}
@@ -673,7 +674,7 @@ dri2_tizen_query_buffer_age(_EGLDisplay *dpy, _EGLSurface *surface)
{
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface);
- if (get_back_bo(dri2_surf, false) < 0) {
+ if (get_back_bo(dri2_surf, false, true) < 0) {
_eglError(EGL_BAD_ALLOC, "DRI2: failed to get back buffer");
return -1;
}
@@ -748,14 +749,22 @@ dri2_tizen_get_buffers(__DRIdrawable *driDrawable,
buffers->image_mask = 0;
buffers->front = NULL;
buffers->back = NULL;
+ buffers->prev = NULL;
if (buffer_mask & __DRI_IMAGE_BUFFER_FRONT)
if (get_front_bo(dri2_surf) < 0)
return 0;
- if (buffer_mask & __DRI_IMAGE_BUFFER_BACK)
- if (get_back_bo(dri2_surf, true) < 0)
+ if (buffer_mask & __DRI_IMAGE_BUFFER_BACK) {
+ /*
+ * The DRI driver has requested the previous buffer so it will take care
+ * of preserving the previous content.
+ */
+ bool allow_preserve = !(buffer_mask & __DRI_IMAGE_BUFFER_PREV);
+
+ if (get_back_bo(dri2_surf, true, allow_preserve) < 0)
return 0;
+ }
if (buffer_mask & __DRI_IMAGE_BUFFER_FRONT) {
buffers->front = dri2_surf->front;
@@ -767,6 +776,14 @@ dri2_tizen_get_buffers(__DRIdrawable *driDrawable,
buffers->image_mask |= __DRI_IMAGE_BUFFER_BACK;
}
+ if (buffer_mask & __DRI_IMAGE_BUFFER_PREV) {
+ if (dri2_surf->base.SwapBehavior == EGL_BUFFER_PRESERVED &&
+ dri2_surf->current) {
+ buffers->prev = dri2_surf->current->dri_image;
+ buffers->image_mask |= __DRI_IMAGE_BUFFER_PREV;
+ }
+ }
+
return 1;
}
--
2.25.1
@@ -1,7 +1,7 @@
From 5bd42e648dc9068392641436b70fc28a00689c8e Mon Sep 17 00:00:00 2001
From c87b779348cd6d7be932c97875086770a545f327 Mon Sep 17 00:00:00 2001
From: Silvestrs Timofejevs <silvestrs.timofejevs@imgtec.com>
Date: Thu, 30 Aug 2018 13:48:53 +0100
Subject: [PATCH 35/67] gbm: add some new GBM formats
Subject: [PATCH 27/58] gbm: add some new GBM formats
GBM_FORMAT_ARGB4444
GBM_FORMAT_BGR888
@@ -13,10 +13,10 @@ GBM_FORMAT_YVU444_PACK10_IMG
2 files changed, 18 insertions(+)
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 2aa9c7c41ad..5acb15b516f 100644
index fc0bbf5fcf9..17594589f56 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -514,11 +514,21 @@ static const struct gbm_dri_visual gbm_dri_visuals_table[] = {
@@ -564,11 +564,21 @@ static const struct gbm_dri_visual gbm_dri_visuals_table[] = {
{ 10, 5, 0, 11 },
{ 5, 5, 5, 1 },
},
@@ -38,7 +38,7 @@ index 2aa9c7c41ad..5acb15b516f 100644
{
GBM_FORMAT_XRGB8888, __DRI_IMAGE_FORMAT_XRGB8888,
{ 16, 8, 0, -1 },
@@ -571,6 +581,12 @@ static const struct gbm_dri_visual gbm_dri_visuals_table[] = {
@@ -621,6 +631,12 @@ static const struct gbm_dri_visual gbm_dri_visuals_table[] = {
{ 16, 16, 16, 16 },
true,
},
@@ -52,10 +52,10 @@ index 2aa9c7c41ad..5acb15b516f 100644
static int
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
index 7c82cd661a3..81308ab9745 100644
index 57fd1b9ab47..bd4185b723f 100644
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -167,6 +167,8 @@ enum gbm_bo_format {
@@ -174,6 +174,8 @@ enum gbm_bo_format {
#define GBM_FORMAT_AYUV __gbm_fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
@@ -1,26 +1,26 @@
From def26b8534e4f8e150e5775dd1f7d2d955580c05 Mon Sep 17 00:00:00 2001
From 7bcf7068e551b5b78381f8a9d7f848af6efe7e36 Mon Sep 17 00:00:00 2001
From: Frank Binns <francisbinns@gmail.com>
Date: Sun, 5 Jun 2016 12:04:40 +0100
Subject: [PATCH 36/67] egl: add "null" platform
Subject: [PATCH 28/58] egl: add "null" platform
---
meson.build | 25 +-
meson.build | 10 +-
meson_options.txt | 2 +-
src/egl/drivers/dri2/egl_dri2.c | 11 +-
src/egl/drivers/dri2/egl_dri2.h | 57 +-
src/egl/drivers/dri2/egl_dri2.h | 59 +-
src/egl/drivers/dri2/platform_null.c | 1179 ++++++++++++++++++++++++++
src/egl/main/eglapi.c | 5 +-
src/egl/main/egldisplay.c | 1 +
src/egl/main/egldisplay.h | 1 +
src/egl/meson.build | 5 +
9 files changed, 1277 insertions(+), 9 deletions(-)
9 files changed, 1264 insertions(+), 9 deletions(-)
create mode 100644 src/egl/drivers/dri2/platform_null.c
diff --git a/meson.build b/meson.build
index 3d9d345dbf2..2018562a1ec 100644
index d9fbb1fd8d9..ce81c7d0f9e 100644
--- a/meson.build
+++ b/meson.build
@@ -340,7 +340,7 @@ endif
@@ -335,7 +335,7 @@ endif
_platforms = get_option('platforms')
if _platforms.contains('auto')
if system_has_kms_drm
@@ -29,68 +29,53 @@ index 3d9d345dbf2..2018562a1ec 100644
elif ['darwin', 'cygwin'].contains(host_machine.system())
_platforms = ['x11']
elif ['haiku'].contains(host_machine.system())
@@ -359,6 +359,7 @@ with_platform_wayland = _platforms.contains('wayland')
@@ -353,6 +353,7 @@ with_platform_x11 = _platforms.contains('x11')
with_platform_wayland = _platforms.contains('wayland')
with_platform_haiku = _platforms.contains('haiku')
with_platform_windows = _platforms.contains('windows')
with_platform_tizen = _platforms.contains('tizen')
+with_platform_null = _platforms.contains('null')
if with_platform_tizen and _platforms.length() != 1
error('tizen cannot be enabled at the same time as other platforms')
@@ -958,6 +959,26 @@ if with_platform_tizen
with_glx = get_option('glx')
if with_glx == 'auto'
@@ -1014,6 +1015,10 @@ if with_platform_android
]
pre_args += '-DHAVE_TIZEN_PLATFORM'
endif
+if with_platform_null
+ pre_args += '-DHAVE_NULL_PLATFORM'
+endif
+if with_platform_android
+ dep_android = [
+ dependency('cutils'),
+ dependency('hardware'),
+ dependency('sync'),
+ ]
+ if with_gallium
+ dep_android += dependency('backtrace')
+ endif
+ if get_option('platform-sdk-version') >= 26
+ dep_android += dependency('nativewindow')
+ endif
+ pre_args += '-DHAVE_ANDROID_PLATFORM'
+endif
+if with_platform_haiku
+ pre_args += '-DHAVE_HAIKU_PLATFORM'
+endif
+
prog_python = import('python').find_installation('python3')
has_mako = run_command(
@@ -1583,7 +1604,7 @@ dep_libdrm = dependency(
prog_python, '-c',
@@ -1640,7 +1645,8 @@ with_gallium_drisw_kms = false
dep_libdrm = dependency(
'libdrm', version : '>=' + _drm_ver,
# GNU/Hurd includes egl_dri2, without drm.
required : (with_dri2 and host_machine.system() != 'gnu') or with_dri3 or
- with_platform_tizen
+ with_platform_tizen or with_platform_null
- required : (with_dri2 and host_machine.system() != 'gnu') or with_dri3
+ required : (with_dri2 and host_machine.system() != 'gnu') or with_dri3 or
+ with_platform_null
)
if dep_libdrm.found()
pre_args += '-DHAVE_LIBDRM'
diff --git a/meson_options.txt b/meson_options.txt
index 8230db93c70..d90a25f97ff 100644
index 3f401d39225..d76cc4b0405 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -23,7 +23,7 @@ option(
type : 'array',
value : ['auto'],
choices : [
- 'auto', 'x11', 'wayland', 'haiku', 'android', 'windows', 'tizen',
+ 'auto', 'x11', 'wayland', 'haiku', 'android', 'windows', 'tizen', 'null',
- 'auto', 'x11', 'wayland', 'haiku', 'android', 'windows',
+ 'auto', 'x11', 'wayland', 'haiku', 'android', 'windows', 'null',
],
description : 'window systems to support. If this is set to `auto`, all platforms applicable will be enabled.'
)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index d511d73f2ed..2f8414e0c60 100644
index 635c445d234..68b8fa7346a 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1253,6 +1253,9 @@ dri2_initialize(_EGLDisplay *disp)
@@ -1261,6 +1261,9 @@ dri2_initialize(_EGLDisplay *disp)
case _EGL_PLATFORM_DEVICE:
ret = dri2_initialize_device(disp);
break;
@@ -100,7 +85,7 @@ index d511d73f2ed..2f8414e0c60 100644
case _EGL_PLATFORM_X11:
case _EGL_PLATFORM_XCB:
ret = dri2_initialize_x11(disp);
@@ -1318,8 +1321,6 @@ dri2_display_destroy(_EGLDisplay *disp)
@@ -1321,8 +1324,6 @@ dri2_display_destroy(_EGLDisplay *disp)
dri2_dpy->vtbl->close_screen_notify(disp);
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
}
@@ -109,10 +94,10 @@ index d511d73f2ed..2f8414e0c60 100644
/* Don't dlclose the driver when building with the address sanitizer, so you
* get good symbols from the leak reports.
@@ -1355,11 +1356,17 @@ dri2_display_destroy(_EGLDisplay *disp)
tpl_object_unreference((tpl_object_t *) dri2_dpy->tpl_dpy);
@@ -1348,11 +1349,17 @@ dri2_display_destroy(_EGLDisplay *disp)
case _EGL_PLATFORM_WAYLAND:
dri2_teardown_wayland(dri2_dpy);
break;
#endif
+ case _EGL_PLATFORM_NULL:
+ dri2_teardown_null(dri2_dpy);
+ break;
@@ -128,12 +113,12 @@ index d511d73f2ed..2f8414e0c60 100644
* the ones from the gbm device. As such the gbm itself is responsible
* for the cleanup.
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index f41f32cd234..eb2127e3fe6 100644
index 35f66ad5453..5de5f0f9a16 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -81,6 +81,10 @@ struct zwp_linux_dmabuf_v1;
#include <tbm_surface_internal.h>
#endif
@@ -77,6 +77,10 @@ struct zwp_linux_dmabuf_feedback_v1;
#endif /* HAVE_ANDROID_PLATFORM */
+#ifdef HAVE_NULL_PLATFORM
+#include <xf86drmMode.h>
@@ -142,7 +127,7 @@ index f41f32cd234..eb2127e3fe6 100644
#include "eglconfig.h"
#include "eglcontext.h"
#include "egldevice.h"
@@ -99,6 +103,22 @@ struct zwp_linux_dmabuf_v1;
@@ -94,6 +98,22 @@ struct zwp_linux_dmabuf_feedback_v1;
struct wl_buffer;
@@ -165,7 +150,7 @@ index f41f32cd234..eb2127e3fe6 100644
struct dri2_egl_display_vtbl {
/* mandatory on Wayland, unused otherwise */
int (*authenticate)(_EGLDisplay *disp, uint32_t id);
@@ -257,6 +277,11 @@ struct dri2_egl_display
@@ -287,6 +307,11 @@ struct dri2_egl_display
char *device_name;
#endif
@@ -177,42 +162,51 @@ index f41f32cd234..eb2127e3fe6 100644
#ifdef HAVE_ANDROID_PLATFORM
const gralloc_module_t *gralloc;
/* gralloc vendor usage bit for front rendering */
@@ -332,7 +357,10 @@ struct dri2_egl_surface
struct wl_display *wl_dpy_wrapper;
struct wl_drm *wl_drm_wrapper;
struct wl_callback *throttle_callback;
@@ -331,11 +356,14 @@ struct dri2_egl_surface
struct zwp_linux_dmabuf_feedback_v1 *wl_dmabuf_feedback;
struct dmabuf_feedback dmabuf_feedback, pending_dmabuf_feedback;
bool compositor_using_another_device;
- int format;
+#endif
+
bool resized;
bool received_dmabuf_feedback;
#endif
+#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_NULL_PLATFORM)
+ int format;
#endif
+#endif
+
#ifdef HAVE_DRM_PLATFORM
@@ -358,9 +386,10 @@ struct dri2_egl_surface
struct gbm_dri_surface *gbm_surf;
#endif
@@ -343,12 +371,15 @@ struct dri2_egl_surface
/* EGL-owned buffers */
__DRIbuffer *local_buffers[__DRI_BUFFER_COUNT];
#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM) || \
- defined(HAVE_TIZEN_PLATFORM)
+ defined(HAVE_TIZEN_PLATFORM) || defined(HAVE_NULL_PLATFORM)
struct {
-#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_TIZEN_PLATFORM)
+#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_TIZEN_PLATFORM) || \
-#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM)
+#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM) || \
+ defined(HAVE_NULL_PLATFORM)
__DRIimage *dri_image;
#endif
struct {
+#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_NULL_PLATFORM)
+ __DRIimage *dri_image;
+#endif
#ifdef HAVE_WAYLAND_PLATFORM
@@ -377,6 +406,9 @@ struct dri2_egl_surface
struct wl_buffer *wl_buffer;
bool wl_release;
- __DRIimage *dri_image;
/* for is_different_gpu case. NULL else */
__DRIimage *linear_copy;
/* for swrast */
@@ -357,6 +388,9 @@ struct dri2_egl_surface
#endif
#ifdef HAVE_TIZEN_PLATFORM
tbm_surface_h tbm_surf;
#ifdef HAVE_DRM_PLATFORM
struct gbm_bo *bo;
+#endif
+#ifdef HAVE_NULL_PLATFORM
+ uint32_t fb_id;
#endif
bool locked;
int age;
@@ -409,6 +441,10 @@ struct dri2_egl_surface
@@ -393,6 +427,10 @@ struct dri2_egl_surface
void *swrast_front;
#endif
@@ -223,9 +217,9 @@ index f41f32cd234..eb2127e3fe6 100644
int out_fence_fd;
EGLBoolean enable_out_fence;
@@ -589,6 +625,21 @@ EGLBoolean
dri2_initialize_tizen(_EGLDisplay *disp);
#endif
@@ -571,6 +609,21 @@ dri2_initialize_android(_EGLDisplay *disp)
EGLBoolean
dri2_initialize_surfaceless(_EGLDisplay *disp);
+#ifdef HAVE_NULL_PLATFORM
+EGLBoolean
@@ -1431,10 +1425,10 @@ index 00000000000..fb03ecc36fd
+ }
+}
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 6d7f62c6851..e4f2c43b4ef 100644
index b7e0d0f53a5..b3d6f3599e5 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -989,7 +989,10 @@ _eglCreateWindowSurfaceCommon(_EGLDisplay *disp, EGLConfig config,
@@ -982,7 +982,10 @@ _eglCreateWindowSurfaceCommon(_EGLDisplay *disp, EGLConfig config,
if (native_window == NULL)
@@ -1447,36 +1441,36 @@ index 6d7f62c6851..e4f2c43b4ef 100644
if (disp && (disp->Platform == _EGL_PLATFORM_SURFACELESS ||
disp->Platform == _EGL_PLATFORM_DEVICE)) {
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 486ac3b0557..395f38156d7 100644
index 131fc22786f..2ce70818929 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -78,6 +78,7 @@ static const struct {
@@ -85,6 +85,7 @@ static const struct {
{ _EGL_PLATFORM_SURFACELESS, "surfaceless" },
{ _EGL_PLATFORM_DEVICE, "device" },
{ _EGL_PLATFORM_TIZEN, "tizen" },
{ _EGL_PLATFORM_WINDOWS, "windows" },
+ { _EGL_PLATFORM_NULL, "null" },
};
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 020529c57e2..8489af9dde2 100644
index f59d43325a6..a2d91679fd7 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -53,6 +53,7 @@ enum _egl_platform_type {
_EGL_PLATFORM_SURFACELESS,
_EGL_PLATFORM_DEVICE,
_EGL_PLATFORM_TIZEN,
_EGL_PLATFORM_WINDOWS,
+ _EGL_PLATFORM_NULL,
_EGL_NUM_PLATFORMS,
_EGL_INVALID_PLATFORM = -1
diff --git a/src/egl/meson.build b/src/egl/meson.build
index 5749ec88f89..daa6a3a04f0 100644
index 315a95013f3..a08f1c71847 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -146,6 +146,11 @@ if with_platform_tizen
incs_for_egl += [inc_loader]
deps_for_egl += [dep_tizen, dep_libdrm]
@@ -150,6 +150,11 @@ elif with_platform_windows
incs_for_egl += [inc_wgl, inc_gallium, inc_gallium_aux]
link_for_egl += libgallium_wgl
endif
+if with_platform_null
+ files_egl += files('drivers/dri2/platform_null.c')
@@ -1,21 +1,21 @@
From d1d64a3c11fbab083d6225857554ac1c9ad645b6 Mon Sep 17 00:00:00 2001
From 3cebad3094a397416b78e5e41351c9c6051ab8ff Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Tue, 29 Jan 2019 14:36:25 +0000
Subject: [PATCH 38/67] egl: add support for EXT_image_gl_colorspace
Subject: [PATCH 29/58] egl: add support for EXT_image_gl_colorspace
---
src/egl/drivers/dri2/egl_dri2.c | 57 +++++++++++++++++++++++++++++++--
src/egl/drivers/dri2/egl_dri2.c | 52 +++++++++++++++++++++++++++++++--
src/egl/main/eglapi.c | 1 +
src/egl/main/egldisplay.h | 1 +
src/egl/main/eglimage.c | 14 ++++++++
src/egl/main/eglimage.c | 14 +++++++++
src/egl/main/eglimage.h | 3 ++
5 files changed, 74 insertions(+), 2 deletions(-)
5 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 2f8414e0c60..6b26ff979ae 100644
index 68b8fa7346a..b25c0231dc8 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1084,6 +1084,9 @@ dri2_setup_screen(_EGLDisplay *disp)
@@ -1092,6 +1092,9 @@ dri2_setup_screen(_EGLDisplay *disp)
dri2_dpy->image->createImageFromBuffer) {
disp->Extensions.IMG_cl_image = EGL_TRUE;
}
@@ -25,19 +25,7 @@ index 2f8414e0c60..6b26ff979ae 100644
}
if (dri2_dpy->flush_control)
@@ -2724,6 +2727,11 @@ dri2_create_image_wayland_wl_buffer_tizen(_EGLDisplay *disp, _EGLContext *ctx,
return NULL;
}
+ if (attrs.GLColorspace != EGL_GL_COLORSPACE_DEFAULT_EXT) {
+ _eglError(EGL_BAD_MATCH, "unsupported colorspace");
+ return NULL;
+ }
+
if (tbm_surface_get_info(tbm_surf, &info)) {
_eglError(EGL_BAD_PARAMETER, "tbm_surface_get_info");
return NULL;
@@ -2799,6 +2807,11 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
@@ -2450,6 +2453,11 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
if (!_eglParseImageAttribList(&attrs, disp, attr_list))
return NULL;
@@ -49,7 +37,7 @@ index 2f8414e0c60..6b26ff979ae 100644
plane = attrs.PlaneWL;
f = buffer->driver_format;
if (plane < 0 || plane >= f->nplanes) {
@@ -2862,6 +2875,11 @@ dri2_create_image_khr_texture(_EGLDisplay *disp, _EGLContext *ctx,
@@ -2513,6 +2521,11 @@ dri2_create_image_khr_texture(_EGLDisplay *disp, _EGLContext *ctx,
if (!_eglParseImageAttribList(&attrs, disp, attr_list))
return EGL_NO_IMAGE_KHR;
@@ -61,7 +49,7 @@ index 2f8414e0c60..6b26ff979ae 100644
switch (target) {
case EGL_GL_TEXTURE_2D_KHR:
if (!disp->Extensions.KHR_gl_texture_2D_image) {
@@ -3007,6 +3025,11 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
@@ -2658,6 +2671,11 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
return NULL;
}
@@ -73,7 +61,7 @@ index 2f8414e0c60..6b26ff979ae 100644
switch (attrs.DRMBufferFormatMESA) {
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA:
format = __DRI_IMAGE_FORMAT_ARGB8888;
@@ -3189,6 +3212,23 @@ dri2_num_fourcc_format_planes(EGLint format)
@@ -2840,6 +2858,23 @@ dri2_num_fourcc_format_planes(EGLint format)
}
}
@@ -97,7 +85,7 @@ index 2f8414e0c60..6b26ff979ae 100644
/* Returns the total number of file descriptors. Zero indicates an error. */
static unsigned
dri2_check_dma_buf_format(const _EGLImageAttribs *attrs)
@@ -3334,6 +3374,7 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
@@ -2985,6 +3020,7 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
int fds[DMA_BUF_MAX_PLANES];
int pitches[DMA_BUF_MAX_PLANES];
int offsets[DMA_BUF_MAX_PLANES];
@@ -105,7 +93,7 @@ index 2f8414e0c60..6b26ff979ae 100644
uint64_t modifier;
bool has_modifier = false;
unsigned error;
@@ -3359,6 +3400,18 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
@@ -3010,6 +3046,18 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
if (!num_fds)
return NULL;
@@ -124,7 +112,7 @@ index 2f8414e0c60..6b26ff979ae 100644
for (unsigned i = 0; i < num_fds; ++i) {
fds[i] = attrs.DMABufPlaneFds[i].Value;
pitches[i] = attrs.DMABufPlanePitches[i].Value;
@@ -3403,7 +3456,7 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
@@ -3054,7 +3102,7 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
}
dri_image =
dri2_dpy->image->createImageFromDmaBufs2(dri2_dpy->dri_screen,
@@ -133,7 +121,7 @@ index 2f8414e0c60..6b26ff979ae 100644
modifier, fds, num_fds, pitches, offsets,
attrs.DMABufYuvColorSpaceHint.Value,
attrs.DMABufSampleRangeHint.Value,
@@ -3415,7 +3468,7 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
@@ -3066,7 +3114,7 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
else {
dri_image =
dri2_dpy->image->createImageFromDmaBufs(dri2_dpy->dri_screen,
@@ -143,19 +131,19 @@ index 2f8414e0c60..6b26ff979ae 100644
attrs.DMABufYuvColorSpaceHint.Value,
attrs.DMABufSampleRangeHint.Value,
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index e4f2c43b4ef..2d3931dfd26 100644
index b3d6f3599e5..d9fbb7a11fb 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -508,6 +508,7 @@ _eglCreateExtensionsString(_EGLDisplay *disp)
@@ -501,6 +501,7 @@ _eglCreateExtensionsString(_EGLDisplay *disp)
_EGL_CHECK_EXTENSION(EXT_create_context_robustness);
_EGL_CHECK_EXTENSION(EXT_image_dma_buf_import);
_EGL_CHECK_EXTENSION(EXT_image_dma_buf_import_modifiers);
+ _EGL_CHECK_EXTENSION(EXT_image_gl_colorspace);
_EGL_CHECK_EXTENSION(EXT_protected_surface);
_EGL_CHECK_EXTENSION(EXT_present_opaque);
_EGL_CHECK_EXTENSION(EXT_surface_CTA861_3_metadata);
_EGL_CHECK_EXTENSION(EXT_surface_SMPTE2086_metadata);
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 8489af9dde2..6e5b29fe1ac 100644
index a2d91679fd7..53f191ae75f 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -108,6 +108,7 @@ struct _egl_extensions
@@ -165,7 +153,7 @@ index 8489af9dde2..6e5b29fe1ac 100644
+ EGLBoolean EXT_image_gl_colorspace;
EGLBoolean EXT_pixel_format_float;
EGLBoolean EXT_protected_surface;
EGLBoolean EXT_surface_CTA861_3_metadata;
EGLBoolean EXT_present_opaque;
diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
index 64bf7f2bfe9..73d4e85b82e 100644
--- a/src/egl/main/eglimage.c
@@ -1,7 +1,7 @@
From c8a6405eaf4c9693f32381fa7aa6d292e7f95716 Mon Sep 17 00:00:00 2001
From 7cfdab7b8a2e122821ec3086e6a5e1d35a0c88a0 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Mon, 24 Jun 2019 09:35:39 +0100
Subject: [PATCH 39/67] meson: force C++ 2011 for "thread_local"
Subject: [PATCH 30/58] meson: force C++ 2011 for "thread_local"
For some combinations of Meson and the GNU C++ compiler, Meson does
not add '-std=c++11' to the command line arguments, resulting in
@@ -14,10 +14,10 @@ command line arguments.
1 file changed, 6 insertions(+)
diff --git a/meson.build b/meson.build
index 2018562a1ec..21d93d372c2 100644
index ce81c7d0f9e..b4d5b849f8b 100644
--- a/meson.build
+++ b/meson.build
@@ -32,6 +32,12 @@ project(
@@ -41,6 +41,12 @@ endif
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
@@ -1,7 +1,7 @@
From dbb0d023abb9e4bfed70144514595f0477840f3e Mon Sep 17 00:00:00 2001
From e8172c9aea79b5cf05523a606a53a0fe63d7f397 Mon Sep 17 00:00:00 2001
From: Luigi Santivetti <luigi.santivetti@imgtec.com>
Date: Wed, 19 Jun 2019 16:36:06 +0100
Subject: [PATCH 40/67] dri2: add support for swap intervals other than 1
Subject: [PATCH 31/58] dri2: add support for swap intervals other than 1
Before this change, the swap interval was fixed at 1, with page flips
scheduled on the next vblank. This change allows any swap interval
@@ -17,18 +17,20 @@ regardless of the timing of subsequent calls to swap buffers.
Change-Id: If7c0495df7ddfaa08583a14f820c46e1b97da788
Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
---
src/egl/drivers/dri2/egl_dri2.h | 34 +-
src/egl/drivers/dri2/egl_dri2.h | 42 ++-
src/egl/drivers/dri2/platform_null.c | 541 +++++++++++++++++++++++----
2 files changed, 497 insertions(+), 78 deletions(-)
2 files changed, 506 insertions(+), 77 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index eb2127e3fe6..64d60ed66e4 100644
index 5de5f0f9a16..f74ee282645 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -332,6 +332,23 @@ struct tpl_swap_queue_elem
@@ -328,6 +328,25 @@ struct dri2_egl_context
__DRIcontext *dri_context;
};
#endif
+#define DRI2_SURFACE_NUM_COLOR_BUFFERS 4
+
+#ifdef HAVE_NULL_PLATFORM
+struct swap_queue_elem
+{
@@ -49,27 +51,27 @@ index eb2127e3fe6..64d60ed66e4 100644
struct dri2_egl_surface
{
_EGLSurface base;
@@ -370,13 +387,18 @@ struct dri2_egl_surface
#ifdef HAVE_TIZEN_PLATFORM
tpl_surface_t *tpl_surf;
bool reset;
+ struct tpl_swap_queue_elem swap_queue[DRI2_SURFACE_NUM_COLOR_BUFFERS];
+#endif
+#if defined(HAVE_TIZEN_PLATFORM) || defined(HAVE_NULL_PLATFORM)
/*
* Protects swap_queue_idx_head, swap_queue_idx_tail and
* color_buffers.locked.
*/
pthread_mutex_t mutex;
pthread_cond_t swap_queue_cond;
- struct tpl_swap_queue_elem swap_queue[DRI2_SURFACE_NUM_COLOR_BUFFERS];
@@ -368,6 +387,19 @@ struct dri2_egl_surface
struct gbm_dri_surface *gbm_surf;
#endif
+#if defined(HAVE_NULL_PLATFORM)
+ /*
+ * Protects swap_queue_idx_head, swap_queue_idx_tail and
+ * color_buffers.locked.
+ */
+ pthread_mutex_t mutex;
+ pthread_cond_t swap_queue_cond;
+ pthread_cond_t swap_unlock_buffer_cond;
+ int swap_queue_idx_head;
+ int swap_queue_idx_tail;
+ pthread_t swap_queue_processor;
+#endif
int swap_queue_idx_head;
int swap_queue_idx_tail;
pthread_t swap_queue_processor;
@@ -412,7 +434,7 @@ struct dri2_egl_surface
+
/* EGL-owned buffers */
__DRIbuffer *local_buffers[__DRI_BUFFER_COUNT];
@@ -394,7 +426,7 @@ struct dri2_egl_surface
#endif
bool locked;
int age;
@@ -78,7 +80,7 @@ index eb2127e3fe6..64d60ed66e4 100644
#endif
#ifdef HAVE_ANDROID_PLATFORM
@@ -442,7 +464,13 @@ struct dri2_egl_surface
@@ -428,7 +460,13 @@ struct dri2_egl_surface
#endif
#ifdef HAVE_NULL_PLATFORM
@@ -1,7 +1,7 @@
From d286d05d0d84c913c8bfcbe8f693083caf3bcc77 Mon Sep 17 00:00:00 2001
From 34f6a09841f2119096676692103251b2d87ac9da Mon Sep 17 00:00:00 2001
From: Silvestrs Timofejevs <silvestrs.timofejevs@imgtec.com>
Date: Mon, 2 Sep 2019 09:32:01 +0100
Subject: [PATCH 41/67] null_platform: add support for explicit synchronisation
Subject: [PATCH 32/58] null_platform: add support for explicit synchronisation
This change adds support for the 'in' fence, the 'out' fence will
potentially be added in subsequent optimisation changes.
@@ -42,10 +42,10 @@ Change-Id: Ib9c4a0bc3ea1b21192ee37909d7580d6b7b366ec
2 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 64d60ed66e4..eb6e4551087 100644
index f74ee282645..e2348443dc9 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -106,6 +106,7 @@ struct wl_buffer;
@@ -101,6 +101,7 @@ struct wl_buffer;
#ifdef HAVE_NULL_PLATFORM
struct display_output {
bool in_use;
@@ -53,7 +53,7 @@ index 64d60ed66e4..eb6e4551087 100644
uint32_t connector_id;
drmModePropertyRes **connector_prop_res;
uint32_t crtc_id;
@@ -338,6 +339,7 @@ struct swap_queue_elem
@@ -336,6 +337,7 @@ struct swap_queue_elem
uint32_t swap_interval;
uint32_t back_id;
uint32_t fb_id;
@@ -1,7 +1,7 @@
From 4f9ca104c16a6eb1af770e2447adb4413fb41cb7 Mon Sep 17 00:00:00 2001
From 681768aaf01927af5337088079a70db7cec7dbb0 Mon Sep 17 00:00:00 2001
From: Luigi Santivetti <luigi.santivetti@imgtec.com>
Date: Thu, 26 Sep 2019 13:32:15 +0100
Subject: [PATCH 42/68] egl/null: add support for DRM image format modifiers
Subject: [PATCH 33/58] egl/null: add support for DRM image format modifiers
This change introduces support for image modifiers to platform_null. In
order for it to create an image with modifiers, it relies on libdrm to
@@ -26,32 +26,15 @@ Internal notes:
Change-Id: I0f7b030f6e1943690692674bf18daabfc153208a
Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
---
meson.build | 5 +
src/egl/drivers/dri2/egl_dri2.h | 3 +
src/egl/drivers/dri2/platform_null.c | 221 +++++++++++++++++++++++----
3 files changed, 203 insertions(+), 26 deletions(-)
2 files changed, 198 insertions(+), 26 deletions(-)
diff --git a/meson.build b/meson.build
index 21d93d372c2..ca89b8ac20d 100644
--- a/meson.build
+++ b/meson.build
@@ -1581,6 +1581,11 @@ if with_gallium_etnaviv
_drm_ver = '2.4.89'
endif
+# platform_null relies on DRM format-modifier iterators available since 2.4.108
+if with_platform_null
+ _drm_ver = '2.4.108'
+endif
+
# Loop over the enables versions and get the highest libdrm requirement for all
# active drivers.
_drm_blame = ''
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index eb6e4551087..32ad720b343 100644
index e2348443dc9..5b382685d38 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -117,6 +117,8 @@ struct display_output {
@@ -112,6 +112,8 @@ struct display_output {
uint32_t mode_blob_id;
unsigned formats;
drmModeAtomicReq *atomic_state;
@@ -60,7 +43,7 @@ index eb6e4551087..32ad720b343 100644
};
#endif
@@ -280,6 +282,7 @@ struct dri2_egl_display
@@ -310,6 +312,7 @@ struct dri2_egl_display
#ifdef HAVE_NULL_PLATFORM
bool atomic_enabled;
@@ -1,7 +1,7 @@
From 1e6466e541e1fc67198be3eeb090e3af22bd6d19 Mon Sep 17 00:00:00 2001
From 9e01160294f65f1330cacc671be97b548452bc69 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Mon, 10 Feb 2020 09:23:03 +0000
Subject: [PATCH 43/67] egl: query the supported ES2 context version
Subject: [PATCH 34/58] egl: query the supported ES2 context version
For OpenGL ES contexts, the EGL specification states that querying
EGL_CONTEXT_CLIENT_VERSION with eglQueryContext may return a version
@@ -39,12 +39,12 @@ large value it currently has.
7 files changed, 50 insertions(+), 4 deletions(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 6490f6e80e2..9c7bcac4cae 100644
index 80acaf3a7b1..acd58ccb559 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -2052,6 +2052,8 @@ typedef struct __DRIDriverVtableExtensionRec {
#define __DRI2_RENDERER_HAS_PROTECTED_CONTENT 0x000e
@@ -1958,6 +1958,8 @@ typedef struct __DRIDriverVtableExtensionRec {
#define __DRI2_RENDERER_PREFER_BACK_BUFFER_REUSE 0x000f
#define __DRI2_RENDERER_HAS_NO_ERROR_CONTEXT 0x0010
+#define __DRI2_RENDERER_OPENGL_ES2_CONTEXT_CLIENT_VERSION_IMG 0x7001
+
@@ -52,10 +52,10 @@ index 6490f6e80e2..9c7bcac4cae 100644
struct __DRI2rendererQueryExtensionRec {
__DRIextension base;
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 6b26ff979ae..c4a49cae592 100644
index b25c0231dc8..3ae5cddbc20 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2055,6 +2055,26 @@ dri2_make_current(_EGLDisplay *disp, _EGLSurface *dsurf,
@@ -2006,6 +2006,26 @@ dri2_make_current(_EGLDisplay *disp, _EGLSurface *dsurf,
return EGL_TRUE;
}
@@ -82,7 +82,7 @@ index 6b26ff979ae..c4a49cae592 100644
__DRIdrawable *
dri2_surface_get_dri_drawable(_EGLSurface *surf)
{
@@ -4336,6 +4356,7 @@ const _EGLDriver _eglDriver = {
@@ -3885,6 +3905,7 @@ const _EGLDriver _eglDriver = {
.CreateContext = dri2_create_context,
.DestroyContext = dri2_destroy_context,
.MakeCurrent = dri2_make_current,
@@ -118,10 +118,10 @@ index 18c73c9cd8b..2690a82eb75 100644
.CreatePixmapSurface = haiku_create_pixmap_surface,
.CreatePbufferSurface = haiku_create_pbuffer_surface,
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 2d3931dfd26..1cbff9656e4 100644
index d9fbb7a11fb..69ac50ff8e8 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -948,7 +948,7 @@ eglQueryContext(EGLDisplay dpy, EGLContext ctx,
@@ -941,7 +941,7 @@ eglQueryContext(EGLDisplay dpy, EGLContext ctx,
_EGL_CHECK_CONTEXT(disp, context, EGL_FALSE);
@@ -1,357 +0,0 @@
From 40c0d03cfb2751279b24890d0f752fade968862e Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Tue, 13 Feb 2018 14:47:48 +0000
Subject: [PATCH 34/67] egl/tizen: expose EXT_yuv_surface support
This adds support for NV12 and NV21 configs.
---
src/egl/drivers/dri2/platform_tizen.c | 278 ++++++++++++++++++--------
1 file changed, 200 insertions(+), 78 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c
index 2bc9b3e7c64..b6478a1875b 100644
--- a/src/egl/drivers/dri2/platform_tizen.c
+++ b/src/egl/drivers/dri2/platform_tizen.c
@@ -100,37 +100,93 @@ create_image_from_native(struct dri2_egl_surface *dri2_surf,
{
_EGLSurface *surf = &dri2_surf->base;
struct dri2_egl_display *dri2_dpy = dri2_egl_display(surf->Resource.Display);
+ struct dri2_egl_config *dri2_conf = dri2_egl_config(surf->Config);
+ const __DRIconfig *config =
+ dri2_get_dri_config(dri2_conf, surf->Type, surf->GLColorspace);
tbm_bo tbm_buf;
tbm_surface_info_s info;
- int fd, fourcc, offset, pitch;
+ int fd[TBM_SURF_PLANE_MAX];
+ int offset[TBM_SURF_PLANE_MAX];
+ int pitch[TBM_SURF_PLANE_MAX];
+ int fourcc;
__DRIimage *dri_image;
-
- tbm_buf = tbm_surface_internal_get_bo(tbm_surf, 0);
- if (!tbm_buf) {
- _eglLog(_EGL_DEBUG, "%s: failed to get bo for tbm surface", __func__);
- return NULL;
- }
+ enum __DRIYUVColorSpace color_space;
+ enum __DRISampleRange sample_range;
+ unsigned csc_standard;
+ unsigned depth_range;
+ unsigned create_error;
if (tbm_surface_get_info(tbm_surf, &info)) {
_eglLog(_EGL_DEBUG, "%s: failed to get tbm surface info", __func__);
return NULL;
}
- fd = tbm_bo_export_fd(tbm_buf);
fourcc = dri2_fourcc_from_tbm_format(info.format);
- offset = info.planes[0].offset;
- pitch = info.planes[0].stride;
-
- dri_image = dri2_dpy->image->createImageFromFds(dri2_dpy->dri_screen,
- info.width,
- info.height,
- fourcc,
- &fd,
- 1,
- &pitch,
- &offset,
- loaderPrivate);
- close(fd);
+
+ for (unsigned i = 0; i < info.num_planes; i++) {
+ int index = tbm_surface_internal_get_plane_bo_idx(tbm_surf, i);
+
+ tbm_buf = tbm_surface_internal_get_bo(tbm_surf, index);
+ if (!tbm_buf) {
+ while (i--)
+ close(fd[i]);
+ _eglLog(_EGL_DEBUG, "%s: failed to get bo %d for tbm surface",
+ __func__, i);
+ return NULL;
+ }
+
+ fd[i] = tbm_bo_export_fd(tbm_buf);
+ offset[i] = info.planes[i].offset;
+ pitch[i] = info.planes[i].stride;
+ }
+
+ dri2_dpy->core->getConfigAttrib(config,
+ __DRI_ATTRIB_YUV_CSC_STANDARD, &csc_standard);
+ switch (csc_standard) {
+ case __DRI_ATTRIB_YUV_CSC_STANDARD_601_BIT:
+ color_space = __DRI_YUV_COLOR_SPACE_ITU_REC601;
+ break;
+ case __DRI_ATTRIB_YUV_CSC_STANDARD_709_BIT:
+ color_space = __DRI_YUV_COLOR_SPACE_ITU_REC709;
+ break;
+ case __DRI_ATTRIB_YUV_CSC_STANDARD_2020_BIT:
+ color_space = __DRI_YUV_COLOR_SPACE_ITU_REC2020;
+ break;
+ default:
+ color_space = __DRI_YUV_COLOR_SPACE_UNDEFINED;
+ break;
+ }
+
+ dri2_dpy->core->getConfigAttrib(config,
+ __DRI_ATTRIB_YUV_DEPTH_RANGE, &depth_range);
+ switch (depth_range) {
+ case __DRI_ATTRIB_YUV_DEPTH_RANGE_LIMITED_BIT:
+ sample_range = __DRI_YUV_NARROW_RANGE;
+ break;
+ case __DRI_ATTRIB_YUV_DEPTH_RANGE_FULL_BIT:
+ sample_range = __DRI_YUV_FULL_RANGE;
+ break;
+ default:
+ sample_range = __DRI_YUV_RANGE_UNDEFINED;
+ break;
+ }
+
+ dri_image = dri2_dpy->image->createImageFromDmaBufs(dri2_dpy->dri_screen,
+ info.width,
+ info.height,
+ fourcc,
+ fd,
+ info.num_planes,
+ pitch,
+ offset,
+ color_space,
+ sample_range,
+ __DRI_YUV_CHROMA_SITING_UNDEFINED,
+ __DRI_YUV_CHROMA_SITING_UNDEFINED,
+ &create_error,
+ loaderPrivate);
+ for (unsigned i = 0; i < info.num_planes; i++)
+ close(fd[i]);
if (!dri_image) {
_eglLog(_EGL_DEBUG, "%s: failed to create dri image from tbm bo", __func__);
@@ -792,10 +848,22 @@ dri2_tizen_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
{
}
+static unsigned
+dri2_tizen_get_capability(void *loaderPrivate, enum dri_loader_cap cap)
+{
+ switch (cap) {
+ case DRI_LOADER_CAP_YUV_SURFACE_IMG:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
static const __DRIimageLoaderExtension tizen_image_loader_extension = {
- .base = { __DRI_IMAGE_LOADER, 1 },
+ .base = { __DRI_IMAGE_LOADER, 2 },
.getBuffers = dri2_tizen_get_buffers,
.flushFrontBuffer = dri2_tizen_flush_front_buffer,
+ .getCapability = dri2_tizen_get_capability,
};
static const __DRIextension *image_loader_extensions[] = {
@@ -804,6 +872,41 @@ static const __DRIextension *image_loader_extensions[] = {
NULL,
};
+static EGLBoolean
+derive_yuv_native_visual_from_config(struct dri2_egl_display *dri2_dpy,
+ const __DRIconfig *dri_config,
+ int *native_visual)
+{
+ unsigned order, subsample, num_planes, plane_bpp;
+
+ dri2_dpy->core->getConfigAttrib(dri_config, __DRI_ATTRIB_YUV_ORDER,
+ &order);
+ dri2_dpy->core->getConfigAttrib(dri_config, __DRI_ATTRIB_YUV_SUBSAMPLE,
+ &subsample);
+ dri2_dpy->core->getConfigAttrib(dri_config, __DRI_ATTRIB_YUV_NUMBER_OF_PLANES,
+ &num_planes);
+ dri2_dpy->core->getConfigAttrib(dri_config, __DRI_ATTRIB_YUV_PLANE_BPP,
+ &plane_bpp);
+
+ if ((plane_bpp & __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT) == 0)
+ return EGL_FALSE;
+
+ if (num_planes != 2)
+ return EGL_FALSE;
+
+ if (subsample & __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_0_BIT) {
+ if (order & __DRI_ATTRIB_YUV_ORDER_YUV_BIT) {
+ *native_visual = TBM_FORMAT_NV12;
+ return EGL_TRUE;
+ } else if (order & __DRI_ATTRIB_YUV_ORDER_YVU_BIT) {
+ *native_visual = TBM_FORMAT_NV21;
+ return EGL_TRUE;
+ }
+ }
+
+ return EGL_FALSE;
+}
+
static EGLBoolean
dri2_tizen_add_configs(_EGLDisplay *dpy)
{
@@ -811,83 +914,102 @@ dri2_tizen_add_configs(_EGLDisplay *dpy)
int count = 0;
for (unsigned i = 0; dri2_dpy->driver_configs[i]; i++) {
- static const struct rgba_shifts_and_sizes pbuffer_sasa[] = {
- {
- /* ARGB8888 */
- { 16, 8, 0, 24 },
- { 8, 8, 8, 8 },
- },
- {
- /* RGB888 */
- { 16, 8, 0, -1 },
- { 8, 8, 8, 0 },
- },
- {
- /* RGB565 */
- { 11, 5, 0, -1 },
- { 5, 6, 5, 0 },
- },
- };
struct dri2_egl_config *dri2_cfg;
- int shifts[4];
- unsigned int sizes[4];
+ unsigned int render_type;
unsigned int caveat = 0;
int surface_type = 0;
- tpl_bool_t is_slow;
EGLint attr_list[] = {
EGL_NATIVE_VISUAL_ID, 0,
EGL_CONFIG_CAVEAT, EGL_NONE,
EGL_NONE,
};
- tpl_result_t res;
-
- dri2_get_shifts_and_sizes(dri2_dpy->core, dri2_dpy->driver_configs[i],
- shifts, sizes);
dri2_dpy->core->getConfigAttrib(dri2_dpy->driver_configs[i],
- __DRI_ATTRIB_BUFFER_SIZE, &depth);
+ __DRI_ATTRIB_CONFIG_CAVEAT, &caveat);
dri2_dpy->core->getConfigAttrib(dri2_dpy->driver_configs[i],
- __DRI_ATTRIB_CONFIG_CAVEAT, &caveat);
+ __DRI_ATTRIB_RENDER_TYPE, &render_type);
+
+ if (render_type & __DRI_ATTRIB_RGBA_BIT) {
+ static const struct rgba_shifts_and_sizes pbuffer_sasa[] = {
+ {
+ /* ARGB8888 */
+ { 16, 8, 0, 24 },
+ { 8, 8, 8, 8 },
+ },
+ {
+ /* RGB888 */
+ { 16, 8, 0, -1 },
+ { 8, 8, 8, 0 },
+ },
+ {
+ /* RGB565 */
+ { 11, 5, 0, -1 },
+ { 5, 6, 5, 0 },
+ },
+ };
+ int shifts[4];
+ unsigned int sizes[4];
+ unsigned int depth;
+ tpl_bool_t is_slow;
+ tpl_result_t res;
- res = tpl_display_query_config(dri2_dpy->tpl_dpy, TPL_SURFACE_TYPE_WINDOW,
- sizes[0], sizes[1], sizes[2], sizes[3],
- depth, &attr_list[1], &is_slow);
- if (res != TPL_ERROR_NONE)
- continue;
- surface_type |= EGL_WINDOW_BIT;
+ dri2_get_shifts_and_sizes(dri2_dpy->core, dri2_dpy->driver_configs[i],
+ shifts, sizes);
- if (is_slow)
- caveat |= __DRI_ATTRIB_SLOW_BIT;
+ dri2_dpy->core->getConfigAttrib(dri2_dpy->driver_configs[i],
+ __DRI_ATTRIB_BUFFER_SIZE, &depth);
+
+ res = tpl_display_query_config(dri2_dpy->tpl_dpy,
+ TPL_SURFACE_TYPE_WINDOW,
+ sizes[0], sizes[1], sizes[2], sizes[3],
+ depth, &attr_list[1], &is_slow);
+ if (res != TPL_ERROR_NONE)
+ continue;
- res = tpl_display_query_config(dri2_dpy->tpl_dpy, TPL_SURFACE_TYPE_PIXMAP,
- sizes[0], sizes[1], sizes[2], sizes[3],
- depth, NULL, &is_slow);
- if (res == TPL_ERROR_NONE) {
- surface_type |= EGL_PIXMAP_BIT;
+ surface_type |= EGL_WINDOW_BIT;
if (is_slow)
caveat |= __DRI_ATTRIB_SLOW_BIT;
- }
- for (unsigned j = 0; j < ARRAY_SIZE(pbuffer_sasa); j++) {
- const struct rgba_shifts_and_sizes *pbuffer_sas = &pbuffer_sasa[j];
-
- if (shifts[0] == pbuffer_sas->shifts[0] &&
- shifts[1] == pbuffer_sas->shifts[1] &&
- shifts[2] == pbuffer_sas->shifts[2] &&
- shifts[3] == pbuffer_sas->shifts[3] &&
- sizes[0] == pbuffer_sas->sizes[0] &&
- sizes[1] == pbuffer_sas->sizes[1] &&
- sizes[2] == pbuffer_sas->sizes[2] &&
- sizes[3] == pbuffer_sas->sizes[3]) {
- surface_type |= EGL_PBUFFER_BIT;
- break;
+ res = tpl_display_query_config(dri2_dpy->tpl_dpy,
+ TPL_SURFACE_TYPE_PIXMAP,
+ sizes[0], sizes[1], sizes[2], sizes[3],
+ depth, NULL, &is_slow);
+ if (res == TPL_ERROR_NONE) {
+ surface_type |= EGL_PIXMAP_BIT;
+
+ if (is_slow)
+ caveat |= __DRI_ATTRIB_SLOW_BIT;
}
- }
- if (dri2_dpy->image->base.version >= 9 && dri2_dpy->image->blitImage)
- surface_type |= EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+ for (unsigned j = 0; j < ARRAY_SIZE(pbuffer_sasa); j++) {
+ const struct rgba_shifts_and_sizes *pbuffer_sas = &pbuffer_sasa[j];
+
+ if (shifts[0] == pbuffer_sas->shifts[0] &&
+ shifts[1] == pbuffer_sas->shifts[1] &&
+ shifts[2] == pbuffer_sas->shifts[2] &&
+ shifts[3] == pbuffer_sas->shifts[3] &&
+ sizes[0] == pbuffer_sas->sizes[0] &&
+ sizes[1] == pbuffer_sas->sizes[1] &&
+ sizes[2] == pbuffer_sas->sizes[2] &&
+ sizes[3] == pbuffer_sas->sizes[3]) {
+ surface_type |= EGL_PBUFFER_BIT;
+ break;
+ }
+
+ }
+
+ if (dri2_dpy->image->base.version >= 9 && dri2_dpy->image->blitImage)
+ surface_type |= EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+ } else if (render_type & __DRI_ATTRIB_YUV_BIT) {
+ if (!derive_yuv_native_visual_from_config(dri2_dpy,
+ dri2_dpy->driver_configs[i],
+ &attr_list[1]))
+ continue;
+ surface_type = EGL_WINDOW_BIT;
+ caveat = 0;
+ }
if (caveat & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
attr_list[3] = EGL_NON_CONFORMANT_CONFIG;
--
2.25.1
@@ -1,7 +1,7 @@
From 64e6997ded5825f10125313ea15e3164bdad769b Mon Sep 17 00:00:00 2001
From d798e80cc8262955ea57d516249c0969e298a395 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Thu, 11 Jun 2020 12:29:51 +0100
Subject: [PATCH 44/67] meson: allow libGL to be built without GLX
Subject: [PATCH 35/58] meson: allow libGL to be built without GLX
If Meson is run with option "glx" set to "null", build the
OpenGL library without GLX.
@@ -9,21 +9,30 @@ OpenGL library without GLX.
The "eglBindAPI workaround for dEQP bug" change to eglcurrent.h
(commit 2d46c91040aeb8ebad486214159c34417fbc87db) has been
modified to use a new EGL_WITH_OPENGL define, which indicates
whether OpneGL is present or not. This allows EGL to be used
whether OpenGL is present or not. This allows EGL to be used
with OpenGL on platforms other than X11.
---
meson.build | 8 ++++++--
meson.build | 10 +++++++---
meson_options.txt | 2 +-
src/egl/main/eglcurrent.h | 7 +++----
src/glx/meson.build | 20 ++++++++++++++++----
src/meson.build | 2 +-
5 files changed, 27 insertions(+), 12 deletions(-)
5 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/meson.build b/meson.build
index 21d93d372c2..8db1699729a 100644
index b4d5b849f8b..e021a896a0a 100644
--- a/meson.build
+++ b/meson.build
@@ -485,6 +485,10 @@ if with_egl and not _platforms.contains(egl_native_platform)
@@ -484,7 +484,7 @@ elif _egl == 'enabled'
error('EGL requires dri, haiku, or windows')
elif not with_shared_glapi
error('EGL requires shared-glapi')
- elif not ['disabled', 'dri'].contains(with_glx)
+ elif not ['disabled', 'dri', 'null'].contains(with_glx)
error('EGL requires dri, but a GLX is being built without dri')
elif host_machine.system() == 'darwin'
error('EGL is not available on MacOS')
@@ -510,6 +510,10 @@ if with_egl and not _platforms.contains(egl_native_platform)
error('-Degl-native-platform does not specify an enabled platform')
endif
@@ -31,19 +40,19 @@ index 21d93d372c2..8db1699729a 100644
+ pre_args += '-DEGL_WITH_OPENGL'
+endif
+
# Android uses emutls for versions <= P/28. For USE_ELF_TLS we need ELF TLS.
use_elf_tls = false
if (not ['freebsd', 'openbsd', 'haiku'].contains(host_machine.system()) and
@@ -502,7 +506,7 @@ if (not ['freebsd', 'openbsd', 'haiku'].contains(host_machine.system()) and
if 'x11' in _platforms
_platforms += 'xcb'
endif
@@ -572,7 +576,7 @@ if with_platform_windows and with_shared_glapi
pre_args += '-DUSE_TLS_BEHIND_FUNCTIONS'
endif
-if with_glx != 'disabled'
+if with_glx != 'disabled' and with_glx != 'null'
if not (with_platform_x11 and with_any_opengl)
error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
elif with_glx == 'gallium-xlib'
@@ -564,7 +568,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
elif with_glx == 'xlib'
@@ -630,7 +634,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
error('Vulkan drivers require dri3 for X11 support')
endif
if with_dri
@@ -53,15 +62,15 @@ index 21d93d372c2..8db1699729a 100644
endif
endif
diff --git a/meson_options.txt b/meson_options.txt
index d90a25f97ff..d36e714ea4c 100644
index d76cc4b0405..65f32547267 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -290,7 +290,7 @@ option(
@@ -306,7 +306,7 @@ option(
'glx',
type : 'combo',
value : 'auto',
- choices : ['auto', 'disabled', 'dri', 'xlib', 'gallium-xlib'],
+ choices : ['auto', 'disabled', 'dri', 'xlib', 'gallium-xlib', 'null'],
- choices : ['auto', 'disabled', 'dri', 'xlib'],
+ choices : ['auto', 'disabled', 'dri', 'xlib', 'null'],
description : 'Build support for GLX platform'
)
option(
@@ -127,18 +136,18 @@ index 8f642d5e14b..605a9717e37 100644
dependencies : [
dep_libdrm, dep_dl, dep_m, dep_thread, dep_x11, dep_xcb_glx, dep_xcb,
diff --git a/src/meson.build b/src/meson.build
index c3bab27718d..f6eede56648 100644
index 91aca307c87..0846a6035c9 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -110,7 +110,7 @@ subdir('loader')
if with_platform_haiku
subdir('hgl')
endif
-if with_glx == 'dri'
+if with_glx == 'dri' or with_glx == 'null'
@@ -127,7 +127,7 @@ endif
if with_gallium
subdir('mesa')
subdir('gallium')
- if with_glx == 'dri'
+ if with_glx == 'dri' or with_glx == 'null'
subdir('glx')
endif
if with_gbm
# This has to be here since it requires libgallium, and subdir cannot
--
2.25.1
@@ -1,7 +1,7 @@
From 394d340dda351452571ec8861d6768c52d338251 Mon Sep 17 00:00:00 2001
From e8236d271ec5a7ef383c1e3ea9049ef27cdd0ed1 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Tue, 25 Aug 2020 14:12:32 +0100
Subject: [PATCH 45/67] egl/wayland: process non-resized window movement
Subject: [PATCH 36/58] egl/wayland: process non-resized window movement
The dx and dy parameters to the wl_egl_window_resize function were
not being processed unless the window width or height were being
@@ -11,10 +11,10 @@ changed.
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 72456d5d748..06272d4081e 100644
index 10a90ff963f..be10fc6474a 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -266,6 +266,9 @@ resize_callback(struct wl_egl_window *wl_win, void *data)
@@ -392,6 +392,9 @@ resize_callback(struct wl_egl_window *wl_win, void *data)
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
@@ -24,7 +24,7 @@ index 72456d5d748..06272d4081e 100644
if (dri2_surf->base.Width == wl_win->width &&
dri2_surf->base.Height == wl_win->height)
return;
@@ -786,8 +789,6 @@ update_buffers(struct dri2_egl_display *dri2_dpy,
@@ -1255,8 +1258,6 @@ update_buffers(struct dri2_egl_display *dri2_dpy,
dri2_surf->base.Width = dri2_surf->wl_win->width;
dri2_surf->base.Height = dri2_surf->wl_win->height;
@@ -32,7 +32,7 @@ index 72456d5d748..06272d4081e 100644
- dri2_surf->dy = dri2_surf->wl_win->dy;
}
if (dri2_surf->wl_win &&
if (dri2_surf->resized || dri2_surf->received_dmabuf_feedback) {
--
2.25.1
@@ -1,7 +1,7 @@
From ed4671544a6add01e87e94c04df59a600403dd21 Mon Sep 17 00:00:00 2001
From 5987d8ad515e94a36eb54aead8ab89f0ad3f427f Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Mon, 10 Mar 2014 13:43:45 +0000
Subject: [PATCH 46/67] Separate EXT_framebuffer_object from ARB version
Subject: [PATCH 37/58] Separate EXT_framebuffer_object from ARB version
This patch separates the EXT_framebuffer_object entry points from the ARB
equivalents.
@@ -20,10 +20,8 @@ We may need to implement the EXT restrictions if we want to upstream.
src/mapi/glapi/gen/EXT_framebuffer_object.xml | 30 +++----
src/mapi/glapi/gen/static_data.py | 15 ++++
src/mesa/main/fbobject.c | 83 +++++++++++++++++++
src/mesa/main/fbobject.h | 54 ++++++++++++
src/mesa/main/genmipmap.c | 6 ++
src/mesa/main/genmipmap.h | 3 +
6 files changed, 176 insertions(+), 15 deletions(-)
4 files changed, 119 insertions(+), 15 deletions(-)
diff --git a/src/mapi/glapi/gen/EXT_framebuffer_object.xml b/src/mapi/glapi/gen/EXT_framebuffer_object.xml
index 6c0e54af1c9..957b6a3a632 100644
@@ -145,36 +143,36 @@ index 6c0e54af1c9..957b6a3a632 100644
</function>
</category>
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index e231c176264..974f366d7b4 100644
index 53f381e9297..b5b3ed9e9b8 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1706,6 +1706,21 @@ offsets = {
"FramebufferTextureMultisampleMultiviewOVR" : 1670,
"MultiDrawArraysIndirectEXT" : 1671,
"MultiDrawElementsIndirectEXT" : 1672,
+ "IsRenderbufferEXT" : 1673,
+ "DeleteRenderbuffersEXT" : 1674,
+ "GenRenderbuffersEXT" : 1675,
+ "RenderbufferStorageEXT" : 1676,
+ "GetRenderbufferParameterivEXT" : 1677,
+ "IsFramebufferEXT" : 1678,
+ "DeleteFramebuffersEXT" : 1679,
+ "GenFramebuffersEXT" : 1680,
+ "CheckFramebufferStatusEXT" : 1681,
+ "FramebufferTexture1DEXT" : 1682,
+ "FramebufferTexture2DEXT" : 1683,
+ "FramebufferTexture3DEXT" : 1684,
+ "FramebufferRenderbufferEXT" : 1685,
+ "GetFramebufferAttachmentParameterivEXT" : 1686,
+ "GenerateMipmapEXT" : 1687,
@@ -1707,6 +1707,21 @@ offsets = {
"FramebufferTextureMultisampleMultiviewOVR" : 1671,
"MultiDrawArraysIndirectEXT" : 1672,
"MultiDrawElementsIndirectEXT" : 1673,
+ "IsRenderbufferEXT" : 1674,
+ "DeleteRenderbuffersEXT" : 1675,
+ "GenRenderbuffersEXT" : 1676,
+ "RenderbufferStorageEXT" : 1677,
+ "GetRenderbufferParameterivEXT" : 1678,
+ "IsFramebufferEXT" : 1679,
+ "DeleteFramebuffersEXT" : 1680,
+ "GenFramebuffersEXT" : 1681,
+ "CheckFramebufferStatusEXT" : 1682,
+ "FramebufferTexture1DEXT" : 1683,
+ "FramebufferTexture2DEXT" : 1684,
+ "FramebufferTexture3DEXT" : 1685,
+ "FramebufferRenderbufferEXT" : 1686,
+ "GetFramebufferAttachmentParameterivEXT" : 1687,
+ "GenerateMipmapEXT" : 1688,
}
functions = [
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 49893165250..885aa442911 100644
index 48df6d7c4de..be56c71be97 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1995,6 +1995,11 @@ _mesa_detach_renderbuffer(struct gl_context *ctx,
@@ -2165,6 +2165,11 @@ _mesa_detach_renderbuffer(struct gl_context *ctx,
return progress;
}
@@ -186,7 +184,7 @@ index 49893165250..885aa442911 100644
void GLAPIENTRY
_mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
@@ -2722,6 +2727,12 @@ renderbuffer_storage_target(GLenum target, GLenum internalFormat,
@@ -2892,6 +2897,12 @@ renderbuffer_storage_target(GLenum target, GLenum internalFormat,
}
@@ -199,8 +197,8 @@ index 49893165250..885aa442911 100644
void GLAPIENTRY
_mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
{
@@ -2752,6 +2763,11 @@ _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
ctx->Driver.EGLImageTargetRenderbufferStorage(ctx, rb, image);
@@ -2929,6 +2940,11 @@ _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
st_egl_image_target_renderbuffer_storage(ctx, rb, image);
}
+void GLAPIENTRY
@@ -211,7 +209,7 @@ index 49893165250..885aa442911 100644
/**
* Helper function for _mesa_GetRenderbufferParameteriv() and
@@ -2784,6 +2800,12 @@ _mesa_RenderbufferStorage(GLenum target, GLenum internalFormat,
@@ -2961,6 +2977,12 @@ _mesa_RenderbufferStorage(GLenum target, GLenum internalFormat,
NO_SAMPLES, 0, "glRenderbufferStorage");
}
@@ -224,7 +222,7 @@ index 49893165250..885aa442911 100644
void GLAPIENTRY
_mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples,
@@ -2985,6 +3007,11 @@ _mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,
@@ -3141,6 +3163,11 @@ _mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,
"glGetNamedRenderbufferParameteriv");
}
@@ -236,7 +234,7 @@ index 49893165250..885aa442911 100644
void GLAPIENTRY
_mesa_GetNamedRenderbufferParameterivEXT(GLuint renderbuffer, GLenum pname,
@@ -3018,6 +3045,11 @@ _mesa_IsFramebuffer(GLuint framebuffer)
@@ -3174,6 +3201,11 @@ _mesa_IsFramebuffer(GLuint framebuffer)
return GL_FALSE;
}
@@ -248,7 +246,7 @@ index 49893165250..885aa442911 100644
/**
* Check if any of the attachments of the given framebuffer are textures
@@ -3253,6 +3285,11 @@ _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
@@ -3396,6 +3428,11 @@ _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
}
}
@@ -260,7 +258,7 @@ index 49893165250..885aa442911 100644
/**
* This is the implementation for glGenFramebuffers and glCreateFramebuffers.
@@ -3299,6 +3336,11 @@ create_framebuffers(GLsizei n, GLuint *framebuffers, bool dsa)
@@ -3442,6 +3479,11 @@ create_framebuffers(GLsizei n, GLuint *framebuffers, bool dsa)
_mesa_HashUnlockMutex(ctx->Shared->FrameBuffers);
}
@@ -272,7 +270,7 @@ index 49893165250..885aa442911 100644
void GLAPIENTRY
_mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers)
@@ -3338,6 +3380,11 @@ _mesa_check_framebuffer_status(struct gl_context *ctx,
@@ -3481,6 +3523,11 @@ _mesa_check_framebuffer_status(struct gl_context *ctx,
return buffer->_Status;
}
@@ -284,7 +282,7 @@ index 49893165250..885aa442911 100644
GLenum GLAPIENTRY
_mesa_CheckFramebufferStatus_no_error(GLenum target)
@@ -3950,6 +3997,12 @@ _mesa_FramebufferTexture1D_no_error(GLenum target, GLenum attachment,
@@ -4093,6 +4140,12 @@ _mesa_FramebufferTexture1D_no_error(GLenum target, GLenum attachment,
texture, level, 0);
}
@@ -297,7 +295,7 @@ index 49893165250..885aa442911 100644
void GLAPIENTRY
_mesa_FramebufferTexture1D(GLenum target, GLenum attachment,
@@ -3990,6 +4043,12 @@ _mesa_FramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment,
@@ -4133,6 +4186,12 @@ _mesa_FramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment,
false);
}
@@ -310,7 +308,7 @@ index 49893165250..885aa442911 100644
void GLAPIENTRY
_mesa_FramebufferTexture3D_no_error(GLenum target, GLenum attachment,
@@ -4100,6 +4159,15 @@ frame_buffer_texture(GLuint framebuffer, GLenum target,
@@ -4243,6 +4302,15 @@ frame_buffer_texture(GLuint framebuffer, GLenum target,
level, 0, layer, layered);
}
@@ -326,7 +324,7 @@ index 49893165250..885aa442911 100644
void GLAPIENTRY
_mesa_FramebufferTextureLayer_no_error(GLenum target, GLenum attachment,
GLuint texture, GLint level,
@@ -4353,6 +4421,15 @@ _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment,
@@ -4495,6 +4563,15 @@ _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment,
renderbuffer, "glFramebufferRenderbuffer");
}
@@ -342,7 +340,7 @@ index 49893165250..885aa442911 100644
void GLAPIENTRY
_mesa_NamedFramebufferRenderbuffer_no_error(GLuint framebuffer,
GLenum attachment,
@@ -4754,6 +4831,12 @@ invalid_pname_enum:
@@ -4896,6 +4973,12 @@ invalid_pname_enum:
return;
}
@@ -355,162 +353,11 @@ index 49893165250..885aa442911 100644
void GLAPIENTRY
_mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
index 2a32c158e68..98271d76f50 100644
--- a/src/mesa/main/fbobject.h
+++ b/src/mesa/main/fbobject.h
@@ -145,6 +145,9 @@ _mesa_bind_framebuffers(struct gl_context *ctx,
extern GLboolean GLAPIENTRY
_mesa_IsRenderbuffer(GLuint renderbuffer);
+extern GLboolean GLAPIENTRY
+_mesa_IsRenderbufferEXT(GLuint renderbuffer);
+
extern void GLAPIENTRY
_mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer);
@@ -157,12 +160,18 @@ _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
void GLAPIENTRY
_mesa_GenRenderbuffers_no_error(GLsizei n, GLuint *renderbuffers);
+extern void GLAPIENTRY
+_mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers);
+
extern void GLAPIENTRY
_mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers);
void GLAPIENTRY
_mesa_CreateRenderbuffers_no_error(GLsizei n, GLuint *renderbuffers);
+extern void GLAPIENTRY
+_mesa_GenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers);
+
extern void GLAPIENTRY
_mesa_CreateRenderbuffers(GLsizei n, GLuint *renderbuffers);
@@ -170,6 +179,10 @@ extern void GLAPIENTRY
_mesa_RenderbufferStorage(GLenum target, GLenum internalformat,
GLsizei width, GLsizei height);
+extern void GLAPIENTRY
+_mesa_RenderbufferStorageEXT(GLenum target, GLenum internalformat,
+ GLsizei width, GLsizei height);
+
extern void GLAPIENTRY
_mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples,
GLenum internalformat,
@@ -213,6 +226,10 @@ extern void GLAPIENTRY
_mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname,
GLint *params);
+extern void GLAPIENTRY
+_mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname,
+ GLint *params);
+
void GLAPIENTRY
_mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,
GLint *params);
@@ -220,6 +237,9 @@ _mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,
extern GLboolean GLAPIENTRY
_mesa_IsFramebuffer(GLuint framebuffer);
+extern GLboolean GLAPIENTRY
+_mesa_IsFramebufferEXT(GLuint framebuffer);
+
extern void GLAPIENTRY
_mesa_BindFramebuffer(GLenum target, GLuint framebuffer);
@@ -229,9 +249,15 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer);
extern void GLAPIENTRY
_mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
+extern void GLAPIENTRY
+_mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers);
+
extern void GLAPIENTRY
_mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers);
+extern void GLAPIENTRY
+_mesa_GenFramebuffersEXT(GLsizei n, GLuint *framebuffers);
+
extern void GLAPIENTRY
_mesa_CreateFramebuffers(GLsizei n, GLuint *framebuffers);
@@ -241,6 +267,9 @@ _mesa_CheckFramebufferStatus_no_error(GLenum target);
extern GLenum GLAPIENTRY
_mesa_CheckFramebufferStatus(GLenum target);
+extern GLenum GLAPIENTRY
+_mesa_CheckFramebufferStatusEXT(GLenum target);
+
extern GLenum GLAPIENTRY
_mesa_CheckNamedFramebufferStatus(GLuint framebuffer, GLenum target);
@@ -259,6 +288,11 @@ extern void GLAPIENTRY
_mesa_FramebufferTexture2D_no_error(GLenum target, GLenum attachment,
GLenum textarget, GLuint texture,
GLint level);
+
+extern void GLAPIENTRY
+_mesa_FramebufferTexture1DEXT(GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture, GLint level);
+
extern void GLAPIENTRY
_mesa_FramebufferTexture2D(GLenum target, GLenum attachment,
GLenum textarget, GLuint texture, GLint level);
@@ -272,6 +306,11 @@ extern void GLAPIENTRY
_mesa_FramebufferTexture3D_no_error(GLenum target, GLenum attachment,
GLenum textarget, GLuint texture,
GLint level, GLint layer);
+
+extern void GLAPIENTRY
+_mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture, GLint level);
+
extern void GLAPIENTRY
_mesa_FramebufferTexture3D(GLenum target, GLenum attachment,
GLenum textarget, GLuint texture,
@@ -281,6 +320,12 @@ extern void GLAPIENTRY
_mesa_FramebufferTextureLayer_no_error(GLenum target, GLenum attachment,
GLuint texture, GLint level,
GLint layer);
+
+extern void GLAPIENTRY
+_mesa_FramebufferTexture3DEXT(GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture,
+ GLint level, GLint zoffset);
+
extern void GLAPIENTRY
_mesa_FramebufferTextureLayer(GLenum target, GLenum attachment,
GLuint texture, GLint level, GLint layer);
@@ -342,6 +387,11 @@ _mesa_NamedFramebufferRenderbuffer_no_error(GLuint framebuffer,
GLenum renderbuffertarget,
GLuint renderbuffer);
+extern void GLAPIENTRY
+_mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer);
+
extern void GLAPIENTRY
_mesa_NamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment,
GLenum renderbuffertarget,
@@ -390,6 +440,10 @@ _mesa_InvalidateSubFramebuffer_no_error(GLenum target, GLsizei numAttachments,
const GLenum *attachments, GLint x,
GLint y, GLsizei width, GLsizei height);
+extern void GLAPIENTRY
+_mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
+ GLenum pname, GLint *params);
+
extern void GLAPIENTRY
_mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments,
const GLenum *attachments, GLint x, GLint y,
diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c
index 36727bb7060..8d262e53852 100644
index 97d0ab36a13..b30cf4f07c4 100644
--- a/src/mesa/main/genmipmap.c
+++ b/src/mesa/main/genmipmap.c
@@ -267,3 +267,9 @@ _mesa_GenerateMultiTexMipmapEXT(GLenum texunit, GLenum target)
@@ -286,3 +286,9 @@ _mesa_GenerateMultiTexMipmapEXT(GLenum texunit, GLenum target)
validate_params_and_generate_mipmap(texObj,
"glGenerateMultiTexMipmapEXT");
}
@@ -520,20 +367,6 @@ index 36727bb7060..8d262e53852 100644
+{
+ _mesa_GenerateMipmap(target);
+}
diff --git a/src/mesa/main/genmipmap.h b/src/mesa/main/genmipmap.h
index c661f2184c7..ff3b45a4417 100644
--- a/src/mesa/main/genmipmap.h
+++ b/src/mesa/main/genmipmap.h
@@ -44,6 +44,9 @@ _mesa_GenerateMipmap(GLenum target);
void GLAPIENTRY
_mesa_GenerateTextureMipmap_no_error(GLuint texture);
+extern void GLAPIENTRY
+_mesa_GenerateMipmapEXT(GLenum target);
+
extern void GLAPIENTRY
_mesa_GenerateTextureMipmap(GLuint texture);
--
2.25.1
@@ -1,509 +0,0 @@
From 02065d490a68d542be56c2ea23346b3fa19928cb Mon Sep 17 00:00:00 2001
From: Silvestrs Timofejevs <silvestrs.timofejevs@imgtec.com>
Date: Mon, 24 Sep 2018 14:14:25 +0100
Subject: [PATCH 37/67] egl: add config debug printout
Feature to print out EGL returned configs for debug purposes.
'eglChooseConfig' and 'eglGetConfigs' debug information printout is
enabled when the log level equals '_EGL_DEBUG'. The configs are
printed, and if any of them are "chosen" they are marked with their
index in the chosen configs array.
---
src/egl/main/eglconfig.c | 20 ++-
src/egl/main/eglconfigdebug.c | 321 ++++++++++++++++++++++++++++++++++
src/egl/main/eglconfigdebug.h | 55 ++++++
src/egl/main/egllog.c | 9 +
src/egl/main/egllog.h | 4 +
src/egl/meson.build | 2 +
6 files changed, 407 insertions(+), 4 deletions(-)
create mode 100644 src/egl/main/eglconfigdebug.c
create mode 100644 src/egl/main/eglconfigdebug.h
diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 5e56948ab72..ea4b3c15f3f 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -40,6 +40,7 @@
#include "util/macros.h"
#include "eglconfig.h"
+#include "eglconfigdebug.h"
#include "egldisplay.h"
#include "eglcurrent.h"
#include "egllog.h"
@@ -1039,14 +1040,21 @@ _eglChooseConfig(_EGLDisplay *disp, const EGLint *attrib_list,
EGLConfig *configs, EGLint config_size, EGLint *num_configs)
{
_EGLConfig criteria;
+ EGLBoolean result;
if (!_eglParseConfigAttribList(&criteria, disp, attrib_list))
return _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
- return _eglFilterConfigArray(disp->Configs,
- configs, config_size, num_configs,
- _eglFallbackMatch, _eglFallbackCompare,
- (void *) &criteria);
+ result = _eglFilterConfigArray(disp->Configs,
+ configs, config_size, num_configs,
+ _eglFallbackMatch, _eglFallbackCompare,
+ (void *) &criteria);
+
+ if (result && (_eglGetLogLevel() == _EGL_DEBUG))
+ eglPrintConfigDebug(disp, configs, *num_configs,
+ EGL_CONFIG_DEBUG_CHOOSE);
+
+ return result;
}
@@ -1096,5 +1104,9 @@ _eglGetConfigs(_EGLDisplay *disp, EGLConfig *configs,
*num_config = _eglFlattenArray(disp->Configs, (void *) configs,
sizeof(configs[0]), config_size, _eglFlattenConfig);
+ if (_eglGetLogLevel() == _EGL_DEBUG)
+ eglPrintConfigDebug(disp, configs, *num_config,
+ EGL_CONFIG_DEBUG_GET);
+
return EGL_TRUE;
}
diff --git a/src/egl/main/eglconfigdebug.c b/src/egl/main/eglconfigdebug.c
new file mode 100644
index 00000000000..92ac41a5614
--- /dev/null
+++ b/src/egl/main/eglconfigdebug.c
@@ -0,0 +1,321 @@
+/*
+ * Copyright 2017 Imagination Technologies.
+ * All Rights Reserved.
+ *
+ * Based on eglinfo, which has copyright:
+ * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "eglarray.h"
+#include "eglconfig.h"
+#include "eglconfigdebug.h"
+#include "egldisplay.h"
+#include "egllog.h"
+#include "egltypedefs.h"
+
+/* Max debug message length */
+#define CONFIG_DEBUG_MSG_MAX 1000
+
+/*
+ * These are X visual types, so if you're running eglinfo under
+ * something not X, they probably don't make sense.
+ */
+static const char *const vnames[] = { "SG", "GS", "SC", "PC", "TC", "DC" };
+
+struct _printAttributes {
+ EGLint id, size, level;
+ EGLint red, green, blue, alpha;
+ EGLint depth, stencil;
+ EGLint renderable, surfaces;
+ EGLint vid, vtype, caveat, bindRgb, bindRgba;
+ EGLint samples, sampleBuffers;
+ char surfString[100];
+ EGLint colorBufferType;
+ EGLint numPlanes, subsample, order;
+};
+
+static void
+_printHeaderFormat(void)
+{
+ /*
+ * EGL configuration output legend:
+ *
+ * chosen --------------- eglChooseConfig returned config priority,
+ * only relevant when eglChooseConfig is called.
+ * id ------------------- EGL_CONFIG_ID
+ * bfsz ----------------- EGL_BUFFER_SIZE
+ * lvl ------------------ EGL_LEVEL
+ *
+ * color size
+ * r -------------------- EGL_RED_SIZE
+ * g -------------------- EGL_GREEN_SIZE
+ * b -------------------- EGL_BLUE_SIZE
+ * a -------------------- EGL_ALPHA_SIZE
+ * dpth ----------------- EGL_DEPTH_SIZE
+ * stcl ----------------- EGL_STENCIL_SIZE
+ *
+ * multisample
+ * ns ------------------- EGL_SAMPLES
+ * b -------------------- EGL_SAMPLE_BUFFERS
+ * visid ---------------- EGL_NATIVE_VISUAL_ID/EGL_NATIVE_VISUAL_TYPE
+ * caveat --------------- EGL_CONFIG_CAVEAT
+ * bind ----------------- EGL_BIND_TO_TEXTURE_RGB/EGL_BIND_TO_TEXTURE_RGBA
+ *
+ * renderable
+ * gl, es, es2, es3, vg - EGL_RENDERABLE_TYPE
+ *
+ * supported
+ * surfaces ------------- EGL_SURFACE_TYPE
+ * colbuf --------------- EGL_COLOR_BUFFER_TYPE
+ *
+ * yuv
+ * p -------------------- EGL_YUV_NUMBER_OF_PLANES_EXT
+ * sub ------------------ EGL_YUV_SUBSAMPLE_EXT
+ * ord ------------------ EGL_YUV_ORDER_EXT
+ */
+ _eglLog(_EGL_DEBUG, "---------------");
+ _eglLog(_EGL_DEBUG, "Configurations:");
+ _eglLog(_EGL_DEBUG, "cho bf lv color size dp st ms vis cav bi renderable supported"
+ " col yuv ");
+ _eglLog(_EGL_DEBUG, "sen id sz l r g b a th cl ns b id eat nd gl es es2 es3 vg surfaces"
+ " buf p sub ord");
+ _eglLog(_EGL_DEBUG, "---------------");
+}
+
+static void
+_snprintfStrcat(char *const msg, const int maxSize, const char *fmt, ...)
+{
+ int maxAllowed;
+ va_list args;
+
+ maxAllowed = maxSize - strlen(msg);
+
+ va_start(args, fmt);
+ (void) vsnprintf(&msg[strlen(msg)], maxAllowed, fmt, args);
+ va_end(args);
+}
+
+static inline const char *_enumToString(EGLint constant)
+{
+ switch (constant) {
+ case EGL_YUV_SUBSAMPLE_4_2_0_EXT: return "420";
+ case EGL_YUV_SUBSAMPLE_4_2_2_EXT: return "422";
+ case EGL_YUV_SUBSAMPLE_4_4_4_EXT: return "444";
+ case EGL_YUV_ORDER_AYUV_EXT: return "AYUV";
+ case EGL_YUV_ORDER_UYVY_EXT: return "UYVY";
+ case EGL_YUV_ORDER_VYUY_EXT: return "VYUY";
+ case EGL_YUV_ORDER_YUYV_EXT: return "YUYV";
+ case EGL_YUV_ORDER_YVYU_EXT: return "YVYU";
+ case EGL_YUV_ORDER_YUV_EXT: return "YUV";
+ case EGL_YUV_ORDER_YVU_EXT: return "YVU";
+ case EGL_LUMINANCE_BUFFER: return "lum";
+ case EGL_YUV_BUFFER_EXT: return "yuv";
+ case EGL_RGB_BUFFER: return "rgb";
+ default: return "?";
+ }
+}
+
+static void
+_eglGetConfigAttrs(_EGLDisplay *const dpy, _EGLConfig *const conf,
+ struct _printAttributes *const attr)
+{
+ EGLBoolean success = EGL_TRUE;
+
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_CONFIG_ID, &attr->id);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_BUFFER_SIZE, &attr->size);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_LEVEL, &attr->level);
+
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_RED_SIZE, &attr->red);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_GREEN_SIZE, &attr->green);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_BLUE_SIZE, &attr->blue);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_ALPHA_SIZE, &attr->alpha);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_DEPTH_SIZE, &attr->depth);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_STENCIL_SIZE, &attr->stencil);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_NATIVE_VISUAL_ID, &attr->vid);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_NATIVE_VISUAL_TYPE, &attr->vtype);
+
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_CONFIG_CAVEAT, &attr->caveat);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_BIND_TO_TEXTURE_RGB, &attr->bindRgb);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_BIND_TO_TEXTURE_RGBA, &attr->bindRgba);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_RENDERABLE_TYPE, &attr->renderable);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_SURFACE_TYPE, &attr->surfaces);
+
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_SAMPLES, &attr->samples);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_SAMPLE_BUFFERS, &attr->sampleBuffers);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_COLOR_BUFFER_TYPE, &attr->colorBufferType);
+
+ if (conf->Display->Extensions.EXT_yuv_surface) {
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_YUV_NUMBER_OF_PLANES_EXT,
+ &attr->numPlanes);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_YUV_SUBSAMPLE_EXT, &attr->subsample);
+ success &= _eglGetConfigAttrib(dpy, conf, EGL_YUV_ORDER_EXT, &attr->order);
+ }
+
+ if (!success)
+ _eglLog(_EGL_DEBUG, "%s: config tainted, could not obtain all attributes",
+ __func__);
+}
+
+static void
+_eglPrintConfig(_EGLDisplay *const dpy, _EGLConfig *const conf,
+ char *const printMsg, const int maxMsgSize)
+{
+ struct _printAttributes attr = { 0 };
+
+ _eglGetConfigAttrs(dpy, conf, &attr);
+
+ if (attr.surfaces & EGL_WINDOW_BIT)
+ strcat(attr.surfString, "win,");
+ if (attr.surfaces & EGL_PBUFFER_BIT)
+ strcat(attr.surfString, "pb,");
+ if (attr.surfaces & EGL_PIXMAP_BIT)
+ strcat(attr.surfString, "pix,");
+ if (attr.surfaces & EGL_STREAM_BIT_KHR)
+ strcat(attr.surfString, "str,");
+ if (attr.surfaces & EGL_SWAP_BEHAVIOR_PRESERVED_BIT)
+ strcat(attr.surfString, "prsv,");
+ if (strlen(attr.surfString) > 0)
+ attr.surfString[strlen(attr.surfString) - 1] = 0;
+
+ _snprintfStrcat(printMsg, maxMsgSize,
+ "0x%03x %2d %2d %2d %2d %2d %2d %2d %2d %2d%2d 0x%08x%2s ",
+ attr.id, attr.size, attr.level,
+ attr.red, attr.green, attr.blue, attr.alpha,
+ attr.depth, attr.stencil,
+ attr.samples, attr.sampleBuffers, attr.vid,
+ attr.vtype < 6 ? vnames[attr.vtype] : "--");
+
+ _snprintfStrcat(printMsg, maxMsgSize,
+ "%c %c %c %c %c %c %c %15s",
+ (attr.caveat != EGL_NONE) ? 'y' : ' ',
+ (attr.bindRgba) ? 'a' : (attr.bindRgb) ? 'y' : ' ',
+ (attr.renderable & EGL_OPENGL_BIT) ? 'y' : ' ',
+ (attr.renderable & EGL_OPENGL_ES_BIT) ? 'y' : ' ',
+ (attr.renderable & EGL_OPENGL_ES2_BIT) ? 'y' : ' ',
+ (attr.renderable & EGL_OPENGL_ES3_BIT) ? 'y' : ' ',
+ (attr.renderable & EGL_OPENVG_BIT) ? 'y' : ' ',
+ attr.surfString);
+
+ _snprintfStrcat(printMsg, maxMsgSize, " %3.3s",
+ _enumToString(attr.colorBufferType));
+
+ if (attr.colorBufferType == EGL_YUV_BUFFER_EXT)
+ _snprintfStrcat(printMsg, maxMsgSize, " %1.1d %3.3s %4.4s", attr.numPlanes,
+ _enumToString(attr.subsample), _enumToString(attr.order));
+
+ _eglLog(_EGL_DEBUG, printMsg);
+}
+
+static void
+_eglMarkChosenConfig(_EGLConfig *const config,
+ _EGLConfig *const *const chosenConfigs,
+ const EGLint numConfigs, char *const printMsg,
+ const int maxMsgSize)
+{
+ const char padding[] = " ";
+
+ if (chosenConfigs == NULL) {
+ _snprintfStrcat(printMsg, maxMsgSize, "%s ", &padding[0]);
+ return;
+ }
+
+ /* Find a match, "mark" and return */
+ for (EGLint i = 0; i < numConfigs; i++) {
+ if (config == chosenConfigs[i]) {
+ _snprintfStrcat(printMsg, maxMsgSize, "%*d ", strlen(padding), i);
+ return;
+ }
+ }
+
+ _snprintfStrcat(printMsg, maxMsgSize, "%s ", &padding[0]);
+}
+
+static void
+_eglPrintConfigs(_EGLDisplay *const dpy,
+ EGLConfig *const configs, const EGLint numConfigs,
+ const enum EGL_CONFIG_DEBUG_OPTION printOption)
+{
+ const int maxMsgSize = CONFIG_DEBUG_MSG_MAX;
+ EGLint numConfigsToPrint;
+ _EGLConfig **configsToPrint;
+ _EGLConfig **chosenConfigs;
+ char *printMsg;
+
+ printMsg = malloc(maxMsgSize);
+ if (!printMsg) {
+ _eglLog(_EGL_DEBUG, "%s: failed to allocate the print message", __func__);
+ return;
+ }
+
+ /*
+ * If the printout request came from the 'eglChooseConfig', all
+ * configs are printed, and the "chosen" configs are marked.
+ */
+ if (printOption == EGL_CONFIG_DEBUG_CHOOSE) {
+ configsToPrint = (_EGLConfig **) dpy->Configs->Elements;
+ numConfigsToPrint = dpy->Configs->Size;
+ chosenConfigs = (_EGLConfig **) configs;
+ } else {
+ assert(printOption == EGL_CONFIG_DEBUG_GET);
+ configsToPrint = (_EGLConfig **) configs;
+ numConfigsToPrint = numConfigs;
+ chosenConfigs = NULL;
+ }
+
+ _printHeaderFormat();
+ for (EGLint i = 0; i < numConfigsToPrint; i++) {
+ _EGLConfig *configToPrint = configsToPrint[i];
+
+ /* "clear" message */
+ printMsg[0] = '\0';
+
+ _eglMarkChosenConfig(configToPrint, chosenConfigs, numConfigs,
+ printMsg, maxMsgSize);
+
+ _eglPrintConfig(dpy, configToPrint, printMsg, maxMsgSize);
+ }
+
+ free(printMsg);
+}
+
+void eglPrintConfigDebug(_EGLDisplay *const dpy,
+ EGLConfig *const configs, const EGLint numConfigs,
+ const enum EGL_CONFIG_DEBUG_OPTION printOption)
+{
+ if (!numConfigs || !configs) {
+ _eglLog(_EGL_DEBUG, "%s: nothing to print", __func__);
+ return;
+ }
+
+ switch (printOption) {
+ case EGL_CONFIG_DEBUG_CHOOSE:
+ case EGL_CONFIG_DEBUG_GET:
+ _eglPrintConfigs(dpy, configs, numConfigs, printOption);
+ break;
+ default:
+ _eglLog(_EGL_DEBUG, "%s: bad debug option", __func__);
+ break;
+ }
+}
diff --git a/src/egl/main/eglconfigdebug.h b/src/egl/main/eglconfigdebug.h
new file mode 100644
index 00000000000..562aefff9de
--- /dev/null
+++ b/src/egl/main/eglconfigdebug.h
@@ -0,0 +1,55 @@
+/**************************************************************************
+ * Copyright 2017 Imagination Technologies.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef EGLCONFIGDEBUG_INCLUDED
+#define EGLCONFIGDEBUG_INCLUDED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "egltypedefs.h"
+
+/**
+ * Config printout options.
+ */
+enum EGL_CONFIG_DEBUG_OPTION {
+ EGL_CONFIG_DEBUG_CHOOSE,
+ EGL_CONFIG_DEBUG_GET,
+};
+
+/**
+ * Print the list of configs and the associated attributes.
+ */
+void eglPrintConfigDebug(_EGLDisplay *const dpy,
+ EGLConfig *const configs, const EGLint numConfigs,
+ const enum EGL_CONFIG_DEBUG_OPTION printOption);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* EGLCONFIGDEBUG_INCLUDED */
diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
index 973b7600ab1..7a9032f9bbb 100644
--- a/src/egl/main/egllog.c
+++ b/src/egl/main/egllog.c
@@ -153,6 +153,15 @@ _eglInitLogger(void)
}
}
+/**
+ * Return the log level.
+ */
+EGLint
+_eglGetLogLevel(void)
+{
+ return logging.level;
+}
+
/**
* Log a message with message logger.
diff --git a/src/egl/main/egllog.h b/src/egl/main/egllog.h
index 2a06a34684a..a1cf9770ed8 100644
--- a/src/egl/main/egllog.h
+++ b/src/egl/main/egllog.h
@@ -44,6 +44,10 @@ extern "C" {
#define _EGL_DEBUG 3 /* useful info for debugging */
+extern EGLint
+_eglGetLogLevel(void);
+
+
extern void
_eglLog(EGLint level, const char *fmtStr, ...);
diff --git a/src/egl/meson.build b/src/egl/meson.build
index daa6a3a04f0..384bb98ebb3 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -31,6 +31,8 @@ files_egl = files(
'main/eglapi.c',
'main/eglarray.c',
'main/eglarray.h',
+ 'main/eglconfigdebug.c',
+ 'main/eglconfigdebug.h',
'main/eglconfig.c',
'main/eglconfig.h',
'main/eglcontext.c',
--
2.25.1
@@ -1,7 +1,7 @@
From f775167cbe3f324468f8f355be13bd6efa7d4567 Mon Sep 17 00:00:00 2001
From 70ff151898723ed28d6afed41ba15a6d88e798a8 Mon Sep 17 00:00:00 2001
From: Luigi Santivetti <luigi.santivetti@imgtec.com>
Date: Mon, 21 Oct 2019 09:21:52 +0100
Subject: [PATCH 47/67] egl/null: add support for async flip with front buffer
Subject: [PATCH 38/58] egl/null: add support for async flip with front buffer
rendering
This change enables the application to render into the buffer being
@@ -45,10 +45,10 @@ Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
2 files changed, 129 insertions(+), 32 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 0f683d76e18..13b808bff80 100644
index 5b382685d38..c8cc3e22a7f 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -282,6 +282,7 @@ struct dri2_egl_display
@@ -313,6 +313,7 @@ struct dri2_egl_display
#ifdef HAVE_NULL_PLATFORM
bool atomic_enabled;
bool in_formats_enabled;
@@ -56,7 +56,7 @@ index 0f683d76e18..13b808bff80 100644
struct display_output output;
#endif
@@ -442,8 +443,12 @@ struct dri2_egl_surface
@@ -431,8 +432,12 @@ struct dri2_egl_surface
#endif
bool locked;
int age;
@@ -69,7 +69,7 @@ index 0f683d76e18..13b808bff80 100644
#ifdef HAVE_ANDROID_PLATFORM
struct ANativeWindow *window;
@@ -472,12 +477,13 @@ struct dri2_egl_surface
@@ -465,12 +470,13 @@ struct dri2_egl_surface
#endif
#ifdef HAVE_NULL_PLATFORM
@@ -85,10 +85,10 @@ index 0f683d76e18..13b808bff80 100644
#endif
diff --git a/src/egl/drivers/dri2/platform_null.c b/src/egl/drivers/dri2/platform_null.c
index 48a586b6f38..33cf576f147 100644
index 2c79199da26..0ce7e60030b 100644
--- a/src/egl/drivers/dri2/platform_null.c
+++ b/src/egl/drivers/dri2/platform_null.c
@@ -601,6 +601,15 @@ swap_dequeue_data_finish(struct dri2_egl_surface *dri2_surf)
@@ -602,6 +602,15 @@ swap_dequeue_data_finish(struct dri2_egl_surface *dri2_surf)
pthread_mutex_unlock(&dri2_surf->mutex);
}
@@ -104,7 +104,7 @@ index 48a586b6f38..33cf576f147 100644
static void
flip_handler(int fd, unsigned int sequence, unsigned int tv_sec,
unsigned int tv_usec, void *flip_data)
@@ -1118,15 +1127,15 @@ get_front_bo(struct dri2_egl_surface *dri2_surf)
@@ -1146,15 +1155,15 @@ get_front_bo(struct dri2_egl_surface *dri2_surf)
if (dri2_surf->base.Type == EGL_WINDOW_BIT)
use |= __DRI_IMAGE_USE_SCANOUT;
@@ -126,7 +126,7 @@ index 48a586b6f38..33cf576f147 100644
return false;
}
}
@@ -1330,7 +1339,7 @@ dri2_null_create_window_surface(_EGLDisplay *disp, _EGLConfig *config,
@@ -1362,7 +1371,7 @@ dri2_null_create_window_surface(_EGLDisplay *disp, _EGLConfig *config,
}
err = display_output_modeset(dri2_dpy->fd, &dri2_dpy->output,
@@ -135,7 +135,7 @@ index 48a586b6f38..33cf576f147 100644
if (err) {
_eglError(EGL_BAD_NATIVE_WINDOW, "window set mode");
goto err_destroy_surface;
@@ -1360,6 +1369,60 @@ dri2_null_create_pbuffer_surface(_EGLDisplay *disp, _EGLConfig *config,
@@ -1392,6 +1401,60 @@ dri2_null_create_pbuffer_surface(_EGLDisplay *disp, _EGLConfig *config,
return create_surface(disp, config, EGL_PBUFFER_BIT, attrib_list);
}
@@ -196,7 +196,7 @@ index 48a586b6f38..33cf576f147 100644
static EGLBoolean
dri2_null_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
{
@@ -1371,14 +1434,7 @@ dri2_null_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
@@ -1403,14 +1466,7 @@ dri2_null_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
* sure we process the flip event.
*/
if (dri2_surf->swap_queue_processor) {
@@ -212,7 +212,7 @@ index 48a586b6f38..33cf576f147 100644
pthread_cancel(dri2_surf->swap_queue_processor);
pthread_join(dri2_surf->swap_queue_processor, NULL);
}
@@ -1392,11 +1448,11 @@ dri2_null_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
@@ -1424,11 +1480,11 @@ dri2_null_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
if (dri2_surf->mutex_init)
pthread_mutex_destroy(&dri2_surf->mutex);
@@ -228,7 +228,7 @@ index 48a586b6f38..33cf576f147 100644
for (unsigned i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
if (dri2_surf->color_buffers[i].fb_id)
@@ -1423,6 +1479,16 @@ dri2_null_swap_buffers(_EGLDisplay *disp, _EGLSurface *draw)
@@ -1455,6 +1511,16 @@ dri2_null_swap_buffers(_EGLDisplay *disp, _EGLSurface *draw)
if (dri2_surf->base.Type != EGL_WINDOW_BIT)
return EGL_TRUE;
@@ -245,7 +245,7 @@ index 48a586b6f38..33cf576f147 100644
for (unsigned i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++)
if (dri2_surf->color_buffers[i].age > 0)
dri2_surf->color_buffers[i].age++;
@@ -1465,6 +1531,22 @@ dri2_null_query_buffer_age(_EGLDisplay *disp, _EGLSurface *surface)
@@ -1497,6 +1563,22 @@ dri2_null_query_buffer_age(_EGLDisplay *disp, _EGLSurface *surface)
static EGLBoolean
dri2_null_swap_interval(_EGLDisplay *dpy, _EGLSurface *draw, EGLint interval)
{
@@ -268,7 +268,7 @@ index 48a586b6f38..33cf576f147 100644
_eglLog(_EGL_DEBUG, "DRI2: set swap interval to %d", interval);
draw->SwapInterval = interval;
return EGL_TRUE;
@@ -1502,7 +1584,7 @@ dri2_null_image_get_buffers(__DRIdrawable *driDrawable, unsigned int format,
@@ -1534,7 +1616,7 @@ dri2_null_image_get_buffers(__DRIdrawable *driDrawable, unsigned int format,
if (buffer_mask & __DRI_IMAGE_BUFFER_FRONT) {
buffers->image_mask |= __DRI_IMAGE_BUFFER_FRONT;
@@ -277,7 +277,7 @@ index 48a586b6f38..33cf576f147 100644
}
if (buffer_mask & __DRI_IMAGE_BUFFER_BACK) {
@@ -1640,18 +1722,27 @@ dri2_null_setup_swap_interval(_EGLDisplay *disp)
@@ -1672,18 +1754,27 @@ dri2_null_setup_swap_interval(_EGLDisplay *disp)
dri2_setup_swap_interval(disp, swap_max_interval);
err = drmGetCap(dri2_dpy->fd, DRM_CAP_ASYNC_PAGE_FLIP, &value);
@@ -1,7 +1,7 @@
From 4d19dc5cc9be4f3f25ed8befbfcda70c047065d3 Mon Sep 17 00:00:00 2001
From f72eb12cb7e96bc01f66c328f96d4453e06ea9f7 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Fri, 21 Aug 2020 12:13:28 +0100
Subject: [PATCH 48/67] gbm: add pbuffer support
Subject: [PATCH 39/58] gbm: add pbuffer support
The EGL backend GLX provider for XWayland may get the EGL configs it
uses to generate the GLX ones from GBM. That platform doesn't support
@@ -18,10 +18,10 @@ isn't supported.
2 files changed, 103 insertions(+), 10 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 13b808bff80..141df1b1732 100644
index c8cc3e22a7f..e48d3d26914 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -471,6 +471,9 @@ struct dri2_egl_surface
@@ -464,6 +464,9 @@ struct dri2_egl_surface
/* surfaceless and device */
__DRIimage *front;
unsigned int visual;
@@ -32,7 +32,7 @@ index 13b808bff80..141df1b1732 100644
#ifdef HAVE_WAYLAND_PLATFORM
void *swrast_front;
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 2b329437f88..258e8b6593e 100644
index 45895a88b6c..4d08851c782 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -41,6 +41,38 @@
@@ -1,32 +1,17 @@
From b0ea3289c16d31d840af71876187cf30b2b32e9a Mon Sep 17 00:00:00 2001
From ec732c0f4dc70991c670fb2995d2505a91b18a68 Mon Sep 17 00:00:00 2001
From: Luigi Santivetti <luigi.santivetti@imgtec.com>
Date: Thu, 2 Sep 2021 22:47:54 +0100
Subject: [PATCH 49/68] egl/null: expose EXT_yuv_surface support
Subject: [PATCH 40/58] egl/null: expose EXT_yuv_surface support
---
include/GL/internal/dri_interface.h | 2 +
src/egl/drivers/dri2/platform_null.c | 177 ++++++++++++++++++++++++---
src/mesa/drivers/dri/pvr/pvrutil.c | 8 ++
3 files changed, 173 insertions(+), 14 deletions(-)
src/egl/drivers/dri2/platform_null.c | 247 +++++++++++++++++++++++++--
1 file changed, 233 insertions(+), 14 deletions(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 9c7bcac4cae..888a117d56e 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1411,6 +1411,8 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_FORMAT_ARGB4444 0x1018
#define __DRI_IMAGE_FORMAT_YVU444_PACK10_IMG 0x1019
#define __DRI_IMAGE_FORMAT_BGR888 0x101a
+#define __DRI_IMAGE_FORMAT_NV12 0x101b
+#define __DRI_IMAGE_FORMAT_NV21 0x101c
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
diff --git a/src/egl/drivers/dri2/platform_null.c b/src/egl/drivers/dri2/platform_null.c
index f2c481c256b..d1e576af5ce 100644
index 0ce7e60030b..c78e1fe0880 100644
--- a/src/egl/drivers/dri2/platform_null.c
+++ b/src/egl/drivers/dri2/platform_null.c
@@ -79,6 +79,35 @@ uint32_t get_back_buffer_id(struct dri2_egl_surface *dri2_surf)
@@ -79,6 +79,70 @@ uint32_t get_back_buffer_id(struct dri2_egl_surface *dri2_surf)
.prop_value = value, \
}
@@ -57,12 +42,47 @@ index f2c481c256b..d1e576af5ce 100644
+ .num_planes = 2,
+ .plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT,
+ },
+ {
+ /* __DRI_IMAGE_FORMAT_YU12 */
+ .order = __DRI_ATTRIB_YUV_ORDER_YUV_BIT,
+ .subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_0_BIT,
+ .num_planes = 3,
+ .plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT,
+ },
+ {
+ /* __DRI_IMAGE_FORMAT_YV12 */
+ .order = __DRI_ATTRIB_YUV_ORDER_YVU_BIT,
+ .subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_0_BIT,
+ .num_planes = 3,
+ .plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT,
+ },
+ {
+ /* __DRI_IMAGE_FORMAT_UYVY */
+ .order = __DRI_ATTRIB_YUV_ORDER_UYVY_BIT,
+ .subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_2_BIT,
+ .num_planes = 1,
+ .plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT,
+ },
+ {
+ /* __DRI_IMAGE_FORMAT_YVYU */
+ .order = __DRI_ATTRIB_YUV_ORDER_YVYU_BIT,
+ .subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_2_BIT,
+ .num_planes = 1,
+ .plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT,
+ },
+ {
+ /* __DRI_IMAGE_FORMAT_VYUY */
+ .order = __DRI_ATTRIB_YUV_ORDER_VYUY_BIT,
+ .subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_2_BIT,
+ .num_planes = 1,
+ .plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT,
+ },
+};
+
/*
* The index of entries in this table is used as a bitmask in
* dri2_dpy->formats, which tracks the formats supported by the display.
@@ -88,24 +117,49 @@ static const struct dri2_null_format {
@@ -88,24 +152,84 @@ static const struct dri2_null_format {
int dri_image_format;
int rgba_shifts[4];
unsigned int rgba_sizes[4];
@@ -109,10 +129,45 @@ index f2c481c256b..d1e576af5ce 100644
+ .rgba_shifts = { -1, -1, -1, -1 },
+ .rgba_sizes = { 0, 0, 0, 0 },
+ .yuv = &dri2_null_yuv_attribs[2],
+ },
+ {
+ .drm_format = DRM_FORMAT_YUV420,
+ .dri_image_format = __DRI_IMAGE_FORMAT_YU12,
+ .rgba_shifts = { -1, -1, -1, -1 },
+ .rgba_sizes = { 0, 0, 0, 0 },
+ .yuv = &dri2_null_yuv_attribs[3],
+ },
+ {
+ .drm_format = DRM_FORMAT_YVU420,
+ .dri_image_format = __DRI_IMAGE_FORMAT_YV12,
+ .rgba_shifts = { -1, -1, -1, -1 },
+ .rgba_sizes = { 0, 0, 0, 0 },
+ .yuv = &dri2_null_yuv_attribs[4],
+ },
+ {
+ .drm_format = DRM_FORMAT_UYVY,
+ .dri_image_format = __DRI_IMAGE_FORMAT_UYVY,
+ .rgba_shifts = { -1, -1, -1, -1 },
+ .rgba_sizes = { 0, 0, 0, 0 },
+ .yuv = &dri2_null_yuv_attribs[5],
+ },
+ {
+ .drm_format = DRM_FORMAT_YVYU,
+ .dri_image_format = __DRI_IMAGE_FORMAT_YVYU,
+ .rgba_shifts = { -1, -1, -1, -1 },
+ .rgba_sizes = { 0, 0, 0, 0 },
+ .yuv = &dri2_null_yuv_attribs[6],
+ },
+ {
+ .drm_format = DRM_FORMAT_VYUY,
+ .dri_image_format = __DRI_IMAGE_FORMAT_VYUY,
+ .rgba_shifts = { -1, -1, -1, -1 },
+ .rgba_sizes = { 0, 0, 0, 0 },
+ .yuv = &dri2_null_yuv_attribs[7],
},
};
@@ -137,6 +191,36 @@ format_idx_get_from_config(struct dri2_egl_display *dri2_dpy,
@@ -137,6 +261,36 @@ format_idx_get_from_config(struct dri2_egl_display *dri2_dpy,
return -1;
}
@@ -149,7 +204,7 @@ index f2c481c256b..d1e576af5ce 100644
static int
format_idx_get_from_dri_image_format(uint32_t dri_image_format)
{
@@ -1082,23 +1166,21 @@ static bool
@@ -1082,23 +1236,21 @@ static bool
add_fb_for_dri_image(struct dri2_egl_display *dri2_dpy, __DRIimage *image,
uint32_t *fb_id_out)
{
@@ -178,7 +233,7 @@ index f2c481c256b..d1e576af5ce 100644
format_idx = format_idx_get_from_dri_image_format(format);
assert(format_idx != -1);
@@ -1106,10 +1188,44 @@ add_fb_for_dri_image(struct dri2_egl_display *dri2_dpy, __DRIimage *image,
@@ -1106,10 +1258,44 @@ add_fb_for_dri_image(struct dri2_egl_display *dri2_dpy, __DRIimage *image,
dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_MODIFIER_UPPER, &h_mod);
dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_MODIFIER_LOWER, &l_mod);
@@ -224,7 +279,7 @@ index f2c481c256b..d1e576af5ce 100644
return !drmModeAddFB2WithModifiers(dri2_dpy->fd, width, height,
dri2_null_formats[format_idx].drm_format,
handles, pitches, offsets, modifiers,
@@ -1256,6 +1372,7 @@ create_surface(_EGLDisplay *disp, _EGLConfig *config, EGLint type,
@@ -1256,6 +1442,7 @@ create_surface(_EGLDisplay *disp, _EGLConfig *config, EGLint type,
struct dri2_egl_config *dri2_config = dri2_egl_config(config);
struct dri2_egl_surface *dri2_surf;
const __DRIconfig *dri_config;
@@ -232,7 +287,7 @@ index f2c481c256b..d1e576af5ce 100644
_EGLSurface *surf;
int format_idx;
bool ret;
@@ -1286,7 +1403,14 @@ create_surface(_EGLDisplay *disp, _EGLConfig *config, EGLint type,
@@ -1286,7 +1473,14 @@ create_surface(_EGLDisplay *disp, _EGLConfig *config, EGLint type,
goto err_free_surface;
}
@@ -248,7 +303,7 @@ index f2c481c256b..d1e576af5ce 100644
assert(format_idx != -1);
dri2_surf->format = dri2_null_formats[format_idx].dri_image_format;
@@ -1627,6 +1751,17 @@ dri2_null_image_get_buffers(__DRIdrawable *driDrawable, unsigned int format,
@@ -1627,6 +1821,17 @@ dri2_null_image_get_buffers(__DRIdrawable *driDrawable, unsigned int format,
return 1;
}
@@ -266,7 +321,7 @@ index f2c481c256b..d1e576af5ce 100644
static void
dri2_null_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
{
@@ -1635,10 +1770,11 @@ dri2_null_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
@@ -1635,10 +1840,11 @@ dri2_null_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
}
static const __DRIimageLoaderExtension image_loader_extension = {
@@ -279,7 +334,7 @@ index f2c481c256b..d1e576af5ce 100644
};
static const __DRIextension *image_loader_extensions[] = {
@@ -1720,10 +1856,24 @@ dri2_null_add_configs_for_formats(_EGLDisplay *disp)
@@ -1720,10 +1926,24 @@ dri2_null_add_configs_for_formats(_EGLDisplay *disp)
for (unsigned i = 0; dri2_dpy->driver_configs[i]; i++) {
struct dri2_egl_config *dri2_conf;
@@ -306,7 +361,7 @@ index f2c481c256b..d1e576af5ce 100644
if (format_idx == -1)
continue;
@@ -1735,8 +1885,7 @@ dri2_null_add_configs_for_formats(_EGLDisplay *disp)
@@ -1735,8 +1955,7 @@ dri2_null_add_configs_for_formats(_EGLDisplay *disp)
dri2_conf = dri2_add_config(disp,
dri2_dpy->driver_configs[i], count + 1,
@@ -316,32 +371,6 @@ index f2c481c256b..d1e576af5ce 100644
if (dri2_conf)
count++;
}
diff --git a/src/mesa/drivers/dri/pvr/pvrutil.c b/src/mesa/drivers/dri/pvr/pvrutil.c
index 945e18cf220..d107a5dafad 100644
--- a/src/mesa/drivers/dri/pvr/pvrutil.c
+++ b/src/mesa/drivers/dri/pvr/pvrutil.c
@@ -174,6 +174,10 @@ PVRDRIFormatToFourCC(int dri_format)
return DRM_FORMAT_YVU444_PACK10_IMG;
case __DRI_IMAGE_FORMAT_BGR888:
return DRM_FORMAT_BGR888;
+ case __DRI_IMAGE_FORMAT_NV12:
+ return DRM_FORMAT_NV12;
+ case __DRI_IMAGE_FORMAT_NV21:
+ return DRM_FORMAT_NV21;
default:
__driUtilMessage("%s: Unknown format: %d", __func__, dri_format);
break;
@@ -230,6 +234,10 @@ PVRDRIFourCCToDRIFormat(int iFourCC)
return __DRI_IMAGE_FORMAT_YVU444_PACK10_IMG;
case DRM_FORMAT_BGR888:
return __DRI_IMAGE_FORMAT_BGR888;
+ case DRM_FORMAT_NV12:
+ return __DRI_IMAGE_FORMAT_NV12;
+ case DRM_FORMAT_NV21:
+ return __DRI_IMAGE_FORMAT_NV21;
default:
__driUtilMessage("%s: Unknown format: %d", __func__, iFourCC);
break;
--
2.25.1
@@ -1,7 +1,7 @@
From db015d5fd0ded075e759677c047c581151bb1b52 Mon Sep 17 00:00:00 2001
From 2df7eb9a5b8ff08184f0759a4d842bfef4f4ec63 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Tue, 9 Mar 2021 17:15:30 +0000
Subject: [PATCH 50/67] dri: preserve the original FD for driver use.
Subject: [PATCH 41/58] dri: preserve the original FD for driver use.
If an application uses a different GPU from the default, allow the
file descriptor (FD) for that original GPU/display to be preserved
@@ -24,20 +24,20 @@ The feature is currently supported by the Wayland, and DRI3 based
X11 EGL and GLX platforms.
---
include/GL/internal/dri_interface.h | 26 +++++++++++++++++--
src/egl/drivers/dri2/egl_dri2.c | 10 +++++++
src/egl/drivers/dri2/egl_dri2.c | 12 ++++++++-
src/egl/drivers/dri2/egl_dri2.h | 1 +
src/egl/drivers/dri2/platform_wayland.c | 31 ++++++++++++++++++++--
src/egl/drivers/dri2/platform_x11.c | 3 +++
src/egl/drivers/dri2/platform_x11_dri3.c | 27 ++++++++++++++++++-
src/glx/dri3_glx.c | 33 ++++++++++++++++++++++--
src/glx/dri3_priv.h | 1 +
8 files changed, 125 insertions(+), 7 deletions(-)
8 files changed, 126 insertions(+), 8 deletions(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 888a117d56e..2fb440feb50 100644
index acd58ccb559..ab6a9fb125b 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1146,7 +1146,7 @@ struct __DRIbufferRec {
@@ -1005,7 +1005,7 @@ struct __DRIbufferRec {
};
#define __DRI_DRI2_LOADER "DRI_DRI2Loader"
@@ -46,7 +46,7 @@ index 888a117d56e..2fb440feb50 100644
enum dri_loader_cap {
/* Whether the loader handles RGBA channel ordering correctly. If not,
@@ -1227,6 +1227,17 @@ struct __DRIdri2LoaderExtensionRec {
@@ -1086,6 +1086,17 @@ struct __DRIdri2LoaderExtensionRec {
* \since 5
*/
void (*destroyLoaderImageState)(void *loaderPrivate);
@@ -64,7 +64,7 @@ index 888a117d56e..2fb440feb50 100644
};
/**
@@ -2131,7 +2142,7 @@ struct __DRIimageList {
@@ -2032,7 +2043,7 @@ struct __DRIimageList {
};
#define __DRI_IMAGE_LOADER "DRI_IMAGE_LOADER"
@@ -73,7 +73,7 @@ index 888a117d56e..2fb440feb50 100644
struct __DRIimageLoaderExtensionRec {
__DRIextension base;
@@ -2199,6 +2210,17 @@ struct __DRIimageLoaderExtensionRec {
@@ -2100,6 +2111,17 @@ struct __DRIimageLoaderExtensionRec {
* \since 4
*/
void (*destroyLoaderImageState)(void *loaderPrivate);
@@ -92,10 +92,10 @@ index 888a117d56e..2fb440feb50 100644
/**
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index c4a49cae592..1df53ef011c 100644
index 3ae5cddbc20..b0fa686581a 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1367,6 +1367,16 @@ dri2_display_destroy(_EGLDisplay *disp)
@@ -1360,6 +1360,16 @@ dri2_display_destroy(_EGLDisplay *disp)
break;
}
@@ -112,11 +112,20 @@ index c4a49cae592..1df53ef011c 100644
if (dri2_dpy->fd >= 0)
close(dri2_dpy->fd);
@@ -3471,7 +3481,7 @@ dri2_bind_wayland_display_wl(_EGLDisplay *disp, struct wl_display *wl_dpy)
if (dri2_dpy->wl_server_drm)
return EGL_FALSE;
- device_name = drmGetRenderDeviceNameFromFd(dri2_dpy->fd);
+ device_name = drmGetRenderDeviceNameFromFd(dri2_dpy->fd_dpy);
if (!device_name)
device_name = strdup(dri2_dpy->device_name);
if (!device_name)
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 141df1b1732..af03caee623 100644
index e48d3d26914..a5418bd3a5b 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -230,6 +230,7 @@ struct dri2_egl_display
@@ -260,6 +260,7 @@ struct dri2_egl_display
const __DRIconfigOptionsExtension *configOptions;
const __DRImutableRenderBufferDriverExtension *mutable_render_buffer;
int fd;
@@ -125,7 +134,7 @@ index 141df1b1732..af03caee623 100644
/* dri2_initialize/dri2_terminate increment/decrement this count, so does
* dri2_make_current (tracks if there are active contexts/surfaces). */
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 06272d4081e..b393e058770 100644
index be10fc6474a..d651274a85f 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -44,6 +44,7 @@
@@ -134,9 +143,9 @@ index 06272d4081e..b393e058770 100644
#include "util/anon_file.h"
+#include "util/os_file.h"
#include "eglglobals.h"
#include "kopper_interface.h"
#include <wayland-egl-backend.h>
@@ -973,21 +974,32 @@ dri2_wl_get_capability(void *loaderPrivate, enum dri_loader_cap cap)
@@ -1448,21 +1449,32 @@ dri2_wl_get_capability(void *loaderPrivate, enum dri_loader_cap cap)
}
}
@@ -171,7 +180,7 @@ index 06272d4081e..b393e058770 100644
};
static void
@@ -1640,12 +1652,14 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp)
@@ -2224,12 +2236,14 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp)
{
_EGLDevice *dev;
struct dri2_egl_display *dri2_dpy;
@@ -184,11 +193,11 @@ index 06272d4081e..b393e058770 100644
dri2_dpy->fd = -1;
+ dri2_dpy->fd_dpy = -1;
disp->DriverData = (void *) dri2_dpy;
if (disp->PlatformDisplay == NULL) {
dri2_dpy->wl_dpy = wl_display_connect(NULL);
@@ -1690,8 +1704,20 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp)
(roundtrip(dri2_dpy) < 0 || !dri2_dpy->authenticated))
if (dri2_wl_formats_init(&dri2_dpy->formats) < 0)
@@ -2303,8 +2317,20 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp)
goto cleanup;
}
+ fd_old = dri2_dpy->fd;
+ dri2_dpy->fd_dpy = os_dupfd_cloexec(dri2_dpy->fd);
@@ -207,19 +216,19 @@ index 06272d4081e..b393e058770 100644
dev = _eglAddDevice(dri2_dpy->fd, false);
if (!dev) {
_eglError(EGL_NOT_INITIALIZED, "DRI2: failed to find EGLDevice");
@@ -2236,6 +2262,7 @@ dri2_initialize_wayland_swrast(_EGLDisplay *disp)
@@ -2868,6 +2894,7 @@ dri2_initialize_wayland_swrast(_EGLDisplay *disp)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
dri2_dpy->fd = -1;
+ dri2_dpy->fd_dpy = -1;
disp->DriverData = (void *) dri2_dpy;
if (disp->PlatformDisplay == NULL) {
dri2_dpy->wl_dpy = wl_display_connect(NULL);
if (dri2_wl_formats_init(&dri2_dpy->formats) < 0)
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 5ffdf132184..5cf3ce2a369 100644
index 53302981fc2..730a91d14c3 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -1277,6 +1277,7 @@ dri2_initialize_x11_swrast(_EGLDisplay *disp)
@@ -1413,6 +1413,7 @@ dri2_initialize_x11_swrast(_EGLDisplay *disp)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
dri2_dpy->fd = -1;
@@ -227,7 +236,7 @@ index 5ffdf132184..5cf3ce2a369 100644
if (!dri2_get_xcb_connection(disp, dri2_dpy))
goto cleanup;
@@ -1364,6 +1365,7 @@ dri2_initialize_x11_dri3(_EGLDisplay *disp)
@@ -1497,6 +1498,7 @@ dri2_initialize_x11_dri3(_EGLDisplay *disp)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
dri2_dpy->fd = -1;
@@ -235,7 +244,7 @@ index 5ffdf132184..5cf3ce2a369 100644
if (!dri2_get_xcb_connection(disp, dri2_dpy))
goto cleanup;
@@ -1472,6 +1474,7 @@ dri2_initialize_x11_dri2(_EGLDisplay *disp)
@@ -1605,6 +1607,7 @@ dri2_initialize_x11_dri2(_EGLDisplay *disp)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
dri2_dpy->fd = -1;
@@ -244,7 +253,7 @@ index 5ffdf132184..5cf3ce2a369 100644
goto cleanup;
diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c
index e117105fcb6..0babf9f867e 100644
index 3d7c2ae4401..860d975ba5c 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -32,6 +32,7 @@
@@ -255,7 +264,7 @@ index e117105fcb6..0babf9f867e 100644
#include "egl_dri2.h"
#include "platform_x11_dri3.h"
@@ -414,11 +415,21 @@ dri3_flush_front_buffer(__DRIdrawable *driDrawable, void *loaderPrivate)
@@ -431,11 +432,21 @@ dri3_flush_front_buffer(__DRIdrawable *driDrawable, void *loaderPrivate)
_eglLog(_EGL_WARNING, "FIXME: egl/x11 doesn't support front buffer rendering.");
}
@@ -278,7 +287,7 @@ index e117105fcb6..0babf9f867e 100644
};
static EGLBoolean
@@ -537,6 +548,7 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
@@ -554,6 +565,7 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
xcb_xfixes_query_version_cookie_t xfixes_query_cookie;
xcb_generic_error_t *error;
const xcb_query_extension_reply_t *extension;
@@ -286,7 +295,7 @@ index e117105fcb6..0babf9f867e 100644
xcb_prefetch_extension_data (dri2_dpy->conn, &xcb_dri3_id);
xcb_prefetch_extension_data (dri2_dpy->conn, &xcb_present_id);
@@ -616,12 +628,25 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
@@ -633,12 +645,25 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
return EGL_FALSE;
}
@@ -313,7 +322,7 @@ index e117105fcb6..0babf9f867e 100644
}
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index db1b079663f..1ed6b60ffe8 100644
index 6370ca05beb..cf7fc613c86 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -77,6 +77,7 @@
@@ -324,7 +333,7 @@ index db1b079663f..1ed6b60ffe8 100644
static struct dri3_drawable *
loader_drawable_to_dri3_drawable(struct loader_dri3_drawable *draw) {
@@ -529,6 +530,14 @@ dri3_flush_swap_buffers(__DRIdrawable *driDrawable, void *loaderPrivate)
@@ -543,6 +544,14 @@ dri3_flush_swap_buffers(__DRIdrawable *driDrawable, void *loaderPrivate)
loader_dri3_swapbuffer_barrier(draw);
}
@@ -339,7 +348,7 @@ index db1b079663f..1ed6b60ffe8 100644
static void
dri_set_background_context(void *loaderPrivate)
{
@@ -548,11 +557,12 @@ dri_is_thread_safe(void *loaderPrivate)
@@ -562,11 +571,12 @@ dri_is_thread_safe(void *loaderPrivate)
/* The image loader extension record for DRI3
*/
static const __DRIimageLoaderExtension imageLoaderExtension = {
@@ -353,7 +362,7 @@ index db1b079663f..1ed6b60ffe8 100644
};
const __DRIuseInvalidateExtension dri3UseInvalidate = {
@@ -618,6 +628,10 @@ dri3_destroy_screen(struct glx_screen *base)
@@ -632,6 +642,10 @@ dri3_destroy_screen(struct glx_screen *base)
loader_dri3_close_screen(psc->driScreen);
(*psc->core->destroyScreen) (psc->driScreen);
driDestroyConfigs(psc->driver_configs);
@@ -364,7 +373,7 @@ index db1b079663f..1ed6b60ffe8 100644
close(psc->fd);
free(psc);
}
@@ -842,8 +856,9 @@ dri3_create_screen(int screen, struct glx_display * priv)
@@ -858,8 +872,9 @@ dri3_create_screen(int screen, struct glx_display * priv)
struct dri3_screen *psc;
__GLXDRIscreen *psp;
struct glx_config *configs = NULL, *visuals = NULL;
@@ -375,7 +384,7 @@ index db1b079663f..1ed6b60ffe8 100644
psc = calloc(1, sizeof *psc);
if (psc == NULL)
@@ -851,6 +866,7 @@ dri3_create_screen(int screen, struct glx_display * priv)
@@ -867,6 +882,7 @@ dri3_create_screen(int screen, struct glx_display * priv)
psc->fd = -1;
psc->fd_display_gpu = -1;
@@ -383,7 +392,7 @@ index db1b079663f..1ed6b60ffe8 100644
if (!glx_screen_init(&psc->base, screen, priv)) {
free(psc);
@@ -871,12 +887,23 @@ dri3_create_screen(int screen, struct glx_display * priv)
@@ -887,12 +903,23 @@ dri3_create_screen(int screen, struct glx_display * priv)
return NULL;
}
@@ -407,7 +416,7 @@ index db1b079663f..1ed6b60ffe8 100644
driverName = loader_get_driver_for_fd(psc->fd);
if (!driverName) {
@@ -1049,6 +1076,8 @@ handle_error:
@@ -1098,6 +1125,8 @@ handle_error:
if (psc->driScreenDisplayGPU)
psc->core->destroyScreen(psc->driScreenDisplayGPU);
psc->driScreenDisplayGPU = NULL;
@@ -417,7 +426,7 @@ index db1b079663f..1ed6b60ffe8 100644
close(psc->fd);
if (psc->fd_display_gpu >= 0)
diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
index c0e833c16ef..b3dccf28c06 100644
index 192238fde14..bac8a358e3b 100644
--- a/src/glx/dri3_priv.h
+++ b/src/glx/dri3_priv.h
@@ -107,6 +107,7 @@ struct dri3_screen {
@@ -426,8 +435,8 @@ index c0e833c16ef..b3dccf28c06 100644
int fd;
+ int fd_dpy;
bool is_different_gpu;
bool prefer_back_buffer_reuse;
/* fd for display GPU in case of prime */
--
2.25.1
@@ -0,0 +1,131 @@
From 6f85acbf79443bdfe18ae68d5c023ea946c7fcd0 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Wed, 28 Apr 2021 10:57:15 +0100
Subject: [PATCH 42/58] egl/wayland: a linear buffer is not needed with DRM
format modifiers
If the compositor supports DRM format modifiers, there is no
need for an additional linear buffer, as the client can allocate
buffers with attributes known to the compositor.
---
src/egl/drivers/dri2/platform_wayland.c | 36 ++++++++++++++-----------
1 file changed, 21 insertions(+), 15 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index d651274a85f..64c7a42eaeb 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1014,7 +1014,7 @@ create_dri_image_diff_gpu(struct dri2_egl_surface *dri2_surf,
&linear_mod, 1, NULL);
}
-static void
+static bool
create_dri_image_from_dmabuf_feedback(struct dri2_egl_surface *dri2_surf,
unsigned int dri_image_format, uint32_t use_flags)
{
@@ -1027,7 +1027,7 @@ create_dri_image_from_dmabuf_feedback(struct dri2_egl_surface *dri2_surf,
/* We don't have valid dma-buf feedback, so return */
if (dri2_surf->dmabuf_feedback.main_device == 0)
- return;
+ return false;
visual_idx = dri2_wl_visual_idx_from_fourcc(dri2_surf->format);
assert(visual_idx != -1);
@@ -1071,11 +1071,13 @@ create_dri_image_from_dmabuf_feedback(struct dri2_egl_surface *dri2_surf,
modifiers, num_modifiers, NULL);
if (dri2_surf->back->dri_image)
- return;
+ return num_modifiers != 0;
}
+
+ return false;
}
-static void
+static bool
create_dri_image(struct dri2_egl_surface *dri2_surf,
unsigned int dri_image_format, uint32_t use_flags)
{
@@ -1107,6 +1109,8 @@ create_dri_image(struct dri2_egl_surface *dri2_surf,
dri_image_format,
dri2_dpy->is_different_gpu ? 0 : use_flags,
modifiers, num_modifiers, NULL);
+
+ return num_modifiers != 0;
}
static int
@@ -1118,6 +1122,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
int visual_idx;
unsigned int dri_image_format;
unsigned int linear_dri_image_format;
+ bool have_modifiers = false;
visual_idx = dri2_wl_visual_idx_from_fourcc(dri2_surf->format);
assert(visual_idx != -1);
@@ -1177,23 +1182,24 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
use_flags |= __DRI_IMAGE_USE_PROTECTED;
}
- if (dri2_dpy->is_different_gpu && dri2_surf->back->linear_copy == NULL) {
- create_dri_image_diff_gpu(dri2_surf, linear_dri_image_format, use_flags);
- if (dri2_surf->back->linear_copy == NULL)
- return -1;
- }
-
if (dri2_surf->back->dri_image == NULL) {
if (dri2_surf->wl_dmabuf_feedback)
- create_dri_image_from_dmabuf_feedback(dri2_surf, dri_image_format, use_flags);
+ have_modifiers = create_dri_image_from_dmabuf_feedback(dri2_surf, dri_image_format, use_flags);
if (dri2_surf->back->dri_image == NULL)
- create_dri_image(dri2_surf, dri_image_format, use_flags);
+ have_modifiers = create_dri_image(dri2_surf, dri_image_format, use_flags);
dri2_surf->back->age = 0;
}
if (dri2_surf->back->dri_image == NULL)
return -1;
+ if (dri2_dpy->is_different_gpu && !have_modifiers &&
+ dri2_surf->back->linear_copy == NULL) {
+ create_dri_image_diff_gpu(dri2_surf, linear_dri_image_format, use_flags);
+ if (dri2_surf->back->linear_copy == NULL)
+ return -1;
+ }
+
dri2_surf->back->locked = true;
return 0;
@@ -1283,7 +1289,7 @@ update_buffers(struct dri2_egl_display *dri2_dpy,
dri2_surf->color_buffers[i].age > BUFFER_TRIM_AGE_HYSTERESIS) {
wl_buffer_destroy(dri2_surf->color_buffers[i].wl_buffer);
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].dri_image);
- if (dri2_dpy->is_different_gpu)
+ if (dri2_surf->color_buffers[i].linear_copy)
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].linear_copy);
dri2_surf->color_buffers[i].wl_buffer = NULL;
dri2_surf->color_buffers[i].dri_image = NULL;
@@ -1700,7 +1706,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
if (!dri2_surf->current->wl_buffer) {
__DRIimage *image;
- if (dri2_dpy->is_different_gpu)
+ if (dri2_surf->current->linear_copy)
image = dri2_surf->current->linear_copy;
else
image = dri2_surf->current->dri_image;
@@ -1734,7 +1740,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
dri2_flush_drawable_for_swapbuffers(disp, draw);
- if (dri2_dpy->is_different_gpu) {
+ if (dri2_surf->current->linear_copy) {
_EGLContext *ctx = _eglGetCurrentContext();
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
dri2_dpy->image->blitImage(dri2_ctx->dri_context,
--
2.25.1
@@ -1,7 +1,7 @@
From e57b9a1b34a733f88af51b1395eebe647006939d Mon Sep 17 00:00:00 2001
From bebd31516110ec781fc5f6ab5fdfc307b6866660 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Wed, 28 Apr 2021 16:33:42 +0100
Subject: [PATCH 52/67] dri3: a linear buffer is not needed with DRM format
Subject: [PATCH 43/58] dri3: a linear buffer is not needed with DRM format
modifiers
If the X Server supports DRM format modifiers, there is no need
@@ -15,10 +15,10 @@ with attributes known to the Server.
4 files changed, 113 insertions(+), 50 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c
index 0babf9f867e..94205a495a6 100644
index 860d975ba5c..4d2e3049071 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -143,6 +143,7 @@ dri3_create_surface(_EGLDisplay *disp, EGLint type, _EGLConfig *conf,
@@ -158,6 +158,7 @@ dri3_create_surface(_EGLDisplay *disp, EGLint type, _EGLConfig *conf,
struct dri3_egl_surface *dri3_surf;
const __DRIconfig *dri_config;
xcb_drawable_t drawable;
@@ -26,7 +26,7 @@ index 0babf9f867e..94205a495a6 100644
dri3_surf = calloc(1, sizeof *dri3_surf);
if (!dri3_surf) {
@@ -150,6 +151,10 @@ dri3_create_surface(_EGLDisplay *disp, EGLint type, _EGLConfig *conf,
@@ -165,6 +166,10 @@ dri3_create_surface(_EGLDisplay *disp, EGLint type, _EGLConfig *conf,
return NULL;
}
@@ -37,21 +37,21 @@ index 0babf9f867e..94205a495a6 100644
if (!dri2_init_surface(&dri3_surf->surf.base, disp, type, conf,
attrib_list, false, native_surface))
goto cleanup_surf;
@@ -174,7 +179,7 @@ dri3_create_surface(_EGLDisplay *disp, EGLint type, _EGLConfig *conf,
@@ -190,7 +195,7 @@ dri3_create_surface(_EGLDisplay *disp, EGLint type, _EGLConfig *conf,
if (loader_dri3_drawable_init(dri2_dpy->conn, drawable,
egl_to_loader_dri3_drawable_type(type),
dri2_dpy->dri_screen,
- dri2_dpy->is_different_gpu,
+ is_incompat_gpu,
dri2_dpy->multibuffers_available,
true,
dri_config,
&dri2_dpy->loader_dri3_ext,
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index 1ed6b60ffe8..025ad0128ec 100644
index cf7fc613c86..81e088efc29 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -354,6 +354,21 @@ dri3_destroy_drawable(__GLXDRIdrawable *base)
free(pdraw);
@@ -364,6 +364,21 @@ glx_to_loader_dri3_drawable_type(int type)
}
}
+static bool
@@ -71,8 +71,8 @@ index 1ed6b60ffe8..025ad0128ec 100644
+
static __GLXDRIdrawable *
dri3_create_drawable(struct glx_screen *base, XID xDrawable,
GLXDrawable drawable, struct glx_config *config_base)
@@ -361,11 +376,9 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
GLXDrawable drawable, int type,
@@ -372,11 +387,9 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
struct dri3_drawable *pdraw;
struct dri3_screen *psc = (struct dri3_screen *) base;
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base;
@@ -85,7 +85,7 @@ index 1ed6b60ffe8..025ad0128ec 100644
pdraw = calloc(1, sizeof(*pdraw));
if (!pdraw)
@@ -376,14 +389,6 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
@@ -387,14 +400,6 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
pdraw->base.drawable = drawable;
pdraw->base.psc = &psc->base;
@@ -100,7 +100,7 @@ index 1ed6b60ffe8..025ad0128ec 100644
(void) __glXInitialize(psc->base.dpy);
if (loader_dri3_drawable_init(XGetXCBConnection(base->dpy),
@@ -737,13 +742,14 @@ static const struct glx_context_vtable dri3_context_vtable = {
@@ -751,13 +756,14 @@ static const struct glx_context_vtable dri3_context_vtable = {
.interop_export_object = dri3_interop_export_object
};
@@ -119,7 +119,7 @@ index 1ed6b60ffe8..025ad0128ec 100644
{
const __DRIextension **extensions;
unsigned mask;
@@ -774,16 +780,6 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv,
@@ -788,16 +794,6 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv,
}
for (i = 0; extensions[i]; i++) {
@@ -136,7 +136,7 @@ index 1ed6b60ffe8..025ad0128ec 100644
if ((strcmp(extensions[i]->name, __DRI2_FLUSH) == 0)) {
psc->f = (__DRI2flushExtension *) extensions[i];
/* internal driver extension, no GL extension exposed */
@@ -817,6 +813,33 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv,
@@ -833,6 +829,33 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv,
}
}
@@ -170,7 +170,7 @@ index 1ed6b60ffe8..025ad0128ec 100644
static char *
dri3_get_driver_name(struct glx_screen *glx_screen)
{
@@ -859,6 +882,8 @@ dri3_create_screen(int screen, struct glx_display * priv)
@@ -875,6 +898,8 @@ dri3_create_screen(int screen, struct glx_display * priv)
char *driverName = NULL, *driverNameDisplayGPU, *tmp;
int i;
int fd_old;
@@ -179,7 +179,7 @@ index 1ed6b60ffe8..025ad0128ec 100644
psc = calloc(1, sizeof *psc);
if (psc == NULL)
@@ -890,8 +915,8 @@ dri3_create_screen(int screen, struct glx_display * priv)
@@ -906,8 +931,8 @@ dri3_create_screen(int screen, struct glx_display * priv)
fd_old = psc->fd;
psc->fd_dpy = os_dupfd_cloexec(psc->fd);
psc->fd_display_gpu = fcntl(psc->fd, F_DUPFD_CLOEXEC, 3);
@@ -190,7 +190,7 @@ index 1ed6b60ffe8..025ad0128ec 100644
close(psc->fd_display_gpu);
psc->fd_display_gpu = -1;
}
@@ -933,27 +958,6 @@ dri3_create_screen(int screen, struct glx_display * priv)
@@ -949,27 +974,6 @@ dri3_create_screen(int screen, struct glx_display * priv)
goto handle_error;
}
@@ -218,7 +218,7 @@ index 1ed6b60ffe8..025ad0128ec 100644
psc->driScreen =
psc->image_driver->createNewScreen2(screen, psc->fd,
pdp->loader_extensions,
@@ -965,7 +969,42 @@ dri3_create_screen(int screen, struct glx_display * priv)
@@ -981,7 +985,42 @@ dri3_create_screen(int screen, struct glx_display * priv)
goto handle_error;
}
@@ -263,10 +263,10 @@ index 1ed6b60ffe8..025ad0128ec 100644
if (!psc->image || psc->image->base.version < 7 || !psc->image->createImageFromFds) {
ErrorMessageF("Version 7 or imageFromFds image extension not found\n");
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index ff6d1ffc660..5c0379ab5de 100644
index 364695d0667..d431d23cf2f 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -2288,3 +2288,18 @@ dri3_find_back_alloc(struct loader_dri3_drawable *draw)
@@ -2407,3 +2407,18 @@ dri3_find_back_alloc(struct loader_dri3_drawable *draw)
return back;
}
@@ -286,10 +286,10 @@ index ff6d1ffc660..5c0379ab5de 100644
+#endif
+}
diff --git a/src/loader/loader_dri3_helper.h b/src/loader/loader_dri3_helper.h
index 028e25dc070..5790f5444f5 100644
index 792f7270098..3226a7250d2 100644
--- a/src/loader/loader_dri3_helper.h
+++ b/src/loader/loader_dri3_helper.h
@@ -287,4 +287,8 @@ loader_dri3_swapbuffer_barrier(struct loader_dri3_drawable *draw);
@@ -293,4 +293,8 @@ loader_dri3_swapbuffer_barrier(struct loader_dri3_drawable *draw);
void
loader_dri3_close_screen(__DRIscreen *dri_screen);
@@ -1,7 +1,7 @@
From 8de0535741ce8d126da4d9b0b0eb8c46dd4810b5 Mon Sep 17 00:00:00 2001
From 43b1db77a10ff200b4732951d054b75db121cf42 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Thu, 20 May 2021 14:43:29 +0100
Subject: [PATCH 53/67] egl/drm: add support for DRI_PRIME GPU selection
Subject: [PATCH 44/58] egl/drm: add support for DRI_PRIME GPU selection
Add support for selecting the GPU to be used for rendering using
the DRI_PRIME environment variable. If a different GPU is selected,
@@ -26,10 +26,10 @@ via the getCapabilities function in the DRI Image extension.
5 files changed, 66 insertions(+), 11 deletions(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 2fb440feb50..080d191b0a3 100644
index ab6a9fb125b..123349acb72 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1548,6 +1548,8 @@ enum __DRIChromaSiting {
@@ -1397,6 +1397,8 @@ enum __DRIChromaSiting {
*/
/*@{*/
#define __DRI_IMAGE_CAP_GLOBAL_NAMES 1
@@ -39,10 +39,10 @@ index 2fb440feb50..080d191b0a3 100644
/**
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 1df53ef011c..ec4ac602a84 100644
index b0fa686581a..d0503f614f6 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1368,6 +1368,7 @@ dri2_display_destroy(_EGLDisplay *disp)
@@ -1361,6 +1361,7 @@ dri2_display_destroy(_EGLDisplay *disp)
}
switch (disp->Platform) {
@@ -50,7 +50,7 @@ index 1df53ef011c..ec4ac602a84 100644
case _EGL_PLATFORM_WAYLAND:
case _EGL_PLATFORM_X11:
if (dri2_dpy->fd_dpy >= 0 && dri2_dpy->fd_dpy != dri2_dpy->fd)
@@ -3943,6 +3944,15 @@ dri2_bind_wayland_display_wl(_EGLDisplay *disp, struct wl_display *wl_dpy)
@@ -3492,6 +3493,15 @@ dri2_bind_wayland_display_wl(_EGLDisplay *disp, struct wl_display *wl_dpy)
dri2_dpy->image->base.version >= 7 &&
dri2_dpy->image->createImageFromFds != NULL)
flags |= WAYLAND_DRM_PRIME;
@@ -67,7 +67,7 @@ index 1df53ef011c..ec4ac602a84 100644
dri2_dpy->wl_server_drm =
wayland_drm_init(wl_dpy, device_name,
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 258e8b6593e..f160ad1175e 100644
index 4d08851c782..19c50c25128 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -595,7 +595,7 @@ dri2_drm_authenticate(_EGLDisplay *disp, uint32_t id)
@@ -121,7 +121,7 @@ index 258e8b6593e..f160ad1175e 100644
dev = _eglAddDevice(dri2_dpy->fd, dri2_dpy->gbm_dri->software);
if (!dev) {
err = "DRI2: failed to find EGLDevice";
@@ -872,7 +879,7 @@ dri2_initialize_drm(_EGLDisplay *disp)
@@ -875,7 +882,7 @@ dri2_initialize_drm(_EGLDisplay *disp)
disp->Extensions.EXT_buffer_age = EGL_TRUE;
#ifdef HAVE_WAYLAND_PLATFORM
@@ -131,10 +131,10 @@ index 258e8b6593e..f160ad1175e 100644
dri2_set_WL_bind_wayland_display(disp);
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 5acb15b516f..c1586f42e46 100644
index 17594589f56..2b60a469559 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -51,6 +51,7 @@
@@ -52,6 +52,7 @@
#include "loader.h"
#include "util/debug.h"
#include "util/macros.h"
@@ -142,7 +142,7 @@ index 5acb15b516f..c1586f42e46 100644
/* For importing wl_buffer */
#if HAVE_WAYLAND_PLATFORM
@@ -141,6 +142,14 @@ image_get_buffers(__DRIdrawable *driDrawable,
@@ -164,6 +165,14 @@ image_get_buffers(__DRIdrawable *driDrawable,
surf->dri_private, buffer_mask, buffers);
}
@@ -157,7 +157,7 @@ index 5acb15b516f..c1586f42e46 100644
static void
swrast_get_drawable_info(__DRIdrawable *driDrawable,
int *x,
@@ -220,20 +229,22 @@ static const __DRIimageLookupExtension image_lookup_extension = {
@@ -245,20 +254,22 @@ static const __DRIimageLookupExtension image_lookup_extension = {
};
static const __DRIdri2LoaderExtension dri2_loader_extension = {
@@ -182,7 +182,7 @@ index 5acb15b516f..c1586f42e46 100644
};
static const __DRIswrastLoaderExtension swrast_loader_extension = {
@@ -398,12 +409,12 @@ dri_screen_create_dri2(struct gbm_dri_device *dri, char *driver_name)
@@ -431,12 +442,12 @@ dri_screen_create_dri2(struct gbm_dri_device *dri, char *driver_name)
return -1;
if (dri->dri2->base.version >= 4) {
@@ -197,7 +197,7 @@ index 5acb15b516f..c1586f42e46 100644
dri->loader_extensions,
&dri->driver_configs, dri);
}
@@ -470,8 +481,20 @@ static int
@@ -503,8 +514,20 @@ static int
dri_screen_create(struct gbm_dri_device *dri)
{
char *driver_name;
@@ -219,7 +219,7 @@ index 5acb15b516f..c1586f42e46 100644
if (!driver_name)
return -1;
@@ -1424,6 +1447,9 @@ dri_destroy(struct gbm_device *gbm)
@@ -1469,6 +1492,9 @@ dri_destroy(struct gbm_device *gbm)
dlclose(dri->driver);
free(dri->driver_name);
@@ -229,7 +229,7 @@ index 5acb15b516f..c1586f42e46 100644
free(dri);
}
@@ -1445,6 +1471,8 @@ dri_device_create(int fd, uint32_t gbm_backend_version)
@@ -1490,6 +1516,8 @@ dri_device_create(int fd, uint32_t gbm_backend_version)
if (!dri)
return NULL;
@@ -239,10 +239,10 @@ index 5acb15b516f..c1586f42e46 100644
dri->base.v0.backend_version = gbm_backend_version;
dri->base.v0.bo_create = gbm_dri_bo_create;
diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h
index 9e77ba5887c..e33a96edb0b 100644
index 31f6b67a40f..3f94352185f 100644
--- a/src/gbm/backends/dri/gbm_driint.h
+++ b/src/gbm/backends/dri/gbm_driint.h
@@ -61,6 +61,8 @@ struct gbm_dri_visual {
@@ -62,6 +62,8 @@ struct gbm_dri_visual {
struct gbm_dri_device {
struct gbm_device base;
@@ -251,7 +251,7 @@ index 9e77ba5887c..e33a96edb0b 100644
void *driver;
char *driver_name; /* Name of the DRI module, without the _dri suffix */
bool software; /* A software driver was loaded */
@@ -191,4 +193,10 @@ gbm_dri_bo_unmap_dumb(struct gbm_dri_bo *bo)
@@ -195,4 +197,10 @@ gbm_dri_bo_unmap_dumb(struct gbm_dri_bo *bo)
bo->map = NULL;
}
@@ -1,7 +1,7 @@
From f1f625dbcb4e0cc062369729b1da3d7fc65969e8 Mon Sep 17 00:00:00 2001
From 42ecc1e6f730932fe4dcb9125652fe2e96aba1e9 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Thu, 20 May 2021 20:16:18 +0100
Subject: [PATCH 54/67] egl/null: add support for DRI_PRIME GPU selection
Subject: [PATCH 45/58] egl/null: add support for DRI_PRIME GPU selection
Add support for selecting the GPU to be used for rendering using
the DRI_PRIME environment variable. If a different GPU is selected,
@@ -10,21 +10,56 @@ preserved, which can be obtained by calling the getDisplayFD
function in the image loader extension.
This change includes code, in function dri2_null_try_device, to
skip display devices that are not supported by the PVR driver.
This is to prevent failure on PC based test systems, that often
include display hardware that is incompatible with the driver.
This code would not be needed for systems that don't use the PVR
driver, or on production systems that use the PVR driver.
optionally skip display devices that are not supported by a
particular DRI driver. This can be enabled by setting Meson build
option null-dri-driver-name. This feature is to prevent failure
on PC based test systems, that may have display and GPU hardware
other than that being tested.
---
meson.build | 4 +
meson_options.txt | 6 ++
src/egl/drivers/dri2/egl_dri2.c | 1 +
src/egl/drivers/dri2/platform_null.c | 133 +++++++++++++++++++--------
2 files changed, 98 insertions(+), 36 deletions(-)
src/egl/drivers/dri2/platform_null.c | 135 +++++++++++++++++++--------
src/egl/meson.build | 5 +
5 files changed, 114 insertions(+), 37 deletions(-)
diff --git a/meson.build b/meson.build
index e021a896a0a..a37add42a6d 100644
--- a/meson.build
+++ b/meson.build
@@ -361,6 +361,10 @@ with_platform_haiku = _platforms.contains('haiku')
with_platform_windows = _platforms.contains('windows')
with_platform_null = _platforms.contains('null')
+if with_platform_null
+ null_dri_driver_name = get_option('null-dri-driver-name')
+endif
+
with_glx = get_option('glx')
if with_glx == 'auto'
if with_platform_android
diff --git a/meson_options.txt b/meson_options.txt
index 65f32547267..84661fb851f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -37,6 +37,12 @@ option(
],
description : 'the window system EGL assumes for EGL_DEFAULT_DISPLAY',
)
+option(
+ 'null-dri-driver-name',
+ type : 'string',
+ value : '',
+ description : 'For the null platform, ignore all dri drivers apart from this one. By default, no dri drivers are ignored.'
+)
option(
'android-stub',
type : 'boolean',
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index ec4ac602a84..56b5175db6e 100644
index d0503f614f6..fce277c6874 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1369,6 +1369,7 @@ dri2_display_destroy(_EGLDisplay *disp)
@@ -1362,6 +1362,7 @@ dri2_display_destroy(_EGLDisplay *disp)
switch (disp->Platform) {
case _EGL_PLATFORM_DRM:
@@ -33,10 +68,10 @@ index ec4ac602a84..56b5175db6e 100644
case _EGL_PLATFORM_X11:
if (dri2_dpy->fd_dpy >= 0 && dri2_dpy->fd_dpy != dri2_dpy->fd)
diff --git a/src/egl/drivers/dri2/platform_null.c b/src/egl/drivers/dri2/platform_null.c
index db6f1147670..af77ea4dd89 100644
index c78e1fe0880..e2a138367f9 100644
--- a/src/egl/drivers/dri2/platform_null.c
+++ b/src/egl/drivers/dri2/platform_null.c
@@ -44,6 +44,7 @@
@@ -45,6 +45,7 @@
#include "egl_dri2.h"
#include "loader.h"
@@ -44,7 +79,7 @@ index db6f1147670..af77ea4dd89 100644
#define NULL_CARD_MINOR_MAX 63U
@@ -953,7 +954,7 @@ swap_idle_get_target_frame(struct dri2_egl_surface *dri2_surf,
@@ -1045,7 +1046,7 @@ swap_idle_get_target_frame(struct dri2_egl_surface *dri2_surf,
* current vblank by the number of intervals set at the time swapBuffer
* is called. For intervals of 1 or 0, we don't need a target frame.
*/
@@ -53,7 +88,7 @@ index db6f1147670..af77ea4dd89 100644
if (err)
return err;
@@ -1003,7 +1004,7 @@ swap_vblank_state_transition(struct dri2_egl_surface *dri2_surf,
@@ -1095,7 +1096,7 @@ swap_vblank_state_transition(struct dri2_egl_surface *dri2_surf,
uint32_t flags = DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT;
int err;
@@ -62,7 +97,7 @@ index db6f1147670..af77ea4dd89 100644
flags, dri2_surf);
if (err) {
dri2_surf->swap_state = SWAP_ERROR;
@@ -1029,7 +1030,7 @@ swap_flip_state_transition(struct dri2_egl_surface *dri2_surf)
@@ -1121,7 +1122,7 @@ swap_flip_state_transition(struct dri2_egl_surface *dri2_surf)
flags |= DRM_MODE_PAGE_FLIP_ASYNC;
}
@@ -71,7 +106,7 @@ index db6f1147670..af77ea4dd89 100644
dri2_surf->swap_data->fb_id, flags, dri2_surf);
if (err) {
dri2_surf->swap_state = SWAP_ERROR;
@@ -1049,7 +1050,7 @@ swap_poll_state_transition(struct dri2_egl_surface *dri2_surf)
@@ -1141,7 +1142,7 @@ swap_poll_state_transition(struct dri2_egl_surface *dri2_surf)
int err;
/* dri2_surf->swap_state is being set inside the handler */
@@ -80,7 +115,7 @@ index db6f1147670..af77ea4dd89 100644
if (err) {
dri2_surf->swap_state = SWAP_ERROR;
return err;
@@ -1201,7 +1202,7 @@ add_fb_for_dri_image(struct dri2_egl_display *dri2_dpy, __DRIimage *image,
@@ -1296,7 +1297,7 @@ add_fb_for_dri_image(struct dri2_egl_display *dri2_dpy, __DRIimage *image,
handles[i] = (uint32_t) handle;
}
@@ -89,7 +124,16 @@ index db6f1147670..af77ea4dd89 100644
dri2_null_formats[format_idx].drm_format,
handles, pitches, offsets, modifiers,
fb_id_out, flags);
@@ -1459,7 +1460,7 @@ dri2_null_create_window_surface(_EGLDisplay *disp, _EGLConfig *config,
@@ -1486,7 +1487,7 @@ create_surface(_EGLDisplay *disp, _EGLConfig *config, EGLint type,
dri2_surf->format = dri2_null_formats[format_idx].dri_image_format;
if (dri2_dpy->in_formats_enabled) {
- ret = in_formats_get_modifiers(dri2_dpy->fd,
+ ret = in_formats_get_modifiers(dri2_dpy->fd_dpy,
dri2_dpy->output.in_formats_id,
dri2_null_formats[format_idx].drm_format,
&dri2_dpy->output.modifiers);
@@ -1564,7 +1565,7 @@ dri2_null_create_window_surface(_EGLDisplay *disp, _EGLConfig *config,
goto err_destroy_surface;
}
@@ -98,7 +142,7 @@ index db6f1147670..af77ea4dd89 100644
dri2_surf->front_buffer.fb_id);
if (err) {
_eglError(EGL_BAD_NATIVE_WINDOW, "window set mode");
@@ -1573,11 +1574,11 @@ dri2_null_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
@@ -1678,11 +1679,11 @@ dri2_null_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
dri2_dpy->image->destroyImage(dri2_surf->front_buffer.dri_image);
if (dri2_surf->front_buffer.fb_id)
@@ -112,7 +156,7 @@ index db6f1147670..af77ea4dd89 100644
if (dri2_surf->color_buffers[i].dri_image)
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].dri_image);
}
@@ -1734,12 +1735,22 @@ dri2_null_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
@@ -1839,12 +1840,22 @@ dri2_null_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
(void) loaderPrivate;
}
@@ -136,7 +180,7 @@ index db6f1147670..af77ea4dd89 100644
};
static const __DRIextension *image_loader_extensions[] = {
@@ -1768,12 +1779,74 @@ dri2_null_device_is_kms(int fd)
@@ -1873,12 +1884,74 @@ dri2_null_device_is_kms(int fd)
return is_kms;
}
@@ -148,11 +192,11 @@ index db6f1147670..af77ea4dd89 100644
+ if (!dri2_null_device_is_kms(dri2_dpy->fd_dpy))
+ return false;
+
+#if 1
+ /* Skip devices not supported by the pvr driver */
+#if defined(NULL_DRI_DRIVER_NAME)
+ /* Skip devices not handled by NULL_DRI_DRIVER_NAME */
+ {
+ char *driver_name = loader_get_driver_for_fd(dri2_dpy->fd_dpy);
+ bool skip = !driver_name || !!strcmp(driver_name, "pvr");
+ bool skip = !driver_name || !!strcmp(driver_name, NULL_DRI_DRIVER_NAME);
+
+ free(driver_name);
+
@@ -211,7 +255,7 @@ index db6f1147670..af77ea4dd89 100644
for (unsigned i = 0; i <= NULL_CARD_MINOR_MAX; i++) {
char *card_path;
@@ -1781,32 +1854,20 @@ dri2_null_probe_device(_EGLDisplay *disp)
@@ -1886,32 +1959,20 @@ dri2_null_probe_device(_EGLDisplay *disp)
if (asprintf(&card_path, DRM_DEV_NAME, DRM_DIR_NAME, i) < 0)
continue;
@@ -254,7 +298,7 @@ index db6f1147670..af77ea4dd89 100644
dri2_dpy->fd = -1;
}
@@ -1867,7 +1928,7 @@ dri2_null_setup_swap_interval(_EGLDisplay *disp)
@@ -1972,7 +2033,7 @@ dri2_null_setup_swap_interval(_EGLDisplay *disp)
dri2_setup_swap_interval(disp, swap_max_interval);
@@ -263,7 +307,7 @@ index db6f1147670..af77ea4dd89 100644
if (err || value == 0) {
/* DRM/KMS does not support async page flip. In order to support
@@ -1914,7 +1975,7 @@ dri2_initialize_null(_EGLDisplay *disp)
@@ -2020,7 +2081,7 @@ dri2_initialize_null(_EGLDisplay *disp)
* modesetting if not. If this succeeds then universal planes will also have
* been enabled.
*/
@@ -272,7 +316,7 @@ index db6f1147670..af77ea4dd89 100644
dri2_dpy->atomic_enabled = !err;
if (!dri2_dpy->atomic_enabled) {
@@ -1922,7 +1983,7 @@ dri2_initialize_null(_EGLDisplay *disp)
@@ -2028,7 +2089,7 @@ dri2_initialize_null(_EGLDisplay *disp)
* Enable universal planes so that we can get the pixel formats for the
* primary plane
*/
@@ -281,17 +325,17 @@ index db6f1147670..af77ea4dd89 100644
if (err) {
_eglError(EGL_NOT_INITIALIZED, "failed to enable universal planes");
goto cleanup;
@@ -1955,7 +2016,7 @@ dri2_initialize_null(_EGLDisplay *disp)
prefer_in_formats = dri2_dpy->image->base.version >= 14 &&
@@ -2064,7 +2125,7 @@ dri2_initialize_null(_EGLDisplay *disp)
dri2_dpy->image->createImageWithModifiers;
}
- if (!display_output_init(dri2_dpy->fd, &dri2_dpy->output,
+ if (!display_output_init(dri2_dpy->fd_dpy, &dri2_dpy->output,
dri2_dpy->atomic_enabled,
prefer_in_formats,
&dri2_dpy->in_formats_enabled)) {
@@ -1990,7 +2051,7 @@ dri2_teardown_null(struct dri2_egl_display *dri2_dpy)
drmModeFreeFormats(dri2_dpy->output.in_formats);
@@ -2098,7 +2159,7 @@ dri2_teardown_null(struct dri2_egl_display *dri2_dpy)
drmModeAtomicFree(dri2_dpy->output.atomic_state);
if (dri2_dpy->output.mode_blob_id)
- drmModeDestroyPropertyBlob(dri2_dpy->fd, dri2_dpy->output.mode_blob_id);
@@ -299,6 +343,22 @@ index db6f1147670..af77ea4dd89 100644
if (dri2_dpy->output.plane_prop_res) {
for (unsigned i = 0; dri2_dpy->output.plane_prop_res[i]; i++)
diff --git a/src/egl/meson.build b/src/egl/meson.build
index a08f1c71847..4aa9f5fb0de 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -151,6 +151,11 @@ elif with_platform_windows
link_for_egl += libgallium_wgl
endif
if with_platform_null
+ if null_dri_driver_name != ''
+ c_args_for_egl += [
+ '-DNULL_DRI_DRIVER_NAME="@0@"'.format(null_dri_driver_name),
+ ]
+ endif
files_egl += files('drivers/dri2/platform_null.c')
incs_for_egl += [inc_loader]
deps_for_egl += dep_libdrm
--
2.25.1
@@ -1,7 +1,7 @@
From 693fff6d87abfcae887afde7f80f402b7ff5c0ab Mon Sep 17 00:00:00 2001
From ade2c62537be41361638aa55126c0ee9966ab726 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Mon, 28 Jun 2021 16:36:15 +0100
Subject: [PATCH 55/67] egl/null: introduce NULL_DRM_DISPLAY
Subject: [PATCH 46/58] egl/null: introduce NULL_DRM_DISPLAY
Introduce the NULL_DRM_DISPLAY environment variable, which allows
a particular DRM display to be selected, rather than the first
@@ -16,10 +16,10 @@ the display. For example, NULL_DRM_DISPLAY=2 will select
1 file changed, 46 insertions(+), 19 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_null.c b/src/egl/drivers/dri2/platform_null.c
index af77ea4dd89..529cc7a2a2f 100644
index 6ca417bf022..86bcbdf30b8 100644
--- a/src/egl/drivers/dri2/platform_null.c
+++ b/src/egl/drivers/dri2/platform_null.c
@@ -1784,6 +1784,8 @@ dri2_null_try_device(_EGLDisplay *disp)
@@ -1889,6 +1889,8 @@ dri2_null_try_device(_EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
@@ -28,7 +28,7 @@ index af77ea4dd89..529cc7a2a2f 100644
if (!dri2_null_device_is_kms(dri2_dpy->fd_dpy))
return false;
@@ -1841,34 +1843,56 @@ dri2_null_try_device(_EGLDisplay *disp)
@@ -1946,34 +1948,56 @@ dri2_null_try_device(_EGLDisplay *disp)
}
static bool
@@ -103,7 +103,7 @@ index af77ea4dd89..529cc7a2a2f 100644
}
return false;
@@ -1965,7 +1989,10 @@ dri2_initialize_null(_EGLDisplay *disp)
@@ -2071,7 +2095,10 @@ dri2_initialize_null(_EGLDisplay *disp)
disp->DriverData = (void *) dri2_dpy;
@@ -1,29 +1,20 @@
From a422756b7d73b48d3d10d15066a61e9332370719 Mon Sep 17 00:00:00 2001
From 0fa00f7164d8a7104994a38acb66735ae8eb7e06 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Mon, 21 Jun 2021 17:05:17 +0100
Subject: [PATCH 56/67] vulkan/wsi: check the DRI3 and Present XCB reply
Subject: [PATCH 47/58] vulkan/wsi: check the DRI3 and Present XCB reply
pointers
Check that the DRI3 and Present version replies are not NULL
before accessing the version fields.
---
src/vulkan/wsi/wsi_common_x11.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
src/vulkan/wsi/wsi_common_x11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 9dce78eddeb..9eb624df640 100644
index 96e0be3d62a..b12512aad18 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -216,7 +216,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
ver_cookie = xcb_dri3_query_version(conn, 1, 2);
ver_reply = xcb_dri3_query_version_reply(conn, ver_cookie, NULL);
- has_dri3_v1_2 =
+ has_dri3_v1_2 = ver_reply != NULL &&
(ver_reply->major_version > 1 || ver_reply->minor_version >= 2);
free(ver_reply);
}
@@ -230,7 +230,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
@@ -261,7 +261,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
ver_cookie = xcb_present_query_version(conn, 1, 2);
ver_reply = xcb_present_query_version_reply(conn, ver_cookie, NULL);
@@ -0,0 +1,642 @@
From 5e9022211de798b72b7bbcd5a451f38a4f667dee Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Thu, 17 Jun 2021 17:17:07 +0100
Subject: [PATCH 48/58] vulkan/wsi: make the display FD available
Pass the display FD to the Vulkan image create and memory
allocation functions when allocating swapchain images.
The wl_drm interface code has been partially restored, in order
to obtain the display FD from the compositor.
---
src/vulkan/wsi/meson.build | 2 +
src/vulkan/wsi/wsi_common.c | 24 +++++-
src/vulkan/wsi/wsi_common.h | 14 ++++
src/vulkan/wsi/wsi_common_display.c | 3 +-
src/vulkan/wsi/wsi_common_drm.c | 19 ++++-
src/vulkan/wsi/wsi_common_private.h | 10 ++-
src/vulkan/wsi/wsi_common_wayland.c | 126 ++++++++++++++++++++++++++--
src/vulkan/wsi/wsi_common_win32.c | 4 +-
src/vulkan/wsi/wsi_common_x11.c | 25 +++++-
9 files changed, 206 insertions(+), 21 deletions(-)
diff --git a/src/vulkan/wsi/meson.build b/src/vulkan/wsi/meson.build
index e234e31d340..84ae5c5f690 100644
--- a/src/vulkan/wsi/meson.build
+++ b/src/vulkan/wsi/meson.build
@@ -31,6 +31,8 @@ endif
if with_platform_wayland
files_vulkan_wsi += files('wsi_common_wayland.c')
files_vulkan_wsi += [
+ wayland_drm_client_protocol_h,
+ wayland_drm_protocol_c,
linux_dmabuf_unstable_v1_client_protocol_h,
linux_dmabuf_unstable_v1_protocol_c,
]
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 562efdd529c..385e83803dd 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -360,6 +360,7 @@ VkResult
wsi_configure_image(const struct wsi_swapchain *chain,
const VkSwapchainCreateInfoKHR *pCreateInfo,
VkExternalMemoryHandleTypeFlags handle_types,
+ int display_fd,
struct wsi_image_info *info)
{
memset(info, 0, sizeof(*info));
@@ -418,6 +419,12 @@ wsi_configure_image(const struct wsi_swapchain *chain,
};
__vk_append_struct(&info->create, &info->wsi);
+ info->wsi2 = (struct wsi_image_create_info2) {
+ .sType = VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO2_MESA,
+ .display_fd = display_fd,
+ };
+ __vk_append_struct(&info->create, &info->wsi2);
+
if (pCreateInfo->flags & VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR) {
info->create.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT |
VK_IMAGE_CREATE_EXTENDED_USAGE_BIT_KHR;
@@ -471,6 +478,7 @@ wsi_destroy_image_info(const struct wsi_swapchain *chain,
VkResult
wsi_create_image(const struct wsi_swapchain *chain,
const struct wsi_image_info *info,
+ int display_fd,
struct wsi_image *image)
{
const struct wsi_device *wsi = chain->wsi;
@@ -485,7 +493,7 @@ wsi_create_image(const struct wsi_swapchain *chain,
if (result != VK_SUCCESS)
goto fail;
- result = info->create_mem(chain, info, image);
+ result = info->create_mem(chain, info, display_fd, image);
if (result != VK_SUCCESS)
goto fail;
@@ -1152,7 +1160,8 @@ wsi_create_buffer_image_mem(const struct wsi_swapchain *chain,
const struct wsi_image_info *info,
struct wsi_image *image,
VkExternalMemoryHandleTypeFlags handle_types,
- bool implicit_sync)
+ bool implicit_sync,
+ int display_fd)
{
const struct wsi_device *wsi = chain->wsi;
VkResult result;
@@ -1186,9 +1195,14 @@ wsi_create_buffer_image_mem(const struct wsi_swapchain *chain,
.pNext = NULL,
.implicit_sync = implicit_sync,
};
+ const struct wsi_memory_allocate_info2 memory_wsi_info2 = {
+ .sType = VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO2_MESA,
+ .pNext = &memory_wsi_info,
+ .display_fd = display_fd,
+ };
const VkExportMemoryAllocateInfo memory_export_info = {
.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO,
- .pNext = &memory_wsi_info,
+ .pNext = &memory_wsi_info2,
.handleTypes = handle_types,
};
const VkMemoryDedicatedAllocateInfo buf_mem_dedicated_info = {
@@ -1347,10 +1361,12 @@ wsi_finish_create_buffer_image(const struct wsi_swapchain *chain,
VkResult
wsi_configure_buffer_image(UNUSED const struct wsi_swapchain *chain,
const VkSwapchainCreateInfoKHR *pCreateInfo,
+ int display_fd,
struct wsi_image_info *info)
{
VkResult result = wsi_configure_image(chain, pCreateInfo,
- 0 /* handle_types */, info);
+ 0 /* handle_types */,
+ display_fd, info);
if (result != VK_SUCCESS)
return result;
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index f96632308df..13502fc6507 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -50,6 +50,8 @@ extern const struct vk_device_entrypoint_table wsi_device_entrypoints;
#define VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA (VkStructureType)1000001003
#define VK_STRUCTURE_TYPE_WSI_SURFACE_SUPPORTED_COUNTERS_MESA (VkStructureType)1000001005
#define VK_STRUCTURE_TYPE_WSI_MEMORY_SIGNAL_SUBMIT_INFO_MESA (VkStructureType)1000001006
+#define VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO2_MESA (VkStructureType)1000001007
+#define VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO2_MESA (VkStructureType)1000001008
/* This is always chained to VkImageCreateInfo when a wsi image is created.
* It indicates that the image can be transitioned to/from
@@ -86,6 +88,18 @@ struct wsi_memory_signal_submit_info {
VkDeviceMemory memory;
};
+struct wsi_image_create_info2 {
+ VkStructureType sType;
+ const void *pNext;
+ int display_fd;
+};
+
+struct wsi_memory_allocate_info2 {
+ VkStructureType sType;
+ const void *pNext;
+ int display_fd;
+};
+
struct wsi_interface;
struct driOptionCache;
diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c
index 3c9f3b1c32b..d237dfc092a 100644
--- a/src/vulkan/wsi/wsi_common_display.c
+++ b/src/vulkan/wsi/wsi_common_display.c
@@ -1097,7 +1097,7 @@ wsi_display_image_init(VkDevice device_h,
return VK_ERROR_DEVICE_LOST;
VkResult result = wsi_create_image(&chain->base, &chain->base.image_info,
- &image->base);
+ wsi->fd, &image->base);
if (result != VK_SUCCESS)
return result;
@@ -1980,6 +1980,7 @@ wsi_display_surface_create_swapchain(
result = wsi_configure_native_image(&chain->base, create_info,
0, NULL, NULL,
NULL /* alloc_shm */,
+ wsi->fd,
&chain->base.image_info);
if (result != VK_SUCCESS) {
vk_free(allocator, chain);
diff --git a/src/vulkan/wsi/wsi_common_drm.c b/src/vulkan/wsi/wsi_common_drm.c
index 72af5b2c820..beb87d7336f 100644
--- a/src/vulkan/wsi/wsi_common_drm.c
+++ b/src/vulkan/wsi/wsi_common_drm.c
@@ -142,6 +142,7 @@ get_modifier_props(const struct wsi_image_info *info, uint64_t modifier)
static VkResult
wsi_create_native_image_mem(const struct wsi_swapchain *chain,
const struct wsi_image_info *info,
+ int display_fd,
struct wsi_image *image);
VkResult
@@ -152,6 +153,7 @@ wsi_configure_native_image(const struct wsi_swapchain *chain,
const uint64_t *const *modifiers,
uint8_t *(alloc_shm)(struct wsi_image *image,
unsigned size),
+ int display_fd,
struct wsi_image_info *info)
{
const struct wsi_device *wsi = chain->wsi;
@@ -160,7 +162,8 @@ wsi_configure_native_image(const struct wsi_swapchain *chain,
wsi->sw ? VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT :
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT;
- VkResult result = wsi_configure_image(chain, pCreateInfo, handle_type, info);
+ VkResult result = wsi_configure_image(chain, pCreateInfo, handle_type,
+ display_fd, info);
if (result != VK_SUCCESS)
return result;
@@ -290,6 +293,7 @@ fail_oom:
static VkResult
wsi_create_native_image_mem(const struct wsi_swapchain *chain,
const struct wsi_image_info *info,
+ int display_fd,
struct wsi_image *image)
{
const struct wsi_device *wsi = chain->wsi;
@@ -316,9 +320,14 @@ wsi_create_native_image_mem(const struct wsi_swapchain *chain,
.pNext = NULL,
.implicit_sync = true,
};
+ const struct wsi_memory_allocate_info2 memory_wsi_info2 = {
+ .sType = VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO2_MESA,
+ .pNext = &memory_wsi_info,
+ .display_fd = display_fd,
+ };
const VkExportMemoryAllocateInfo memory_export_info = {
.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO,
- .pNext = &memory_wsi_info,
+ .pNext = &memory_wsi_info2,
.handleTypes = wsi->sw ? VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT :
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
};
@@ -427,13 +436,14 @@ wsi_create_native_image_mem(const struct wsi_swapchain *chain,
static VkResult
wsi_create_prime_image_mem(const struct wsi_swapchain *chain,
const struct wsi_image_info *info,
+ int display_fd,
struct wsi_image *image)
{
const struct wsi_device *wsi = chain->wsi;
VkResult result =
wsi_create_buffer_image_mem(chain, info, image,
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
- true);
+ true, display_fd);
if (result != VK_SUCCESS)
return result;
@@ -459,10 +469,11 @@ VkResult
wsi_configure_prime_image(UNUSED const struct wsi_swapchain *chain,
const VkSwapchainCreateInfoKHR *pCreateInfo,
bool use_modifier,
+ int display_fd,
struct wsi_image_info *info)
{
VkResult result =
- wsi_configure_buffer_image(chain, pCreateInfo, info);
+ wsi_configure_buffer_image(chain, pCreateInfo, display_fd, info);
if (result != VK_SUCCESS)
return result;
diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h
index af190ce501b..b6c1fc0bb85 100644
--- a/src/vulkan/wsi/wsi_common_private.h
+++ b/src/vulkan/wsi/wsi_common_private.h
@@ -32,6 +32,7 @@ struct wsi_swapchain;
struct wsi_image_info {
VkImageCreateInfo create;
struct wsi_image_create_info wsi;
+ struct wsi_image_create_info2 wsi2;
VkExternalMemoryImageCreateInfo ext_mem;
VkImageFormatListCreateInfoKHR format_list;
VkImageDrmFormatModifierListCreateInfoEXT drm_mod_list;
@@ -57,6 +58,7 @@ struct wsi_image_info {
VkResult (*create_mem)(const struct wsi_swapchain *chain,
const struct wsi_image_info *info,
+ int display_fd,
struct wsi_image *image);
VkResult (*finish_create)(const struct wsi_swapchain *chain,
@@ -145,12 +147,14 @@ wsi_configure_native_image(const struct wsi_swapchain *chain,
const uint64_t *const *modifiers,
uint8_t *(alloc_shm)(struct wsi_image *image,
unsigned size),
+ int display_fd,
struct wsi_image_info *info);
VkResult
wsi_configure_prime_image(UNUSED const struct wsi_swapchain *chain,
const VkSwapchainCreateInfoKHR *pCreateInfo,
bool use_modifier,
+ int display_fd,
struct wsi_image_info *info);
VkResult
@@ -158,7 +162,8 @@ wsi_create_buffer_image_mem(const struct wsi_swapchain *chain,
const struct wsi_image_info *info,
struct wsi_image *image,
VkExternalMemoryHandleTypeFlags handle_types,
- bool implicit_sync);
+ bool implicit_sync,
+ int display_fd);
VkResult
wsi_finish_create_buffer_image(const struct wsi_swapchain *chain,
@@ -168,12 +173,14 @@ wsi_finish_create_buffer_image(const struct wsi_swapchain *chain,
VkResult
wsi_configure_buffer_image(UNUSED const struct wsi_swapchain *chain,
const VkSwapchainCreateInfoKHR *pCreateInfo,
+ int display_fd,
struct wsi_image_info *info);
VkResult
wsi_configure_image(const struct wsi_swapchain *chain,
const VkSwapchainCreateInfoKHR *pCreateInfo,
VkExternalMemoryHandleTypeFlags handle_types,
+ int display_fd,
struct wsi_image_info *info);
void
wsi_destroy_image_info(const struct wsi_swapchain *chain,
@@ -181,6 +188,7 @@ wsi_destroy_image_info(const struct wsi_swapchain *chain,
VkResult
wsi_create_image(const struct wsi_swapchain *chain,
const struct wsi_image_info *info,
+ int display_fd,
struct wsi_image *image);
void
wsi_destroy_image(const struct wsi_swapchain *chain,
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 0678556105e..c01c4079d61 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -32,6 +32,8 @@
#include <pthread.h>
#include <poll.h>
#include <sys/mman.h>
+#include <fcntl.h>
+#include <xf86drm.h>
#include "drm-uapi/drm_fourcc.h"
@@ -64,12 +66,15 @@ struct wsi_wl_display {
struct wl_event_queue * queue;
struct wl_shm * wl_shm;
+ struct wl_drm * wl_drm;
struct zwp_linux_dmabuf_v1 * wl_dmabuf;
struct wsi_wayland *wsi_wl;
/* Formats populated by zwp_linux_dmabuf_v1 or wl_shm interfaces */
struct u_vector formats;
+ int fd;
+ bool authenticated;
/* Only used for displays created by wsi_wl_display_create */
uint32_t refcount;
@@ -444,6 +449,79 @@ wl_shm_format_for_vk_format(VkFormat vk_format, bool alpha)
}
}
+static int
+open_display_device(const char *name)
+{
+ int fd;
+
+#ifdef O_CLOEXEC
+ fd = open(name, O_RDWR | O_CLOEXEC);
+ if (fd != -1 || errno != EINVAL) {
+ return fd;
+ }
+#endif
+
+ fd = open(name, O_RDWR);
+ if (fd != -1) {
+ long flags = fcntl(fd, F_GETFD);
+
+ if (flags != -1) {
+ if (!fcntl(fd, F_SETFD, flags | FD_CLOEXEC))
+ return fd;
+ }
+ close (fd);
+ }
+
+ return -1;
+}
+
+static void
+drm_handle_device(void *data, struct wl_drm *drm, const char *name)
+{
+ struct wsi_wl_display *display = data;
+ const int fd = open_display_device(name);
+
+ if (fd != -1) {
+ if (drmGetNodeTypeFromFd(fd) != DRM_NODE_RENDER) {
+ drm_magic_t magic;
+
+ if (drmGetMagic(fd, &magic)) {
+ close(fd);
+ return;
+ }
+ wl_drm_authenticate(drm, magic);
+ } else {
+ display->authenticated = true;
+ }
+ display->fd = fd;
+ }
+}
+
+static void
+drm_handle_format(void *data, struct wl_drm *drm, uint32_t wl_format)
+{
+}
+
+static void
+drm_handle_authenticated(void *data, struct wl_drm *drm)
+{
+ struct wsi_wl_display *display = data;
+
+ display->authenticated = true;
+}
+
+static void
+drm_handle_capabilities(void *data, struct wl_drm *drm, uint32_t capabilities)
+{
+}
+
+static const struct wl_drm_listener drm_listener = {
+ drm_handle_device,
+ drm_handle_format,
+ drm_handle_authenticated,
+ drm_handle_capabilities,
+};
+
static void
dmabuf_handle_format(void *data, struct zwp_linux_dmabuf_v1 *dmabuf,
uint32_t format)
@@ -496,6 +574,15 @@ registry_handle_global(void *data, struct wl_registry *registry,
return;
}
+ if (strcmp(interface, "wl_drm") == 0) {
+ assert(display->wl_drm == NULL);
+ assert(version >= 2);
+
+ display->wl_drm =
+ wl_registry_bind(registry, name, &wl_drm_interface, 2);
+ wl_drm_add_listener(display->drm.wl_drm, &drm_listener, display);
+ }
+
if (strcmp(interface, "zwp_linux_dmabuf_v1") == 0 && version >= 3) {
display->wl_dmabuf =
wl_registry_bind(registry, name, &zwp_linux_dmabuf_v1_interface, 3);
@@ -525,12 +612,17 @@ wsi_wl_display_finish(struct wsi_wl_display *display)
u_vector_finish(&display->formats);
if (display->wl_shm)
wl_shm_destroy(display->wl_shm);
+ if (display->wl_drm)
+ wl_drm_destroy(display->wl_drm);
if (display->wl_dmabuf)
zwp_linux_dmabuf_v1_destroy(display->wl_dmabuf);
if (display->wl_display_wrapper)
wl_proxy_wrapper_destroy(display->wl_display_wrapper);
if (display->queue)
wl_event_queue_destroy(display->queue);
+
+ if (display->fd != -1)
+ close(display->fd);
}
static VkResult
@@ -548,6 +640,7 @@ wsi_wl_display_init(struct wsi_wayland *wsi_wl,
display->wsi_wl = wsi_wl;
display->wl_display = wl_display;
display->sw = sw;
+ display->fd = -1;
display->queue = wl_display_create_queue(wl_display);
if (!display->queue) {
@@ -573,25 +666,45 @@ wsi_wl_display_init(struct wsi_wayland *wsi_wl,
wl_registry_add_listener(registry, &registry_listener, display);
- /* Round-trip to get wl_shm and zwp_linux_dmabuf_v1 globals */
+ /* Round-trip to get wl_shm, wl_drm and zwp_linux_dmabuf_v1 globals */
wl_display_roundtrip_queue(display->wl_display, display->queue);
if (!display->wl_dmabuf && !display->wl_shm) {
result = VK_ERROR_SURFACE_LOST_KHR;
goto fail_registry;
}
+ if (display->wl_dmabuf && !display->wl_drm) {
+ result = VK_ERROR_SURFACE_LOST_KHR;
+ goto fail_registry;
+ }
+
+ /* Round-trip to get display FD, formats and modifiers */
+ if (display->wl_drm || get_format_list)
+ wl_display_roundtrip_queue(display->wl_display, display->queue);
+
+ if (display->wl_drm && display->fd == -1) {
+ result = VK_ERROR_SURFACE_LOST_KHR;
+ goto fail_registry;
+ }
+
+ if (display->wl_drm) {
+ wl_display_roundtrip_queue(display->wl_display, display->queue);
+
+ if (!display->authenticated) {
+ result = VK_ERROR_SURFACE_LOST_KHR;
+ goto fail_registry;
+ }
+ }
+
/* Caller doesn't expect us to query formats/modifiers, so return */
if (!get_format_list)
goto out;
- /* Round-trip again to get formats and modifiers */
- wl_display_roundtrip_queue(display->wl_display, display->queue);
-
if (wsi_wl->wsi->force_bgra8_unorm_first) {
/* Find BGRA8_UNORM in the list and swap it to the first position if we
* can find it. Some apps get confused if SRGB is first in the list.
*/
- struct wsi_wl_format *first_fmt = u_vector_head(&display->formats);
+ struct wsi_wl_format *first_fmt = u_vector_tail(&display->formats);
struct wsi_wl_format *f, tmp_fmt;
f = find_format(&display->formats, VK_FORMAT_B8G8R8A8_UNORM);
if (f) {
@@ -1122,7 +1235,7 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
VkResult result;
result = wsi_create_image(&chain->base, &chain->base.image_info,
- &image->base);
+ display->fd, &image->base);
if (result != VK_SUCCESS)
return result;
@@ -1323,6 +1436,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
&chain->num_drm_modifiers,
&chain->drm_modifiers,
NULL /* alloc_shm */,
+ chain->display->fd,
&chain->base.image_info);
if (result != VK_SUCCESS)
goto fail;
diff --git a/src/vulkan/wsi/wsi_common_win32.c b/src/vulkan/wsi/wsi_common_win32.c
index 69b331642d9..6075891a702 100644
--- a/src/vulkan/wsi/wsi_common_win32.c
+++ b/src/vulkan/wsi/wsi_common_win32.c
@@ -357,7 +357,7 @@ wsi_configure_win32_image(const struct wsi_swapchain *chain,
struct wsi_image_info *info)
{
VkResult result =
- wsi_configure_buffer_image(chain, pCreateInfo, info);
+ wsi_configure_buffer_image(chain, pCreateInfo, -1, info);
if (result != VK_SUCCESS)
return result;
@@ -383,7 +383,7 @@ wsi_win32_image_init(VkDevice device_h,
{
assert(chain->base.use_buffer_blit);
VkResult result = wsi_create_image(&chain->base, &chain->base.image_info,
- &image->base);
+ -1, &image->base);
if (result != VK_SUCCESS)
return result;
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index b12512aad18..8d9123c0494 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -1576,6 +1576,7 @@ static VkResult
x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
const VkSwapchainCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks* pAllocator,
+ int display_fd,
struct x11_image *image)
{
xcb_void_cookie_t cookie;
@@ -1584,7 +1585,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
int fence_fd;
result = wsi_create_image(&chain->base, &chain->base.image_info,
- &image->base);
+ display_fd, &image->base);
if (result != VK_SUCCESS)
return result;
@@ -2021,16 +2022,26 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
modifiers, num_modifiers, &num_tranches,
pAllocator);
+ int display_fd = -1;
+ if (!wsi_device->sw) {
+ xcb_screen_iterator_t screen_iter =
+ xcb_setup_roots_iterator(xcb_get_setup(conn));
+ xcb_screen_t *screen = screen_iter.data;
+
+ display_fd = wsi_dri3_open(conn, screen->root, None);
+ }
+
if (chain->base.use_buffer_blit) {
bool use_modifier = num_tranches > 0;
result = wsi_configure_prime_image(&chain->base, pCreateInfo,
- use_modifier,
+ use_modifier, display_fd,
&chain->base.image_info);
} else {
result = wsi_configure_native_image(&chain->base, pCreateInfo,
num_tranches, num_modifiers,
(const uint64_t *const *)modifiers,
chain->has_mit_shm ? &alloc_shm : NULL,
+ display_fd,
&chain->base.image_info);
}
if (result != VK_SUCCESS)
@@ -2039,11 +2050,16 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
uint32_t image = 0;
for (; image < chain->base.image_count; image++) {
result = x11_image_init(device, chain, pCreateInfo, pAllocator,
- &chain->images[image]);
+ display_fd, &chain->images[image]);
if (result != VK_SUCCESS)
goto fail_init_images;
}
+ if (display_fd >= 0) {
+ close(display_fd);
+ display_fd = -1;
+ }
+
/* Initialize queues for images in our swapchain. Possible queues are:
* - Present queue: for images sent to the X server but not yet presented.
* - Acquire queue: for images already presented but not yet released by the
@@ -2122,6 +2138,9 @@ fail_modifiers:
for (int i = 0; i < ARRAY_SIZE(modifiers); i++)
vk_free(pAllocator, modifiers[i]);
+ if (display_fd >= 0)
+ close(display_fd);
+
fail_register:
xcb_unregister_for_special_event(chain->conn, chain->special_event);
--
2.25.1
File diff suppressed because it is too large Load Diff
@@ -1,7 +1,7 @@
From 83953c9325e4cc9adb23ad7654a02ddabdd3fd99 Mon Sep 17 00:00:00 2001
From cf627f39eac96553d44c8642a26354ca70286c64 Mon Sep 17 00:00:00 2001
From: brendan King <Brendan.King@imgtec.com>
Date: Fri, 30 Jul 2021 15:34:13 +0100
Subject: [PATCH 60/67] vulkan/wsi: Disable use of VK_EXT_pci_bus_info
Subject: [PATCH 50/58] vulkan/wsi: Disable use of VK_EXT_pci_bus_info
The VK_EXT_pci_bus_info related code has been wrapped in
VULKAN_WSI_USE_PCI_BUS_INFO, effectively disabling it.
@@ -16,10 +16,10 @@ to indicate that the device is a PCI one.
3 files changed, 10 insertions(+)
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index b1360edb911..66d6683a7c1 100644
index 6032401b37c..9919652e06e 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -56,11 +56,15 @@ wsi_device_init(struct wsi_device *wsi,
@@ -63,11 +63,15 @@ wsi_device_init(struct wsi_device *wsi,
WSI_GET_CB(GetPhysicalDeviceQueueFamilyProperties);
#undef WSI_GET_CB
@@ -36,10 +36,10 @@ index b1360edb911..66d6683a7c1 100644
GetPhysicalDeviceProperties2(pdevice, &pdp2);
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index c2563c677e6..4a733665d2c 100644
index 3ef630080f2..b6ea6e7b36a 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -112,7 +112,9 @@ struct wsi_device {
@@ -114,7 +114,9 @@ struct wsi_device {
VkPhysicalDeviceMemoryProperties memory_props;
uint32_t queue_family_count;
@@ -50,10 +50,10 @@ index c2563c677e6..4a733665d2c 100644
bool supports_modifiers;
uint32_t maxImageDimension2D;
diff --git a/src/vulkan/wsi/wsi_common_drm.c b/src/vulkan/wsi/wsi_common_drm.c
index 6201891ca80..49a78cf4c62 100644
index beb87d7336f..885e4c214cf 100644
--- a/src/vulkan/wsi/wsi_common_drm.c
+++ b/src/vulkan/wsi/wsi_common_drm.c
@@ -45,6 +45,7 @@ wsi_device_matches_drm_fd(const struct wsi_device *wsi, int drm_fd)
@@ -71,6 +71,7 @@ wsi_device_matches_drm_fd(const struct wsi_device *wsi, int drm_fd)
if (ret)
return false;
@@ -61,7 +61,7 @@ index 6201891ca80..49a78cf4c62 100644
bool match = false;
switch (fd_device->bustype) {
case DRM_BUS_PCI:
@@ -57,6 +58,9 @@ wsi_device_matches_drm_fd(const struct wsi_device *wsi, int drm_fd)
@@ -83,6 +84,9 @@ wsi_device_matches_drm_fd(const struct wsi_device *wsi, int drm_fd)
default:
break;
}
@@ -1,56 +0,0 @@
From 627ec429d684c57bdee45a21354009810fc03186 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Wed, 28 Apr 2021 10:57:15 +0100
Subject: [PATCH 51/67] egl/wayland: a linear buffer is not needed with DRM
format modifiers
If the compositor supports DRM format modifiers, there is no
need for an additional linear buffer, as the client can allocate
buffers with attributes known to the compositor.
---
src/egl/drivers/dri2/platform_wayland.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index b393e058770..60683fa6c1a 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -695,7 +695,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
use_flags |= __DRI_IMAGE_USE_PROTECTED;
}
- if (dri2_dpy->is_different_gpu &&
+ if (dri2_dpy->is_different_gpu && !num_modifiers &&
dri2_surf->back->linear_copy == NULL) {
/* The LINEAR modifier should be a perfect alias of the LINEAR use
* flag; try the new interface first before the old, then fall back. */
@@ -811,7 +811,7 @@ update_buffers(struct dri2_egl_display *dri2_dpy,
dri2_surf->color_buffers[i].wl_buffer) {
wl_buffer_destroy(dri2_surf->color_buffers[i].wl_buffer);
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].dri_image);
- if (dri2_dpy->is_different_gpu)
+ if (dri2_surf->color_buffers[i].linear_copy)
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].linear_copy);
dri2_surf->color_buffers[i].wl_buffer = NULL;
dri2_surf->color_buffers[i].dri_image = NULL;
@@ -1247,7 +1247,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
if (!dri2_surf->current->wl_buffer) {
__DRIimage *image;
- if (dri2_dpy->is_different_gpu)
+ if (dri2_surf->current->linear_copy)
image = dri2_surf->current->linear_copy;
else
image = dri2_surf->current->dri_image;
@@ -1281,7 +1281,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
dri2_flush_drawable_for_swapbuffers(disp, draw);
- if (dri2_dpy->is_different_gpu) {
+ if (dri2_surf->current->linear_copy) {
_EGLContext *ctx = _eglGetCurrentContext();
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
dri2_dpy->image->blitImage(dri2_ctx->dri_context,
--
2.25.1
@@ -1,7 +1,7 @@
From 10a0d4ec4f9d468c792f5e675d924fa7a8f97373 Mon Sep 17 00:00:00 2001
From 06c6ca320bf9e632a7a410f3921e81bf9fc7c3b8 Mon Sep 17 00:00:00 2001
From: brendan King <Brendan.King@imgtec.com>
Date: Mon, 2 Aug 2021 16:29:36 +0100
Subject: [PATCH 61/67] vulkan/wsi: default to force_bgra8_unorm_first true
Subject: [PATCH 51/58] vulkan/wsi: default to force_bgra8_unorm_first true
If VULKAN_WSI_BGRA8_SNORM_FIRST is not defined, default to
force_bgra8_unorm_first true.
@@ -15,10 +15,10 @@ to VK_FORMAT_B8G8R8A8_UNORM rather than VK_FORMAT_B8G8R8A8_SRGB.
1 file changed, 4 insertions(+)
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 66d6683a7c1..1ffca6fecfb 100644
index 9919652e06e..96cd263556c 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -158,6 +158,10 @@ wsi_device_init(struct wsi_device *wsi,
@@ -170,6 +170,10 @@ wsi_device_init(struct wsi_device *wsi,
driQueryOptionb(dri_options, "vk_wsi_force_bgra8_unorm_first");
}
}
@@ -1,7 +1,7 @@
From c2b91fcb7c88bfec23077ae31c0035684249ea1b Mon Sep 17 00:00:00 2001
From b0f528f9a74f15c509654f3a76707da99b00a8be Mon Sep 17 00:00:00 2001
From: brendan King <Brendan.King@imgtec.com>
Date: Tue, 3 Aug 2021 15:44:57 +0100
Subject: [PATCH 63/67] vulkan/wsi: enable additional formats for Display
Subject: [PATCH 52/58] vulkan/wsi: enable additional formats for Display
Add VK_FORMAT_R5G6B5_UNORM_PACK16.
@@ -11,10 +11,10 @@ This is for compatibility with IMG WSI.
1 file changed, 1 insertion(+)
diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c
index f135b4e38de..298c78809c3 100644
index 5b020f9fdc0..66052b7dcee 100644
--- a/src/vulkan/wsi/wsi_common_display.c
+++ b/src/vulkan/wsi/wsi_common_display.c
@@ -900,6 +900,7 @@ static const struct {
@@ -1134,6 +1134,7 @@ static const struct {
} available_surface_formats[] = {
{ .format = VK_FORMAT_B8G8R8A8_SRGB, .drm_format = DRM_FORMAT_XRGB8888 },
{ .format = VK_FORMAT_B8G8R8A8_UNORM, .drm_format = DRM_FORMAT_XRGB8888 },
@@ -1,7 +1,7 @@
From 28e4349702566ba34dad4c214c64bfd702177c8a Mon Sep 17 00:00:00 2001
From 8c5f7a9cffeae4b2516f286e78a8a1d35ab16e4e Mon Sep 17 00:00:00 2001
From: brendan King <Brendan.King@imgtec.com>
Date: Thu, 16 Sep 2021 17:46:28 +0100
Subject: [PATCH 66/67] mesa: partially revert pbuffer attribute removal
Subject: [PATCH 53/58] mesa: partially revert pbuffer attribute removal
This partially reverts commit 5ffd1ebe6b3c8c7dd316dd47fac088044222e6ef
("mesa: Remove misc pbuffer attributes from struct gl_config").
@@ -9,15 +9,15 @@ This partially reverts commit 5ffd1ebe6b3c8c7dd316dd47fac088044222e6ef
The IMG PowerVR driver sets meaningful values for the maximum
pbuffer width, height and pixels.
---
src/mesa/drivers/dri/common/utils.c | 7 ++++---
src/mesa/main/mtypes.h | 5 +++++
src/gallium/frontends/dri/utils.c | 7 ++++---
src/mesa/main/glconfig.h | 5 +++++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index df5f8cbfdc0..28debe4e013 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -480,6 +480,7 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a,
diff --git a/src/gallium/frontends/dri/utils.c b/src/gallium/frontends/dri/utils.c
index c27d150d7e5..20f2b519350 100644
--- a/src/gallium/frontends/dri/utils.c
+++ b/src/gallium/frontends/dri/utils.c
@@ -452,6 +452,7 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a,
return all;
}
@@ -25,7 +25,7 @@ index df5f8cbfdc0..28debe4e013 100644
#define __ATTRIB(attrib, field) case attrib: *value = config->modes.field; break
/**
@@ -555,9 +556,9 @@ driGetConfigAttribIndex(const __DRIconfig *config,
@@ -527,9 +528,9 @@ driGetConfigAttribIndex(const __DRIconfig *config,
__ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask);
__ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask);
__ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask);
@@ -38,11 +38,11 @@ index df5f8cbfdc0..28debe4e013 100644
case __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH:
case __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT:
case __DRI_ATTRIB_VISUAL_SELECT_GROUP:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8f77d4c58dd..e37c61d23d0 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -175,6 +175,11 @@ struct gl_config
diff --git a/src/mesa/main/glconfig.h b/src/mesa/main/glconfig.h
index d54a4f75cfd..f9aa5a06940 100644
--- a/src/mesa/main/glconfig.h
+++ b/src/mesa/main/glconfig.h
@@ -27,6 +27,11 @@ struct gl_config
/* ARB_multisample / SGIS_multisample */
GLuint samples;
@@ -1,7 +1,7 @@
From 9bb8868ebab2d041c24c76487b6419a8039a5ce7 Mon Sep 17 00:00:00 2001
From 035839e9ee7778b46fe643056df35c3879e20d4a Mon Sep 17 00:00:00 2001
From: Frank Binns <frank.binns@imgtec.com>
Date: Wed, 4 Jun 2014 13:43:03 +0100
Subject: [PATCH 67/67] egl_dri2: set pbuffer config attribs to 0 for
Subject: [PATCH 54/58] egl_dri2: set pbuffer config attribs to 0 for
non-pbuffer configs
If the EGL_PBUFFER_BIT isn't set in the surface type, don't set the
@@ -14,10 +14,10 @@ values from the DRI config.
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 56b5175db6e..1b10c2e7362 100644
index fce277c6874..152da09881e 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -407,6 +407,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
@@ -403,6 +403,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
_EGLConfig base;
unsigned int attrib, value, double_buffer;
@@ -25,7 +25,7 @@ index 56b5175db6e..1b10c2e7362 100644
bool srgb = false;
EGLint key, bind_to_texture_rgb, bind_to_texture_rgba;
int dri_shifts[4] = { -1, -1, -1, -1 };
@@ -530,11 +531,17 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
@@ -526,11 +527,17 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
break;
case __DRI_ATTRIB_MAX_PBUFFER_WIDTH:
@@ -45,7 +45,7 @@ index 56b5175db6e..1b10c2e7362 100644
case __DRI_ATTRIB_MUTABLE_RENDER_BUFFER:
if (disp->Extensions.KHR_mutable_render_buffer)
surface_type |= EGL_MUTABLE_RENDER_BUFFER_BIT_KHR;
@@ -614,6 +621,15 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
@@ -610,6 +617,15 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
}
}
@@ -1,7 +1,7 @@
From f9c028d508bac22d7c78b0232c625e27d13340a7 Mon Sep 17 00:00:00 2001
From 33fe8986dacdf7968e6a0583e0a491c8f519b919 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Thu, 11 Nov 2021 12:09:38 +0000
Subject: [PATCH 68/68] GL_ARB_geometry_shader4 entry points.
Subject: [PATCH 55/58] GL_ARB_geometry_shader4 entry points.
---
src/mapi/glapi/gen/ARB_geometry_shader4.xml | 97 +++++++++++++++++++++
@@ -114,10 +114,10 @@ index 00000000000..d92dc577b17
+
+</OpenGLAPI>
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 4e35de0f4ea..d5a5e7f5386 100644
index f6657e6ffeb..a6c2889a6e1 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -8064,7 +8064,7 @@
@@ -8066,7 +8066,7 @@
<!-- 46. GL_ARB_framebuffer_sRGB -->
@@ -127,17 +127,17 @@ index 4e35de0f4ea..d5a5e7f5386 100644
<!-- 48. GL_ARB_half_float_vertex -->
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index 974f366d7b4..833ad73dd6a 100644
index b5b3ed9e9b8..6dca8614354 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1721,6 +1721,10 @@ offsets = {
"FramebufferRenderbufferEXT" : 1685,
"GetFramebufferAttachmentParameterivEXT" : 1686,
"GenerateMipmapEXT" : 1687,
+ "ProgramParameteriARB" : 1688,
+ "FramebufferTextureARB" : 1689,
+ "FramebufferTextureLayerARB" : 1690,
+ "FramebufferTextureFaceARB" : 1691,
@@ -1722,6 +1722,10 @@ offsets = {
"FramebufferRenderbufferEXT" : 1686,
"GetFramebufferAttachmentParameterivEXT" : 1687,
"GenerateMipmapEXT" : 1688,
+ "ProgramParameteriARB" : 1689,
+ "FramebufferTextureARB" : 1690,
+ "FramebufferTextureLayerARB" : 1691,
+ "FramebufferTextureFaceARB" : 1692,
}
functions = [
@@ -0,0 +1,285 @@
From fa1e5e1225aecbf5228dbc5092d7a02141cd98f7 Mon Sep 17 00:00:00 2001
From: brendan King <Brendan.King@imgtec.com>
Date: Thu, 9 Sep 2021 17:55:13 +0100
Subject: [PATCH 56/58] egl/wayland: add EGL_BUFFER_PRESERVED support
When the next back buffer is obtained, and the swap method is
EGL_BUFFER_PRESERVED, the current buffer contents are preserved with
a blit, unless the DRI driver is using the image loader extension,
and the DRI driver requests the current buffer contents
(__DRI_IMAGE_BUFFER_PREV) as well as the back buffer. This allows the
blit to be avoided for GPUs that can support EGL_BUFFER_PRESERVED
directly.
Querying the age of a back buffer may force a blit, but outside of EGL
conformance testing, this would be an odd thing to do, as the buffer
age can always be assumed to be 1 with EGL_BUFFER_PRESERVED.
Any received dmabuf feedback may also force a blit.
The IMG PVR driver does not support the DRI2 loader extension, which
is why the buffer preserved support for the extension is less optimal,
with the current buffer always being preserved with a blit.
EGL_BUFFER_PRESERVED support has not been added for the Mesa software
rasteriser.
---
include/GL/internal/dri_interface.h | 4 ++
src/egl/drivers/dri2/platform_wayland.c | 94 +++++++++++++++++++++----
2 files changed, 83 insertions(+), 15 deletions(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 123349acb72..618eba9eaeb 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -2036,12 +2036,16 @@ enum __DRIimageBufferMask {
* OpenGL ES API and little change to the SurfaceFlinger API.
*/
__DRI_IMAGE_BUFFER_SHARED = (1 << 2),
+#define DRI_IMAGE_HAS_BUFFER_PREV
+ __DRI_IMAGE_BUFFER_PREV = (1 << 31),
+
};
struct __DRIimageList {
uint32_t image_mask;
__DRIimage *back;
__DRIimage *front;
+ __DRIimage *prev;
};
#define __DRI_IMAGE_LOADER "DRI_IMAGE_LOADER"
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 64c7a42eaeb..156a4524a54 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -962,12 +962,22 @@ dri2_wl_swap_interval(_EGLDisplay *disp, _EGLSurface *surf, EGLint interval)
}
static void
-dri2_wl_release_buffers(struct dri2_egl_surface *dri2_surf)
+dri2_wl_release_buffers(struct dri2_egl_surface *dri2_surf,
+ bool release_non_current,
+ bool release_current)
{
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
+ if (dri2_surf->current == &dri2_surf->color_buffers[i]) {
+ if (!release_current)
+ continue;
+ } else {
+ if (!release_non_current)
+ continue;
+ }
+
if (dri2_surf->color_buffers[i].wl_buffer) {
if (dri2_surf->color_buffers[i].locked) {
dri2_surf->color_buffers[i].wl_release = true;
@@ -992,6 +1002,9 @@ dri2_wl_release_buffers(struct dri2_egl_surface *dri2_surf)
if (dri2_dpy->dri2)
dri2_egl_surface_free_local_buffers(dri2_surf);
+
+ if (release_current)
+ dri2_surf->current = NULL;
}
static void
@@ -1114,7 +1127,8 @@ create_dri_image(struct dri2_egl_surface *dri2_surf,
}
static int
-get_back_bo(struct dri2_egl_surface *dri2_surf)
+get_back_bo(struct dri2_egl_surface *dri2_surf, bool allow_preserve,
+ bool preserve_current)
{
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
@@ -1200,6 +1214,28 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
return -1;
}
+ if ((allow_preserve || preserve_current) &&
+ dri2_surf->base.SwapBehavior == EGL_BUFFER_PRESERVED &&
+ dri2_surf->current && dri2_surf->back->age != 1) {
+ _EGLContext *ctx = _eglGetCurrentContext();
+ struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
+
+ if (dri2_ctx) {
+ dri2_dpy->image->blitImage(dri2_ctx->dri_context,
+ dri2_surf->back->dri_image,
+ dri2_surf->current->dri_image,
+ 0, 0, dri2_surf->base.Width,
+ dri2_surf->base.Height,
+ 0, 0, dri2_surf->base.Width,
+ dri2_surf->base.Height,
+ __BLIT_FLAG_FLUSH);
+ dri2_surf->back->age = 1;
+
+ if (!preserve_current)
+ dri2_surf->current = NULL;
+ }
+ }
+
dri2_surf->back->locked = true;
return 0;
@@ -1257,8 +1293,12 @@ front_bo_to_dri_buffer(struct dri2_egl_display *dri2_dpy,
static int
update_buffers(struct dri2_egl_display *dri2_dpy,
- struct dri2_egl_surface *dri2_surf)
+ struct dri2_egl_surface *dri2_surf,
+ bool allow_preserve)
{
+ bool preserve_current = false;
+ int res;
+
if (dri2_surf->wl_win &&
(dri2_surf->base.Width != dri2_surf->wl_win->width ||
dri2_surf->base.Height != dri2_surf->wl_win->height)) {
@@ -1268,12 +1308,20 @@ update_buffers(struct dri2_egl_display *dri2_dpy,
}
if (dri2_surf->resized || dri2_surf->received_dmabuf_feedback) {
- dri2_wl_release_buffers(dri2_surf);
+ preserve_current = !dri2_surf->resized &&
+ dri2_surf->base.SwapBehavior == EGL_BUFFER_PRESERVED;
+
+ dri2_wl_release_buffers(dri2_surf, true, !preserve_current);
dri2_surf->resized = false;
dri2_surf->received_dmabuf_feedback = false;
}
- if (get_back_bo(dri2_surf) < 0) {
+ res = get_back_bo(dri2_surf, allow_preserve, preserve_current);
+
+ if (preserve_current)
+ dri2_wl_release_buffers(dri2_surf, false, true);
+
+ if (res < 0) {
_eglError(EGL_BAD_ALLOC, "failed to allocate color buffer");
return -1;
}
@@ -1303,12 +1351,13 @@ update_buffers(struct dri2_egl_display *dri2_dpy,
static int
update_buffers_if_needed(struct dri2_egl_display *dri2_dpy,
- struct dri2_egl_surface *dri2_surf)
+ struct dri2_egl_surface *dri2_surf,
+ bool allow_preserve)
{
if (dri2_surf->back != NULL)
return 0;
- return update_buffers(dri2_dpy, dri2_surf);
+ return update_buffers(dri2_dpy, dri2_surf, allow_preserve);
}
static __DRIbuffer *
@@ -1327,7 +1376,7 @@ dri2_wl_get_buffers_with_format(__DRIdrawable * driDrawable,
switch (attachments[i]) {
case __DRI_BUFFER_BACK_LEFT:
- if (update_buffers_if_needed(dri2_dpy, dri2_surf) < 0)
+ if (update_buffers_if_needed(dri2_dpy, dri2_surf, true) < 0)
return NULL;
back_bo_to_dri_buffer(dri2_dpy, dri2_surf, &dri2_surf->buffers[j]);
@@ -1412,14 +1461,25 @@ image_get_buffers(__DRIdrawable *driDrawable,
buffers->image_mask = 0;
buffers->front = NULL;
buffers->back = NULL;
+ buffers->prev = NULL;
if (buffer_mask & __DRI_IMAGE_BUFFER_BACK)
{
- if (update_buffers_if_needed(dri2_dpy, dri2_surf) < 0)
+ bool buffer_prev = buffer_mask & __DRI_IMAGE_BUFFER_PREV;
+
+ if (update_buffers_if_needed(dri2_dpy, dri2_surf, !buffer_prev) < 0)
return 0;
buffers->image_mask |= __DRI_IMAGE_BUFFER_BACK;
buffers->back = dri2_surf->back->dri_image;
+
+ if (buffer_prev && dri2_surf->current &&
+ dri2_surf->base.SwapBehavior == EGL_BUFFER_PRESERVED)
+ {
+ buffers->image_mask |= __DRI_IMAGE_BUFFER_PREV;
+ buffers->prev = dri2_surf->current->dri_image;
+ dri2_surf->back->age = 1;
+ }
}
if (buffer_mask & __DRI_IMAGE_BUFFER_FRONT)
@@ -1689,7 +1749,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
/* Make sure we have a back buffer in case we're swapping without ever
* rendering. */
- if (update_buffers_if_needed(dri2_dpy, dri2_surf) < 0)
+ if (update_buffers_if_needed(dri2_dpy, dri2_surf, true) < 0)
return _eglError(EGL_BAD_ALLOC, "dri2_swap_buffers");
if (draw->SwapInterval > 0) {
@@ -1780,7 +1840,7 @@ dri2_wl_query_buffer_age(_EGLDisplay *disp, _EGLSurface *surface)
if (surface->Type != EGL_WINDOW_BIT)
return 0;
- if (update_buffers_if_needed(dri2_dpy, dri2_surf) < 0) {
+ if (update_buffers_if_needed(dri2_dpy, dri2_surf, true) < 0) {
_eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age");
return -1;
}
@@ -2157,7 +2217,7 @@ static const __DRIextension *image_loader_extensions[] = {
};
static EGLBoolean
-dri2_wl_add_configs_for_visuals(_EGLDisplay *disp)
+dri2_wl_add_configs_for_visuals(_EGLDisplay *disp, bool allow_preserve)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
unsigned int format_count[ARRAY_SIZE(dri2_wl_visuals)] = { 0 };
@@ -2178,6 +2238,10 @@ dri2_wl_add_configs_for_visuals(_EGLDisplay *disp)
if (dri2_wl_visuals[j].wl_drm_format != WL_DRM_FORMAT_YUYV)
surface_type |= EGL_PBUFFER_BIT;
+ if (allow_preserve &&
+ dri2_dpy->image->base.version >= 9 && dri2_dpy->image->blitImage)
+ surface_type |= EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+
dri2_conf = dri2_add_config(disp, dri2_dpy->driver_configs[i],
count + 1, surface_type, NULL, dri2_wl_visuals[j].rgba_shifts, dri2_wl_visuals[j].rgba_sizes);
if (dri2_conf) {
@@ -2403,7 +2467,7 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp)
goto cleanup;
}
- if (!dri2_wl_add_configs_for_visuals(disp)) {
+ if (!dri2_wl_add_configs_for_visuals(disp, true)) {
_eglError(EGL_NOT_INITIALIZED, "DRI2: failed to add configs");
goto cleanup;
}
@@ -2515,7 +2579,7 @@ swrast_update_buffers(struct dri2_egl_surface *dri2_surf)
dri2_surf->base.Height != dri2_surf->wl_win->height)) {
if (!zink)
- dri2_wl_release_buffers(dri2_surf);
+ dri2_wl_release_buffers(dri2_surf, true, true);
dri2_surf->base.Width = dri2_surf->wl_win->width;
dri2_surf->base.Height = dri2_surf->wl_win->height;
@@ -2962,7 +3026,7 @@ dri2_initialize_wayland_swrast(_EGLDisplay *disp)
dri2_wl_setup_swap_interval(disp);
- if (!dri2_wl_add_configs_for_visuals(disp)) {
+ if (!dri2_wl_add_configs_for_visuals(disp, false)) {
_eglError(EGL_NOT_INITIALIZED, "DRI2: failed to add configs");
goto cleanup;
}
--
2.25.1
@@ -0,0 +1,28 @@
From 521c05973fe7e4433d89872cb2127b2e4c47941f Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Wed, 23 Mar 2022 12:57:01 +0000
Subject: [PATCH 57/58] glapi: restore exec="dynamic"
This is needed for the dispatch table entry points used by the IMG
Rogue DDK driver, which have no implementation in Mesa. Using
exec="dynamic" avoids the need to create stubs in Mesa for the
unimplemented functions.
---
src/mapi/glapi/gen/api_exec_init.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mapi/glapi/gen/api_exec_init.py b/src/mapi/glapi/gen/api_exec_init.py
index ec1c2ea6b88..e10097f921f 100644
--- a/src/mapi/glapi/gen/api_exec_init.py
+++ b/src/mapi/glapi/gen/api_exec_init.py
@@ -33,6 +33,7 @@ import apiexec
exec_flavor_map = {
+ 'dynamic': None,
'vtxfmt': None,
'dlist': '_mesa_',
'mesa': '_mesa_',
--
2.25.1
@@ -1,143 +0,0 @@
From b900d4998b95a8bdfb01600f81635ff76810cfe6 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Tue, 16 Feb 2021 20:17:32 +0000
Subject: [PATCH 57/67] vulkan/wsi: Allow host visible memory to be requested
Allow host visible memory to be explicitly requested when allocating
native images.
For a software driver on X11, we need to be able to map the memory on
the host, in order to present the contents to the X Server.
---
src/vulkan/wsi/wsi_common_display.c | 2 +-
src/vulkan/wsi/wsi_common_drm.c | 17 +++++++++++++----
src/vulkan/wsi/wsi_common_private.h | 1 +
src/vulkan/wsi/wsi_common_wayland.c | 3 ++-
src/vulkan/wsi/wsi_common_x11.c | 1 +
5 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c
index aa07cada107..71a84e54079 100644
--- a/src/vulkan/wsi/wsi_common_display.c
+++ b/src/vulkan/wsi/wsi_common_display.c
@@ -1031,7 +1031,7 @@ wsi_display_image_init(VkDevice device_h,
return VK_ERROR_DEVICE_LOST;
VkResult result = wsi_create_native_image(&chain->base, create_info,
- 0, NULL, NULL,
+ 0, NULL, NULL, false,
&image->base);
if (result != VK_SUCCESS)
return result;
diff --git a/src/vulkan/wsi/wsi_common_drm.c b/src/vulkan/wsi/wsi_common_drm.c
index 70d934aef13..aabb761908c 100644
--- a/src/vulkan/wsi/wsi_common_drm.c
+++ b/src/vulkan/wsi/wsi_common_drm.c
@@ -66,6 +66,7 @@ wsi_device_matches_drm_fd(const struct wsi_device *wsi, int drm_fd)
static uint32_t
select_memory_type(const struct wsi_device *wsi,
bool want_device_local,
+ bool want_host_visible,
uint32_t type_bits)
{
assert(type_bits);
@@ -74,8 +75,10 @@ select_memory_type(const struct wsi_device *wsi,
for (uint32_t i = 0; i < wsi->memory_props.memoryTypeCount; i++) {
const VkMemoryType type = wsi->memory_props.memoryTypes[i];
bool local = type.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
+ bool host = type.propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
- if ((type_bits & (1 << i)) && local == want_device_local)
+ if ((type_bits & (1 << i)) && local == want_device_local &&
+ (!want_host_visible || host))
return i;
all_local &= local;
}
@@ -83,6 +86,8 @@ select_memory_type(const struct wsi_device *wsi,
/* ignore want_device_local when all memory types are device-local */
if (all_local) {
assert(!want_device_local);
+ /* currently, host visibility is only needed with device local */
+ assert(!want_host_visible);
return ffs(type_bits) - 1;
}
@@ -107,6 +112,7 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
uint32_t num_modifier_lists,
const uint32_t *num_modifiers,
const uint64_t *const *modifiers,
+ bool host_visible,
struct wsi_image *image)
{
const struct wsi_device *wsi = chain->wsi;
@@ -317,7 +323,8 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
.pNext = &memory_dedicated_info,
.allocationSize = reqs.size,
- .memoryTypeIndex = select_memory_type(wsi, true, reqs.memoryTypeBits),
+ .memoryTypeIndex = select_memory_type(wsi, true, host_visible,
+ reqs.memoryTypeBits),
};
result = wsi->AllocateMemory(chain->device, &memory_info,
&chain->alloc, &image->memory);
@@ -488,7 +495,8 @@ wsi_create_prime_image(const struct wsi_swapchain *chain,
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
.pNext = &prime_memory_dedicated_info,
.allocationSize = linear_size,
- .memoryTypeIndex = select_memory_type(wsi, false, reqs.memoryTypeBits),
+ .memoryTypeIndex = select_memory_type(wsi, false, false,
+ reqs.memoryTypeBits),
};
result = wsi->AllocateMemory(chain->device, &prime_memory_info,
&chain->alloc, &image->prime.memory);
@@ -542,7 +550,8 @@ wsi_create_prime_image(const struct wsi_swapchain *chain,
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
.pNext = &memory_dedicated_info,
.allocationSize = reqs.size,
- .memoryTypeIndex = select_memory_type(wsi, true, reqs.memoryTypeBits),
+ .memoryTypeIndex = select_memory_type(wsi, true, false,
+ reqs.memoryTypeBits),
};
result = wsi->AllocateMemory(chain->device, &memory_info,
&chain->alloc, &image->memory);
diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h
index 1fe8211f9cb..5ad087b32e0 100644
--- a/src/vulkan/wsi/wsi_common_private.h
+++ b/src/vulkan/wsi/wsi_common_private.h
@@ -94,6 +94,7 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
uint32_t num_modifier_lists,
const uint32_t *num_modifiers,
const uint64_t *const *modifiers,
+ bool host_visible,
struct wsi_image *image);
VkResult
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 40f5338314f..983833e880b 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -1074,7 +1074,8 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
result = wsi_create_native_image(&chain->base, pCreateInfo,
chain->num_drm_modifiers > 0 ? 1 : 0,
&chain->num_drm_modifiers,
- &chain->drm_modifiers, &image->base);
+ &chain->drm_modifiers, false,
+ &image->base);
if (result != VK_SUCCESS)
return result;
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 9eb624df640..eb639d6c265 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -1315,6 +1315,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
} else {
result = wsi_create_native_image(&chain->base, pCreateInfo,
num_tranches, num_modifiers, modifiers,
+ chain->base.wsi->sw,
&image->base);
}
if (result < 0)
--
2.25.1
@@ -0,0 +1,42 @@
From cd53160de9ca913e68a1d826b701e5569fa0ef42 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Fri, 29 Apr 2022 14:48:06 +0100
Subject: [PATCH 58/58] Revert "meson: check -mtls if has_exe_wrapper"
This reverts commit 558bc2227ed00fc6a29c2a10c0b99719cd445c6c.
The change breaks 32 bit x86 cross compilation on x86_64 systems, as
meson.has_exe_wrapper returns true, but Meson fails with:
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: x86
Host machine cpu: i686
Target machine cpu family: x86
Target machine cpu: i686
Checking if "thread_local" compiles: YES
meson.build:555:4: ERROR: Can not run test applications in this
cross environment.
See also https://github.com/mesonbuild/meson/issues/9845
---
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 31b6ffdb060..63d487ae7b1 100644
--- a/meson.build
+++ b/meson.build
@@ -550,7 +550,7 @@ endforeach
if not have_mtls_dialect
# need .run to check libc support. meson aborts when calling .run when
# cross-compiling, but because this is just an optimization we can skip it
- if meson.is_cross_build() and not meson.has_exe_wrapper()
+ if meson.is_cross_build()
warning('cannot auto-detect -mtls-dialect when cross-compiling, using compiler default')
else
# -fpic to force dynamic tls, otherwise TLS relaxation defeats check
--
2.25.1
@@ -1,419 +0,0 @@
From afcfb076e89365ff1f33c658a6a615d2108d97f5 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Thu, 17 Jun 2021 17:17:07 +0100
Subject: [PATCH 58/67] vulkan/wsi: make the display FD available
Pass the display FD to the Vulkan image create and memory
allocation functions when allocating swapchain images.
---
src/vulkan/wsi/wsi_common.h | 14 +++
src/vulkan/wsi/wsi_common_display.c | 2 +-
src/vulkan/wsi/wsi_common_drm.c | 22 ++++-
src/vulkan/wsi/wsi_common_private.h | 2 +
src/vulkan/wsi/wsi_common_wayland.c | 127 ++++++++++++++++++++++------
src/vulkan/wsi/wsi_common_x11.c | 42 ++++++---
6 files changed, 169 insertions(+), 40 deletions(-)
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index d5367db3a94..c2563c677e6 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -37,6 +37,8 @@
#define VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA (VkStructureType)1000001003
#define VK_STRUCTURE_TYPE_WSI_SURFACE_SUPPORTED_COUNTERS_MESA (VkStructureType)1000001005
#define VK_STRUCTURE_TYPE_WSI_MEMORY_SIGNAL_SUBMIT_INFO_MESA (VkStructureType)1000001006
+#define VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO2_MESA (VkStructureType)1000001007
+#define VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO2_MESA (VkStructureType)1000001008
/* This is always chained to VkImageCreateInfo when a wsi image is created.
* It indicates that the image can be transitioned to/from
@@ -75,6 +77,18 @@ struct wsi_memory_signal_submit_info {
VkDeviceMemory memory;
};
+struct wsi_image_create_info2 {
+ VkStructureType sType;
+ const void *pNext;
+ int display_fd;
+};
+
+struct wsi_memory_allocate_info2 {
+ VkStructureType sType;
+ const void *pNext;
+ int display_fd;
+};
+
struct wsi_fence {
VkDevice device;
const struct wsi_device *wsi_device;
diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c
index 71a84e54079..f135b4e38de 100644
--- a/src/vulkan/wsi/wsi_common_display.c
+++ b/src/vulkan/wsi/wsi_common_display.c
@@ -1032,7 +1032,7 @@ wsi_display_image_init(VkDevice device_h,
VkResult result = wsi_create_native_image(&chain->base, create_info,
0, NULL, NULL, false,
- &image->base);
+ wsi->fd, &image->base);
if (result != VK_SUCCESS)
return result;
diff --git a/src/vulkan/wsi/wsi_common_drm.c b/src/vulkan/wsi/wsi_common_drm.c
index aabb761908c..6201891ca80 100644
--- a/src/vulkan/wsi/wsi_common_drm.c
+++ b/src/vulkan/wsi/wsi_common_drm.c
@@ -113,6 +113,7 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
const uint32_t *num_modifiers,
const uint64_t *const *modifiers,
bool host_visible,
+ int display_fd,
struct wsi_image *image)
{
const struct wsi_device *wsi = chain->wsi;
@@ -170,6 +171,12 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
__vk_append_struct(&image_info, &image_format_list);
}
+ struct wsi_image_create_info2 image_wsi_info2 = {
+ .sType = VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO2_MESA,
+ .display_fd = display_fd,
+ };
+ __vk_append_struct(&image_info, &image_wsi_info2);
+
VkImageDrmFormatModifierListCreateInfoEXT image_modifier_list;
uint32_t image_modifier_count = 0, modifier_prop_count = 0;
@@ -308,9 +315,14 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
.pNext = NULL,
.implicit_sync = true,
};
+ const struct wsi_memory_allocate_info2 memory_wsi_info2 = {
+ .sType = VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO2_MESA,
+ .pNext = &memory_wsi_info,
+ .display_fd = display_fd,
+ };
const VkExportMemoryAllocateInfo memory_export_info = {
.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO,
- .pNext = &memory_wsi_info,
+ .pNext = &memory_wsi_info2,
.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
};
const VkMemoryDedicatedAllocateInfo memory_dedicated_info = {
@@ -440,6 +452,7 @@ VkResult
wsi_create_prime_image(const struct wsi_swapchain *chain,
const VkSwapchainCreateInfoKHR *pCreateInfo,
bool use_modifier,
+ int display_fd,
struct wsi_image *image)
{
const struct wsi_device *wsi = chain->wsi;
@@ -480,9 +493,14 @@ wsi_create_prime_image(const struct wsi_swapchain *chain,
.pNext = NULL,
.implicit_sync = true,
};
+ const struct wsi_memory_allocate_info2 memory_wsi_info2 = {
+ .sType = VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO2_MESA,
+ .pNext = &memory_wsi_info,
+ .display_fd = display_fd,
+ };
const VkExportMemoryAllocateInfo prime_memory_export_info = {
.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO,
- .pNext = &memory_wsi_info,
+ .pNext = &memory_wsi_info2,
.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
};
const VkMemoryDedicatedAllocateInfo prime_memory_dedicated_info = {
diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h
index 5ad087b32e0..e46328156dc 100644
--- a/src/vulkan/wsi/wsi_common_private.h
+++ b/src/vulkan/wsi/wsi_common_private.h
@@ -95,12 +95,14 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
const uint32_t *num_modifiers,
const uint64_t *const *modifiers,
bool host_visible,
+ int display_fd,
struct wsi_image *image);
VkResult
wsi_create_prime_image(const struct wsi_swapchain *chain,
const VkSwapchainCreateInfoKHR *pCreateInfo,
bool use_modifier,
+ int display_fd,
struct wsi_image *image);
void
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 983833e880b..1109d3f07b6 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -32,6 +32,8 @@
#include <pthread.h>
#include <poll.h>
#include <sys/mman.h>
+#include <fcntl.h>
+#include <xf86drm.h>
#include "drm-uapi/drm_fourcc.h"
@@ -82,6 +84,9 @@ struct wsi_wl_display {
struct wsi_wayland *wsi_wl;
+ int fd;
+ bool authenticated;
+
/* Points to formats in wsi_wl_display_drm or wsi_wl_display_dmabuf */
struct u_vector * formats;
@@ -261,10 +266,52 @@ wsi_wl_display_add_wl_shm_format(struct wsi_wl_display *display,
}
}
+static int
+open_display_device(const char *name)
+{
+ int fd;
+
+#ifdef O_CLOEXEC
+ fd = open(name, O_RDWR | O_CLOEXEC);
+ if (fd != -1 || errno != EINVAL) {
+ return fd;
+ }
+#endif
+
+ fd = open(name, O_RDWR);
+ if (fd != -1) {
+ long flags = fcntl(fd, F_GETFD);
+
+ if (flags != -1) {
+ if (!fcntl(fd, F_SETFD, flags | FD_CLOEXEC))
+ return fd;
+ }
+ close (fd);
+ }
+
+ return -1;
+}
static void
drm_handle_device(void *data, struct wl_drm *drm, const char *name)
{
+ struct wsi_wl_display *display = data;
+ const int fd = open_display_device(name);
+
+ if (fd != -1) {
+ if (drmGetNodeTypeFromFd(fd) != DRM_NODE_RENDER) {
+ drm_magic_t magic;
+
+ if (drmGetMagic(fd, &magic)) {
+ close(fd);
+ return;
+ }
+ wl_drm_authenticate(drm, magic);
+ } else {
+ display->authenticated = true;
+ }
+ display->fd = fd;
+ }
}
static uint32_t
@@ -346,6 +393,9 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t wl_format)
static void
drm_handle_authenticated(void *data, struct wl_drm *drm)
{
+ struct wsi_wl_display *display = data;
+
+ display->authenticated = true;
}
static void
@@ -487,6 +537,9 @@ wsi_wl_display_finish(struct wsi_wl_display *display)
wl_proxy_wrapper_destroy(display->wl_display_wrapper);
if (display->queue)
wl_event_queue_destroy(display->queue);
+
+ if (display->fd != -1)
+ close(display->fd);
}
static VkResult
@@ -501,6 +554,7 @@ wsi_wl_display_init(struct wsi_wayland *wsi_wl,
display->wsi_wl = wsi_wl;
display->wl_display = wl_display;
display->sw = sw;
+ display->fd = -1;
if (get_format_list) {
if (!u_vector_init(&display->swrast.formats, sizeof(VkFormat), 8) ||
@@ -542,41 +596,60 @@ wsi_wl_display_init(struct wsi_wayland *wsi_wl,
/* Round-trip to get wl_drms and zwp_linux_dmabuf_v1 globals */
wl_display_roundtrip_queue(display->wl_display, display->queue);
+ if (!display->drm.wl_drm && !display->dmabuf.wl_dmabuf && !display->swrast.wl_shm) {
+ result = VK_ERROR_SURFACE_LOST_KHR;
+ goto fail_registry;
+ }
+
/* Round-trip again to get formats, modifiers and capabilities */
- if (display->drm.wl_drm || display->dmabuf.wl_dmabuf || display->swrast.wl_shm)
- wl_display_roundtrip_queue(display->wl_display, display->queue);
+ wl_display_roundtrip_queue(display->wl_display, display->queue);
- if (wsi_wl->wsi->force_bgra8_unorm_first) {
- /* Find BGRA8_UNORM in the list and swap it to the first position if we
- * can find it. Some apps get confused if SRGB is first in the list.
- */
- VkFormat *first_fmt = u_vector_head(display->formats);
- VkFormat *iter_fmt;
- u_vector_foreach(iter_fmt, display->formats) {
- if (*iter_fmt == VK_FORMAT_B8G8R8A8_UNORM) {
- *iter_fmt = *first_fmt;
- *first_fmt = VK_FORMAT_B8G8R8A8_UNORM;
- break;
- }
- }
+ if (display->fd == -1) {
+ result = VK_ERROR_SURFACE_LOST_KHR;
+ goto fail_registry;
}
- /* Prefer the linux-dmabuf protocol if available */
- if (display->sw)
- display->formats = &display->swrast.formats;
- else if (display->dmabuf.wl_dmabuf) {
- display->formats = &display->dmabuf.formats;
- } else if (display->drm.wl_drm &&
- (display->drm.capabilities & WL_DRM_CAPABILITY_PRIME)) {
- /* We need prime support for wl_drm */
- display->formats = &display->drm.formats;
- }
+ wl_display_roundtrip_queue(display->wl_display, display->queue);
- if (!display->formats) {
+ if (!display->authenticated) {
result = VK_ERROR_SURFACE_LOST_KHR;
goto fail_registry;
}
+ if (get_format_list) {
+ /* Prefer the linux-dmabuf protocol if available */
+ if (display->sw)
+ display->formats = &display->swrast.formats;
+ else if(display->dmabuf.wl_dmabuf &&
+ u_vector_length(&display->dmabuf.formats)) {
+ display->formats = &display->dmabuf.formats;
+ } else if (display->drm.wl_drm &&
+ display->drm.capabilities & WL_DRM_CAPABILITY_PRIME) {
+ display->formats = &display->drm.formats;
+ }
+
+ if (!display->formats) {
+ result = VK_ERROR_SURFACE_LOST_KHR;
+ goto fail_registry;
+ }
+
+ if (wsi_wl->wsi->force_bgra8_unorm_first) {
+ /* Find BGRA8_UNORM in the list and swap it to the first position if
+ * we can find it. Some apps get confused if SRGB is first in the
+ * list.
+ */
+ VkFormat *first_fmt = u_vector_tail(display->formats);
+ VkFormat *iter_fmt;
+ u_vector_foreach(iter_fmt, display->formats) {
+ if (*iter_fmt == VK_FORMAT_B8G8R8A8_UNORM) {
+ *iter_fmt = *first_fmt;
+ *first_fmt = VK_FORMAT_B8G8R8A8_UNORM;
+ break;
+ }
+ }
+ }
+ }
+
/* We don't need this anymore */
wl_registry_destroy(registry);
@@ -1075,7 +1148,7 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
chain->num_drm_modifiers > 0 ? 1 : 0,
&chain->num_drm_modifiers,
&chain->drm_modifiers, false,
- &image->base);
+ display->fd, &image->base);
if (result != VK_SUCCESS)
return result;
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index eb639d6c265..ba64e260932 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -1303,7 +1303,8 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
const VkAllocationCallbacks* pAllocator,
const uint64_t *const *modifiers,
const uint32_t *num_modifiers,
- int num_tranches, struct x11_image *image)
+ int num_tranches, int display_fd,
+ struct x11_image *image)
{
xcb_void_cookie_t cookie;
VkResult result;
@@ -1311,11 +1312,12 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
if (chain->base.use_prime_blit) {
bool use_modifier = num_tranches > 0;
- result = wsi_create_prime_image(&chain->base, pCreateInfo, use_modifier, &image->base);
+ result = wsi_create_prime_image(&chain->base, pCreateInfo, use_modifier,
+ display_fd, &image->base);
} else {
result = wsi_create_native_image(&chain->base, pCreateInfo,
num_tranches, num_modifiers, modifiers,
- chain->base.wsi->sw,
+ chain->base.wsi->sw, display_fd,
&image->base);
}
if (result < 0)
@@ -1687,14 +1689,34 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
modifiers, num_modifiers, &num_tranches,
pAllocator);
+
uint32_t image = 0;
- for (; image < chain->base.image_count; image++) {
- result = x11_image_init(device, chain, pCreateInfo, pAllocator,
- (const uint64_t *const *)modifiers,
- num_modifiers, num_tranches,
- &chain->images[image]);
- if (result != VK_SUCCESS)
- goto fail_init_images;
+ {
+ int display_fd = -1;
+
+ if (!wsi_device->sw) {
+ xcb_screen_iterator_t screen_iter =
+ xcb_setup_roots_iterator(xcb_get_setup(conn));
+ xcb_screen_t *screen = screen_iter.data;
+
+ display_fd = wsi_dri3_open(conn, screen->root, None);
+ }
+
+ for (; image < chain->base.image_count; image++) {
+ result = x11_image_init(device, chain, pCreateInfo, pAllocator,
+ (const uint64_t *const *)modifiers,
+ num_modifiers, num_tranches,
+ display_fd, &chain->images[image]);
+ if (result != VK_SUCCESS) {
+ if (display_fd >= 0)
+ close(display_fd);
+
+ goto fail_init_images;
+ }
+ }
+
+ if (display_fd >= 0)
+ close(display_fd);
}
if ((chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR ||
--
2.25.1
@@ -0,0 +1,85 @@
From 81f126f4dde3fd866b480a56ae5a2c105656534c Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Mon, 18 Jul 2022 13:00:31 +0100
Subject: [PATCH 59/60] gbm: add GBM_FORMAT_AXBXGXRX106106106106
---
include/GL/internal/dri_interface.h | 1 +
src/egl/drivers/dri2/egl_dri2.c | 1 +
src/gbm/backends/dri/gbm_dri.c | 5 +++++
src/gbm/main/gbm.c | 1 +
src/gbm/main/gbm.h | 6 ++++++
5 files changed, 14 insertions(+)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 618eba9eaeb..d04f6018e79 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1272,6 +1272,7 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_FORMAT_YV12 0x101e
#define __DRI_IMAGE_FORMAT_YVYU 0x101f
#define __DRI_IMAGE_FORMAT_VYUY 0x1020
+#define __DRI_IMAGE_FORMAT_AXBXGXRX106106106106 0x1021
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 152da09881e..d803142044c 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2865,6 +2865,7 @@ dri2_num_fourcc_format_planes(EGLint format)
case DRM_FORMAT_BGRA1010102:
case DRM_FORMAT_XBGR16161616F:
case DRM_FORMAT_ABGR16161616F:
+ case DRM_FORMAT_AXBXGXRX106106106106:
case DRM_FORMAT_YUYV:
case DRM_FORMAT_YVYU:
case DRM_FORMAT_UYVY:
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 2b60a469559..824495f6f85 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -642,6 +642,11 @@ static const struct gbm_dri_visual gbm_dri_visuals_table[] = {
{ 0, 10, 20, 30 },
{ 10, 10, 10, 2 },
},
+ {
+ GBM_FORMAT_AXBXGXRX106106106106, __DRI_IMAGE_FORMAT_AXBXGXRX106106106106,
+ { 6, 22, 38, 54 },
+ { 10, 10, 10, 10 },
+ },
{
GBM_FORMAT_XBGR16161616F, __DRI_IMAGE_FORMAT_XBGR16161616F,
{ 0, 16, 32, -1 },
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
index 3ce816f5169..e39d0656e68 100644
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -275,6 +275,7 @@ gbm_bo_get_bpp(struct gbm_bo *bo)
return 32;
case GBM_FORMAT_XBGR16161616F:
case GBM_FORMAT_ABGR16161616F:
+ case GBM_FORMAT_AXBXGXRX106106106106:
return 64;
}
}
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
index bd4185b723f..f3ab7999b58 100644
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -166,6 +166,12 @@ enum gbm_bo_format {
#define GBM_FORMAT_ABGR16161616F __gbm_fourcc_code('A', 'B', '4', 'H') /* [63:0] A:B:G:R 16:16:16:16 little endian */
+/*
+ * RGBA format with 10-bit components packed in 64-bit per pixel, with 6 bits
+ * of unused padding per component:
+ */
+#define GBM_FORMAT_AXBXGXRX106106106106 __gbm_fourcc_code('A', 'B', '1', '0') /* [63:0] A:x:B:x:G:x:R:x 10:6:10:6:10:6:10:6 little endian */
+
/* packed YCbCr */
#define GBM_FORMAT_YUYV __gbm_fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
#define GBM_FORMAT_YVYU __gbm_fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */
--
2.25.1
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,37 @@
From e426d71154302c9f9dd5f728a309b4323fbc509b Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Mon, 18 Jul 2022 13:08:17 +0100
Subject: [PATCH 60/60] gallium/pvr: Add DRM_FORMAT_AXBXGXRX106106106106
IMG NOTE: This patch should be merged into the "Add PVR Gallium
driver" patch the next time the Mesa version is upgraded in the
IMG DDK.
---
src/gallium/frontends/pvr/pvrutil.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/gallium/frontends/pvr/pvrutil.c b/src/gallium/frontends/pvr/pvrutil.c
index 2706b02d7bc..b3bcd13bba4 100644
--- a/src/gallium/frontends/pvr/pvrutil.c
+++ b/src/gallium/frontends/pvr/pvrutil.c
@@ -192,6 +192,8 @@ PVRDRIFormatToFourCC(int dri_format)
return DRM_FORMAT_YVYU;
case __DRI_IMAGE_FORMAT_VYUY:
return DRM_FORMAT_VYUY;
+ case __DRI_IMAGE_FORMAT_AXBXGXRX106106106106:
+ return DRM_FORMAT_AXBXGXRX106106106106;
default:
__driUtilMessage("%s: Unknown format: %d", __func__, dri_format);
break;
@@ -260,6 +262,8 @@ PVRDRIFourCCToDRIFormat(int iFourCC)
return __DRI_IMAGE_FORMAT_YVYU;
case DRM_FORMAT_VYUY:
return __DRI_IMAGE_FORMAT_VYUY;
+ case DRM_FORMAT_AXBXGXRX106106106106:
+ return __DRI_IMAGE_FORMAT_AXBXGXRX106106106106;
default:
__driUtilMessage("%s: Unknown format: %d", __func__, iFourCC);
break;
--
2.25.1
@@ -0,0 +1,73 @@
From 7f8aed6fcc4cd6cf02c031e510d55c2081feeec8 Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Mon, 8 Aug 2022 13:04:39 +0100
Subject: [PATCH 61/61] gallium/pvr: add the DRIconfigOptions extension
Add the DRIconfigOptions DRI extension, which is needed by the EGL
MESA_query_driver extension. The PVR driver does not support the DRI
configuration mechanism, and returns a minimal XML string for use
by eglGetDisplayDriverConfig.
IMG NOTE: This patch should be merged into the "Add PVR Gallium
driver" patch the next time the Mesa version is upgraded in the
IMG DDK.
---
src/gallium/frontends/pvr/pvrdri.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/gallium/frontends/pvr/pvrdri.c b/src/gallium/frontends/pvr/pvrdri.c
index d7d620cc6d2..0b8c4cfe282 100644
--- a/src/gallium/frontends/pvr/pvrdri.c
+++ b/src/gallium/frontends/pvr/pvrdri.c
@@ -27,6 +27,8 @@
#include "util/u_atomic.h"
#include "utils.h"
+#include <util/xmlconfig.h>
+#include <util/driconf.h>
#include "dri_screen.h"
@@ -577,6 +579,22 @@ PVRDRIReleaseBuffer(__DRIscreen *psDRIScreen, __DRIbuffer *psDRIBuffer)
free(psPVRBuffer);
}
+static char *
+PVRDRIGetXMLConfigOptions(const char *pszDriverName)
+{
+ const driOptionDescription asConfigOptions[] =
+ {
+ DRI_CONF_SECTION_MISCELLANEOUS
+ DRI_CONF_OPT_B("pvr_driconf_not_used", true,
+ "The PowerVR driver does not use DRIConf")
+ DRI_CONF_SECTION_END
+ };
+
+ (void) pszDriverName;
+
+ return driGetOptionsXml(&asConfigOptions[0], ARRAY_SIZE(asConfigOptions));
+}
+
const struct __DriverAPIRec pvr_driver_api = {
.InitScreen = PVRDRIInitScreen,
.DestroyScreen = PVRDRIDestroyScreen,
@@ -596,10 +614,16 @@ static const struct __DRIDriverVtableExtensionRec pvr_vtable = {
.vtable = &pvr_driver_api,
};
+const __DRIconfigOptionsExtension pvr_config_options = {
+ .base = { __DRI_CONFIG_OPTIONS, 2 },
+ .getXml = PVRDRIGetXMLConfigOptions,
+};
+
const __DRIextension *pvr_driver_extensions[] = {
&driCoreExtension.base,
&driImageDriverExtension.base,
&pvrDRI2Extension.base,
&pvr_vtable.base,
+ &pvr_config_options.base,
NULL
};
--
2.25.1
@@ -0,0 +1,347 @@
From b50d678b86c1102a84c2b5fb55dd46f6e466974b Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Thu, 18 Aug 2022 19:14:29 +0100
Subject: [PATCH 62/62] gallium/pvr: support DRI Image extension v21
IMG NOTE: This patch should be merged into the "Add PVR Gallium
driver" patch the next time the Mesa version is upgraded in the
IMG DDK.
---
src/gallium/frontends/pvr/dri_support.h | 46 +++++++++++
src/gallium/frontends/pvr/pvrcompat.c | 74 +++++++++++++++++
src/gallium/frontends/pvr/pvrdri_support.h | 27 +++++++
src/gallium/frontends/pvr/pvrext.c | 94 +++++++++++++++++++++-
4 files changed, 240 insertions(+), 1 deletion(-)
diff --git a/src/gallium/frontends/pvr/dri_support.h b/src/gallium/frontends/pvr/dri_support.h
index b0b31060dcb..3cc8f290d4d 100644
--- a/src/gallium/frontends/pvr/dri_support.h
+++ b/src/gallium/frontends/pvr/dri_support.h
@@ -489,6 +489,52 @@ struct PVRDRISupportInterfaceV2
struct {
bool (*HaveGetFenceFromCLEvent)(void);
} v4;
+ /* The v5 interface is an extension of v4, so v4 is required as well */
+ struct {
+ __DRIimage *(*CreateImageFromDMABufs3)
+ (struct DRISUPScreen *psDRISUPScreen,
+ int iWidth,
+ int iHeight,
+ int iFourCC,
+ uint64_t uModifier,
+ int *piFDs,
+ int iNumFDs,
+ int *piStrides,
+ int *piOffsets,
+ unsigned int uColorSpace,
+ unsigned int uSampleRange,
+ unsigned int uHorizSiting,
+ unsigned int uVertSiting,
+ uint32_t uFlags,
+ unsigned int *puError,
+ void *pvLoaderPrivate);
+
+ __DRIimage *(*CreateImageWithModifiers2)
+ (struct DRISUPScreen *psDRISUPScreen,
+ int iWidth,
+ int iHeight,
+ int iFourCC,
+ const uint64_t *puModifiers,
+ const unsigned int uModifierCount,
+ unsigned int uUsage,
+ void *pvLoaderPrivate);
+
+ __DRIimage *(*CreateImageFromFDs2)
+ (struct DRISUPScreen *psDRISUPcreen,
+ int iWidth,
+ int iHeight,
+ int iFourCC,
+ int *piFDs,
+ int iNumFDs,
+ uint32_t uFlags,
+ int *piStrides,
+ int *piOffsets,
+ void *pvLoaderPrivate);
+
+ void (*SetInFenceFD)
+ (__DRIimage *psImage,
+ int iFD);
+ } v5;
};
struct PVRDRIImageList {
diff --git a/src/gallium/frontends/pvr/pvrcompat.c b/src/gallium/frontends/pvr/pvrcompat.c
index 23a57dde682..782c900101c 100644
--- a/src/gallium/frontends/pvr/pvrcompat.c
+++ b/src/gallium/frontends/pvr/pvrcompat.c
@@ -55,6 +55,10 @@ static pthread_mutex_t gsCompatLock = PTHREAD_MUTEX_INITIALIZER;
ptr = dlsym(gpvSupLib, MAKESTRING(func)); \
} while(0)
+/* Check if a function exists in the DRI Support interface structure */
+#define HaveFuncV2(field) \
+ ((gsSupV2.field) != NULL) \
+
/* Call a function via the DRI Support interface structure */
#define CallFuncV2(field, ...) \
do { \
@@ -238,6 +242,7 @@ MODSUPRegisterSupportInterfaceV2(const void *pvInterface,
case 2:
case 3:
case 4:
+ case 5:
/* These versions require version 0 */
return false;
default:
@@ -247,6 +252,13 @@ MODSUPRegisterSupportInterfaceV2(const void *pvInterface,
/* The "default" case should be associated with the latest version */
switch (uVersion) {
default:
+ case 5:
+ /* This version is an extension of versions 0 to 4 */
+ if (uMinVersion > 0)
+ return false;
+
+ uEnd = PVRDRIInterfaceV2End(v5);
+ break;
case 4:
/* This version is an extension of versions 0 to 3 */
if (uMinVersion > 0)
@@ -836,3 +848,65 @@ DRISUPHaveGetFenceFromCLEvent(void)
return true;
}
+
+__DRIimage *
+DRISUPCreateImageFromDMABufs3(struct DRISUPScreen *psDRISUPScreen,
+ int iWidth, int iHeight, int iFourCC,
+ uint64_t uModifier, int *piFDs, int iNumFDs,
+ int *piStrides, int *piOffsets,
+ unsigned int uColorSpace,
+ unsigned int uSampleRange,
+ unsigned int uHorizSiting,
+ unsigned int uVertSiting,
+ uint32_t uFlags,
+ unsigned int *puError, void *pvLoaderPrivate)
+{
+ CallFuncV2(v5.CreateImageFromDMABufs3,
+ psDRISUPScreen, iWidth, iHeight, iFourCC, uModifier,
+ piFDs, iNumFDs, piStrides, piOffsets, uColorSpace, uSampleRange,
+ uHorizSiting, uVertSiting, uFlags, puError, pvLoaderPrivate);
+
+ return NULL;
+}
+
+__DRIimage *
+DRISUPCreateImageWithModifiers2(struct DRISUPScreen *psDRISUPScreen,
+ int iWidth, int iHeight, int iFourCC,
+ const uint64_t *puModifiers,
+ const unsigned int uModifierCount,
+ unsigned int uUse,
+ void *pvLoaderPrivate)
+{
+ CallFuncV2(v5.CreateImageWithModifiers2,
+ psDRISUPScreen, iWidth, iHeight, iFourCC, puModifiers,
+ uModifierCount, uUse, pvLoaderPrivate);
+
+ return NULL;
+}
+
+__DRIimage *
+DRISUPCreateImageFromFDs2(struct DRISUPScreen *psDRISUPcreen,
+ int iWidth, int iHeight, int iFourCC,
+ int *piFDs, int iNumFDs, uint32_t uFlags,
+ int *piStrides, int *piOffsets,
+ void *pvLoaderPrivate)
+{
+ CallFuncV2(v5.CreateImageFromFDs2,
+ psDRISUPcreen, iWidth, iHeight, iFourCC, piFDs, iNumFDs,
+ uFlags, piStrides, piOffsets, pvLoaderPrivate);
+
+ return NULL;
+}
+
+bool
+DRISUPHaveSetInFenceFd(void)
+{
+ return HaveFuncV2(v5.SetInFenceFD);
+}
+
+void
+DRISUPSetInFenceFd(__DRIimage *psImage, int iFd)
+{
+ CallFuncV2(v5.SetInFenceFD,
+ psImage, iFd);
+}
diff --git a/src/gallium/frontends/pvr/pvrdri_support.h b/src/gallium/frontends/pvr/pvrdri_support.h
index 58ea3505a4d..f735354440c 100644
--- a/src/gallium/frontends/pvr/pvrdri_support.h
+++ b/src/gallium/frontends/pvr/pvrdri_support.h
@@ -203,4 +203,31 @@ void DRISUPSetDamageRegion(struct DRISUPDrawable *psDRISUPDrawable,
bool DRISUPHaveGetFenceFromCLEvent(void);
+__DRIimage *DRISUPCreateImageFromDMABufs3(struct DRISUPScreen *psDRISUPScreen,
+ int iWidth, int iHeight,
+ int iFourCC, uint64_t uModifier,
+ int *piFDs, int iNumFDs,
+ int *piStrides, int *piOffsets,
+ unsigned int uColorSpace,
+ unsigned int uSampleRange,
+ unsigned int uHorizSiting,
+ unsigned int uVertSiting,
+ uint32_t uFlags,
+ unsigned int *puError,
+ void *pvLoaderPrivate);
+__DRIimage *DRISUPCreateImageWithModifiers2(struct DRISUPScreen *psDRISUPScreen,
+ int iWidth, int iHeight,
+ int iFourCC,
+ const uint64_t *puModifiers,
+ const unsigned int uModifierCount,
+ unsigned int uUse,
+ void *pvLoaderPrivate);
+__DRIimage *DRISUPCreateImageFromFDs2(struct DRISUPScreen *psDRISUPcreen,
+ int iWidth, int iHeight, int iFourCC,
+ int *piFDs, int iNumFDs, uint32_t uFlags,
+ int *piStrides, int *piOffsets,
+ void *pvLoaderPrivate);
+
+bool DRISUPHaveSetInFenceFd(void);
+void DRISUPSetInFenceFd(__DRIimage *psImage, int iFd);
#endif /* defined(__PVRDRI_SUPPORT_H__) */
diff --git a/src/gallium/frontends/pvr/pvrext.c b/src/gallium/frontends/pvr/pvrext.c
index 478399618df..826e84f502f 100644
--- a/src/gallium/frontends/pvr/pvrext.c
+++ b/src/gallium/frontends/pvr/pvrext.c
@@ -71,7 +71,7 @@
/* Maximum version numbers for each supported extension */
#define PVR_DRI_TEX_BUFFER_VERSION 3
#define PVR_DRI2_FLUSH_VERSION 4
-#define PVR_DRI_IMAGE_VERSION 17
+#define PVR_DRI_IMAGE_VERSION 21
#define PVR_DRI2_ROBUSTNESS_VERSION 1
#define PVR_DRI2_FENCE_VERSION 2
#define PVR_DRI2_RENDERER_QUERY_VERSION 1
@@ -445,6 +445,68 @@ PVRDRICreateImageFromRenderbuffer2(__DRIcontext *psDRIContext,
pvLoaderPrivate, puError);
}
+static __DRIimage *
+PVRDRICreateImageFromDmaBufs3(__DRIscreen *psDRIScreen,
+ int iWidth, int iHeight,
+ int iFourCC, uint64_t uModifier,
+ int *piFDs, int iNumFDs,
+ int *piStrides, int *piOffsets,
+ enum __DRIYUVColorSpace eColorSpace,
+ enum __DRISampleRange eSampleRange,
+ enum __DRIChromaSiting eHorizSiting,
+ enum __DRIChromaSiting eVertSiting,
+ uint32_t uFlags, unsigned int *puError,
+ void *pvLoaderPrivate)
+{
+ PVRDRIScreen *psPVRScreen = psDRIScreen->driverPrivate;
+
+ return DRISUPCreateImageFromDMABufs3(psPVRScreen->psDRISUPScreen,
+ iWidth, iHeight, iFourCC, uModifier,
+ piFDs, iNumFDs, piStrides, piOffsets,
+ (unsigned int) eColorSpace,
+ (unsigned int) eSampleRange,
+ (unsigned int) eHorizSiting,
+ (unsigned int) eVertSiting,
+ uFlags, puError, pvLoaderPrivate);
+}
+
+static __DRIimage *
+PVRDRICreateImageWithModifiers2(__DRIscreen *psDRIScreen,
+ int iWidth, int iHeight, int iFormat,
+ const uint64_t *puModifiers,
+ const unsigned int uModifierCount,
+ unsigned int uUse,
+ void *pvLoaderPrivate)
+{
+ PVRDRIScreen *psPVRScreen = psDRIScreen->driverPrivate;
+ int iFourCC = PVRDRIFormatToFourCC(iFormat);
+
+ return DRISUPCreateImageWithModifiers2(psPVRScreen->psDRISUPScreen,
+ iWidth, iHeight, iFourCC,
+ puModifiers, uModifierCount,
+ uUse, pvLoaderPrivate);
+}
+
+static __DRIimage *
+PVRDRICreateImageFromFds2(__DRIscreen *psDRIScreen, int iWidth, int iHeight,
+ int iFourCC, int *piFDs, int iNumFDs,
+ uint32_t uFlags, int *piStrides, int *piOffsets,
+ void *pvLoaderPrivate)
+{
+ PVRDRIScreen *psPVRScreen = psDRIScreen->driverPrivate;
+
+ return DRISUPCreateImageFromFDs2(psPVRScreen->psDRISUPScreen,
+ iWidth, iHeight, iFourCC, piFDs, iNumFDs,
+ uFlags, piStrides, piOffsets,
+ pvLoaderPrivate);
+}
+
+static void
+PVRDRISetInFenceFd(__DRIimage *psImage, int iFd)
+{
+ return DRISUPSetInFenceFd(psImage, iFd);
+}
+
#if defined(EGL_IMG_cl_image)
static __DRIimage *
PVRDRICreateImageFromBuffer(__DRIcontext *psDRIContext, int iTarget,
@@ -486,6 +548,10 @@ static __DRIimageExtension pvrDRIImage = {
.queryDmaBufFormatModifierAttribs =
PVRDRIQueryDmaBufFormatModifierAttribs,
.createImageFromRenderbuffer2 = PVRDRICreateImageFromRenderbuffer2,
+ .createImageFromDmaBufs3 = PVRDRICreateImageFromDmaBufs3,
+ .createImageWithModifiers2 = PVRDRICreateImageWithModifiers2,
+ .createImageFromFds2 = PVRDRICreateImageFromFds2,
+ .setInFenceFd = PVRDRISetInFenceFd,
#if defined(EGL_IMG_cl_image)
.createImageFromBuffer = PVRDRICreateImageFromBuffer,
#endif
@@ -684,8 +750,10 @@ PVRDRIScreenExtensionVersionInfo(void)
void
PVRDRIAdjustExtensions(unsigned int uVersion, unsigned int uMinVersion)
{
+ /* __DRI2fenceExtension adjustment */
switch (uVersion) {
default:
+ case 5:
case 4:
/* Is the KHR_cl_event2 EGL extension supported? */
if (!DRISUPHaveGetFenceFromCLEvent())
@@ -701,4 +769,28 @@ PVRDRIAdjustExtensions(unsigned int uVersion, unsigned int uMinVersion)
pvrDRIFenceExtension.get_fence_from_cl_event = NULL;
break;
}
+
+ /* __DRIimageExtension adjustment */
+ switch (uVersion) {
+ default:
+ case 5:
+ if (!DRISUPHaveSetInFenceFd())
+ pvrDRIImage.setInFenceFd = NULL;
+
+ break;
+ case 4:
+ case 3:
+ case 2:
+ case 1:
+ case 0:
+ /*
+ * The following are not supported:
+ * createImageFromDmaBufs3
+ * createImageWithModifiers2
+ * createImageFromFds2
+ * setInFenceFd
+ */
+ pvrDRIImage.base.version = 17;
+ break;
+ }
}
--
2.34.1
@@ -1,64 +0,0 @@
From 7e8bb12d48651796da6d8f3df1b388551d3b5510 Mon Sep 17 00:00:00 2001
From: brendan King <Brendan.King@imgtec.com>
Date: Mon, 2 Aug 2021 11:21:16 +0100
Subject: [PATCH 62/67] vulkan/wsi: enable additional formats for Wayland
Add VK_FORMAT_R5G6B5_UNORM_PACK16.
This is for compatibility with IMG WSI.
---
src/vulkan/wsi/wsi_common_wayland.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 1109d3f07b6..e520aa9af00 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -68,6 +68,7 @@ struct wsi_wl_display_dmabuf {
struct {
struct u_vector argb8888;
struct u_vector xrgb8888;
+ struct u_vector rgb565;
} modifiers;
};
@@ -441,6 +442,9 @@ dmabuf_handle_modifier(void *data, struct zwp_linux_dmabuf_v1 *dmabuf,
case WL_DRM_FORMAT_XRGB8888:
modifiers = &display->dmabuf.modifiers.xrgb8888;
break;
+ case WL_DRM_FORMAT_RGB565:
+ modifiers = &display->dmabuf.modifiers.rgb565;
+ break;
default:
return; /* Unsupported format */
}
@@ -527,6 +531,7 @@ wsi_wl_display_finish(struct wsi_wl_display *display)
u_vector_finish(&display->dmabuf.formats);
u_vector_finish(&display->dmabuf.modifiers.argb8888);
u_vector_finish(&display->dmabuf.modifiers.xrgb8888);
+ u_vector_finish(&display->dmabuf.modifiers.rgb565);
if (display->swrast.wl_shm)
wl_shm_destroy(display->swrast.wl_shm);
if (display->drm.wl_drm)
@@ -563,6 +568,8 @@ wsi_wl_display_init(struct wsi_wayland *wsi_wl,
!u_vector_init(&display->dmabuf.modifiers.argb8888,
sizeof(uint64_t), 32) ||
!u_vector_init(&display->dmabuf.modifiers.xrgb8888,
+ sizeof(uint64_t), 32) ||
+ !u_vector_init(&display->dmabuf.modifiers.rgb565,
sizeof(uint64_t), 32)) {
result = VK_ERROR_OUT_OF_HOST_MEMORY;
goto fail;
@@ -1356,6 +1363,9 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
case WL_DRM_FORMAT_XRGB8888:
modifiers = &chain->display->dmabuf.modifiers.xrgb8888;
break;
+ case WL_DRM_FORMAT_RGB565:
+ modifiers = &chain->display->dmabuf.modifiers.rgb565;
+ break;
default:
modifiers = NULL;
break;
--
2.25.1
@@ -1,183 +0,0 @@
From 85762f3538a21a99bf1b71d87345ebe51f9de453 Mon Sep 17 00:00:00 2001
From: Luigi Santivetti <luigi.santivetti@imgtec.com>
Date: Thu, 12 Aug 2021 00:55:46 +0100
Subject: [PATCH 64/67] mesa/main: dri: add YUV420_3PLANE and YVU420_3PLANE
---
include/GL/internal/dri_interface.h | 2 ++
src/gallium/include/pipe/p_format.h | 3 +++
src/mesa/drivers/dri/common/utils.c | 18 ++++++++++++++++++
src/mesa/drivers/dri/pvr/dri_support.h | 2 ++
src/mesa/drivers/dri/pvr/pvrutil.c | 13 +++++++++++++
src/mesa/main/format_info.py | 2 +-
src/mesa/main/formats.c | 2 ++
src/mesa/main/formats.csv | 2 ++
src/mesa/main/formats.h | 6 ++++++
9 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 080d191b0a3..7d9a1bd9ba6 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1424,6 +1424,8 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_FORMAT_BGR888 0x101a
#define __DRI_IMAGE_FORMAT_NV12 0x101b
#define __DRI_IMAGE_FORMAT_NV21 0x101c
+#define __DRI_IMAGE_FORMAT_YU12 0x101d
+#define __DRI_IMAGE_FORMAT_YV12 0x101e
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index fd653379b7a..970f07598d5 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -516,6 +516,9 @@ enum pipe_format {
PIPE_FORMAT_YUV420_2PLANE,
PIPE_FORMAT_YVU420_2PLANE,
+ PIPE_FORMAT_YUV420_3PLANE,
+ PIPE_FORMAT_YVU420_3PLANE,
+
PIPE_FORMAT_COUNT
};
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index d268dc41fbb..df5f8cbfdc0 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -330,6 +330,24 @@ driCreateConfigs(mesa_format format,
yuv_subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_0_BIT;
yuv_plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT;
break;
+ case MESA_FORMAT_YUV420_3PLANE:
+ masks = format_table[11].masks;
+ shifts = format_table[11].shifts;
+ is_yuv = true; /* FIXME: This should come from formats_info.py */
+ yuv_order = __DRI_ATTRIB_YUV_ORDER_YUV_BIT;
+ yuv_num_planes = 3;
+ yuv_subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_0_BIT;
+ yuv_plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT;
+ break;
+ case MESA_FORMAT_YVU420_3PLANE:
+ masks = format_table[11].masks;
+ shifts = format_table[11].shifts;
+ is_yuv = true; /* FIXME: This should come from formats_info.py */
+ yuv_order = __DRI_ATTRIB_YUV_ORDER_YVU_BIT;
+ yuv_num_planes = 3;
+ yuv_subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_0_BIT;
+ yuv_plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT;
+ break;
default:
fprintf(stderr, "[%s:%u] Unknown framebuffer type %s (%d).\n",
__func__, __LINE__,
diff --git a/src/mesa/drivers/dri/pvr/dri_support.h b/src/mesa/drivers/dri/pvr/dri_support.h
index ab0b9dd9a23..a4999dc36bf 100644
--- a/src/mesa/drivers/dri/pvr/dri_support.h
+++ b/src/mesa/drivers/dri/pvr/dri_support.h
@@ -189,6 +189,8 @@ typedef enum
#define PVRDRI_MESA_FORMAT_YVU420_2PLANE 8
#define PVRDRI_MESA_FORMAT_B8G8R8A8_SRGB 9
#define PVRDRI_MESA_FORMAT_R8G8B8A8_SRGB 10
+#define PVRDRI_MESA_FORMAT_YUV420_3PLANE 11
+#define PVRDRI_MESA_FORMAT_YVU420_3PLANE 12
/* The blit flags match their DRI counterparts */
#define PVRDRI_BLIT_FLAG_FLUSH 0x0001
diff --git a/src/mesa/drivers/dri/pvr/pvrutil.c b/src/mesa/drivers/dri/pvr/pvrutil.c
index d107a5dafad..ee11ac55914 100644
--- a/src/mesa/drivers/dri/pvr/pvrutil.c
+++ b/src/mesa/drivers/dri/pvr/pvrutil.c
@@ -118,6 +118,10 @@ PVRDRIMesaFormatToMesaFormat(int pvrdri_mesa_format)
return MESA_FORMAT_B8G8R8A8_SRGB;
case PVRDRI_MESA_FORMAT_R8G8B8A8_SRGB:
return MESA_FORMAT_R8G8B8A8_SRGB;
+ case PVRDRI_MESA_FORMAT_YUV420_3PLANE:
+ return MESA_FORMAT_YUV420_3PLANE;
+ case PVRDRI_MESA_FORMAT_YVU420_3PLANE:
+ return MESA_FORMAT_YVU420_3PLANE;
default:
__driUtilMessage("%s: Unknown format: %d", __func__, pvrdri_mesa_format);
break;
@@ -178,6 +182,11 @@ PVRDRIFormatToFourCC(int dri_format)
return DRM_FORMAT_NV12;
case __DRI_IMAGE_FORMAT_NV21:
return DRM_FORMAT_NV21;
+ case __DRI_IMAGE_FORMAT_YU12:
+ return DRM_FORMAT_YUV420;
+ case __DRI_IMAGE_FORMAT_YV12:
+ return DRM_FORMAT_YVU420;
+
default:
__driUtilMessage("%s: Unknown format: %d", __func__, dri_format);
break;
@@ -238,6 +247,10 @@ PVRDRIFourCCToDRIFormat(int iFourCC)
return __DRI_IMAGE_FORMAT_NV12;
case DRM_FORMAT_NV21:
return __DRI_IMAGE_FORMAT_NV21;
+ case DRM_FORMAT_YUV420:
+ return __DRI_IMAGE_FORMAT_YU12;
+ case DRM_FORMAT_YVU420:
+ return __DRI_IMAGE_FORMAT_YV12;
default:
__driUtilMessage("%s: Unknown format: %d", __func__, iFourCC);
break;
diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py
index d58403ea85e..bc18db74f17 100644
--- a/src/mesa/main/format_info.py
+++ b/src/mesa/main/format_info.py
@@ -29,7 +29,7 @@ import sys
def get_gl_base_format(fmat):
if fmat.name == 'MESA_FORMAT_NONE':
return 'GL_NONE'
- elif fmat.name in ['MESA_FORMAT_YCBCR', 'MESA_FORMAT_YCBCR_REV', 'MESA_FORMAT_YUV420_2PLANE', 'MESA_FORMAT_YVU420_2PLANE']:
+ elif fmat.name in ['MESA_FORMAT_YCBCR', 'MESA_FORMAT_YCBCR_REV', 'MESA_FORMAT_YUV420_2PLANE', 'MESA_FORMAT_YVU420_2PLANE', 'MESA_FORMAT_YUV420_3PLANE', 'MESA_FORMAT_YVU420_3PLANE']:
return 'GL_YCBCR_MESA'
elif fmat.has_channel('r'):
if fmat.has_channel('g'):
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index f81caeceff4..d7b0d0a07c9 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -1455,6 +1455,8 @@ _mesa_format_matches_format_and_type(mesa_format mformat,
switch (mformat) {
case MESA_FORMAT_YUV420_2PLANE:
case MESA_FORMAT_YVU420_2PLANE:
+ case MESA_FORMAT_YUV420_3PLANE:
+ case MESA_FORMAT_YVU420_3PLANE:
return false;
default:
diff --git a/src/mesa/main/formats.csv b/src/mesa/main/formats.csv
index b2d476577e0..825443b10ce 100644
--- a/src/mesa/main/formats.csv
+++ b/src/mesa/main/formats.csv
@@ -94,6 +94,8 @@ MESA_FORMAT_YCBCR , other , 1, 1, 1, x16 , , ,
MESA_FORMAT_YCBCR_REV , other , 1, 1, 1, x16 , , , , xyzw, yuv
MESA_FORMAT_YUV420_2PLANE , other , 1, 1, 1, x8 , , , , y___, yuv
MESA_FORMAT_YVU420_2PLANE , other , 1, 1, 1, x8 , , , , y___, yuv
+MESA_FORMAT_YUV420_3PLANE , other , 1, 1, 1, x8 , , , , y___, yuv
+MESA_FORMAT_YVU420_3PLANE , other , 1, 1, 1, x8 , , , , y___, yuv
MESA_FORMAT_RG_RB_UNORM8 , other , 2, 1, 1, x16 , , , , xyz1, rgb
MESA_FORMAT_GR_BR_UNORM8 , other , 2, 1, 1, x16 , , , , xyz1, rgb
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 0e778d64467..1ab03d2be7e 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -624,6 +624,12 @@ typedef enum pipe_format mesa_format;
#define HAVE_MESA_FORMAT_YVU420_2PLANE
#define MESA_FORMAT_YVU420_2PLANE PIPE_FORMAT_YVU420_2PLANE
+#define HAVE_MESA_FORMAT_YUV420_3PLANE
+#define MESA_FORMAT_YUV420_3PLANE PIPE_FORMAT_YUV420_3PLANE
+
+#define HAVE_MESA_FORMAT_YVU420_3PLANE
+#define MESA_FORMAT_YVU420_3PLANE PIPE_FORMAT_YVU420_3PLANE
+
#define MESA_FORMAT_COUNT PIPE_FORMAT_COUNT
/* Packed to array format adapters */
--
2.25.1
@@ -1,58 +0,0 @@
From 89f34a04c15c8657cb77bbbc94fb9b9d0ac76980 Mon Sep 17 00:00:00 2001
From: Luigi Santivetti <luigi.santivetti@imgtec.com>
Date: Mon, 23 Aug 2021 09:18:37 +0100
Subject: [PATCH 65/67] egl/null: add support for YU12 and YV12
---
src/egl/drivers/dri2/platform_null.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/egl/drivers/dri2/platform_null.c b/src/egl/drivers/dri2/platform_null.c
index 529cc7a2a2f..2e86d6533de 100644
--- a/src/egl/drivers/dri2/platform_null.c
+++ b/src/egl/drivers/dri2/platform_null.c
@@ -106,6 +106,20 @@ static const struct dri2_null_yuv_attrib {
.num_planes = 2,
.plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT,
},
+ {
+ /* __DRI_IMAGE_FORMAT_YU12 */
+ .order = __DRI_ATTRIB_YUV_ORDER_YUV_BIT,
+ .subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_0_BIT,
+ .num_planes = 3,
+ .plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT,
+ },
+ {
+ /* __DRI_IMAGE_FORMAT_YV12 */
+ .order = __DRI_ATTRIB_YUV_ORDER_YVU_BIT,
+ .subsample = __DRI_ATTRIB_YUV_SUBSAMPLE_4_2_0_BIT,
+ .num_planes = 3,
+ .plane_bpp = __DRI_ATTRIB_YUV_PLANE_BPP_8_BIT,
+ },
};
/*
@@ -161,6 +175,20 @@ static const struct dri2_null_format {
.rgba_sizes = { 0, 0, 0, 0 },
.yuv = &dri2_null_yuv_attribs[2],
},
+ {
+ .drm_format = DRM_FORMAT_YUV420,
+ .dri_image_format = __DRI_IMAGE_FORMAT_YU12,
+ .rgba_shifts = { -1, -1, -1, -1 },
+ .rgba_sizes = { 0, 0, 0, 0 },
+ .yuv = &dri2_null_yuv_attribs[3],
+ },
+ {
+ .drm_format = DRM_FORMAT_YVU420,
+ .dri_image_format = __DRI_IMAGE_FORMAT_YV12,
+ .rgba_shifts = { -1, -1, -1, -1 },
+ .rgba_sizes = { 0, 0, 0, 0 },
+ .yuv = &dri2_null_yuv_attribs[4],
+ },
};
--
2.25.1
Regular → Executable
+58 -90
View File
@@ -24,19 +24,21 @@ config BR2_PACKAGE_MESA3D_NEEDS_ELFUTILS
config BR2_PACKAGE_MESA3D_LLVM
bool "llvm support"
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_INSTALL_LIBSTDCPP
depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
depends on !BR2_STATIC_LIBS
depends on BR2_USE_WCHAR # std::wstring
depends on BR2_HOST_GCC_AT_LEAST_5 # host-llvm
select BR2_PACKAGE_LLVM
comment "llvm support needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, dynamic library"
comment "llvm support needs a toolchain w/ wchar, threads, C++, gcc >= 5, dynamic library, host gcc >= 5"
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
!BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 \
|| BR2_STATIC_LIBS || !BR2_USE_WCHAR
!BR2_TOOLCHAIN_GCC_AT_LEAST_5 \
|| BR2_STATIC_LIBS || !BR2_USE_WCHAR \
|| !BR2_HOST_GCC_AT_LEAST_5
comment "llvm support needs a toolchain not affected by GCC bug 64735"
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
@@ -54,21 +56,15 @@ config BR2_PACKAGE_MESA3D_OPENCL
select BR2_PACKAGE_LIBCLC
select BR2_PACKAGE_HAS_LIBOPENCL
# inform the .mk file of gallium, dri or vulkan driver selection
# inform the .mk file of gallium, dri, dri3 or vulkan driver selection
config BR2_PACKAGE_MESA3D_DRI3
bool
select BR2_PACKAGE_XLIB_LIBXSHMFENCE
config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
bool
select BR2_PACKAGE_MESA3D_DRIVER
config BR2_PACKAGE_MESA3D_DRI_DRIVER
bool
select BR2_PACKAGE_MESA3D_DRIVER
select BR2_PACKAGE_MESA3D_GBM if \
!BR2_PACKAGE_MESA3D_OPENGL_GLX && \
!BR2_PACKAGE_MESA3D_OPENGL_EGL
select BR2_PACKAGE_XLIB_LIBXSHMFENCE if \
(BR2_PACKAGE_XORG7 && BR2_TOOLCHAIN_HAS_SYNC_4 && \
!BR2_RISCV_32)
config BR2_PACKAGE_MESA3D_VULKAN_DRIVER
bool
select BR2_PACKAGE_MESA3D_DRIVER
@@ -97,8 +93,17 @@ config BR2_PACKAGE_MESA3D_NEEDS_X11
comment "Gallium drivers"
config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_CROCUS
bool "Gallium crocus driver"
depends on BR2_i386 || BR2_x86_64
select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
help
Mesa driver for gen4-7 Intel GPUs.
config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_ETNAVIV
bool "Gallium Etnaviv driver"
depends on (BR2_TOOLCHAIN_HAS_SYNC_4 && !BR2_RISCV_32) || !BR2_PACKAGE_XORG7 # libxshmfence
select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
select BR2_PACKAGE_LIBDRM_ETNAVIV
help
@@ -112,6 +117,7 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO
# can't see is just spurious. However, that dependency is about
# the toolchain having sync4 primitives, which is always a given
# for arm/aarch64.
select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
select BR2_PACKAGE_LIBDRM_FREEDRENO
help
@@ -120,16 +126,11 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO
config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_I915
bool "Gallium i915 driver"
depends on BR2_i386 || BR2_x86_64
depends on !BR2_PACKAGE_MESA3D_DRI_DRIVER_I915
select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
select BR2_PACKAGE_LIBDRM_INTEL
help
Support for i915-based Intel GPUs.
comment "Gallium i915: Only one i915 provider can be built"
depends on BR2_i386 || BR2_x86_64
depends on BR2_PACKAGE_MESA3D_DRI_DRIVER_I915
config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS
bool "Gallium iris driver"
depends on BR2_i386 || BR2_x86_64
@@ -139,6 +140,8 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS
config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_LIMA
bool "Gallium lima driver"
depends on (BR2_TOOLCHAIN_HAS_SYNC_4 && !BR2_RISCV_32) || !BR2_PACKAGE_XORG7 # libxshmfence
select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
help
Mesa driver for ARM Mali Utgard GPUs.
@@ -154,6 +157,8 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_NOUVEAU
config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST
bool "Gallium panfrost driver"
depends on (BR2_TOOLCHAIN_HAS_SYNC_4 && !BR2_RISCV_32) || !BR2_PACKAGE_XORG7 # libxshmfence
select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
help
Mesa driver for ARM Mali Midgard and Bifrost GPUs.
@@ -241,8 +246,10 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_TEGRA
config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_V3D
bool "Gallium v3d driver"
depends on (BR2_arm && BR2_ARM_CPU_HAS_NEON) || BR2_aarch64
depends on BR2_TOOLCHAIN_HAS_SYNC_4 || !BR2_PACKAGE_XORG7 # libxshmfence
select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
select BR2_PACKAGE_LIBDRM_VC4
select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4 # runtime
select BR2_PACKAGE_MESA3D_OPENGL_EGL
help
Driver for Broadcom VC6 (rpi4) GPUs (needs vc4).
@@ -254,7 +261,9 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_V3D
config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4
bool "Gallium vc4 driver"
depends on BR2_arm || BR2_aarch64
depends on (BR2_arm && BR2_ARM_CPU_HAS_NEON) || BR2_aarch64
depends on BR2_TOOLCHAIN_HAS_SYNC_4 || !BR2_PACKAGE_XORG7 # libxshmfence
select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
select BR2_PACKAGE_LIBDRM_VC4
select BR2_PACKAGE_MESA3D_OPENGL_EGL
@@ -270,6 +279,14 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VIRGL
virgl is the 3D acceleration backend for the virtio-gpu
shipping with qemu.
config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PVR
bool "Gallium pvr driver"
depends on BR2_PACKAGE_IMG_GPU_POWERVR
select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
select BR2_PACKAGE_MESA3D_OPENGL_EGL
help
pvr is the 3D acceleration backend for Imagination PowerVR GPUs
config BR2_PACKAGE_MESA3D_VDPAU
bool "Gallium VDPAU state tracker"
depends on BR2_PACKAGE_XORG7
@@ -308,76 +325,24 @@ comment "Gallium XvMC state tracker needs X.org and gallium drivers r600 or nouv
!(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_NOUVEAU \
|| BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_R600)
comment "DRI drivers"
config BR2_PACKAGE_MESA3D_DRI_DRIVER_I915
bool "DRI i915 driver"
depends on BR2_i386 || BR2_x86_64
select BR2_PACKAGE_MESA3D_DRI_DRIVER
select BR2_PACKAGE_LIBDRM_INTEL
help
Support for i915-based Intel GPUs.
config BR2_PACKAGE_MESA3D_DRI_DRIVER_I965
bool "DRI i965 driver"
depends on BR2_i386 || BR2_x86_64
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_17 # memfd.h
select BR2_PACKAGE_MESA3D_DRI_DRIVER
select BR2_PACKAGE_LIBDRM_INTEL
help
Support for i965-based Intel GPUs.
comment "DRI i965 driver needs a toolchain w/ headers >= 3.17"
depends on BR2_i386 || BR2_x86_64
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_17
config BR2_PACKAGE_MESA3D_DRI_DRIVER_NOUVEAU
bool "DRI nouveau driver"
select BR2_PACKAGE_MESA3D_DRI_DRIVER
select BR2_PACKAGE_LIBDRM_NOUVEAU
help
Support for Nvidia-based GPUs.
config BR2_PACKAGE_MESA3D_DRI_DRIVER_RADEON
bool "DRI radeon r100 driver"
depends on BR2_i386 || BR2_x86_64
# libdrm's radeon option depends on LIBDRM_HAS_ATOMIC. Propagating
# that dependency here causes a circular dependency that Kconfig
# can't see is just spurious. However, that dependency is about
# the toolchain having sync4 primitives, which is always a given
# for i386 and x86_64.
select BR2_PACKAGE_MESA3D_DRI_DRIVER
select BR2_PACKAGE_LIBDRM_RADEON
help
Legacy Radeon driver for R100 series GPUs.
config BR2_PACKAGE_MESA3D_DRI_DRIVER_PVR
bool "DRI pvr driver"
depends on BR2_PACKAGE_IMG_GPU_POWERVR
select BR2_PACKAGE_MESA3D_DRI_DRIVER
help
Support for Imagination PowerVR GPUs.
comment "Vulkan drivers"
config BR2_PACKAGE_MESA3D_VULKAN_DRIVER_INTEL
bool "Vulkan Intel driver"
depends on BR2_i386 || BR2_x86_64
depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libxshmfence
depends on BR2_TOOLCHAIN_HAS_SYNC_4 || !BR2_PACKAGE_XORG7 # libxshmfence
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_17 # memfd.h
depends on BR2_TOOLCHAIN_USES_GLIBC # ifunc, static_assert
depends on BR2_PACKAGE_XORG7 # xorgproto
select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
select BR2_PACKAGE_MESA3D_VULKAN_DRIVER
select BR2_PACKAGE_XORGPROTO
select BR2_PACKAGE_XLIB_LIBXSHMFENCE
help
Vulkan driver for Intel hardware from Ivy Bridge onward.
comment "intel vulkan depends on X.org and needs a glibc toolchain w/ headers >= 3.17"
comment "intel vulkan needs a glibc toolchain w/ headers >= 3.17"
depends on BR2_i386 || BR2_x86_64
depends on BR2_TOOLCHAIN_HAS_SYNC_4
depends on BR2_TOOLCHAIN_HAS_SYNC_4 || !BR2_PACKAGE_XORG7
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_17 || \
!BR2_TOOLCHAIN_USES_GLIBC || !BR2_PACKAGE_XORG7
!BR2_TOOLCHAIN_USES_GLIBC
comment "Off-screen Rendering"
@@ -393,22 +358,22 @@ comment "OpenGL API Support"
config BR2_PACKAGE_MESA3D_GBM
bool "gbm"
depends on BR2_PACKAGE_MESA3D_DRI_DRIVER \
|| (BR2_PACKAGE_MESA3D_GALLIUM_DRIVER && BR2_PACKAGE_MESA3D_OPENGL_EGL)
depends on BR2_PACKAGE_MESA3D_GALLIUM_DRIVER && \
BR2_PACKAGE_MESA3D_OPENGL_EGL
select BR2_PACKAGE_HAS_LIBGBM
select BR2_PACKAGE_LIBGBM_HAS_FEATURE_FORMAT_MODIFIER_PLANE_COUNT
select BR2_PACKAGE_LIBGBM_HAS_FEATURE_DMA_BUF
help
Enable Generic Buffer Management (gbm)
comment "gbm support needs a dri driver or a gallium driver w/ EGL support."
depends on !BR2_PACKAGE_MESA3D_DRI_DRIVER \
&& !(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER && BR2_PACKAGE_MESA3D_OPENGL_EGL)
comment "gbm support needs a gallium driver w/ EGL support."
depends on !(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER && BR2_PACKAGE_MESA3D_OPENGL_EGL)
config BR2_PACKAGE_MESA3D_OPENGL_GLX
bool "OpenGL GLX"
depends on BR2_PACKAGE_XORG7
select BR2_PACKAGE_HAS_LIBGL
select BR2_PACKAGE_HAS_LIBGL if !BR2_PACKAGE_LIBGLVND
select BR2_PACKAGE_LIBGLVND_DISPATCH_GL if BR2_PACKAGE_LIBGLVND
select BR2_PACKAGE_MESA3D_NEEDS_X11
help
Enable GLX graphic acceleration (OpenGL + X11).
@@ -418,7 +383,9 @@ comment "OpenGL GLX support needs X11"
config BR2_PACKAGE_MESA3D_OPENGL_EGL
bool "OpenGL EGL"
select BR2_PACKAGE_HAS_LIBEGL
depends on BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
select BR2_PACKAGE_HAS_LIBEGL if !BR2_PACKAGE_LIBGLVND
select BR2_PACKAGE_LIBGLVND_DISPATCH_EGL if BR2_PACKAGE_LIBGLVND
select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
select BR2_PACKAGE_MESA3D_GBM
help
@@ -427,7 +394,8 @@ config BR2_PACKAGE_MESA3D_OPENGL_EGL
config BR2_PACKAGE_MESA3D_OPENGL_ES
bool "OpenGL ES"
select BR2_PACKAGE_HAS_LIBGLES
select BR2_PACKAGE_HAS_LIBGLES if !BR2_PACKAGE_LIBGLVND
select BR2_PACKAGE_LIBGLVND_DISPATCH_GLES if BR2_PACKAGE_LIBGLVND
help
Use the Khronos OpenGL ES APIs. This is commonly used on
embedded systems and represents a subset of the OpenGL API.
@@ -438,13 +406,13 @@ config BR2_PACKAGE_PROVIDES_LIBGBM
default "mesa3d" if BR2_PACKAGE_MESA3D_GBM
config BR2_PACKAGE_PROVIDES_LIBGL
default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_GLX
default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_GLX && !BR2_PACKAGE_LIBGLVND
config BR2_PACKAGE_PROVIDES_LIBEGL
default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_EGL
default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_EGL && !BR2_PACKAGE_LIBGLVND
config BR2_PACKAGE_PROVIDES_LIBGLES
default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_ES
default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_ES && !BR2_PACKAGE_LIBGLVND
config BR2_PACKAGE_PROVIDES_LIBOPENCL
default "mesa3d" if BR2_PACKAGE_MESA3D_OPENCL
+4 -4
View File
@@ -1,6 +1,6 @@
# From https://lists.freedesktop.org/archives/mesa-announce/2021-August/000643.html
sha256 2c65e6710b419b67456a48beefd0be827b32db416772e0e363d5f7d54dc01787 mesa-21.2.1.tar.xz
sha512 d4056287ec86f7a95ce534a251a1ccbc3a3b08a2f7112152def2f054fc8a9424501d5883c463554ee95fe2dafb832613efd7145e989ee8281948233942730c2c mesa-21.2.1.tar.xz
# From https://lists.freedesktop.org/archives/mesa-announce/2022-June/000682.html
sha256 b98f32ba7aa2a1ff5725fb36eb999c693079f0ca16f70aa2f103e2b6c3f093e3 mesa-22.1.3.tar.xz
sha512 e7348839eb37de89c90d21277a7cbb42ee673ad6c656177853f6d35db99556dbac29867712222342d902b4fa67df5687c9d543bad99c81bcd0ecfb7f08f37480 mesa-22.1.3.tar.xz
# License
sha256 998437f3f75f0c542046f83c1cb349408122268168fb13eb4ae6967aa18b7d98 docs/license.rst
sha256 4bc15d14dcc134b024cbdca3b5330010136ce8a427b6f8353440ce2ad7aab037 docs/license.rst
Regular → Executable
+52 -30
View File
@@ -5,7 +5,7 @@
################################################################################
# When updating the version, please also update mesa3d-headers
MESA3D_VERSION = 21.2.1
MESA3D_VERSION = 22.1.3
MESA3D_SOURCE = mesa-$(MESA3D_VERSION).tar.xz
MESA3D_SITE = https://archive.mesa3d.org
MESA3D_LICENSE = MIT, SGI, Khronos
@@ -20,11 +20,23 @@ MESA3D_PROVIDES =
MESA3D_DEPENDENCIES = \
host-bison \
host-flex \
host-python3-mako \
host-python-mako \
expat \
libdrm \
zlib
# the src/mesa/main/formats.csv in mesa-22.1.3 offical tarball is msdos file format
# patch the 0023-dri-add-support-for-YUV-DRI-config.patch will failed:
# Hunk #1 FAILED at 92 (different line endings).
# so first change to the unix file format before patch
define MESA3D_CHANEG_FILE_TO_UNIX_FORMAT
if [ -f $(@D)/src/mesa/main/formats.csv ]; then \
sed -i 's/\r$$//' $(@D)/src/mesa/main/formats.csv; \
fi
endef
MESA3D_POST_EXTRACT_HOOKS += MESA3D_CHANEG_FILE_TO_UNIX_FORMAT
MESA3D_CONF_OPTS = \
-Dgallium-omx=disabled \
-Dpower8=disabled
@@ -35,6 +47,15 @@ ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM),y)
MESA3D_CONF_OPTS += -Db_asneeded=false
endif
ifeq ($(BR2_PACKAGE_MESA3D_DRI3),y)
MESA3D_CONF_OPTS += -Ddri3=enabled
ifeq ($(BR2_PACKAGE_XLIB_LIBXSHMFENCE),y)
MESA3D_DEPENDENCIES += xlib_libxshmfence
endif
else
MESA3D_CONF_OPTS += -Ddri3=disabled
endif
ifeq ($(BR2_PACKAGE_MESA3D_LLVM),y)
MESA3D_DEPENDENCIES += host-llvm llvm
MESA3D_MESON_EXTRA_BINARIES += llvm-config='$(STAGING_DIR)/usr/bin/llvm-config'
@@ -64,7 +85,10 @@ ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX),y)
# dri : dri based GLX requires at least one DRI driver || dri based GLX requires shared-glapi
# xlib : xlib conflicts with any dri driver
# gallium-xlib : Gallium-xlib based GLX requires at least one gallium driver || Gallium-xlib based GLX requires softpipe or llvmpipe || gallium-xlib conflicts with any dri driver.
MESA3D_CONF_OPTS += -Dglx=dri
# Always enable glx-direct; without it, many GLX applications don't work.
MESA3D_CONF_OPTS += \
-Dglx=dri \
-Dglx-direct=true
ifeq ($(BR2_PACKAGE_MESA3D_NEEDS_XA),y)
MESA3D_CONF_OPTS += -Dgallium-xa=enabled
else
@@ -76,9 +100,16 @@ MESA3D_CONF_OPTS += \
-Dgallium-xa=disabled
endif
# ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
# MESA3D_CONF_OPTS += -Dgallium-vc4-neon=auto
# else
# MESA3D_CONF_OPTS += -Dgallium-vc4-neon=disabled
# endif
# Drivers
#Gallium Drivers
MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_CROCUS) += crocus
MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_ETNAVIV) += etnaviv
MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO) += freedreno
MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_I915) += i915
@@ -95,12 +126,7 @@ MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_TEGRA) += tegra
MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_V3D) += v3d
MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4) += vc4
MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VIRGL) += virgl
# DRI Drivers
MESA3D_DRI_DRIVERS-$(BR2_PACKAGE_MESA3D_DRI_DRIVER_I915) += i915
MESA3D_DRI_DRIVERS-$(BR2_PACKAGE_MESA3D_DRI_DRIVER_I965) += i965
MESA3D_DRI_DRIVERS-$(BR2_PACKAGE_MESA3D_DRI_DRIVER_NOUVEAU) += nouveau
MESA3D_DRI_DRIVERS-$(BR2_PACKAGE_MESA3D_DRI_DRIVER_RADEON) += r100
MESA3D_DRI_DRIVERS-$(BR2_PACKAGE_MESA3D_DRI_DRIVER_PVR) += pvr
MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PVR) += pvr
# Vulkan Drivers
MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_INTEL) += intel
@@ -113,31 +139,16 @@ MESA3D_CONF_OPTS += \
-Dshared-glapi=enabled \
-Dgallium-drivers=$(subst $(space),$(comma),$(MESA3D_GALLIUM_DRIVERS-y)) \
-Dgallium-extra-hud=true
ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PVR),y)
MESA3D_DEPENDENCIES += img-gpu-powervr
endif
ifeq ($(BR2_PACKAGE_MESA3D_DRI_DRIVER),)
MESA3D_CONF_OPTS += \
-Ddri-drivers= -Ddri3=disabled
else
ifeq ($(BR2_PACKAGE_XLIB_LIBXSHMFENCE),y)
MESA3D_DEPENDENCIES += xlib_libxshmfence
MESA3D_CONF_OPTS += -Ddri3=enabled
else
MESA3D_CONF_OPTS += -Ddri3=disabled
endif
MESA3D_CONF_OPTS += \
-Dshared-glapi=enabled \
-Dglx-direct=true \
-Ddri-drivers=$(subst $(space),$(comma),$(MESA3D_DRI_DRIVERS-y))
endif
ifeq ($(BR2_PACKAGE_MESA3D_VULKAN_DRIVER),)
MESA3D_CONF_OPTS += \
-Dvulkan-drivers=
else
MESA3D_DEPENDENCIES += xlib_libxshmfence
MESA3D_CONF_OPTS += \
-Ddri3=enabled \
-Dvulkan-drivers=$(subst $(space),$(comma),$(MESA3D_VULKAN_DRIVERS-y))
endif
@@ -157,9 +168,9 @@ MESA3D_CONF_OPTS += -Dopengl=true
# we do not need libva support in mesa3d, therefore disable this option
MESA3D_CONF_OPTS += -Dgallium-va=disabled
# libGL is only provided for a full xorg stack
# libGL is only provided for a full xorg stack, without libglvnd
ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX),y)
MESA3D_PROVIDES += libgl
MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libgl)
else
define MESA3D_REMOVE_OPENGL_HEADERS
rm -rf $(STAGING_DIR)/usr/include/GL/
@@ -197,7 +208,7 @@ MESA3D_CONF_OPTS += \
endif
ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_EGL),y)
MESA3D_PROVIDES += libegl
MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libegl)
MESA3D_CONF_OPTS += \
-Degl=enabled
else
@@ -206,7 +217,7 @@ MESA3D_CONF_OPTS += \
endif
ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_ES),y)
MESA3D_PROVIDES += libgles
MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libgles)
MESA3D_CONF_OPTS += -Dgles1=enabled -Dgles2=enabled
else
MESA3D_CONF_OPTS += -Dgles1=disabled -Dgles2=disabled
@@ -261,4 +272,15 @@ ifeq ($(BR2_m68k),y)
MESA3D_CFLAGS += -mlong-jump-table-offsets
endif
ifeq ($(BR2_PACKAGE_LIBGLVND),y)
ifneq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX)$(BR2_PACKAGE_MESA3D_OPENGL_EGL),)
MESA3D_DEPENDENCIES += libglvnd
MESA3D_CONF_OPTS += -Dglvnd=true
else
MESA3D_CONF_OPTS += -Dglvnd=false
endif
else
MESA3D_CONF_OPTS += -Dglvnd=false
endif
$(eval $(meson-package))