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

Commit fa8c18ba authored by Brian Lindahl's avatar Brian Lindahl Committed by Android (Google) Code Review
Browse files

Merge changes from topic "android-display-processing-1" into main

* changes:
  Add plumbing to pass picture profiles down to Composer HAL
  Move picture profile flag from surfaceflinger to libgui
parents 057332b5 7a4cb7e1
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
package: "com.android.graphics.libgui.flags"
container: "system"

flag {
  name: "apply_picture_profiles"
  namespace: "tv_os_media"
  description: "This flag controls sending picture profiles from BBQ to Composer HAL"
  bug: "337330263"
  is_fixed_read_only: true
} # apply_picture_profiles

flag {
  name: "bq_setframerate"
  namespace: "core_graphics"
+1 −0
Original line number Diff line number Diff line
@@ -136,6 +136,7 @@ cc_library_shared {
        "GraphicBuffer.cpp",
        "GraphicBufferAllocator.cpp",
        "GraphicBufferMapper.cpp",
        "PictureProfileHandle.cpp",
        "PixelFormat.cpp",
        "PublicFormat.cpp",
        "StaticAsserts.cpp",
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 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.
 */

#include <ui/PictureProfileHandle.h>

#include <format>

namespace android {

const PictureProfileHandle PictureProfileHandle::NONE(0);

::std::string toString(const PictureProfileHandle& handle) {
    return std::format("{:#010x}", handle.getId());
}

} // namespace android
+60 −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.
 */

#pragma once

#include <stdint.h>
#include <array>
#include <string>

namespace android {

/**
 * An opaque value that uniquely identifies a picture profile, or a set of parameters, which
 * describes the configuration of a picture processing pipeline that is applied to a graphic buffer
 * to enhance its quality prior to rendering on the display.
 */
typedef int64_t PictureProfileId;

/**
 * A picture profile handle wraps the picture profile ID for type-safety, and represents an opaque
 * handle that doesn't have the performance drawbacks of Binders.
 */
class PictureProfileHandle {
public:
    // A profile that represents no picture processing.
    static const PictureProfileHandle NONE;

    PictureProfileHandle() { *this = NONE; }
    PictureProfileHandle(PictureProfileId id) : mId(id) {}

    PictureProfileId const& getId() const { return mId; }

    inline bool operator==(const PictureProfileHandle& rhs) { return mId == rhs.mId; }
    inline bool operator!=(const PictureProfileHandle& rhs) { return !(*this == rhs); }

    // Is the picture profile effectively null, or not-specified?
    inline bool operator!() const { return mId == NONE.mId; }

    operator bool() const { return !!*this; }

    friend ::std::string toString(const PictureProfileHandle& handle);

private:
    PictureProfileId mId;
};

} // namespace android
+2 −0
Original line number Diff line number Diff line
@@ -285,6 +285,8 @@ struct DisplayDeviceState {
    bool isProtected = false;
    // Refer to DisplayDevice::mRequestedRefreshRate, for virtual display only
    Fps requestedRefreshRate;
    int32_t maxLayerPictureProfiles = 0;
    bool hasPictureProcessing = false;

private:
    static std::atomic<int32_t> sNextSequenceId;
Loading