summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2015-02-19 16:10:43 -0800
committerDan Stoza <stoza@google.com>2015-03-19 13:56:00 -0700
commit82c6bcc9705eabcaf5b9e45bc81867b0e2d61a02 (patch)
tree5ae0c4334682e0f5ca86328ec0b69a00ca421355 /opengl
parentad36432de81c4c88d726680b7c52e8357df98455 (diff)
downloadframeworks_native-82c6bcc9705eabcaf5b9e45bc81867b0e2d61a02.zip
frameworks_native-82c6bcc9705eabcaf5b9e45bc81867b0e2d61a02.tar.gz
frameworks_native-82c6bcc9705eabcaf5b9e45bc81867b0e2d61a02.tar.bz2
DO NOT MERGE Add dataSpace to buffer queues; remove old format enums.
- Wire up new dataSpace parameter through buffer queue stack - Update tests to include the parameter - Switch eglApi to using dataSpace to indicate sRGB gamma/linear difference - Remove RAW_SENSOR in favor of RAW16 - Remove use of sRGB format enums - Add default dataspace to buffer queue core - Add query for default dataspace Cherry pick of I070bd2e7c56506055c419004c29e2e3feac725df Change-Id: I461952389c18051176c6b75e664f20ad369f5760
Diffstat (limited to 'opengl')
-rw-r--r--opengl/libs/EGL/eglApi.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index ff08a6b..11a13c3 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -381,20 +381,15 @@ EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
// Turn linear formats into corresponding sRGB formats when colorspace is
// EGL_GL_COLORSPACE_SRGB_KHR, or turn sRGB formats into corresponding linear
// formats when colorspace is EGL_GL_COLORSPACE_LINEAR_KHR. In any cases where
-// the modification isn't possible, the original format is returned.
-static int modifyFormatColorspace(int fmt, EGLint colorspace) {
+// the modification isn't possible, the original dataSpace is returned.
+static android_dataspace modifyBufferDataspace( android_dataspace dataSpace,
+ EGLint colorspace) {
if (colorspace == EGL_GL_COLORSPACE_LINEAR_KHR) {
- switch (fmt) {
- case HAL_PIXEL_FORMAT_sRGB_A_8888: return HAL_PIXEL_FORMAT_RGBA_8888;
- case HAL_PIXEL_FORMAT_sRGB_X_8888: return HAL_PIXEL_FORMAT_RGBX_8888;
- }
+ return HAL_DATASPACE_SRGB_LINEAR;
} else if (colorspace == EGL_GL_COLORSPACE_SRGB_KHR) {
- switch (fmt) {
- case HAL_PIXEL_FORMAT_RGBA_8888: return HAL_PIXEL_FORMAT_sRGB_A_8888;
- case HAL_PIXEL_FORMAT_RGBX_8888: return HAL_PIXEL_FORMAT_sRGB_X_8888;
- }
+ return HAL_DATASPACE_SRGB;
}
- return fmt;
+ return dataSpace;
}
EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
@@ -424,6 +419,7 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
// by default, just pick RGBA_8888
EGLint format = HAL_PIXEL_FORMAT_RGBA_8888;
+ android_dataspace dataSpace = HAL_DATASPACE_UNKNOWN;
EGLint a = 0;
cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_ALPHA_SIZE, &a);
@@ -449,7 +445,7 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
for (const EGLint* attr = attrib_list; *attr != EGL_NONE; attr += 2) {
if (*attr == EGL_GL_COLORSPACE_KHR) {
if (ENABLE_EGL_KHR_GL_COLORSPACE) {
- format = modifyFormatColorspace(format, *(attr+1));
+ dataSpace = modifyBufferDataspace(dataSpace, *(attr+1));
} else {
// Normally we'd pass through unhandled attributes to
// the driver. But in case the driver implements this
@@ -473,6 +469,16 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
}
}
+ if (dataSpace != 0) {
+ int err = native_window_set_buffers_data_space(window, dataSpace);
+ if (err != 0) {
+ ALOGE("error setting native window pixel dataSpace: %s (%d)",
+ strerror(-err), err);
+ native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL);
+ return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
+ }
+ }
+
// the EGL spec requires that a new EGLSurface default to swap interval
// 1, so explicitly set that on the window here.
ANativeWindow* anw = reinterpret_cast<ANativeWindow*>(window);