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.
90 lines
2.9 KiB
90 lines
2.9 KiB
/*
|
|
* Copyright (c) Hisilicon Technologies Co., Ltd.. 2016-2020. All rights reserved.
|
|
* Description: Support private hwgraphics hidl interface
|
|
* Author: Hisilicon
|
|
* Created: 2016.11.29
|
|
*/
|
|
#ifndef HWGRAPHICS_IAPI_COMIMPL_H
|
|
#define HWGRAPHICS_IAPI_COMIMPL_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <utils/Looper.h>
|
|
|
|
|
|
#include "uapi_win.h"
|
|
#include "uapi_gfx2d.h"
|
|
#include "HwGalleryIapiAdapter.h"
|
|
|
|
namespace android {
|
|
class HwGalleryIapiComImpl : public HwGalleryIapiAdapter {
|
|
public:
|
|
|
|
class DequeueMessageHandler : public android::MessageHandler {
|
|
public:
|
|
void handleMessage(const android::Message& message) override;
|
|
};
|
|
|
|
HwGalleryIapiComImpl();
|
|
|
|
~HwGalleryIapiComImpl() override;
|
|
|
|
int Init(uint32_t w, uint32_t h) override;
|
|
int VoDeinit() override;
|
|
int VoInit(uint32_t w, uint32_t h);
|
|
int VoWindowSetting(td_u32 w, td_u32 h) override;
|
|
int VoDoFramex(const private_handle_t& handle, const ExtendFrameInfo &extendInfo) override;
|
|
int VoGetFormat(td_u32 &type) override;
|
|
void VoGetWindowHandle(td_u32 &windowHandle) override;
|
|
int VoDoFramexSync() override;
|
|
void VoSetFrameInfo(const private_handle_t& handle, uapi_video_frame_info &stFrame,
|
|
const ExtendFrameInfo &extendInfo);
|
|
void GetDisplayId(void);
|
|
bool Is8KFormat();
|
|
void GetDefaultWindowAttr(uapi_win_attr &pstWinAttr) const;
|
|
|
|
void VoDoDequeue(void);
|
|
int CreateDequeueThread() override;
|
|
void DequeueThreadFun(void);
|
|
void SendDequeueMessage(void) const;
|
|
|
|
int RMRegister(void) override;
|
|
int RMUnRegister(void) override;
|
|
int RMAcquireResource(void) override;
|
|
|
|
struct VideoBufferHandle {
|
|
td_mem_handle_t handle;
|
|
uint32_t width;
|
|
uint32_t height;
|
|
uint32_t stride;
|
|
};
|
|
|
|
int InitVideoBuffer(uint32_t width, uint32_t height);
|
|
int CreateVideoScreen(VideoBufferHandle &videoBufHandle, uint32_t width, uint32_t height);
|
|
void DestroyVideoScreen(void);
|
|
int ConvertARGBToYUV420SP(const private_handle_t& srcBufHandle, const VideoBufferHandle &videoBufHandle);
|
|
void TdeCreateSrcSurface(uapi_gfx2d_surface &srcSurface, const private_handle_t &srcBufHandle,
|
|
uapi_gfx2d_attr &attr) const;
|
|
void TdeCreateDstSurface(uapi_gfx2d_surface &dstSurface, const VideoBufferHandle &videoBufHandle,
|
|
uapi_gfx2d_attr &attr);
|
|
|
|
private:
|
|
|
|
void DealVideoFrameInfo(const private_handle_t &handle, uapi_video_frame_info &stFrame) const;
|
|
std::vector<VideoBufferHandle> m_videoBuffers;
|
|
std::map<uint32_t, uapi_color_primary> m_colorSpaceMap;
|
|
int m_frameRate;
|
|
int m_formatType;
|
|
bool m_isRmRegister;
|
|
unsigned int m_frameIndex;
|
|
int m_frameCount;
|
|
int m_bufCount;
|
|
bool m_isInitialized;
|
|
android::sp<android::Looper> m_looper;
|
|
td_handle m_rmService;
|
|
td_handle m_socWindow;
|
|
uapi_disp m_displayId;
|
|
};
|
|
}
|
|
#endif
|