1 /* 2 * Copyright 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef SURFACE_UTILS_H_ 18 19 #define SURFACE_UTILS_H_ 20 21 #include <utils/Errors.h> 22 #include <utils/StrongPointer.h> 23 24 struct ANativeWindow; 25 class Surface; 26 27 namespace android { 28 29 struct HDRStaticInfo; 30 31 /** 32 * Configures |nativeWindow| for given |width|x|height|, pixel |format|, |rotation| and |usage|. 33 * If |reconnect| is true, reconnects to the native window before hand. 34 * @return first error encountered, or NO_ERROR on success. 35 */ 36 status_t setNativeWindowSizeFormatAndUsage( 37 ANativeWindow *nativeWindow /* nonnull */, 38 int width, int height, int format, int rotation, int usage, bool reconnect); 39 void setNativeWindowHdrMetadata( 40 ANativeWindow *nativeWindow /* nonnull */, HDRStaticInfo *info /* nonnull */); 41 status_t pushBlankBuffersToNativeWindow(ANativeWindow *nativeWindow /* nonnull */); 42 status_t nativeWindowConnect(ANativeWindow *surface, const char *reason); 43 status_t nativeWindowDisconnect(ANativeWindow *surface, const char *reason); 44 45 /** 46 * Disable buffer dropping behavior of BufferQueue if target sdk of application 47 * is Q or later. If the caller is not an app (e.g. MediaPlayer in mediaserver) 48 * retain buffer dropping behavior. 49 * 50 * @return NO_ERROR 51 */ 52 status_t disableLegacyBufferDropPostQ(const sp<Surface> &surface); 53 54 } // namespace android 55 56 #endif // SURFACE_UTILS_H_ 57