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

Commit bf170d93 authored by Dominik Laskowski's avatar Dominik Laskowski
Browse files

SF: Use std::string for display name

Bug: 74619554
Test: Build
Change-Id: Ic07b38516233dda0c275774ccca315b1ac205d47
parent fc2c032b
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -149,8 +149,8 @@ int DisplayDevice::getHeight() const {
    return mDisplayHeight;
}

void DisplayDevice::setDisplayName(const String8& displayName) {
    if (!displayName.isEmpty()) {
void DisplayDevice::setDisplayName(const std::string& displayName) {
    if (!displayName.empty()) {
        // never override the name with an empty name
        mDisplayName = displayName;
    }
@@ -201,8 +201,7 @@ void DisplayDevice::swapBuffers(HWComposer& hwc) const {

    status_t result = mDisplaySurface->advanceFrame();
    if (result != NO_ERROR) {
        ALOGE("[%s] failed pushing new frame to HWC: %d",
                mDisplayName.string(), result);
        ALOGE("[%s] failed pushing new frame to HWC: %d", mDisplayName.c_str(), result);
    }
}

@@ -481,7 +480,7 @@ uint32_t DisplayDevice::getPrimaryDisplayOrientationTransform() {
void DisplayDevice::dump(String8& result) const {
    const Transform& tr(mGlobalTransform);
    ANativeWindow* const window = mNativeWindow.get();
    result.appendFormat("+ DisplayDevice: %s\n", mDisplayName.string());
    result.appendFormat("+ DisplayDevice: %s\n", mDisplayName.c_str());
    result.appendFormat("   type=%x, hwcId=%d, layerStack=%u, (%4dx%4d), ANativeWindow=%p "
                        "(%d:%d:%d:%d), orient=%2d (type=%08x), "
                        "flips=%u, isSecure=%d, powerMode=%d, activeConfig=%d, numLayers=%zu\n",
+5 −4
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "RenderEngine/Surface.h"

#include <memory>
#include <string>

struct ANativeWindow;

@@ -152,8 +153,8 @@ public:
    }
    inline Rect bounds() const { return getBounds(); }

    void setDisplayName(const String8& displayName);
    const String8& getDisplayName() const { return mDisplayName; }
    void setDisplayName(const std::string& displayName);
    const std::string& getDisplayName() const { return mDisplayName; }

    bool makeCurrent() const;
    void setViewportAndProjection() const;
@@ -208,7 +209,7 @@ private:
    int             mDisplayWidth;
    int             mDisplayHeight;
    mutable uint32_t mPageFlipCount;
    String8         mDisplayName;
    std::string     mDisplayName;
    bool            mIsSecure;

    /*
@@ -283,7 +284,7 @@ struct DisplayDeviceState {
    uint8_t orientation = 0;
    uint32_t width = 0;
    uint32_t height = 0;
    String8 displayName;
    std::string displayName;
    bool isSecure = false;
};

+5 −5
Original line number Diff line number Diff line
@@ -32,11 +32,11 @@ namespace android {
// ---------------------------------------------------------------------------

#define VDS_LOGE(msg, ...) ALOGE("[%s] " msg, \
        mDisplayName.string(), ##__VA_ARGS__)
        mDisplayName.c_str(), ##__VA_ARGS__)
#define VDS_LOGW_IF(cond, msg, ...) ALOGW_IF(cond, "[%s] " msg, \
        mDisplayName.string(), ##__VA_ARGS__)
        mDisplayName.c_str(), ##__VA_ARGS__)
#define VDS_LOGV(msg, ...) ALOGV("[%s] " msg, \
        mDisplayName.string(), ##__VA_ARGS__)
        mDisplayName.c_str(), ##__VA_ARGS__)

static const char* dbgCompositionTypeStr(DisplaySurface::CompositionType type) {
    switch (type) {
@@ -52,7 +52,7 @@ VirtualDisplaySurface::VirtualDisplaySurface(HWComposer& hwc, int32_t dispId,
        const sp<IGraphicBufferProducer>& sink,
        const sp<IGraphicBufferProducer>& bqProducer,
        const sp<IGraphicBufferConsumer>& bqConsumer,
        const String8& name)
        const std::string& name)
:   ConsumerBase(bqConsumer),
    mHwc(hwc),
    mDisplayId(dispId),
@@ -102,7 +102,7 @@ VirtualDisplaySurface::VirtualDisplaySurface(HWComposer& hwc, int32_t dispId,
    }
    mOutputFormat = mDefaultOutputFormat;

    ConsumerBase::mName = String8::format("VDS: %s", mDisplayName.string());
    ConsumerBase::mName = String8::format("VDS: %s", mDisplayName.c_str());
    mConsumer->setConsumerName(ConsumerBase::mName);
    mConsumer->setConsumerUsageBits(GRALLOC_USAGE_HW_COMPOSER);
    mConsumer->setDefaultBufferSize(sinkWidth, sinkHeight);
+4 −2
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#ifndef ANDROID_SF_VIRTUAL_DISPLAY_SURFACE_H
#define ANDROID_SF_VIRTUAL_DISPLAY_SURFACE_H

#include <string>

#include "DisplaySurface.h"
#include "HWComposerBufferCache.h"

@@ -77,7 +79,7 @@ public:
            const sp<IGraphicBufferProducer>& sink,
            const sp<IGraphicBufferProducer>& bqProducer,
            const sp<IGraphicBufferConsumer>& bqConsumer,
            const String8& name);
            const std::string& name);

    //
    // DisplaySurface interface
@@ -153,7 +155,7 @@ private:
    //
    HWComposer& mHwc;
    const int32_t mDisplayId;
    const String8 mDisplayName;
    const std::string mDisplayName;
    sp<IGraphicBufferProducer> mSource[2]; // indexed by SOURCE_*
    uint32_t mDefaultOutputFormat;

+1 −1
Original line number Diff line number Diff line
@@ -2905,7 +2905,7 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& displayDev

        if (!displayDevice->makeCurrent()) {
            ALOGW("DisplayDevice::makeCurrent failed. Aborting surface composition for display %s",
                  displayDevice->getDisplayName().string());
                  displayDevice->getDisplayName().c_str());
            getRenderEngine().resetCurrentSurface();

            // |mStateLock| not needed as we are on the main thread