7566503cc1
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>
204 lines
7.5 KiB
Diff
204 lines
7.5 KiB
Diff
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 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
|
|
that differs from that specified at context creation time. For example,
|
|
if an OpenGL ES2 context is specified at context creation time, an
|
|
OpenGL ES3 context may be created, and so "3" should be returned
|
|
when EGL_CONTEXT_CLIENT_VERSION is queried.
|
|
|
|
A new EGL driver API function has been added,
|
|
QueryContextClientVersion, that is called when the context client
|
|
version is queried, allowing EGL drivers to override the default
|
|
value (i.e. the version specified at context creation time). If the
|
|
function returns zero, the default is used.
|
|
|
|
For DRI drivers, QueryContextClientVersion returns zero for all API
|
|
contexts other than OpenGL ES2. For OpenGL ES2, the supported context
|
|
client version is queried via the Query Renderer driver extension, using
|
|
integer query __DRI2_RENDERER_OPENGL_ES2_CONTEXT_CLIENT_VERSION_IMG. If
|
|
the query isn't supported, or the query returns zero, zero is returned
|
|
to the caller.
|
|
|
|
IMG NOTE: In order to avoid potential name and value clashes, "_IMG"
|
|
has been added to the end of the new query name, this should be removed
|
|
if an attempt is made to push this patch upstream. The value of the new
|
|
query should be adjusted to be the next one in sequence, rather than the
|
|
large value it currently has.
|
|
---
|
|
include/GL/internal/dri_interface.h | 2 ++
|
|
src/egl/drivers/dri2/egl_dri2.c | 21 +++++++++++++++++++++
|
|
src/egl/drivers/haiku/egl_haiku.cpp | 9 +++++++++
|
|
src/egl/main/eglapi.c | 2 +-
|
|
src/egl/main/eglcontext.c | 16 ++++++++++++++--
|
|
src/egl/main/eglcontext.h | 3 ++-
|
|
src/egl/main/egldriver.h | 1 +
|
|
7 files changed, 50 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
|
|
index 80acaf3a7b1..acd58ccb559 100644
|
|
--- a/include/GL/internal/dri_interface.h
|
|
+++ b/include/GL/internal/dri_interface.h
|
|
@@ -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
|
|
+
|
|
typedef struct __DRI2rendererQueryExtensionRec __DRI2rendererQueryExtension;
|
|
struct __DRI2rendererQueryExtensionRec {
|
|
__DRIextension base;
|
|
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
|
|
index b25c0231dc8..3ae5cddbc20 100644
|
|
--- a/src/egl/drivers/dri2/egl_dri2.c
|
|
+++ b/src/egl/drivers/dri2/egl_dri2.c
|
|
@@ -2006,6 +2006,26 @@ dri2_make_current(_EGLDisplay *disp, _EGLSurface *dsurf,
|
|
return EGL_TRUE;
|
|
}
|
|
|
|
+static EGLint
|
|
+dri2_query_context_client_version(_EGLDisplay *disp, _EGLContext *ctx)
|
|
+{
|
|
+ struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
|
|
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
|
+
|
|
+ switch (dri2_ctx->base.ClientAPI) {
|
|
+ case EGL_OPENGL_ES_API:
|
|
+ switch (dri2_ctx->base.ClientMajorVersion) {
|
|
+ case 2:
|
|
+ return dri2_renderer_query_integer(dri2_dpy,
|
|
+ __DRI2_RENDERER_OPENGL_ES2_CONTEXT_CLIENT_VERSION_IMG);
|
|
+ default:
|
|
+ return 0;
|
|
+ }
|
|
+ default:
|
|
+ return 0;
|
|
+ }
|
|
+}
|
|
+
|
|
__DRIdrawable *
|
|
dri2_surface_get_dri_drawable(_EGLSurface *surf)
|
|
{
|
|
@@ -3885,6 +3905,7 @@ const _EGLDriver _eglDriver = {
|
|
.CreateContext = dri2_create_context,
|
|
.DestroyContext = dri2_destroy_context,
|
|
.MakeCurrent = dri2_make_current,
|
|
+ .QueryContextClientVersion = dri2_query_context_client_version,
|
|
.CreateWindowSurface = dri2_create_window_surface,
|
|
.CreatePixmapSurface = dri2_create_pixmap_surface,
|
|
.CreatePbufferSurface = dri2_create_pbuffer_surface,
|
|
diff --git a/src/egl/drivers/haiku/egl_haiku.cpp b/src/egl/drivers/haiku/egl_haiku.cpp
|
|
index 18c73c9cd8b..2690a82eb75 100644
|
|
--- a/src/egl/drivers/haiku/egl_haiku.cpp
|
|
+++ b/src/egl/drivers/haiku/egl_haiku.cpp
|
|
@@ -297,6 +297,14 @@ haiku_make_current(_EGLDisplay *disp, _EGLSurface *dsurf,
|
|
}
|
|
|
|
|
|
+extern "C"
|
|
+EGLint
|
|
+haiku_dri2_query_context_client_version(_EGLDisplay *disp, _EGLContext *ctx)
|
|
+{
|
|
+ // Tell caller to use the default value.
|
|
+ return 0;
|
|
+}
|
|
+
|
|
extern "C"
|
|
EGLBoolean
|
|
haiku_swap_buffers(_EGLDisplay *disp, _EGLSurface *surf)
|
|
@@ -316,6 +324,7 @@ const _EGLDriver _eglDriver = {
|
|
.CreateContext = haiku_create_context,
|
|
.DestroyContext = haiku_destroy_context,
|
|
.MakeCurrent = haiku_make_current,
|
|
+ .QueryContextClientVersion = haiku_dri2_query_context_client_version,
|
|
.CreateWindowSurface = haiku_create_window_surface,
|
|
.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 d9fbb7a11fb..69ac50ff8e8 100644
|
|
--- a/src/egl/main/eglapi.c
|
|
+++ b/src/egl/main/eglapi.c
|
|
@@ -941,7 +941,7 @@ eglQueryContext(EGLDisplay dpy, EGLContext ctx,
|
|
|
|
_EGL_CHECK_CONTEXT(disp, context, EGL_FALSE);
|
|
|
|
- ret = _eglQueryContext(context, attribute, value);
|
|
+ ret = _eglQueryContext(disp, context, attribute, value);
|
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
|
}
|
|
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
|
|
index 15de7c99496..7274d246194 100644
|
|
--- a/src/egl/main/eglcontext.c
|
|
+++ b/src/egl/main/eglcontext.c
|
|
@@ -35,6 +35,7 @@
|
|
#include "eglcontext.h"
|
|
#include "egldisplay.h"
|
|
#include "eglcurrent.h"
|
|
+#include "egldriver.h"
|
|
#include "eglsurface.h"
|
|
#include "egllog.h"
|
|
#include "util/macros.h"
|
|
@@ -670,8 +671,19 @@ _eglQueryContextRenderBuffer(_EGLContext *ctx)
|
|
}
|
|
|
|
|
|
+static EGLint
|
|
+_eglQueryContextClientVersion(_EGLDisplay *disp, _EGLContext *ctx)
|
|
+{
|
|
+ EGLint version;
|
|
+
|
|
+ version = disp->Driver->QueryContextClientVersion(disp, ctx);
|
|
+
|
|
+ return (version) ? version : ctx->ClientMajorVersion;
|
|
+}
|
|
+
|
|
EGLBoolean
|
|
-_eglQueryContext(_EGLContext *c, EGLint attribute, EGLint *value)
|
|
+_eglQueryContext(_EGLDisplay *disp, _EGLContext *c,
|
|
+ EGLint attribute, EGLint *value)
|
|
{
|
|
if (!value)
|
|
return _eglError(EGL_BAD_PARAMETER, "eglQueryContext");
|
|
@@ -688,7 +700,7 @@ _eglQueryContext(_EGLContext *c, EGLint attribute, EGLint *value)
|
|
*value = c->Config ? c->Config->ConfigID : 0;
|
|
break;
|
|
case EGL_CONTEXT_CLIENT_VERSION:
|
|
- *value = c->ClientMajorVersion;
|
|
+ *value = _eglQueryContextClientVersion(disp, c);
|
|
break;
|
|
case EGL_CONTEXT_CLIENT_TYPE:
|
|
*value = c->ClientAPI;
|
|
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
|
|
index 06029e81251..d890217852d 100644
|
|
--- a/src/egl/main/eglcontext.h
|
|
+++ b/src/egl/main/eglcontext.h
|
|
@@ -74,7 +74,8 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *disp,
|
|
|
|
|
|
extern EGLBoolean
|
|
-_eglQueryContext(_EGLContext *ctx, EGLint attribute, EGLint *value);
|
|
+_eglQueryContext(_EGLDisplay *disp, _EGLContext *ctx,
|
|
+ EGLint attribute, EGLint *value);
|
|
|
|
|
|
extern EGLBoolean
|
|
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
|
|
index 12f9a0aab86..92af8bd16d5 100644
|
|
--- a/src/egl/main/egldriver.h
|
|
+++ b/src/egl/main/egldriver.h
|
|
@@ -97,6 +97,7 @@ struct _egl_driver
|
|
EGLBoolean (*MakeCurrent)(_EGLDisplay *disp,
|
|
_EGLSurface *draw, _EGLSurface *read,
|
|
_EGLContext *ctx);
|
|
+ EGLint (*QueryContextClientVersion)(_EGLDisplay *disp, _EGLContext *ctx);
|
|
|
|
/* surface funcs */
|
|
_EGLSurface *(*CreateWindowSurface)(_EGLDisplay *disp, _EGLConfig *config,
|
|
--
|
|
2.25.1
|
|
|