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

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

Merge "Remove per-display caching toggle" into main

parents 70091815 ea8c7a02
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ namespace compositionengine::impl::planner {
// as a more efficient representation of parts of the layer stack.
// Implicitly, layer caching must also be enabled for the Planner to have any effect
// E.g., setprop debug.sf.enable_layer_caching 1, or
// adb shell service call SurfaceFlinger 1040 i32 1 [i64 <display ID>]
// adb shell service call SurfaceFlinger 1040 i32 1
class Planner {
public:
    Planner(renderengine::RenderEngine& renderengine);
+6 −19
Original line number Diff line number Diff line
@@ -7025,29 +7025,16 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
                return NO_ERROR;
            }
            // Toggle caching feature
            // First argument is an int32 - nonzero enables caching and zero disables caching
            // Second argument is an optional uint64 - if present, then limits enabling/disabling
            // caching to a particular physical display
            // First argument is an int32 - nonzero enables caching and zero disables caching for
            // all displays
            case 1040: {
                auto future = mScheduler->schedule([&] {
                    n = data.readInt32();
                    PhysicalDisplayId inputId;
                    if (uint64_t inputDisplayId; data.readUint64(&inputDisplayId) == NO_ERROR) {
                        inputId = PhysicalDisplayId::fromValue(inputDisplayId);
                        if (!getPhysicalDisplayToken(inputId)) {
                            ALOGE("No display with id: %" PRIu64, inputDisplayId);
                            return NAME_NOT_FOUND;
                        }
                    }
                    {
                    Mutex::Autolock lock(mStateLock);
                    mLayerCachingEnabled = n != 0;
                    for (const auto& [_, display] : mDisplays) {
                            if (inputId == display->getPhysicalId()) {
                        display->enableLayerCaching(mLayerCachingEnabled);
                    }
                        }
                    }
                    return OK;
                });