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

Commit bf0bbc2d authored by Alec Mouri's avatar Alec Mouri
Browse files

Remove concept of nits from the client target properties

An earlier patch replaced white point nits with a per-layer brightness.
This patch does the same for providing the brightness space of the
client target relative to the display brightness.

Bug: 217961164
Test: builds, boots
Change-Id: I1be65f7c511fefa239305e0735637126a1cd6622
Merged-In: I1be65f7c511fefa239305e0735637126a1cd6622
parent 7cc7dd13
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -33,8 +33,8 @@

package android.hardware.graphics.composer3;
@VintfStability
parcelable ClientTargetPropertyWithNits {
parcelable ClientTargetPropertyWithBrightness {
  long display;
  android.hardware.graphics.composer3.ClientTargetProperty clientTargetProperty;
  float whitePointNits;
  float brightness;
}
+1 −1
Original line number Diff line number Diff line
@@ -40,5 +40,5 @@ union CommandResultPayload {
  android.hardware.graphics.composer3.PresentFence presentFence;
  android.hardware.graphics.composer3.ReleaseFences releaseFences;
  android.hardware.graphics.composer3.PresentOrValidate presentOrValidateResult;
  android.hardware.graphics.composer3.ClientTargetPropertyWithNits clientTargetProperty;
  android.hardware.graphics.composer3.ClientTargetPropertyWithBrightness clientTargetProperty;
}
+3 −3
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ package android.hardware.graphics.composer3;
import android.hardware.graphics.composer3.ClientTargetProperty;

@VintfStability
parcelable ClientTargetPropertyWithNits {
parcelable ClientTargetPropertyWithBrightness {
    /**
     * The display which this commands refers to.
     * @see IComposer.createDisplay
@@ -32,7 +32,7 @@ parcelable ClientTargetPropertyWithNits {
    ClientTargetProperty clientTargetProperty;

    /**
     * The white points nits as described in CommandResultPayload.clientTargetProperty
     * The brightness as described in CommandResultPayload.clientTargetProperty
     */
    float whitePointNits;
    float brightness;
}
+4 −3
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package android.hardware.graphics.composer3;

import android.hardware.graphics.composer3.ChangedCompositionTypes;
import android.hardware.graphics.composer3.ClientTargetPropertyWithNits;
import android.hardware.graphics.composer3.ClientTargetPropertyWithBrightness;
import android.hardware.graphics.composer3.CommandError;
import android.hardware.graphics.composer3.DisplayRequest;
import android.hardware.graphics.composer3.PresentFence;
@@ -83,12 +83,13 @@ union CommandResultPayload {
    PresentOrValidate presentOrValidateResult;

    /**
     * The white point parameter describes the intended white point of the client target buffer.
     * The brightness parameter describes the intended brightness space of the client target buffer.
     * The brightness is in the range [0, 1], where 1 is the current brightness of the display.
     * When client composition blends both HDR and SDR content, the client must composite to the
     * brightness space as specified by the hardware composer. This is so that adjusting the real
     * display brightness may be applied atomically with compensating the client target output. For
     * instance, client-compositing a list of SDR layers requires dimming the brightness space of
     * the SDR buffers when an HDR layer is simultaneously device-composited.
     */
    ClientTargetPropertyWithNits clientTargetProperty;
    ClientTargetPropertyWithBrightness clientTargetProperty;
}
+7 −6
Original line number Diff line number Diff line
@@ -153,14 +153,14 @@ class ComposerClientReader {
    }

    // Get the client target properties requested by hardware composer.
    ClientTargetPropertyWithNits takeClientTargetProperty(int64_t display) {
    ClientTargetPropertyWithBrightness takeClientTargetProperty(int64_t display) {
        auto found = mReturnData.find(display);

        // If not found, return the default values.
        if (found == mReturnData.end()) {
            return ClientTargetPropertyWithNits{
            return ClientTargetPropertyWithBrightness{
                    .clientTargetProperty = {common::PixelFormat::RGBA_8888, Dataspace::UNKNOWN},
                    .whitePointNits = -1.f,
                    .brightness = 1.f,
            };
        }

@@ -201,7 +201,8 @@ class ComposerClientReader {
        data.presentOrValidateState = std::move(presentOrValidate.result);
    }

    void parseSetClientTargetProperty(const ClientTargetPropertyWithNits&& clientTargetProperty) {
    void parseSetClientTargetProperty(
            const ClientTargetPropertyWithBrightness&& clientTargetProperty) {
        auto& data = mReturnData[clientTargetProperty.display];
        data.clientTargetProperty = std::move(clientTargetProperty);
    }
@@ -213,9 +214,9 @@ class ComposerClientReader {
        std::vector<ReleaseFences::Layer> releasedLayers;
        PresentOrValidate::Result presentOrValidateState;

        ClientTargetPropertyWithNits clientTargetProperty = {
        ClientTargetPropertyWithBrightness clientTargetProperty = {
                .clientTargetProperty = {common::PixelFormat::RGBA_8888, Dataspace::UNKNOWN},
                .whitePointNits = -1.f,
                .brightness = 1.f,
        };
    };