Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 109d6814 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[ConfigStore] Add getCompositionPreference."

parents 4439ca7f bfbaf840
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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,
+25 −0
Original line number Diff line number Diff line
@@ -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);
};
+23 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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
+8 −0
Original line number Diff line number Diff line
@@ -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