xref: /OK3568_Linux_fs/external/linux-rga/core/utils/utils.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (C) 2022 Rockchip Electronics Co., Ltd.
3*4882a593Smuzhiyun  * Authors:
4*4882a593Smuzhiyun  *  Cerf Yu <cerf.yu@rock-chips.com>
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Licensed under the Apache License, Version 2.0 (the "License");
7*4882a593Smuzhiyun  * you may not use this file except in compliance with the License.
8*4882a593Smuzhiyun  * You may obtain a copy of the License at
9*4882a593Smuzhiyun  *
10*4882a593Smuzhiyun  *      http://www.apache.org/licenses/LICENSE-2.0
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * Unless required by applicable law or agreed to in writing, software
13*4882a593Smuzhiyun  * distributed under the License is distributed on an "AS IS" BASIS,
14*4882a593Smuzhiyun  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15*4882a593Smuzhiyun  * See the License for the specific language governing permissions and
16*4882a593Smuzhiyun  * limitations under the License.
17*4882a593Smuzhiyun  */
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun #include "android_utils/android_utils.h"
20*4882a593Smuzhiyun #include "drm_utils/drm_utils.h"
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun /*
23*4882a593Smuzhiyun  * When a pointer is converted to uint64_t, it must first be assigned to
24*4882a593Smuzhiyun  * an integer of the same size, and then converted to uint64_t. The opposite
25*4882a593Smuzhiyun  * is true.
26*4882a593Smuzhiyun  */
27*4882a593Smuzhiyun #define ptr_to_u64(ptr) ((uint64_t)(uintptr_t)(ptr))
28*4882a593Smuzhiyun #define u64_to_ptr(var) ((void *)(uintptr_t)(var))
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun #define is_rga_format(format) ((format) & 0xff00 || (format) == 0)
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun int convert_to_rga_format(int ex_format);
33