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

Commit 015b7d98 authored by Peiyong Lin's avatar Peiyong Lin Committed by Android (Google) Code Review
Browse files

Merge "Add getClientTargetProperty API entry."

parents 8081fb6e bc51e085
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -626,9 +626,15 @@ class CommandReaderBase {
    }

   protected:
     template <typename T>
     bool beginCommand(T* outCommand, uint16_t* outLength) {
         return beginCommandBase(reinterpret_cast<IComposerClient::Command*>(outCommand),
                                 outLength);
     }

    bool isEmpty() const { return (mDataRead >= mDataSize); }

    bool beginCommand(IComposerClient::Command* outCommand, uint16_t* outLength) {
    bool beginCommandBase(IComposerClient::Command* outCommand, uint16_t* outLength) {
        if (mCommandEnd) {
            LOG_FATAL("endCommand was not called for last command");
        }
+21 −30
Original line number Diff line number Diff line
@@ -146,6 +146,25 @@ class ComposerCommandEngine : protected CommandReaderBase {
        return std::make_unique<CommandWriterBase>(writerInitialSize);
    }

    virtual Error executeValidateDisplayInternal() {
        std::vector<Layer> changedLayers;
        std::vector<IComposerClient::Composition> compositionTypes;
        uint32_t displayRequestMask = 0x0;
        std::vector<Layer> requestedLayers;
        std::vector<uint32_t> requestMasks;

        auto err = mHal->validateDisplay(mCurrentDisplay, &changedLayers, &compositionTypes,
                                         &displayRequestMask, &requestedLayers, &requestMasks);
        mResources->setDisplayMustValidateState(mCurrentDisplay, false);
        if (err == Error::NONE) {
            mWriter->setChangedCompositionTypes(changedLayers, compositionTypes);
            mWriter->setDisplayRequests(displayRequestMask, requestedLayers, requestMasks);
        } else {
            mWriter->setError(getCommandLoc(), err);
        }
        return err;
    }

    bool executeSelectDisplay(uint16_t length) {
        if (length != CommandWriterBase::kSelectDisplayLength) {
            return false;
@@ -255,23 +274,7 @@ class ComposerCommandEngine : protected CommandReaderBase {
        if (length != CommandWriterBase::kValidateDisplayLength) {
            return false;
        }

        std::vector<Layer> changedLayers;
        std::vector<IComposerClient::Composition> compositionTypes;
        uint32_t displayRequestMask = 0x0;
        std::vector<Layer> requestedLayers;
        std::vector<uint32_t> requestMasks;

        auto err = mHal->validateDisplay(mCurrentDisplay, &changedLayers, &compositionTypes,
                                         &displayRequestMask, &requestedLayers, &requestMasks);
        mResources->setDisplayMustValidateState(mCurrentDisplay, false);
        if (err == Error::NONE) {
            mWriter->setChangedCompositionTypes(changedLayers, compositionTypes);
            mWriter->setDisplayRequests(displayRequestMask, requestedLayers, requestMasks);
        } else {
            mWriter->setError(getCommandLoc(), err);
        }

        executeValidateDisplayInternal();
        return true;
    }

@@ -297,21 +300,9 @@ class ComposerCommandEngine : protected CommandReaderBase {
        }

        // Present has failed. We need to fallback to validate
        std::vector<Layer> changedLayers;
        std::vector<IComposerClient::Composition> compositionTypes;
        uint32_t displayRequestMask = 0x0;
        std::vector<Layer> requestedLayers;
        std::vector<uint32_t> requestMasks;

        auto err = mHal->validateDisplay(mCurrentDisplay, &changedLayers, &compositionTypes,
                                         &displayRequestMask, &requestedLayers, &requestMasks);
        mResources->setDisplayMustValidateState(mCurrentDisplay, false);
        auto err = executeValidateDisplayInternal();
        if (err == Error::NONE) {
            mWriter->setPresentOrValidateResult(0);
            mWriter->setChangedCompositionTypes(changedLayers, compositionTypes);
            mWriter->setDisplayRequests(displayRequestMask, requestedLayers, requestMasks);
        } else {
            mWriter->setError(getCommandLoc(), err);
        }

        return true;
+22 −0
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package android.hardware.graphics.composer@2.4;

import android.hardware.graphics.common@1.2::PixelFormat;
import android.hardware.graphics.common@1.2::Dataspace;
import android.hardware.graphics.composer@2.1::IComposerClient.Command;
import IComposerCallback;
import @2.1::Config;
import @2.1::Display;
@@ -56,6 +59,20 @@ interface IComposerClient extends @2.3::IComposerClient {
        AUTO_LOW_LATENCY_MODE = 5,
    };

    enum Command : @2.3::IComposerClient.Command {
        /**
         * SET_CLIENT_TARGET_PROPERTY has this pseudo prototype
         *
         * This command has the following binary layout in bytes:
         *
         *     0 - 3: clientTargetProperty.pixelFormat
         *     4 - 7: clientTargetProperty.dataspace
         *
         *   setClientTargetProperty(ClientTargetProperty clientTargetProperty);
         */
         SET_CLIENT_TARGET_PROPERTY = 0x105 << @2.1::IComposerClient.Command:OPCODE_SHIFT,
    };

    /**
     * Supersedes {@link @2.1::IComposerClient.DisplayType}.
     */
@@ -99,6 +116,11 @@ interface IComposerClient extends @2.3::IComposerClient {
        bool seamlessRequired;
    };

    struct ClientTargetProperty {
        PixelFormat pixelFormat;
        Dataspace dataspace;
    };

    /**
     * Provides a IComposerCallback object for the device to call.
     *
+12 −1
Original line number Diff line number Diff line
@@ -41,14 +41,25 @@ using android::hardware::graphics::composer::V2_4::IComposerClient;
// units of uint32_t's.
class CommandWriterBase : public V2_3::CommandWriterBase {
  public:
    static constexpr uint16_t kSetClientTargetPropertyLength = 2;

    CommandWriterBase(uint32_t initialMaxSize) : V2_3::CommandWriterBase(initialMaxSize) {}

    void setClientTargetProperty(
            const IComposerClient::ClientTargetProperty& clientTargetProperty) {
        beginCommand(IComposerClient::Command::SET_CLIENT_TARGET_PROPERTY,
                     kSetClientTargetPropertyLength);
        writeSigned(static_cast<int32_t>(clientTargetProperty.pixelFormat));
        writeSigned(static_cast<int32_t>(clientTargetProperty.dataspace));
        endCommand();
    }
};

// This class helps parse a command queue.  Note that all sizes/lengths are in
// units of uint32_t's.
class CommandReaderBase : public V2_3::CommandReaderBase {
  public:
    CommandReaderBase() : V2_3::CommandReaderBase(){};
    CommandReaderBase() : V2_3::CommandReaderBase() {}
};

}  // namespace V2_4
+2 −2
Original line number Diff line number Diff line
@@ -26,11 +26,11 @@ cc_library_headers {
    ],
    header_libs: [
        "android.hardware.graphics.composer@2.3-hal",
        "android.hardware.graphics.composer@2.3-command-buffer",
        "android.hardware.graphics.composer@2.4-command-buffer",
    ],
    export_header_lib_headers: [
        "android.hardware.graphics.composer@2.3-hal",
        "android.hardware.graphics.composer@2.3-command-buffer",
        "android.hardware.graphics.composer@2.4-command-buffer",
    ],
    export_include_dirs: ["include"],
}
Loading