Loading configstore/1.2/ISurfaceFlingerConfigs.hal +22 −8 Original line number Diff line number Diff line Loading @@ -34,25 +34,39 @@ interface ISurfaceFlingerConfigs extends @1.1::ISurfaceFlingerConfigs { useColorManagement() generates (OptionalBool value); /** * Returns the default data space and default pixel format that * SurfaceFlinger expects to receive and output. * To determine the default data space and default pixel format, * there are a few things we recommend to consider: * Returns the default data space and pixel format that SurfaceFlinger * expects to receive and output as well as the wide color gamut data space * and pixel format for wide color gamut surfaces. * To determine the data space and pixel format, there are a few things * we recommend to consider: * * 1. Hardware composer's capability to composite contents with the * 1. Hardware composer's capability to composite contents with the chosen * data space and pixel format efficiently; * 2. Hardware composer's ability to composite contents when sRGB contents * and the chosen data space contents coexist; * and the chosen wide color gamut data space contents coexist; * 3. For better blending, consider using pixel format where the alpha * channel has as many bits as the RGB color channel. * 4. Memory consumption and efficient buffer compression when considering * more bits in pixel format. * * @return dataSpace is the default data space that SurfaceFlinger expects. * @return dataspace is the default data space that SurfaceFlinger expects. * The data space must not be Dataspace::UNKNOWN, if unspecified, * the default data space is Dataspace::V0_SRGB; * @return pixelFormat is the default pixel format that SurfaceFlinger * expects. If unspecified, the default pixel format is * PixelFormat::RGBA_8888. * @return wcgDataspace is the data space that SurfaceFlinger expects for * wide color gamut surfaces. * When hasWideColorDisplay returns true, this API must return a * valid wide color gamut data space. * The data space must not be UNKNOWN, if unspecified, the data space * is V0_SRGB by default, which essentially indicates there's no wide * color gamut, meaning hasWideColorDisplay returns false. * @return wcgPixelFormat is the pixel format that SurfaceFlinger expects for * wide color gamut surfaces. If unspecified, the pixel format is * PixelFormat::RGBA_8888 by default. */ getCompositionPreference() generates (Dataspace dataSpace, PixelFormat pixelFormat); generates (Dataspace dataspace, PixelFormat pixelFormat, Dataspace wcgDataspace, PixelFormat wcgPixelFormat); }; configstore/1.2/default/SurfaceFlingerConfigs.cpp +28 −9 Original line number Diff line number Diff line Loading @@ -203,22 +203,41 @@ Return<void> SurfaceFlingerConfigs::useColorManagement(useColorManagement_cb _hi return Void(); } #ifdef COMPOSITION_DATA_SPACE static_assert(COMPOSITION_DATA_SPACE != 0, "Expected composition data space must not be UNKNOWN"); #ifdef DEFAULT_COMPOSITION_DATA_SPACE static_assert(DEFAULT_COMPOSITION_DATA_SPACE != 0, "Default composition data space must not be UNKNOWN"); #endif #ifdef WCG_COMPOSITION_DATA_SPACE static_assert(WCG_COMPOSITION_DATA_SPACE != 0, "Wide color gamut composition data space must not be UNKNOWN"); #endif Return<void> SurfaceFlingerConfigs::getCompositionPreference(getCompositionPreference_cb _hidl_cb) { Dataspace dataSpace = Dataspace::V0_SRGB; PixelFormat pixelFormat = PixelFormat::RGBA_8888; Dataspace defaultDataspace = Dataspace::V0_SRGB; PixelFormat defaultPixelFormat = PixelFormat::RGBA_8888; #ifdef DEFAULT_COMPOSITION_DATA_SPACE defaultDataspace = static_cast<Dataspace>(DEFAULT_COMPOSITION_DATA_SPACE); #endif #ifdef COMPOSITION_DATA_SPACE dataSpace = static_cast<Dataspace>(COMPOSITION_DATA_SPACE); #ifdef DEFAULT_COMPOSITION_PIXEL_FORMAT defaultPixelFormat = static_cast<PixelFormat>(DEFAULT_COMPOSITION_PIXEL_FORMAT); #endif #ifdef COMPOSITION_PIXEL_FORMAT pixelFormat = static_cast<PixelFormat>(COMPOSITION_PIXEL_FORMAT); Dataspace wideColorGamutDataspace = Dataspace::V0_SRGB; PixelFormat wideColorGamutPixelFormat = PixelFormat::RGBA_8888; #ifdef WCG_COMPOSITION_DATA_SPACE wideColorGamutDataspace = static_cast<Dataspace>(WCG_COMPOSITION_DATA_SPACE); #endif #ifdef WCG_COMPOSITION_PIXEL_FORMAT wideColorGamutPixelFormat = static_cast<PixelFormat>(WCG_COMPOSITION_PIXEL_FORMAT); #endif _hidl_cb(dataSpace, pixelFormat); _hidl_cb(defaultDataspace, defaultPixelFormat, wideColorGamutDataspace, wideColorGamutPixelFormat); return Void(); } Loading configstore/1.2/default/surfaceflinger.mk +12 −4 Original line number Diff line number Diff line Loading @@ -59,10 +59,18 @@ ifeq ($(TARGET_USE_COLOR_MANAGEMENT),true) LOCAL_CFLAGS += -DUSE_COLOR_MANAGEMENT endif ifneq ($(SF_COMPOSITION_DATA_SPACE),) LOCAL_CFLAGS += -DCOMPOSITION_DATA_SPACE=$(SF_COMPOSITION_DATA_SPACE) ifneq ($(SF_DEFAULT_COMPOSITION_DATA_SPACE),) LOCAL_CFLAGS += -DDEFAULT_COMPOSITION_DATA_SPACE=$(SF_DEFAULT_COMPOSITION_DATA_SPACE) endif ifneq ($(SF_COMPOSITION_PIXEL_FORMAT),) LOCAL_CFLAGS += -DCOMPOSITION_PIXEL_FORMAT=$(SF_COMPOSITION_PIXEL_FORMAT) ifneq ($(SF_DEFAULT_COMPOSITION_PIXEL_FORMAT),) LOCAL_CFLAGS += -DDEFAULT_COMPOSITION_PIXEL_FORMAT=$(SF_DEFAULT_COMPOSITION_PIXEL_FORMAT) endif ifneq ($(SF_WCG_COMPOSITION_DATA_SPACE),) LOCAL_CFLAGS += -DWCG_COMPOSITION_DATA_SPACE=$(SF_WCG_COMPOSITION_DATA_SPACE) endif ifneq ($(SF_WCG_COMPOSITION_PIXEL_FORMAT),) LOCAL_CFLAGS += -DWCG_COMPOSITION_PIXEL_FORMAT=$(SF_WCG_COMPOSITION_PIXEL_FORMAT) endif Loading
configstore/1.2/ISurfaceFlingerConfigs.hal +22 −8 Original line number Diff line number Diff line Loading @@ -34,25 +34,39 @@ interface ISurfaceFlingerConfigs extends @1.1::ISurfaceFlingerConfigs { useColorManagement() generates (OptionalBool value); /** * Returns the default data space and default pixel format that * SurfaceFlinger expects to receive and output. * To determine the default data space and default pixel format, * there are a few things we recommend to consider: * Returns the default data space and pixel format that SurfaceFlinger * expects to receive and output as well as the wide color gamut data space * and pixel format for wide color gamut surfaces. * To determine the data space and pixel format, there are a few things * we recommend to consider: * * 1. Hardware composer's capability to composite contents with the * 1. Hardware composer's capability to composite contents with the chosen * data space and pixel format efficiently; * 2. Hardware composer's ability to composite contents when sRGB contents * and the chosen data space contents coexist; * and the chosen wide color gamut data space contents coexist; * 3. For better blending, consider using pixel format where the alpha * channel has as many bits as the RGB color channel. * 4. Memory consumption and efficient buffer compression when considering * more bits in pixel format. * * @return dataSpace is the default data space that SurfaceFlinger expects. * @return dataspace is the default data space that SurfaceFlinger expects. * The data space must not be Dataspace::UNKNOWN, if unspecified, * the default data space is Dataspace::V0_SRGB; * @return pixelFormat is the default pixel format that SurfaceFlinger * expects. If unspecified, the default pixel format is * PixelFormat::RGBA_8888. * @return wcgDataspace is the data space that SurfaceFlinger expects for * wide color gamut surfaces. * When hasWideColorDisplay returns true, this API must return a * valid wide color gamut data space. * The data space must not be UNKNOWN, if unspecified, the data space * is V0_SRGB by default, which essentially indicates there's no wide * color gamut, meaning hasWideColorDisplay returns false. * @return wcgPixelFormat is the pixel format that SurfaceFlinger expects for * wide color gamut surfaces. If unspecified, the pixel format is * PixelFormat::RGBA_8888 by default. */ getCompositionPreference() generates (Dataspace dataSpace, PixelFormat pixelFormat); generates (Dataspace dataspace, PixelFormat pixelFormat, Dataspace wcgDataspace, PixelFormat wcgPixelFormat); };
configstore/1.2/default/SurfaceFlingerConfigs.cpp +28 −9 Original line number Diff line number Diff line Loading @@ -203,22 +203,41 @@ Return<void> SurfaceFlingerConfigs::useColorManagement(useColorManagement_cb _hi return Void(); } #ifdef COMPOSITION_DATA_SPACE static_assert(COMPOSITION_DATA_SPACE != 0, "Expected composition data space must not be UNKNOWN"); #ifdef DEFAULT_COMPOSITION_DATA_SPACE static_assert(DEFAULT_COMPOSITION_DATA_SPACE != 0, "Default composition data space must not be UNKNOWN"); #endif #ifdef WCG_COMPOSITION_DATA_SPACE static_assert(WCG_COMPOSITION_DATA_SPACE != 0, "Wide color gamut composition data space must not be UNKNOWN"); #endif Return<void> SurfaceFlingerConfigs::getCompositionPreference(getCompositionPreference_cb _hidl_cb) { Dataspace dataSpace = Dataspace::V0_SRGB; PixelFormat pixelFormat = PixelFormat::RGBA_8888; Dataspace defaultDataspace = Dataspace::V0_SRGB; PixelFormat defaultPixelFormat = PixelFormat::RGBA_8888; #ifdef DEFAULT_COMPOSITION_DATA_SPACE defaultDataspace = static_cast<Dataspace>(DEFAULT_COMPOSITION_DATA_SPACE); #endif #ifdef COMPOSITION_DATA_SPACE dataSpace = static_cast<Dataspace>(COMPOSITION_DATA_SPACE); #ifdef DEFAULT_COMPOSITION_PIXEL_FORMAT defaultPixelFormat = static_cast<PixelFormat>(DEFAULT_COMPOSITION_PIXEL_FORMAT); #endif #ifdef COMPOSITION_PIXEL_FORMAT pixelFormat = static_cast<PixelFormat>(COMPOSITION_PIXEL_FORMAT); Dataspace wideColorGamutDataspace = Dataspace::V0_SRGB; PixelFormat wideColorGamutPixelFormat = PixelFormat::RGBA_8888; #ifdef WCG_COMPOSITION_DATA_SPACE wideColorGamutDataspace = static_cast<Dataspace>(WCG_COMPOSITION_DATA_SPACE); #endif #ifdef WCG_COMPOSITION_PIXEL_FORMAT wideColorGamutPixelFormat = static_cast<PixelFormat>(WCG_COMPOSITION_PIXEL_FORMAT); #endif _hidl_cb(dataSpace, pixelFormat); _hidl_cb(defaultDataspace, defaultPixelFormat, wideColorGamutDataspace, wideColorGamutPixelFormat); return Void(); } Loading
configstore/1.2/default/surfaceflinger.mk +12 −4 Original line number Diff line number Diff line Loading @@ -59,10 +59,18 @@ ifeq ($(TARGET_USE_COLOR_MANAGEMENT),true) LOCAL_CFLAGS += -DUSE_COLOR_MANAGEMENT endif ifneq ($(SF_COMPOSITION_DATA_SPACE),) LOCAL_CFLAGS += -DCOMPOSITION_DATA_SPACE=$(SF_COMPOSITION_DATA_SPACE) ifneq ($(SF_DEFAULT_COMPOSITION_DATA_SPACE),) LOCAL_CFLAGS += -DDEFAULT_COMPOSITION_DATA_SPACE=$(SF_DEFAULT_COMPOSITION_DATA_SPACE) endif ifneq ($(SF_COMPOSITION_PIXEL_FORMAT),) LOCAL_CFLAGS += -DCOMPOSITION_PIXEL_FORMAT=$(SF_COMPOSITION_PIXEL_FORMAT) ifneq ($(SF_DEFAULT_COMPOSITION_PIXEL_FORMAT),) LOCAL_CFLAGS += -DDEFAULT_COMPOSITION_PIXEL_FORMAT=$(SF_DEFAULT_COMPOSITION_PIXEL_FORMAT) endif ifneq ($(SF_WCG_COMPOSITION_DATA_SPACE),) LOCAL_CFLAGS += -DWCG_COMPOSITION_DATA_SPACE=$(SF_WCG_COMPOSITION_DATA_SPACE) endif ifneq ($(SF_WCG_COMPOSITION_PIXEL_FORMAT),) LOCAL_CFLAGS += -DWCG_COMPOSITION_PIXEL_FORMAT=$(SF_WCG_COMPOSITION_PIXEL_FORMAT) endif