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

Commit 63f12794 authored by Dominik Laskowski's avatar Dominik Laskowski
Browse files

SF: Bundle ftl::Flags for CompositionCoverage

...as they will later be passed to Scheduler via ICompositor. For now,
extract ICompositor to its own header, alongside CompositionCoverage.

Bug: 241285475
Bug: 241285191
Test: Frame misses are still traced.
Change-Id: I1562893c9357a02aa42516e775700065b9b17e4b
parent dff1554c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -17,12 +17,12 @@
#define ATRACE_TAG ATRACE_TAG_GRAPHICS

#include <binder/IPCThreadState.h>

#include <gui/DisplayEventReceiver.h>
#include <utils/Log.h>
#include <utils/Timers.h>
#include <utils/threads.h>

#include <gui/DisplayEventReceiver.h>
#include <scheduler/interface/ICompositor.h>

#include "EventThread.h"
#include "FrameTimeline.h"
+1 −9
Original line number Diff line number Diff line
@@ -37,15 +37,7 @@

namespace android {

struct ICompositor {
    virtual void configure() = 0;
    virtual bool commit(TimePoint frameTime, VsyncId, TimePoint expectedVsyncTime) = 0;
    virtual void composite(TimePoint frameTime, VsyncId) = 0;
    virtual void sample() = 0;

protected:
    ~ICompositor() = default;
};
struct ICompositor;

template <typename F>
class Task : public MessageHandler {
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@
#include <utils/Trace.h>

#include <FrameTimeline/FrameTimeline.h>
#include <scheduler/interface/ICompositor.h>

#include <algorithm>
#include <cinttypes>
#include <cstdint>
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <cstdint>

#include <ftl/flags.h>

namespace android {

// Whether composition was covered by HWC and/or GPU.
enum class CompositionCoverage : std::uint8_t {
    Hwc = 1 << 0,

    // Mutually exclusive: The composition either used the GPU, or reused a buffer that had been
    // composited on the GPU.
    Gpu = 1 << 1,
    GpuReuse = 1 << 2,
};

using CompositionCoverageFlags = ftl::Flags<CompositionCoverage>;

} // namespace android
+43 −0
Original line number Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <scheduler/Time.h>
#include <scheduler/VsyncId.h>

namespace android {

struct ICompositor {
    // Configures physical displays, processing hotplug and/or mode setting via the Composer HAL.
    virtual void configure() = 0;

    // Commits transactions for layers and displays. Returns whether any state has been invalidated,
    // i.e. whether a frame should be composited for each display.
    virtual bool commit(TimePoint frameTime, VsyncId, TimePoint expectedVsyncTime) = 0;

    // Composites a frame for each display. CompositionEngine performs GPU and/or HAL composition
    // via RenderEngine and the Composer HAL, respectively.
    virtual void composite(TimePoint frameTime, VsyncId) = 0;

    // Samples the composited frame via RegionSamplingThread.
    virtual void sample() = 0;

protected:
    ~ICompositor() = default;
};

} // namespace android
Loading