132a6e48fSopenharmony_ci/* 232a6e48fSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd. 332a6e48fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 432a6e48fSopenharmony_ci * you may not use this file except in compliance with the License. 532a6e48fSopenharmony_ci * You may obtain a copy of the License at 632a6e48fSopenharmony_ci * 732a6e48fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 832a6e48fSopenharmony_ci * 932a6e48fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1032a6e48fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1132a6e48fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1232a6e48fSopenharmony_ci * See the License for the specific language governing permissions and 1332a6e48fSopenharmony_ci * limitations under the License. 1432a6e48fSopenharmony_ci */ 1532a6e48fSopenharmony_ci 1632a6e48fSopenharmony_ci#ifndef FRAMEWORKS_SURFACE_INCLUDE_BUFFER_LOG_H 1732a6e48fSopenharmony_ci#define FRAMEWORKS_SURFACE_INCLUDE_BUFFER_LOG_H 1832a6e48fSopenharmony_ci 1932a6e48fSopenharmony_ci#include <hilog/log.h> 2032a6e48fSopenharmony_ci 2132a6e48fSopenharmony_cinamespace OHOS { 2232a6e48fSopenharmony_cinamespace { 2332a6e48fSopenharmony_ci// The "0xD001401" is the domain ID for graphic module that alloted by the OS. 2432a6e48fSopenharmony_ci#undef LOG_DOMAIN 2532a6e48fSopenharmony_ci#define LOG_DOMAIN 0xD001401 2632a6e48fSopenharmony_ci#undef LOG_TAG 2732a6e48fSopenharmony_ci#define LOG_TAG "Bufferqueue" 2832a6e48fSopenharmony_ci} 2932a6e48fSopenharmony_ci 3032a6e48fSopenharmony_ci#if (defined(__aarch64__) || defined(__x86_64__)) 3132a6e48fSopenharmony_ci#define BPUBI64 "%{public}ld" 3232a6e48fSopenharmony_ci#define BPUB_SIZE "%{public}lu" 3332a6e48fSopenharmony_ci#define BPUBU64 "%{public}lu" 3432a6e48fSopenharmony_ci#else 3532a6e48fSopenharmony_ci#define BPUBI64 "%{public}lld" 3632a6e48fSopenharmony_ci#define BPUB_SIZE "%{public}u" 3732a6e48fSopenharmony_ci#define BPUBU64 "%{public}llu" 3832a6e48fSopenharmony_ci#endif 3932a6e48fSopenharmony_ci 4032a6e48fSopenharmony_ci#define B_CPRINTF(func, fmt, ...) \ 4132a6e48fSopenharmony_ci func(LOG_CORE, "<%{public}s:%{public}d-%{public}s>: " fmt, \ 4232a6e48fSopenharmony_ci __FILE_NAME__, __LINE__, __func__, ##__VA_ARGS__) 4332a6e48fSopenharmony_ci 4432a6e48fSopenharmony_ci#define BLOGD(fmt, ...) B_CPRINTF(HILOG_DEBUG, fmt, ##__VA_ARGS__) 4532a6e48fSopenharmony_ci#define BLOGI(fmt, ...) B_CPRINTF(HILOG_INFO, fmt, ##__VA_ARGS__) 4632a6e48fSopenharmony_ci#define BLOGW(fmt, ...) B_CPRINTF(HILOG_WARN, fmt, ##__VA_ARGS__) 4732a6e48fSopenharmony_ci#define BLOGE(fmt, ...) B_CPRINTF(HILOG_ERROR, fmt, ##__VA_ARGS__) 4832a6e48fSopenharmony_ci 4932a6e48fSopenharmony_ci#define BLOGN_FAILURE_RET(ret) \ 5032a6e48fSopenharmony_ci do { \ 5132a6e48fSopenharmony_ci BLOGE("Fail ret: %{public}d, uniqueId: %{public}" PRIu64 ".", ret, uniqueId_); \ 5232a6e48fSopenharmony_ci return ret; \ 5332a6e48fSopenharmony_ci } while (0) 5432a6e48fSopenharmony_ci 5532a6e48fSopenharmony_ci#define BLOGE_CHECK_AND_RETURN_RET(cond, ret, fmt, ...) \ 5632a6e48fSopenharmony_ci do { \ 5732a6e48fSopenharmony_ci if (!(cond)) { \ 5832a6e48fSopenharmony_ci BLOGE(fmt, ##__VA_ARGS__); \ 5932a6e48fSopenharmony_ci return ret; \ 6032a6e48fSopenharmony_ci } \ 6132a6e48fSopenharmony_ci } while (0) 6232a6e48fSopenharmony_ci} // namespace OHOS 6332a6e48fSopenharmony_ci 6432a6e48fSopenharmony_ci#endif // FRAMEWORKS_SURFACE_INCLUDE_BUFFER_LOG_H 65