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

Commit c48af244 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[Composer] Fix compiler warnings" into main

parents 6c145343 e3a1fa5e
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -17,19 +17,13 @@
#pragma once

#ifndef LOG_TAG
#warn "ComposerCommandBuffer.h included without LOG_TAG"
#warning "ComposerCommandBuffer.h included without LOG_TAG"
#endif

//#define LOG_NDEBUG 0

#include <algorithm>
#include <limits>
#include <memory>
#include <vector>

#include <inttypes.h>
#include <string.h>

#include <android/hardware/graphics/composer/2.2/IComposer.h>
#include <android/hardware/graphics/composer/2.2/IComposerClient.h>
#include <fmq/MessageQueue.h>
@@ -82,7 +76,7 @@ class CommandWriterBase : public V2_1::CommandWriterBase {

    void setLayerPerFrameMetadata(const hidl_vec<IComposerClient::PerFrameMetadata>& metadataVec) {
        beginCommand(IComposerClient::Command::SET_LAYER_PER_FRAME_METADATA,
                     metadataVec.size() * 2);
                     static_cast<uint16_t>(metadataVec.size() * 2));
        for (const auto& metadata : metadataVec) {
            writeSigned(static_cast<int32_t>(metadata.key));
            writeFloat(metadata.value);
+2 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
#pragma once

#ifndef LOG_TAG
#warn "ComposerCommandBuffer.h included without LOG_TAG"
#warning "ComposerCommandBuffer.h included without LOG_TAG"
#endif

//#define LOG_NDEBUG 0
@@ -46,7 +46,7 @@ class CommandWriterBase : public V2_2::CommandWriterBase {
   public:
    void setLayerPerFrameMetadata(const hidl_vec<IComposerClient::PerFrameMetadata>& metadataVec) {
        beginCommand(IComposerClient::Command::SET_LAYER_PER_FRAME_METADATA,
                     metadataVec.size() * 2);
                     static_cast<uint16_t>(metadataVec.size() * 2));
        for (const auto& metadata : metadataVec) {
            writeSigned(static_cast<int32_t>(metadata.key));
            writeFloat(metadata.value);
+7 −6
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
#pragma once

#ifndef LOG_TAG
#warn "ComposerCommandBuffer.h included without LOG_TAG"
#warning "ComposerCommandBuffer.h included without LOG_TAG"
#endif

//#define LOG_NDEBUG 0
@@ -63,16 +63,17 @@ class CommandWriterBase : public V2_3::CommandWriterBase {

        beginCommand(IComposerClient::Command::SET_LAYER_GENERIC_METADATA,
                     static_cast<uint16_t>(commandSize));
        write(key.size());
        writeBlob(key.size(), reinterpret_cast<const unsigned char*>(key.c_str()));
        write(static_cast<uint32_t>(key.size()));
        writeBlob(static_cast<uint32_t>(key.size()),
                  reinterpret_cast<const unsigned char*>(key.c_str()));
        write(mandatory);
        write(value.size());
        writeBlob(value.size(), value.data());
        write(static_cast<uint32_t>(value.size()));
        writeBlob(static_cast<uint32_t>(value.size()), value.data());
        endCommand();
    }

  protected:
    uint32_t sizeToElements(uint32_t size) { return (size + 3) / 4; }
    uint32_t sizeToElements(size_t size) { return static_cast<uint32_t>((size + 3) / 4); }
};

// This class helps parse a command queue.  Note that all sizes/lengths are in