[ConfigStore] Add getCompositionPreference.
In order to tell renderer to render into the best color space with the right pixel format. We need to expose it as a composition preference. This patch adds ConfigStore API to query such preference. Typically, this API will return the default data space of a color space that the panel is calibrated to, with the default pixel format that hardware composer can composite to efficiently. However, devices can make tradeoff between data space and pixel format. BUG: 113530681 Test: Build, flash, boot Change-Id: I0ea09e21e70843b50157ec617c87a42bb4ff7332
This commit is contained in:
parent
2e133cf047
commit
bfbaf8400e
5 changed files with 58 additions and 0 deletions
|
@ -12,6 +12,7 @@ hidl_interface {
|
|||
interfaces: [
|
||||
"android.hardware.configstore@1.1",
|
||||
"android.hardware.configstore@1.0",
|
||||
"android.hardware.graphics.common@1.1",
|
||||
"android.hidl.base@1.0",
|
||||
],
|
||||
gen_java: true,
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package android.hardware.configstore@1.2;
|
||||
|
||||
import android.hardware.graphics.common@1.1::Dataspace;
|
||||
import android.hardware.graphics.common@1.1::PixelFormat;
|
||||
import @1.1::ISurfaceFlingerConfigs;
|
||||
import @1.0::OptionalBool;
|
||||
|
||||
|
@ -30,4 +32,27 @@ interface ISurfaceFlingerConfigs extends @1.1::ISurfaceFlingerConfigs {
|
|||
* return true.
|
||||
*/
|
||||
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:
|
||||
*
|
||||
* 1. Hardware composer's capability to composite contents with the
|
||||
* data space and pixel format efficiently;
|
||||
* 2. Hardware composer's ability to composite contents when sRGB contents
|
||||
* and the chosen 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.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
getCompositionPreference()
|
||||
generates (Dataspace dataSpace, PixelFormat pixelFormat);
|
||||
};
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "SurfaceFlingerConfigs.h"
|
||||
|
||||
#include <android/hardware/configstore/1.1/types.h>
|
||||
#include <android/hardware/graphics/common/1.1/types.h>
|
||||
#include <log/log.h>
|
||||
|
||||
namespace android {
|
||||
|
@ -25,6 +26,9 @@ namespace configstore {
|
|||
namespace V1_2 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::graphics::common::V1_1::Dataspace;
|
||||
using ::android::hardware::graphics::common::V1_1::PixelFormat;
|
||||
|
||||
// ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs implementation.
|
||||
Return<void> SurfaceFlingerConfigs::vsyncEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) {
|
||||
#ifdef VSYNC_EVENT_PHASE_OFFSET_NS
|
||||
|
@ -199,6 +203,25 @@ 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");
|
||||
#endif
|
||||
|
||||
Return<void> SurfaceFlingerConfigs::getCompositionPreference(getCompositionPreference_cb _hidl_cb) {
|
||||
Dataspace dataSpace = Dataspace::V0_SRGB;
|
||||
PixelFormat pixelFormat = PixelFormat::RGBA_8888;
|
||||
|
||||
#ifdef COMPOSITION_DATA_SPACE
|
||||
dataSpace = static_cast<Dataspace>(COMPOSITION_DATA_SPACE);
|
||||
#endif
|
||||
|
||||
#ifdef COMPOSITION_PIXEL_FORMAT
|
||||
pixelFormat = static_cast<PixelFormat>(COMPOSITION_PIXEL_FORMAT);
|
||||
#endif
|
||||
_hidl_cb(dataSpace, pixelFormat);
|
||||
return Void();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_2
|
||||
} // namespace configstore
|
||||
|
|
|
@ -52,6 +52,7 @@ struct SurfaceFlingerConfigs : public ISurfaceFlingerConfigs {
|
|||
|
||||
// ::android::hardware::configstore::V1_2::ISurfaceFlingerConfigs follow implementation.
|
||||
Return<void> useColorManagement(useColorManagement_cb _hidl_cb) override;
|
||||
Return<void> getCompositionPreference(getCompositionPreference_cb _hidl_cb) override;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
|
|
@ -58,3 +58,11 @@ endif
|
|||
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)
|
||||
endif
|
||||
|
||||
ifneq ($(SF_COMPOSITION_PIXEL_FORMAT),)
|
||||
LOCAL_CFLAGS += -DCOMPOSITION_PIXEL_FORMAT=$(SF_COMPOSITION_PIXEL_FORMAT)
|
||||
endif
|
||||
|
|
Loading…
Reference in a new issue