1 /* 2 * Copyright 2023 Google LLC 3 * SPDX-License-Identifier: MIT 4 */ 5 6 #pragma once 7 8 #include <EGL/egl.h> 9 #include <EGL/eglext.h> 10 11 #include "gfxstream/guest/ANativeWindow.h" 12 13 namespace gfxstream { 14 15 class ANativeWindowHelperAndroid : public ANativeWindowHelper { 16 public: 17 ANativeWindowHelperAndroid() = default; 18 19 bool isValid(EGLNativeWindowType window); 20 bool isValid(EGLClientBuffer buffer); 21 22 void acquire(EGLNativeWindowType window); 23 void release(EGLNativeWindowType window); 24 25 void acquire(EGLClientBuffer buffer); 26 void release(EGLClientBuffer buffer); 27 28 int getConsumerUsage(EGLNativeWindowType window, int* usage); 29 void setUsage(EGLNativeWindowType window, int usage); 30 31 int getWidth(EGLNativeWindowType window); 32 int getHeight(EGLNativeWindowType window); 33 34 int getWidth(EGLClientBuffer buffer); 35 int getHeight(EGLClientBuffer buffer); 36 37 int getFormat(EGLClientBuffer buffer, Gralloc* helper); 38 39 void setSwapInterval(EGLNativeWindowType window, int interval); 40 41 int queueBuffer(EGLNativeWindowType window, EGLClientBuffer buffer, int fence); 42 int dequeueBuffer(EGLNativeWindowType window, EGLClientBuffer* buffer, int* fence); 43 int cancelBuffer(EGLNativeWindowType window, EGLClientBuffer buffer); 44 45 int getHostHandle(EGLClientBuffer buffer, Gralloc* helper); 46 }; 47 48 } // namespace gfxstream 49