1 /*
2  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
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 express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup Surface
18  * @{
19  *
20  * @brief Provides shared memory for multimedia and graphics.
21  *
22  * This module is used to apply for and release shared memory and is used by the multimedia and graphics modules
23  * across processes.
24  *
25  * @since 1.0
26  * @version 1.0
27  */
28 
29 /**
30  * @file surface_type.h
31  *
32  * @brief Provides the capabilities of setting shared memory parameters.
33  *
34  * @since 1.0
35  * @version 1.0
36  */
37 
38 #ifndef GRAPHIC_LITE_SURFACE_TYPE_H
39 #define GRAPHIC_LITE_SURFACE_TYPE_H
40 
41 #include "gfx_utils/pixel_format_utils.h"
42 
43 namespace OHOS {
44 constexpr uint16_t SURFACE_MAX_WIDTH = 7680;
45 constexpr uint16_t SURFACE_MAX_HEIGHT = 7680;
46 constexpr uint16_t SURFACE_MAX_QUEUE_SIZE = 10;
47 constexpr uint16_t SURFACE_MIN_QUEUE_SIZE = 1;
48 constexpr uint16_t SURFACE_DEFAULT_QUEUE_SIZE = 1;
49 constexpr uint16_t SURFACE_MAX_STRIDE_ALIGNMENT = 32;
50 constexpr uint16_t SURFACE_MIN_STRIDE_ALIGNMENT = 4;
51 constexpr uint16_t SURFACE_DEFAULT_STRIDE_ALIGNMENT = 4;
52 #define SURFACE_MAX_SIZE 58982400 // 8K * 8K
53 
54 /**
55  * @brief Enumerates shared memory usage scenarios, including physically contiguous memory and virtual memory.
56  *
57  */
58 enum BufferConsumerUsage {
59     /** Virtual memory */
60     BUFFER_CONSUMER_USAGE_SORTWARE = 0,
61     /** Physically contiguous memory. The cache is not used. */
62     BUFFER_CONSUMER_USAGE_HARDWARE,
63     /** Physically contiguous memory. Consumers use the cache. */
64     BUFFER_CONSUMER_USAGE_HARDWARE_CONSUMER_CACHE,
65     /** Physically contiguous memory. Producers use the cache. */
66     BUFFER_CONSUMER_USAGE_HARDWARE_PRODUCER_CACHE,
67     /** Valid maximum value, used to determine whether the current shared memory usage scenario is within a proper
68      *  range. */
69     BUFFER_CONSUMER_USAGE_MAX
70 };
71 } // end namespace OHOS
72 #endif
73