/* * Copyright 2020 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 #include #include namespace android::hardware::graphics::composer::V2_4::vts { using Display = V2_1::Display; // IComposerCallback to be installed with IComposerClient::registerCallback. class GraphicsComposerCallback : public IComposerCallback { public: void setVsyncAllowed(bool allowed); std::vector getDisplays() const; int32_t getInvalidHotplugCount() const; int32_t getInvalidRefreshCount() const; int32_t getInvalidVsyncCount() const; int32_t getInvalidVsync_2_4Count() const; int32_t getInvalidVsyncPeriodChangeCount() const; int32_t getInvalidSeamlessPossibleCount() const; std::optional takeLastVsyncPeriodChangeTimeline(); private: Return onHotplug(Display display, Connection connection) override; Return onRefresh(Display display) override; Return onVsync(Display display, int64_t) override; Return onVsync_2_4(Display display, int64_t, VsyncPeriodNanos vsyncPeriodNanos) override; Return onVsyncPeriodTimingChanged( Display display, const VsyncPeriodChangeTimeline& updatedTimeline) override; Return onSeamlessPossible(Display display) override; mutable std::mutex mMutex; // the set of all currently connected displays std::vector mDisplays; // true only when vsync is enabled bool mVsyncAllowed = true; std::optional mTimeline; // track invalid callbacks int32_t mInvalidHotplugCount = 0; int32_t mInvalidRefreshCount = 0; int32_t mInvalidVsyncCount = 0; int32_t mInvalidVsync_2_4Count = 0; int32_t mInvalidVsyncPeriodChangeCount = 0; int32_t mInvalidSeamlessPossibleCount = 0; }; } // namespace android::hardware::graphics::composer::V2_4::vts