Home | History | Annotate | Download | only in gralloc960
      1 /*
      2  * Copyright (C) 2010-2017 ARM Limited. All rights reserved.
      3  *
      4  * Copyright (C) 2008 The Android Open Source Project
      5  *
      6  * Licensed under the Apache License, Version 2.0 (the "License");
      7  * you may not use this file except in compliance with the License.
      8  * You may obtain a copy of the License at
      9  *
     10  *      http://www.apache.org/licenses/LICENSE-2.0
     11  *
     12  * Unless required by applicable law or agreed to in writing, software
     13  * distributed under the License is distributed on an "AS IS" BASIS,
     14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15  * See the License for the specific language governing permissions and
     16  * limitations under the License.
     17  */
     18 
     19 #ifndef GRALLOC_HELPER_H_
     20 #define GRALLOC_HELPER_H_
     21 
     22 #include <sys/mman.h>
     23 #include <android/log.h>
     24 
     25 #ifndef AWAR
     26 #define AWAR(fmt, args...) \
     27 	__android_log_print(ANDROID_LOG_WARN, "[Gralloc-Warning]", "%s:%d " fmt, __func__, __LINE__, ##args)
     28 #endif
     29 #ifndef AINF
     30 #define AINF(fmt, args...) __android_log_print(ANDROID_LOG_INFO, "[Gralloc]", fmt, ##args)
     31 #endif
     32 #ifndef AERR
     33 #define AERR(fmt, args...) \
     34 	__android_log_print(ANDROID_LOG_ERROR, "[Gralloc-ERROR]", "%s:%d " fmt, __func__, __LINE__, ##args)
     35 #endif
     36 #ifndef AERR_IF
     37 #define AERR_IF(eq, fmt, args...) \
     38 	if ((eq))                     \
     39 	AERR(fmt, args)
     40 #endif
     41 
     42 #define GRALLOC_ALIGN(value, base) (((value) + ((base)-1)) & ~((base)-1))
     43 
     44 #define GRALLOC_UNUSED(x) ((void)x)
     45 
     46 static inline size_t round_up_to_page_size(size_t x)
     47 {
     48 	return (x + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
     49 }
     50 
     51 #endif /* GRALLOC_HELPER_H_ */
     52