diff options
| author | 2016-12-13 16:51:25 -0800 | |
|---|---|---|
| committer | 2016-12-13 17:02:55 -0800 | |
| commit | ff415149dc5a83a4eb5960daf2cb2c310ef89847 (patch) | |
| tree | 2f3b04aceccccdfb817a62847d595c7f50d05a43 | |
| parent | 7969999ddd959a6e5e2fb5842ea0e17ac6bb13a5 (diff) | |
Add fp16 pixel and window formats
Bug: 32984164
Test: compile
Change-Id: I8303afbf857796295a280c0d9438a3c403a11437
| -rw-r--r-- | include/android/native_window.h | 6 | ||||
| -rw-r--r-- | include/ui/PixelFormat.h | 2 | ||||
| -rw-r--r-- | libs/gui/CpuConsumer.cpp | 2 | ||||
| -rw-r--r-- | libs/gui/GLConsumer.cpp | 2 | ||||
| -rw-r--r-- | libs/ui/PixelFormat.cpp | 6 | ||||
| -rw-r--r-- | opengl/libs/EGL/eglApi.cpp | 1 | ||||
| -rw-r--r-- | services/surfaceflinger/DisplayHardware/HWComposer_hwc1.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 1 |
8 files changed, 22 insertions, 0 deletions
diff --git a/include/android/native_window.h b/include/android/native_window.h index b60b9f1d9c..b017a25208 100644 --- a/include/android/native_window.h +++ b/include/android/native_window.h @@ -38,12 +38,18 @@ extern "C" { * Pixel formats that a window can use. */ enum { + // NOTE: these values must match the values from graphics/common/x.x/types.hal + /** Red: 8 bits, Green: 8 bits, Blue: 8 bits, Alpha: 8 bits. **/ WINDOW_FORMAT_RGBA_8888 = 1, /** Red: 8 bits, Green: 8 bits, Blue: 8 bits, Unused: 8 bits. **/ WINDOW_FORMAT_RGBX_8888 = 2, /** Red: 5 bits, Green: 6 bits, Blue: 5 bits. **/ WINDOW_FORMAT_RGB_565 = 4, + /** Red: 16 bits, Green: 16 bits, Blue: 16 bits, Alpha: 16 bits. **/ + WINDOW_FORMAT_RGBA_FP16 = 0x16, + /** Red: 16 bits, Green: 16 bits, Blue: 16 bits, Unused: 16 bits. **/ + WINDOW_FORMAT_RGBX_FP16 = 0x17, }; struct ANativeWindow; diff --git a/include/ui/PixelFormat.h b/include/ui/PixelFormat.h index f26fecb8b1..99c6663ded 100644 --- a/include/ui/PixelFormat.h +++ b/include/ui/PixelFormat.h @@ -60,6 +60,8 @@ enum { PIXEL_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA PIXEL_FORMAT_RGBA_5551 = 6, // 16-bit ARGB PIXEL_FORMAT_RGBA_4444 = 7, // 16-bit ARGB + PIXEL_FORMAT_RGBA_FP16 = HAL_PIXEL_FORMAT_RGBA_FP16, // 64-bit RGBA + PIXEL_FORMAT_RGBX_FP16 = HAL_PIXEL_FORMAT_RGBX_FP16, // 64-bit RGB0 }; typedef int32_t PixelFormat; diff --git a/libs/gui/CpuConsumer.cpp b/libs/gui/CpuConsumer.cpp index 839316021e..4acf618a63 100644 --- a/libs/gui/CpuConsumer.cpp +++ b/libs/gui/CpuConsumer.cpp @@ -64,6 +64,8 @@ static bool isPossiblyYUV(PixelFormat format) { switch (static_cast<int>(format)) { case HAL_PIXEL_FORMAT_RGBA_8888: case HAL_PIXEL_FORMAT_RGBX_8888: + case HAL_PIXEL_FORMAT_RGBA_FP16: + case HAL_PIXEL_FORMAT_RGBX_FP16: case HAL_PIXEL_FORMAT_RGB_888: case HAL_PIXEL_FORMAT_RGB_565: case HAL_PIXEL_FORMAT_BGRA_8888: diff --git a/libs/gui/GLConsumer.cpp b/libs/gui/GLConsumer.cpp index 10e999c228..9f0398d77e 100644 --- a/libs/gui/GLConsumer.cpp +++ b/libs/gui/GLConsumer.cpp @@ -856,6 +856,8 @@ void GLConsumer::computeTransformMatrix(float outTransform[16], switch (buf->getPixelFormat()) { case PIXEL_FORMAT_RGBA_8888: case PIXEL_FORMAT_RGBX_8888: + case PIXEL_FORMAT_RGBA_FP16: + case PIXEL_FORMAT_RGBX_FP16: case PIXEL_FORMAT_RGB_888: case PIXEL_FORMAT_RGB_565: case PIXEL_FORMAT_BGRA_8888: diff --git a/libs/ui/PixelFormat.cpp b/libs/ui/PixelFormat.cpp index cab1dde3fa..3ceb6380e5 100644 --- a/libs/ui/PixelFormat.cpp +++ b/libs/ui/PixelFormat.cpp @@ -22,6 +22,9 @@ namespace android { uint32_t bytesPerPixel(PixelFormat format) { switch (format) { + case PIXEL_FORMAT_RGBA_FP16: + case PIXEL_FORMAT_RGBX_FP16: + return 8; case PIXEL_FORMAT_RGBA_8888: case PIXEL_FORMAT_RGBX_8888: case PIXEL_FORMAT_BGRA_8888: @@ -38,6 +41,9 @@ uint32_t bytesPerPixel(PixelFormat format) { uint32_t bitsPerPixel(PixelFormat format) { switch (format) { + case PIXEL_FORMAT_RGBA_FP16: + case PIXEL_FORMAT_RGBX_FP16: + return 64; case PIXEL_FORMAT_RGBA_8888: case PIXEL_FORMAT_RGBX_8888: case PIXEL_FORMAT_BGRA_8888: diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp index d5a02e35de..55a6093143 100644 --- a/opengl/libs/EGL/eglApi.cpp +++ b/opengl/libs/EGL/eglApi.cpp @@ -475,6 +475,7 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, // modify the EGLconfig's format before setting the native window's // format. + // TODO: Add support for HAL_PIXEL_FORMAT_RGBA_FP16 // by default, just pick RGBA_8888 EGLint format = HAL_PIXEL_FORMAT_RGBA_8888; android_dataspace dataSpace = HAL_DATASPACE_UNKNOWN; diff --git a/services/surfaceflinger/DisplayHardware/HWComposer_hwc1.cpp b/services/surfaceflinger/DisplayHardware/HWComposer_hwc1.cpp index 2102457994..c40a58c3a3 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer_hwc1.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer_hwc1.cpp @@ -1159,6 +1159,8 @@ static String8 getFormatStr(PixelFormat format) { switch (format) { case PIXEL_FORMAT_RGBA_8888: return String8("RGBA_8888"); case PIXEL_FORMAT_RGBX_8888: return String8("RGBx_8888"); + case PIXEL_FORMAT_RGBA_FP16: return String8("RGBA_FP16"); + case PIXEL_FORMAT_RGBX_FP16: return String8("RGBx_FP16"); case PIXEL_FORMAT_RGB_888: return String8("RGB_888"); case PIXEL_FORMAT_RGB_565: return String8("RGB_565"); case PIXEL_FORMAT_BGRA_8888: return String8("BGRA_8888"); diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 20c0261017..89f968f6a0 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -1187,6 +1187,7 @@ bool Layer::getOpacityForFormat(uint32_t format) { switch (format) { case HAL_PIXEL_FORMAT_RGBA_8888: case HAL_PIXEL_FORMAT_BGRA_8888: + case HAL_PIXEL_FORMAT_RGBA_FP16: return false; } // in all other case, we have no blending (also for unknown formats) |