1/* 2 * Copyright (c) 2023 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#ifndef OHOS_HDI_DISPLAY_BUFFER_V1_0_DISPLAYBUFFERTYPE_H 17#define OHOS_HDI_DISPLAY_BUFFER_V1_0_DISPLAYBUFFERTYPE_H 18 19#include <cstdbool> 20#include <cstdint> 21 22#ifndef HDI_BUFF_MAX_SIZE 23#define HDI_BUFF_MAX_SIZE (1024 * 200) 24#endif 25 26#ifndef HDI_CHECK_VALUE_RETURN 27#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ 28 if ((lv) compare (rv)) { \ 29 return ret; \ 30 } \ 31} while (false) 32#endif 33 34#ifndef HDI_CHECK_VALUE_RET_GOTO 35#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ 36 if ((lv) compare (rv)) { \ 37 ret = value; \ 38 goto table; \ 39 } \ 40} while (false) 41#endif 42 43namespace OHOS { 44class MessageParcel; 45} 46 47namespace OHOS { 48namespace HDI { 49namespace Display { 50namespace Buffer { 51namespace V1_0 { 52 53using namespace OHOS; 54 55struct AllocInfo { 56 uint32_t width; 57 uint32_t height; 58 uint64_t usage; 59 uint32_t format; 60 uint32_t expectedSize; 61} __attribute__ ((aligned(8))); 62 63struct VerifyAllocInfo { 64 uint32_t width; 65 uint32_t height; 66 uint64_t usage; 67 uint32_t format; 68} __attribute__ ((aligned(8))); 69 70bool AllocInfoBlockMarshalling(OHOS::MessageParcel &data, const OHOS::HDI::Display::Buffer::V1_0::AllocInfo& dataBlock); 71 72bool AllocInfoBlockUnmarshalling(OHOS::MessageParcel &data, OHOS::HDI::Display::Buffer::V1_0::AllocInfo& dataBlock); 73 74bool VerifyAllocInfoBlockMarshalling(OHOS::MessageParcel &data, const OHOS::HDI::Display::Buffer::V1_0::VerifyAllocInfo& dataBlock); 75 76bool VerifyAllocInfoBlockUnmarshalling(OHOS::MessageParcel &data, OHOS::HDI::Display::Buffer::V1_0::VerifyAllocInfo& dataBlock); 77 78} // V1_0 79} // Buffer 80} // Display 81} // HDI 82} // OHOS 83 84#endif // OHOS_HDI_DISPLAY_BUFFER_V1_0_DISPLAYBUFFERTYPE_H 85 86