IssueNo:#I3V8U0

Description:Uniform display hdi for L1&L2.
Feature or Bugfix:Bugfix
Binary Source: No
Signed-off-by: JasonYujia <yujia112@126.com>
This commit is contained in:
JasonYujia 2021-06-15 09:44:18 +00:00
parent 0b58c7f017
commit bdbcfb2ee8
4 changed files with 6 additions and 72 deletions

View File

@ -92,7 +92,7 @@ SurfaceError BufferManager::Alloc(BufferRequestConfig& config, sptr<SurfaceBuffe
CHECK_BUFFER(buffer);
BufferHandle* handle = nullptr;
AllocInfo info = {config.width, config.height, config.usage, (PixelFormat)config.format, DMA_MEM};
AllocInfo info = {config.width, config.height, config.usage, (PixelFormat)config.format};
int ret = grallocFuncs_->AllocMem(&info, &handle);
if (ret == DISPLAY_SUCCESS) {

View File

@ -15,7 +15,10 @@ import("//build/ohos.gni")
## Utils BufferHandle {{{
config("buffer_handle_public_config") {
include_dirs = [ "include" ]
include_dirs = [
"include",
"//drivers/peripheral/display/interfaces/include",
]
}
ohos_static_library("buffer_handle") {

View File

@ -1,69 +0,0 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef UTILS_INCLUDE_BUFFER_HANDLE_H
#define UTILS_INCLUDE_BUFFER_HANDLE_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define BUFFER_HANDLE_MAX_RESERVE_INTS 64
#define BUFFER_HANDLE_MAX_RESERVE_FDS 64
typedef struct {
int32_t fd; /**< buffer fd, -1 if not supported */
int32_t width; /**< the width of memory */
int32_t stride; /**< the stride of memory */
int32_t height; /**< the heigh of memory */
int32_t size; /* < size of memory */
int32_t format; /**< the format of memory */
int64_t usage; /**< the usage of memory */
void *virAddr; /**< Virtual address of memory */
uint64_t phyAddr; /**< Physical address */
int32_t key; /**< Shared memory key */
uint32_t reserveFds; /**< the number of reserved fd value */
uint32_t reserveInts; /**< the number of reserved integer value */
int32_t reserve[0]; /**< the data */
} BufferHandle;
/**
* @Description: Init buffer handle, and must be freeed by FreeBufferHandle to avoid memory leak
* @param reserveInts The number of reserved integers
* @param reserveFds The number of reserved fds
* @return Returns pointer to buffer handle if the operation is successful; returns <b>nullptr</b> otherwise.
*/
BufferHandle* AllocateBufferHandle(uint32_t reserveInts, uint32_t reserveFds);
/**
* @Description: Free buffer handle allocated by AllocateBufferHandle, and close the fd at the same time.
* @param handle Buffer handle which is to be freed.
* @return Returns <b>0</b> if the operation is successful; returns <b>-1</b> if failed
*/
int32_t FreeBufferHandle(BufferHandle* handle);
/**
* @Description: clone a new buffer handle based on given buffer handle
* @param handle Buffer handle which is to be cloned.
* @return Returns pointer to buffer handle if the operation is successful; returns <b>nullptr</b> otherwise.
*/
BufferHandle* CloneBufferHandle(const BufferHandle* handle);
#ifdef __cplusplus
}
#endif
#endif // UTILS_INCLUDE_BUFFER_HANDLE_H

View File

@ -171,7 +171,7 @@ BufferHandle *ReadBufferHandle(MessageParcel &parcel)
}
if (!parcel.ReadInt32(handle->width) || !parcel.ReadInt32(handle->stride) || !parcel.ReadInt32(handle->height) ||
!parcel.ReadInt32(handle->size) || !parcel.ReadInt32(handle->format) || !parcel.ReadInt64(handle->usage) ||
!parcel.ReadInt32(handle->size) || !parcel.ReadInt32(handle->format) || !parcel.ReadUint64(handle->usage) ||
!parcel.ReadUint64(handle->phyAddr) || !parcel.ReadInt32(handle->key)) {
UTILS_LOGE("%{public}s a lot failed", __func__);
FreeBufferHandle(handle);