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

Commit 95f669a3 authored by Sally Qi's avatar Sally Qi
Browse files

[Lut HAL backend] implementation

- Add Lut in HWComposer::DeviceRequestedChanges
- parse lutProperties into overlayProperties
- Add a mapper <layer*, pfd> to store lut fd to avoid dup() ops if
  passing the fds into callees.
- SurfaceComposerClient::Transaction::setLuts interface

Bug: 329472100
Test: builds
Flag: NONE HAL backend interface change
Change-Id: Ib2993ce1eab66ab456388c0d15b032201eac7e91
parent 9a4c026c
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -1941,6 +1941,20 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDesir
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setLuts(
        const sp<SurfaceControl>& sc, const base::unique_fd& /*lutFd*/,
        const std::vector<int32_t>& /*offsets*/, const std::vector<int32_t>& /*dimensions*/,
        const std::vector<int32_t>& /*sizes*/, const std::vector<int32_t>& /*samplingKeys*/) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }
    // TODO (b/329472856): update layer_state_t for lut(s)
    registerSurfaceControlForCallback(sc);
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setCachingHint(
        const sp<SurfaceControl>& sc, gui::CachingHint cachingHint) {
    layer_state_t* s = getLayerState(sc);
+30 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.gui;

import android.gui.LutProperties;
import android.os.ParcelFileDescriptor;

/**
 * This mirrors aidl::android::hardware::graphics::composer3::Lut definition
 * @hide
 */
parcelable Lut {
    @nullable ParcelFileDescriptor pfd;

    LutProperties lutProperties;
}
 No newline at end of file
+32 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.gui;

/**
 * This mirrors aidl::android::hardware::graphics::composer3::LutProperties definition.
 * @hide
 */
parcelable LutProperties {
    @Backing(type="int")
    enum Dimension { ONE_D = 1, THREE_D = 3 }
    Dimension dimension;

    long size;
    @Backing(type="int")
    enum SamplingKey { RGB, MAX_RGB }
    SamplingKey[] samplingKeys;
}
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.gui;

import android.gui.LutProperties;

/** @hide */
parcelable OverlayProperties {
    parcelable SupportedBufferCombinations {
@@ -27,4 +29,6 @@ parcelable OverlayProperties {
    SupportedBufferCombinations[] combinations;

    boolean supportMixedColorSpaces;

    @nullable LutProperties[] lutProperties;
}
+5 −0
Original line number Diff line number Diff line
@@ -601,6 +601,11 @@ public:
        Transaction& setExtendedRangeBrightness(const sp<SurfaceControl>& sc,
                                                float currentBufferRatio, float desiredRatio);
        Transaction& setDesiredHdrHeadroom(const sp<SurfaceControl>& sc, float desiredRatio);
        Transaction& setLuts(const sp<SurfaceControl>& sc, const base::unique_fd& lutFd,
                             const std::vector<int32_t>& offsets,
                             const std::vector<int32_t>& dimensions,
                             const std::vector<int32_t>& sizes,
                             const std::vector<int32_t>& samplingKeys);
        Transaction& setCachingHint(const sp<SurfaceControl>& sc, gui::CachingHint cachingHint);
        Transaction& setHdrMetadata(const sp<SurfaceControl>& sc, const HdrMetadata& hdrMetadata);
        Transaction& setSurfaceDamageRegion(const sp<SurfaceControl>& sc,
Loading