1 // Copyright 2024 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expresso or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #include <functional> 18 19 #include "gfxstream/CancelableFuture.h" 20 21 namespace gfxstream { 22 namespace host { 23 24 struct BackendCallbacks { 25 using RegisterProcessCleanupCallbackFunc = 26 std::function<void(void* key, std::function<void()> callback)>; 27 RegisterProcessCleanupCallbackFunc registerProcessCleanupCallback; 28 29 using UnregisterProcessCleanupCallbackFunc = std::function<void(void* key)>; 30 UnregisterProcessCleanupCallbackFunc unregisterProcessCleanupCallback; 31 32 using InvalidateColorBufferFunc = std::function<void(uint32_t colorBufferHandle)>; 33 InvalidateColorBufferFunc invalidateColorBuffer; 34 35 using FlushColorBufferFunc = std::function<void(uint32_t colorBufferHandle)>; 36 FlushColorBufferFunc flushColorBuffer; 37 38 using FlushColorBufferFromBytesFunc = 39 std::function<void(uint32_t colorBufferHandle, const void* bytes, size_t bytesSize)>; 40 FlushColorBufferFromBytesFunc flushColorBufferFromBytes; 41 42 using ScheduleAsyncWorkFunc = 43 std::function<CancelableFuture(std::function<void()> work, std::string description)>; 44 ScheduleAsyncWorkFunc scheduleAsyncWork; 45 }; 46 47 } // namespace host 48 } // namespace gfxstream 49