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

Commit 71641ca3 authored by Peiyong Lin's avatar Peiyong Lin Committed by android-build-merger
Browse files

Merge "[Graphics] Update CommandWriter APIs to common::V1_1::* enum." into pi-dev

am: 584ee3b9

Change-Id: Ieb29aadc2e9034a9ff76495755d290fc0432e781
parents 34f70e48 584ee3b9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -325,7 +325,7 @@ a830336ac8627d6432cfafb1b884343ad9f885dee0a5323e380e6d3c519156b8 android.hardwar
83e7a10ff3702147bd7ffa04567b20d407a3b16bbb7705644af44d919afe9103 android.hardware.gnss@1.1::IGnssMeasurementCallback
0b96e0254e2168cfecb30c1ed5fb42681652cc00faa68c6e07568fafe64d1d50 android.hardware.graphics.common@1.1::types
d9b40a5b09962a5a0780b10fe33a4e607e69e2e088fc83de88a584115b7cb1c0 android.hardware.graphics.composer@2.2::IComposer
da3979dd97093cdc4ffc2e2427e848f4ba07ddcd181f31f2cb494ad0d2fa58ad android.hardware.graphics.composer@2.2::IComposerClient
c3cd2a3e245ffefae859c9a3d31382a9421be95cfa6bc1231571eb3533049b54 android.hardware.graphics.composer@2.2::IComposerClient
dd83be076b6b3f10ed62ab34d8c8b95f2415961fb785200eb842e7bfb2b0ee92 android.hardware.graphics.mapper@2.1::IMapper
675682dd3007805c985eaaec91612abc88f4c25b3431fb84070b7584a1a741fb android.hardware.health@2.0::IHealth
434c4c32c00b0e54bb05e40c79503208b40f786a318029a2a4f66e34f10f2a76 android.hardware.health@2.0::IHealthInfoCallback
+29 −18
Original line number Diff line number Diff line
@@ -247,21 +247,8 @@ class CommandWriterBase {

    void setClientTarget(uint32_t slot, const native_handle_t* target, int acquireFence,
                         Dataspace dataspace, const std::vector<IComposerClient::Rect>& damage) {
        bool doWrite = (damage.size() <= (kMaxLength - 4) / 4);
        size_t length = 4 + ((doWrite) ? damage.size() * 4 : 0);

        beginCommand(IComposerClient::Command::SET_CLIENT_TARGET, length);
        write(slot);
        writeHandle(target, true);
        writeFence(acquireFence);
        writeSigned(static_cast<int32_t>(dataspace));
        // When there are too many rectangles in the damage region and doWrite
        // is false, we write no rectangle at all which means the entire
        // client target is damaged.
        if (doWrite) {
            writeRegion(damage);
        }
        endCommand();
        setClientTargetInternal(slot, target, acquireFence, static_cast<int32_t>(dataspace),
                                damage);
    }

    static constexpr uint16_t kSetOutputBufferLength = 3;
@@ -354,9 +341,7 @@ class CommandWriterBase {

    static constexpr uint16_t kSetLayerDataspaceLength = 1;
    void setLayerDataspace(Dataspace dataspace) {
        beginCommand(IComposerClient::Command::SET_LAYER_DATASPACE, kSetLayerDataspaceLength);
        writeSigned(static_cast<int32_t>(dataspace));
        endCommand();
        setLayerDataspaceInternal(static_cast<int32_t>(dataspace));
    }

    static constexpr uint16_t kSetLayerDisplayFrameLength = 4;
@@ -418,6 +403,32 @@ class CommandWriterBase {
    }

   protected:
    void setClientTargetInternal(uint32_t slot, const native_handle_t* target, int acquireFence,
                                 int32_t dataspace,
                                 const std::vector<IComposerClient::Rect>& damage) {
        bool doWrite = (damage.size() <= (kMaxLength - 4) / 4);
        size_t length = 4 + ((doWrite) ? damage.size() * 4 : 0);

        beginCommand(IComposerClient::Command::SET_CLIENT_TARGET, length);
        write(slot);
        writeHandle(target, true);
        writeFence(acquireFence);
        writeSigned(dataspace);
        // When there are too many rectangles in the damage region and doWrite
        // is false, we write no rectangle at all which means the entire
        // client target is damaged.
        if (doWrite) {
            writeRegion(damage);
        }
        endCommand();
    }

    void setLayerDataspaceInternal(int32_t dataspace) {
        beginCommand(IComposerClient::Command::SET_LAYER_DATASPACE, kSetLayerDataspaceLength);
        writeSigned(dataspace);
        endCommand();
    }

    void beginCommand(IComposerClient::Command command, uint16_t length) {
        if (mCommandEnd) {
            LOG_FATAL("endCommand was not called before command 0x%x", command);
+4 −3
Original line number Diff line number Diff line
@@ -104,9 +104,7 @@ class ComposerClient {

    void execute(TestCommandReader* reader, CommandWriterBase* writer);

   private:
    sp<IComposerClient> mClient;

   protected:
    // Keep track of all virtual displays and layers.  When a test fails with
    // ASSERT_*, the destructor will clean up the resources for the test.
    struct DisplayResource {
@@ -116,6 +114,9 @@ class ComposerClient {
        std::unordered_set<Layer> layers;
    };
    std::unordered_map<Display, DisplayResource> mDisplayResources;

   private:
    sp<IComposerClient> mClient;
};

}  // namespace vts
+62 −2
Original line number Diff line number Diff line
@@ -16,13 +16,14 @@

package android.hardware.graphics.composer@2.2;

import android.hardware.graphics.common@1.0::Dataspace;
import android.hardware.graphics.common@1.0::PixelFormat;
import android.hardware.graphics.common@1.1::ColorMode;
import android.hardware.graphics.common@1.1::Dataspace;
import android.hardware.graphics.common@1.1::PixelFormat;
import android.hardware.graphics.common@1.1::RenderIntent;
import @2.1::IComposerClient;
import @2.1::Display;
import @2.1::Error;
import @2.1::IComposerClient;

interface IComposerClient extends @2.1::IComposerClient {

@@ -247,6 +248,65 @@ interface IComposerClient extends @2.1::IComposerClient {
     */
    setReadbackBuffer(Display display, handle buffer, handle releaseFence) generates (Error error);

    /**
     * createVirtualDisplay_2_2
     * Creates a new virtual display with the given width and height. The
     * format passed into this function is the default format requested by the
     * consumer of the virtual display output buffers.
     *
     * The display must be assumed to be on from the time the first frame is
     * presented until the display is destroyed.
     *
     * @param width is the width in pixels.
     * @param height is the height in pixels.
     * @param formatHint is the default output buffer format selected by
     *        the consumer.
     * @param outputBufferSlotCount is the number of output buffer slots to be
     *        reserved.
     * @return error is NONE upon success. Otherwise,
     *         UNSUPPORTED when the width or height is too large for the
     *                     device to be able to create a virtual display.
     *         NO_RESOURCES when the device is unable to create a new virtual
     *                      display at this time.
     * @return display is the newly-created virtual display.
     * @return format is the format of the buffer the device will produce.
     */
    @callflow(next="*")
    createVirtualDisplay_2_2(uint32_t width,
                             uint32_t height,
                             PixelFormat formatHint,
                             uint32_t outputBufferSlotCount)
                  generates (Error error,
                             Display display,
                             PixelFormat format);

    /**
     * getClientTargetSupport_2_2
     * Returns whether a client target with the given properties can be
     * handled by the device.
     *
     * This function must return true for a client target with width and
     * height equal to the active display configuration dimensions,
     * PixelFormat::RGBA_8888, and Dataspace::UNKNOWN. It is not required to
     * return true for any other configuration.
     *
     * @param display is the display to query.
     * @param width is the client target width in pixels.
     * @param height is the client target height in pixels.
     * @param format is the client target format.
     * @param dataspace is the client target dataspace, as described in
     *        setLayerDataspace.
     * @return error is NONE upon success. Otherwise,
     *         BAD_DISPLAY when an invalid display handle was passed in.
     *         UNSUPPORTED when the given configuration is not supported.
     */
    @callflow(next="*")
    getClientTargetSupport_2_2(Display display,
                               uint32_t width,
                               uint32_t height,
                               PixelFormat format,
                               Dataspace dataspace)
                    generates (Error error);
    /**
     * setPowerMode_2_2
     * Sets the power mode of the given display. The transition must be
+11 −1
Original line number Diff line number Diff line
@@ -47,8 +47,8 @@ namespace V2_2 {

using android::hardware::MessageQueue;
using android::hardware::graphics::common::V1_0::ColorTransform;
using android::hardware::graphics::common::V1_0::Dataspace;
using android::hardware::graphics::common::V1_0::Transform;
using android::hardware::graphics::common::V1_1::Dataspace;
using android::hardware::graphics::composer::V2_1::Config;
using android::hardware::graphics::composer::V2_1::Display;
using android::hardware::graphics::composer::V2_1::Error;
@@ -64,6 +64,16 @@ class CommandWriterBase : public V2_1::CommandWriterBase {
   public:
    CommandWriterBase(uint32_t initialMaxSize) : V2_1::CommandWriterBase(initialMaxSize) {}

    void setClientTarget(uint32_t slot, const native_handle_t* target, int acquireFence,
                         Dataspace dataspace, const std::vector<IComposerClient::Rect>& damage) {
        setClientTargetInternal(slot, target, acquireFence, static_cast<int32_t>(dataspace),
                                damage);
    }

    void setLayerDataspace(Dataspace dataspace) {
        setLayerDataspaceInternal(static_cast<int32_t>(dataspace));
    }

    static constexpr uint16_t kSetLayerFloatColorLength = 4;
    void setLayerFloatColor(IComposerClient::FloatColor color) {
        beginCommand_2_2(IComposerClient::Command::SET_LAYER_FLOAT_COLOR,
Loading