aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Jackson <[email protected]>2017-11-16 13:27:27 -0500
committerAdam Jackson <[email protected]>2017-11-17 16:43:16 -0500
commitddcd4b05a35fdad400637c3decfa9fe183b3e8c7 (patch)
tree374c93bdfadb918179b126a6908b97af4053034e
parent1831e3fb1dc2e8bdc624742fc928e892fc665d26 (diff)
egl: Convert int to attrib in eglGetPlatformDisplay
... because converting attrib to int truncates, and that's bad. Signed-off-by: Adam Jackson <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
-rw-r--r--src/egl/main/eglapi.c27
-rw-r--r--src/egl/main/egldisplay.c15
-rw-r--r--src/egl/main/egldisplay.h8
3 files changed, 25 insertions, 25 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index c1bf5bbfe19..cec67425e13 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -376,7 +376,7 @@ eglGetDisplay(EGLNativeDisplayType nativeDisplay)
static EGLDisplay
_eglGetPlatformDisplayCommon(EGLenum platform, void *native_display,
- const EGLint *attrib_list)
+ const EGLAttrib *attrib_list)
{
_EGLDisplay *dpy;
@@ -412,28 +412,27 @@ _eglGetPlatformDisplayCommon(EGLenum platform, void *native_display,
static EGLDisplay EGLAPIENTRY
eglGetPlatformDisplayEXT(EGLenum platform, void *native_display,
- const EGLint *attrib_list)
+ const EGLint *int_attribs)
{
+ EGLAttrib *attrib_list;
+ EGLDisplay display;
+
_EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY);
- return _eglGetPlatformDisplayCommon(platform, native_display, attrib_list);
+
+ if (_eglConvertIntsToAttribs(int_attribs, &attrib_list) != EGL_SUCCESS)
+ RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, NULL);
+
+ display = _eglGetPlatformDisplayCommon(platform, native_display, attrib_list);
+ free(attrib_list);
+ return display;
}
EGLDisplay EGLAPIENTRY
eglGetPlatformDisplay(EGLenum platform, void *native_display,
const EGLAttrib *attrib_list)
{
- EGLDisplay display;
- EGLint *int_attribs;
-
_EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY);
-
- int_attribs = _eglConvertAttribsToInt(attrib_list);
- if (attrib_list && !int_attribs)
- RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, NULL);
-
- display = _eglGetPlatformDisplayCommon(platform, native_display, int_attribs);
- free(int_attribs);
- return display;
+ return _eglGetPlatformDisplayCommon(platform, native_display, attrib_list);
}
/**
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 690728d2f70..fe963c805ef 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -447,7 +447,8 @@ _eglUnlinkResource(_EGLResource *res, _EGLResourceType type)
#ifdef HAVE_X11_PLATFORM
static EGLBoolean
-_eglParseX11DisplayAttribList(_EGLDisplay *display, const EGLint *attrib_list)
+_eglParseX11DisplayAttribList(_EGLDisplay *display,
+ const EGLAttrib *attrib_list)
{
int i;
@@ -456,8 +457,8 @@ _eglParseX11DisplayAttribList(_EGLDisplay *display, const EGLint *attrib_list)
}
for (i = 0; attrib_list[i] != EGL_NONE; i += 2) {
- EGLint attrib = attrib_list[i];
- EGLint value = attrib_list[i + 1];
+ EGLAttrib attrib = attrib_list[i];
+ EGLAttrib value = attrib_list[i + 1];
/* EGL_EXT_platform_x11 recognizes exactly one attribute,
* EGL_PLATFORM_X11_SCREEN_EXT, which is optional.
@@ -473,7 +474,7 @@ _eglParseX11DisplayAttribList(_EGLDisplay *display, const EGLint *attrib_list)
_EGLDisplay*
_eglGetX11Display(Display *native_display,
- const EGLint *attrib_list)
+ const EGLAttrib *attrib_list)
{
_EGLDisplay *display = _eglFindDisplay(_EGL_PLATFORM_X11,
native_display);
@@ -494,7 +495,7 @@ _eglGetX11Display(Display *native_display,
#ifdef HAVE_DRM_PLATFORM
_EGLDisplay*
_eglGetGbmDisplay(struct gbm_device *native_display,
- const EGLint *attrib_list)
+ const EGLAttrib *attrib_list)
{
/* EGL_MESA_platform_gbm recognizes no attributes. */
if (attrib_list != NULL && attrib_list[0] != EGL_NONE) {
@@ -509,7 +510,7 @@ _eglGetGbmDisplay(struct gbm_device *native_display,
#ifdef HAVE_WAYLAND_PLATFORM
_EGLDisplay*
_eglGetWaylandDisplay(struct wl_display *native_display,
- const EGLint *attrib_list)
+ const EGLAttrib *attrib_list)
{
/* EGL_EXT_platform_wayland recognizes no attributes. */
if (attrib_list != NULL && attrib_list[0] != EGL_NONE) {
@@ -524,7 +525,7 @@ _eglGetWaylandDisplay(struct wl_display *native_display,
#ifdef HAVE_SURFACELESS_PLATFORM
_EGLDisplay*
_eglGetSurfacelessDisplay(void *native_display,
- const EGLint *attrib_list)
+ const EGLAttrib *attrib_list)
{
/* This platform has no native display. */
if (native_display != NULL) {
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 0f57680b21f..52fb4ce21bb 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -266,7 +266,7 @@ _eglIsResourceLinked(_EGLResource *res)
#ifdef HAVE_X11_PLATFORM
_EGLDisplay*
-_eglGetX11Display(Display *native_display, const EGLint *attrib_list);
+_eglGetX11Display(Display *native_display, const EGLAttrib *attrib_list);
#endif
#ifdef HAVE_DRM_PLATFORM
@@ -274,7 +274,7 @@ struct gbm_device;
_EGLDisplay*
_eglGetGbmDisplay(struct gbm_device *native_display,
- const EGLint *attrib_list);
+ const EGLAttrib *attrib_list);
#endif
#ifdef HAVE_WAYLAND_PLATFORM
@@ -282,13 +282,13 @@ struct wl_display;
_EGLDisplay*
_eglGetWaylandDisplay(struct wl_display *native_display,
- const EGLint *attrib_list);
+ const EGLAttrib *attrib_list);
#endif
#ifdef HAVE_SURFACELESS_PLATFORM
_EGLDisplay*
_eglGetSurfacelessDisplay(void *native_display,
- const EGLint *attrib_list);
+ const EGLAttrib *attrib_list);
#endif
#ifdef __cplusplus