You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.9 KiB
74 lines
1.9 KiB
/*
|
|
* Copyright (c) Hisilicon Technologies Co., Ltd.. 2019-2022. All rights reserved.
|
|
* Description: Support hwdisplay hal adaptation interface
|
|
* Author: Hisilicon
|
|
* Created: 2022-12-28
|
|
*/
|
|
|
|
#ifndef DISPLAY_H
|
|
#define DISPLAY_H
|
|
|
|
#include <hardware/hardware.h>
|
|
#include <sys/types.h>
|
|
#include <log/log.h>
|
|
#include <binder/Parcel.h>
|
|
|
|
#include "uapi_svr_dispmng.h"
|
|
__BEGIN_DECLS
|
|
|
|
#define DISP_MNG_VERSION
|
|
|
|
#define DISPLAY_HARDWARE_MODULE_ID "display"
|
|
#define DISPLAY_HARDWARE_DISPLAY0 "video15"
|
|
|
|
/* display module struct */
|
|
typedef struct DisplayModuleT {
|
|
struct hw_module_t common;
|
|
} DisplayModuleT;
|
|
|
|
#ifdef DISP_MNG_VERSION
|
|
/* Display Manager Event */
|
|
typedef void (*DispmngEventCallback)(uapi_svr_dispmng_event event, void *msg, unsigned int msglen, void *privdata);
|
|
|
|
#endif
|
|
|
|
/* display HAL struct */
|
|
typedef struct DisplayDeviceT {
|
|
struct hw_device_t common;
|
|
|
|
int(*invoke)(const android::Parcel &request, android::Parcel &reply);
|
|
#ifdef DISP_MNG_VERSION
|
|
int(*registerDispmngCallback)(unsigned int event, DispmngEventCallback callback, void *arg);
|
|
int(*unregisterDispmngCallback)(unsigned int event, DispmngEventCallback callback);
|
|
#endif
|
|
} DisplayDeviceT;
|
|
|
|
/* display context struct */
|
|
typedef struct DisplayContextT {
|
|
struct DisplayDeviceT device;
|
|
} DisplayContextT;
|
|
|
|
/* display HAL interface, fill the device struct, enable it to use set or get value function */
|
|
static inline int displayOpen(const struct hw_module_t *module,
|
|
hw_device_t **device)
|
|
{
|
|
if (module != nullptr && module->methods != nullptr) {
|
|
return module->methods->open(module, DISPLAY_HARDWARE_DISPLAY0, device);
|
|
} else {
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
/* release module source when the end */
|
|
static inline int displayClose(struct DisplayDeviceT *device)
|
|
{
|
|
if (device != nullptr) {
|
|
return device->common.close(&device->common);
|
|
} else {
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
__END_DECLS
|
|
#endif
|