From 1667e341f1a89aa409430e735dd1e348b22b57f2 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Thu, 17 Feb 2022 11:46:49 +0800 Subject: [PATCH 01/27] code format Signed-off-by: suxiansheng32 --- hardware/rga/include/RgaApi.h | 4 ++-- hardware/rga/include/rga.h | 30 ++++++++++++++---------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/hardware/rga/include/RgaApi.h b/hardware/rga/include/RgaApi.h index b505090..6dc96f5 100755 --- a/hardware/rga/include/RgaApi.h +++ b/hardware/rga/include/RgaApi.h @@ -44,11 +44,11 @@ extern "C"{ * compatibility with the old C interface, so please do * not use ctx, because it is usually a NULL. */ -#define RgaInit(ctx) ({ \ +#define RgaInit(ctx) ( { \ int ret = 0; \ ret = c_RkRgaInit(); \ c_RkRgaGetContext(ctx); \ - ret;\ + ret; \ }) #define RgaDeInit(ctx) { \ (void)(ctx); /* unused */ \ diff --git a/hardware/rga/include/rga.h b/hardware/rga/include/rga.h index 6a573b8..dd0e5fa 100755 --- a/hardware/rga/include/rga.h +++ b/hardware/rga/include/rga.h @@ -86,11 +86,11 @@ enum { yuv2yuv_601_limit_2_709_limit = 0x3 << 8, yuv2yuv_601_limit_2_709_full = 0x4 << 8, yuv2yuv_709_limit_2_601_limit = 0x5 << 8, - yuv2yuv_709_limit_2_601_full = 0x6 << 8, //not support + yuv2yuv_709_limit_2_601_full = 0x6 << 8, // not support yuv2yuv_601_full_2_709_limit = 0x7 << 8, - yuv2yuv_601_full_2_709_full = 0x8 << 8, //not support - yuv2yuv_709_full_2_601_limit = 0x9 << 8, //not support - yuv2yuv_709_full_2_601_full = 0xa << 8, //not support + yuv2yuv_601_full_2_709_full = 0x8 << 8, // not support + yuv2yuv_709_full_2_601_limit = 0x9 << 8, // not support + yuv2yuv_709_full_2_601_full = 0xa << 8, // not support full_csc_mask = 0xf00, }; @@ -201,7 +201,7 @@ typedef struct rga_img_info_t { unsigned int uv_addr; /* cb/cr mem addr */ unsigned int v_addr; /* cr mem addr */ #endif - unsigned int format; //definition by RK_FORMAT + unsigned int format; // definition by RK_FORMAT unsigned short act_w; unsigned short act_h; unsigned short x_offset; @@ -210,7 +210,7 @@ typedef struct rga_img_info_t { unsigned short vir_w; unsigned short vir_h; - unsigned short endian_mode; //for BPP + unsigned short endian_mode; // for BPP unsigned short alpha_swap; } rga_img_info_t; @@ -260,12 +260,10 @@ typedef struct MMU { #else unsigned int base_addr; #endif - unsigned int mmu_flag; /* [0] mmu enable [1] src_flush [2] dst_flush [3] CMD_flush [4~5] page size*/ + unsigned int mmu_flag; /* [0] mmu enable [1] src_flush [2] dst_flush [3] CMD_flush [4~5] page size */ } MMU; - - typedef struct COLOR_FILL { short gr_x_a; short gr_y_a; @@ -276,7 +274,7 @@ typedef struct COLOR_FILL { short gr_x_r; short gr_y_r; - //u8 cp_gr_saturation; + // u8 cp_gr_saturation; } COLOR_FILL; @@ -329,7 +327,7 @@ struct rga_req { #endif RECT clip; /* dst clip window default value is dst_vir */ - /* value from [0, w-1] / [0, h-1]*/ + /* value from [0, w-1] / [0, h-1] */ int sina; /* dst angle default value 0 16.16 scan from table */ int cosa; /* dst angle default value 0 16.16 scan from table */ @@ -364,15 +362,15 @@ struct rga_req { unsigned char alpha_global_value; /* global alpha value */ - unsigned short rop_code; /* rop2/3/4 code scan from rop code table*/ + unsigned short rop_code; /* rop2/3/4 code scan from rop code table */ - unsigned char bsfilter_flag; /* [2] 0 blur 1 sharp / [1:0] filter_type*/ + unsigned char bsfilter_flag; /* [2] 0 blur 1 sharp / [1:0] filter_type */ - unsigned char palette_mode; /* (enum) color palatte 0/1bpp, 1/2bpp 2/4bpp 3/8bpp*/ + unsigned char palette_mode; /* (enum) color palatte 0/1bpp, 1/2bpp 2/4bpp 3/8bpp */ unsigned char yuv2rgb_mode; /* (enum) BT.601 MPEG / BT.601 JPEG / BT.709 */ - unsigned char endian_mode; /* 0/big endian 1/little endian*/ + unsigned char endian_mode; /* 0/big endian 1/little endian */ unsigned char rotate_mode; /* (enum) rotate mode */ /* 0x0, no rotate */ @@ -655,4 +653,4 @@ int RGA_get_dst_fence( } #endif -#endif /*_RK29_IPP_DRIVER_H_*/ \ No newline at end of file +#endif /* _RK29_IPP_DRIVER_H_ */ -- Gitee From fc10c9bca7f2a4315b66744b09728fbc42a35419 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Thu, 17 Feb 2022 15:39:00 +0800 Subject: [PATCH 02/27] code Signed-off-by: suxiansheng32 --- hardware/mpp/include/mpi_enc_utils.h | 2 +- hardware/mpp/include/mpp_list.h | 5 ++--- hardware/mpp/include/mpp_log.h | 10 +++++----- hardware/mpp/include/mpp_thread.h | 14 +++++++------- hardware/mpp/include/vpu_api.h | 9 +++------ hardware/rga/include/im2d.h | 3 +-- 6 files changed, 19 insertions(+), 24 deletions(-) diff --git a/hardware/mpp/include/mpi_enc_utils.h b/hardware/mpp/include/mpi_enc_utils.h index 9c93663..7510250 100644 --- a/hardware/mpp/include/mpi_enc_utils.h +++ b/hardware/mpp/include/mpi_enc_utils.h @@ -38,7 +38,7 @@ typedef struct { // base flow context MppCtx ctx; MppApi *mpi; - MppEncCfg cfg; + MppEncCfg cfg; // input / output MppBufferGroup buf_grp; diff --git a/hardware/mpp/include/mpp_list.h b/hardware/mpp/include/mpp_list.h index f01315e..db24eef 100644 --- a/hardware/mpp/include/mpp_list.h +++ b/hardware/mpp/include/mpp_list.h @@ -31,8 +31,7 @@ typedef void *(*node_destructor)(void *); struct mpp_list_node; -class mpp_list : public MppMutexCond -{ +class mpp_list : public MppMutexCond { public: mpp_list(node_destructor func = NULL); ~mpp_list(); @@ -191,4 +190,4 @@ static __inline int list_empty(struct list_head *head) #endif -#endif /* __MPP_LIST_H__ */ \ No newline at end of file +#endif /* __MPP_LIST_H__ */ diff --git a/hardware/mpp/include/mpp_log.h b/hardware/mpp/include/mpp_log.h index 5b15d8f..028161f 100644 --- a/hardware/mpp/include/mpp_log.h +++ b/hardware/mpp/include/mpp_log.h @@ -32,10 +32,10 @@ #define mpp_err(fmt, ...) _mpp_err(MODULE_TAG, fmt, NULL, ## __VA_ARGS__) #define _mpp_dbg(debug, flag, fmt, ...) \ - do { \ - if (debug & flag) \ + do { \ + if (debug & flag) \ mpp_log(fmt, ## __VA_ARGS__); \ - } while (0) + } while (0) #define mpp_dbg(flag, fmt, ...) _mpp_dbg(mpp_debug, flag, fmt, ## __VA_ARGS__) @@ -46,8 +46,8 @@ #define mpp_err_f(fmt, ...) _mpp_err(MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) #define _mpp_dbg_f(debug, flag, fmt, ...) \ do { \ - if (debug & flag) \ - mpp_log_f(fmt, ## __VA_ARGS__); \ + if (debug & flag) \ + mpp_log_f(fmt, ## __VA_ARGS__); \ } while (0) #define mpp_dbg_f(flag, fmt, ...) _mpp_dbg_f(mpp_debug, flag, fmt, ## __VA_ARGS__) diff --git a/hardware/mpp/include/mpp_thread.h b/hardware/mpp/include/mpp_thread.h index e612d27..45a85a7 100644 --- a/hardware/mpp/include/mpp_thread.h +++ b/hardware/mpp/include/mpp_thread.h @@ -77,12 +77,12 @@ public: class Autolock { public: inline Autolock(Mutex* mutex, RK_U32 enable = 1) : - mEnabled(enable), - mLock(*mutex) - { - if (mEnabled) - mLock.lock(); - } + mEnabled(enable), + mLock(*mutex) + { + if (mEnabled) + mLock.lock(); + } inline ~Autolock() { if (mEnabled) @@ -312,4 +312,4 @@ private: #endif -#endif /* __MPP_THREAD_H__ */ \ No newline at end of file +#endif /* __MPP_THREAD_H__ */ diff --git a/hardware/mpp/include/vpu_api.h b/hardware/mpp/include/vpu_api.h index 28ca787..19bb60a 100644 --- a/hardware/mpp/include/vpu_api.h +++ b/hardware/mpp/include/vpu_api.h @@ -208,7 +208,6 @@ typedef struct EncoderOut { RK_S32 size; RK_S64 timeUs; RK_S32 keyFrame; - } EncoderOut_t; /* @@ -269,13 +268,12 @@ typedef enum VPU_API_ERR { typedef enum VPU_FRAME_ERR { VPU_FRAME_ERR_UNKNOW = 0x0001, VPU_FRAME_ERR_UNSUPPORT = 0x0002, - } VPU_FRAME_ERR; typedef struct EncParameter { RK_S32 width; RK_S32 height; - RK_S32 rc_mode; /* 0 - CQP mode; 1 - CBR mode; 2 - FIXQP mode*/ + RK_S32 rc_mode; /* 0 - CQP mode; 1 - CBR mode; 2 - FIXQP mode */ RK_S32 bitRate; /* target bitrate */ RK_S32 framerate; RK_S32 qp; @@ -327,7 +325,6 @@ typedef struct VpuCodecContext { */ RK_S32 decoder_err; - /** * Allocate and initialize an VpuCodecContext. * @@ -427,7 +424,7 @@ RK_S32 vpu_close_context(struct VpuCodecContext **ctx); RK_S32 (*put_used)(vpu_display_mem_pool *p, void *hdl); \ RK_S32 (*reset)(vpu_display_mem_pool *p); \ RK_S32 (*get_unused_num)(vpu_display_mem_pool *p); \ - RK_S32 buff_size;\ + RK_S32 buff_size; \ float version; \ RK_S32 res[18]; @@ -468,4 +465,4 @@ void release_vpu_memory_pool_allocator(vpu_display_mem_pool *ipool); } #endif -#endif /* __VPU_API_H__ */ \ No newline at end of file +#endif /* __VPU_API_H__ */ diff --git a/hardware/rga/include/im2d.h b/hardware/rga/include/im2d.h index 1112e24..02f140d 100755 --- a/hardware/rga/include/im2d.h +++ b/hardware/rga/include/im2d.h @@ -69,7 +69,6 @@ typedef enum { IM_NN_QUANTIZE = 1 << 23, IM_ROP = 1 << 24, IM_ALPHA_BLEND_PRE_MUL = 1 << 25, - } IM_USAGE; typedef enum { @@ -909,4 +908,4 @@ IM_API IM_STATUS imsync(void); #ifdef __cplusplus } #endif -#endif /* _im2d_h_ */ \ No newline at end of file +#endif /* _im2d_h_ */ -- Gitee From 2bc5a0b2cbb79630a0260db1f856dd8ef0f042ca Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Thu, 17 Feb 2022 16:02:38 +0800 Subject: [PATCH 03/27] code Signed-off-by: suxiansheng32 --- hardware/mpp/include/mpp_log.h | 16 ++++++++-------- hardware/mpp/include/mpp_thread.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hardware/mpp/include/mpp_log.h b/hardware/mpp/include/mpp_log.h index 028161f..26187ce 100644 --- a/hardware/mpp/include/mpp_log.h +++ b/hardware/mpp/include/mpp_log.h @@ -32,10 +32,10 @@ #define mpp_err(fmt, ...) _mpp_err(MODULE_TAG, fmt, NULL, ## __VA_ARGS__) #define _mpp_dbg(debug, flag, fmt, ...) \ - do { \ - if (debug & flag) \ - mpp_log(fmt, ## __VA_ARGS__); \ - } while (0) + do { \ + if (debug & flag) \ + mpp_log(fmt, ## __VA_ARGS__); \ + } while (0) #define mpp_dbg(flag, fmt, ...) _mpp_dbg(mpp_debug, flag, fmt, ## __VA_ARGS__) @@ -45,10 +45,10 @@ #define mpp_log_f(fmt, ...) _mpp_log(MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) #define mpp_err_f(fmt, ...) _mpp_err(MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) #define _mpp_dbg_f(debug, flag, fmt, ...) \ - do { \ - if (debug & flag) \ - mpp_log_f(fmt, ## __VA_ARGS__); \ - } while (0) + do { \ + if (debug & flag) \ + mpp_log_f(fmt, ## __VA_ARGS__); \ + } while (0) #define mpp_dbg_f(flag, fmt, ...) _mpp_dbg_f(mpp_debug, flag, fmt, ## __VA_ARGS__) diff --git a/hardware/mpp/include/mpp_thread.h b/hardware/mpp/include/mpp_thread.h index 45a85a7..4a4cd36 100644 --- a/hardware/mpp/include/mpp_thread.h +++ b/hardware/mpp/include/mpp_thread.h @@ -81,7 +81,7 @@ public: mLock(*mutex) { if (mEnabled) - mLock.lock(); + mLock.lock(); } inline ~Autolock() { -- Gitee From 7a238a141bceec845d714dc17ebb07bcdae52939 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Thu, 17 Feb 2022 16:14:09 +0800 Subject: [PATCH 04/27] code format Signed-off-by: suxiansheng32 --- hardware/mpp/include/mpp_log.h | 2 +- hardware/mpp/include/mpp_thread.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware/mpp/include/mpp_log.h b/hardware/mpp/include/mpp_log.h index 26187ce..d256c52 100644 --- a/hardware/mpp/include/mpp_log.h +++ b/hardware/mpp/include/mpp_log.h @@ -46,7 +46,7 @@ #define mpp_err_f(fmt, ...) _mpp_err(MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) #define _mpp_dbg_f(debug, flag, fmt, ...) \ do { \ - if (debug & flag) \ + if (debug & flag) \ mpp_log_f(fmt, ## __VA_ARGS__); \ } while (0) diff --git a/hardware/mpp/include/mpp_thread.h b/hardware/mpp/include/mpp_thread.h index 4a4cd36..52af317 100644 --- a/hardware/mpp/include/mpp_thread.h +++ b/hardware/mpp/include/mpp_thread.h @@ -80,7 +80,7 @@ public: mEnabled(enable), mLock(*mutex) { - if (mEnabled) + if (mEnabled) mLock.lock(); } inline ~Autolock() -- Gitee From 185618682488fb7e9bab1ab5307377d7ec671a58 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Thu, 17 Feb 2022 18:03:05 +0800 Subject: [PATCH 05/27] code format Signed-off-by: suxiansheng32 --- hardware/display/include/display_common.h | 2 +- .../display/src/display_device/hdi_layer.cpp | 6 +-- .../display/src/display_gfx/display_gfx.c | 15 +++---- hardware/gpu/include/gbm.h | 6 +-- hardware/mpp/include/rk_venc_cmd.h | 3 +- hardware/mpp/src/mpi_enc_utils.c | 2 +- hardware/rga/include/GrallocOps.h | 2 +- hardware/rga/include/RgaMutex.h | 43 ++++++++++++------- hardware/rga/include/RgaSingleton.h | 14 +++--- hardware/rga/include/RockchipRga.h | 18 +++++--- hardware/rga/include/drmrga.h | 4 +- hardware/rga/include/platform_gralloc4.h | 5 +-- .../src/pipeline_core/node/rk_codec_node.cpp | 3 +- 13 files changed, 67 insertions(+), 56 deletions(-) diff --git a/hardware/display/include/display_common.h b/hardware/display/include/display_common.h index 22f6271..ae6fefa 100644 --- a/hardware/display/include/display_common.h +++ b/hardware/display/include/display_common.h @@ -117,4 +117,4 @@ extern "C" { } #endif -#endif /* DISP_COMMON_H */ \ No newline at end of file +#endif /* DISP_COMMON_H */ diff --git a/hardware/display/src/display_device/hdi_layer.cpp b/hardware/display/src/display_device/hdi_layer.cpp index 51f4c95..c7d690d 100644 --- a/hardware/display/src/display_device/hdi_layer.cpp +++ b/hardware/display/src/display_device/hdi_layer.cpp @@ -89,8 +89,7 @@ int32_t HdiLayer::Init() int32_t HdiLayer::SetLayerSize(IRect *rect) { DISPLAY_CHK_RETURN((rect == nullptr), DISPLAY_NULL_PTR, DISPLAY_LOGE("in rect is nullptr")); - DISPLAY_DEBUGLOG(" displayRect x: %{public}d y : %{public}d w : %{public}d h : %{public}d", rect->x, rect->y, rect->w, - rect->h); + DISPLAY_DEBUGLOG(" displayRect x: %{public}d y : %{public}d w : %{public}d h : %{public}d", rect->x, rect->y, rect->w,rect->h); mDisplayRect = *rect; return DISPLAY_SUCCESS; } @@ -142,8 +141,7 @@ int32_t HdiLayer::SetLayerDirtyRegion(IRect *region) int32_t HdiLayer::SetLayerVisibleRegion(uint32_t num, IRect *rect) { - DISPLAY_DEBUGLOG("id : %{public}d DirtyRegion x: %{public}d y : %{public}d w : %{public}d h : %{public}d", mId, rect->x, - rect->y, rect->w, rect->h); + DISPLAY_DEBUGLOG("id : %{public}d DirtyRegion x: %{public}d y : %{public}d w : %{public}d h : %{public}d", mId, rect->x,rect->y, rect->w, rect->h); return DISPLAY_SUCCESS; } diff --git a/hardware/display/src/display_gfx/display_gfx.c b/hardware/display/src/display_gfx/display_gfx.c index a821aad..cdcc81e 100644 --- a/hardware/display/src/display_gfx/display_gfx.c +++ b/hardware/display/src/display_gfx/display_gfx.c @@ -178,7 +178,7 @@ int32_t rkFillRect(ISurface *iSurface, IRect *rect, uint32_t color, GfxOpt *opt) DISPLAY_LOGE("source iSurface address error"); return DISPLAY_PARAM_ERR; } - DISPLAY_LOGE("gfx vir %{public}p phy 0x%{public}x fd %{public}d",dst.vir_addr, (int32_t)dst.phy_addr, dst.fd); + DISPLAY_LOGE("gfx vir %{public}p phy 0x%{public}x fd %{public}d", dst.vir_addr, (int32_t)dst.phy_addr, dst.fd); dst.width = iSurface->width; dst.height = iSurface->height; dst.wstride = ALIGN_UP(iSurface->width, 16); @@ -189,7 +189,6 @@ int32_t rkFillRect(ISurface *iSurface, IRect *rect, uint32_t color, GfxOpt *opt) if (opt->enGlobalAlpha) dst.global_alpha = opt->globalAlpha; ret = imfill(dst, imRect, color); - if (ret != IM_STATUS_SUCCESS) return DISPLAY_FAILURE; else @@ -199,9 +198,9 @@ int32_t rkFillRect(ISurface *iSurface, IRect *rect, uint32_t color, GfxOpt *opt) int32_t blendTypeChange(BlendType blendType) { int32_t rkBlendType; - switch(blendType) { + switch (blendType) { case BLEND_SRC: /**< SRC blending */ - rkBlendType = IM_ALPHA_BLEND_SRC; + rkBlendType = IM_ALPHA_BLEND_SRC; break; case BLEND_DST: /**< SRC blending */ rkBlendType = IM_ALPHA_BLEND_DST; @@ -228,7 +227,7 @@ int32_t blendTypeChange(BlendType blendType) // BLEND_AKS: /**< AKS blending */ // BLEND_AKD: /**< AKD blending */ // BLEND_BUTT: /**< Null operation */ - rkBlendType = IM_STATUS_NOT_SUPPORTED; + rkBlendType = IM_STATUS_NOT_SUPPORTED; break; } return rkBlendType; @@ -237,7 +236,7 @@ int32_t blendTypeChange(BlendType blendType) int32_t TransformTypeChange(TransformType type) { int32_t rkRotateType; - switch(type) { + switch (type) { case ROTATE_90: /**< Rotation by 90 degrees */ rkRotateType = IM_HAL_TRANSFORM_ROT_90; break; @@ -257,7 +256,7 @@ int32_t TransformTypeChange(TransformType type) int32_t mirrorTypeChange(MirrorType type) { int32_t rkMirrorType; - switch(type) { + switch (type) { case MIRROR_LR: /**< Left and right mirrors */ rkMirrorType = IM_HAL_TRANSFORM_FLIP_H; break; @@ -511,4 +510,4 @@ int32_t GfxUninitialize(GfxFuncs *funcs) free(funcs); DISPLAY_LOGI("%s: gfx uninitialize success", __func__); return DISPLAY_SUCCESS; -} \ No newline at end of file +} diff --git a/hardware/gpu/include/gbm.h b/hardware/gpu/include/gbm.h index 3380dde..1e8bc46 100644 --- a/hardware/gpu/include/gbm.h +++ b/hardware/gpu/include/gbm.h @@ -60,7 +60,7 @@ union gbm_bo_handle { /** Format of the allocated buffer */ enum gbm_bo_format { /** RGB with 8 bits per channel in a 32 bit value */ - GBM_BO_FORMAT_XRGB8888, + GBM_BO_FORMAT_XRGB8888, /** ARGB with 8 bits per channel in a 32 bit value */ GBM_BO_FORMAT_ARGB8888 }; @@ -71,7 +71,7 @@ enum gbm_bo_format { * re-namespaced. New GBM formats must not be added, unless they are * identical ports from drm_fourcc. */ -#define __gbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \ +#define __gbm_fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \ ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) #define GBM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ @@ -352,4 +352,4 @@ void gbm_iSurface_destroy(struct gbm_iSurface *iSurface); } #endif -#endif \ No newline at end of file +#endif diff --git a/hardware/mpp/include/rk_venc_cmd.h b/hardware/mpp/include/rk_venc_cmd.h index 92af6e0..ee2594a 100644 --- a/hardware/mpp/include/rk_venc_cmd.h +++ b/hardware/mpp/include/rk_venc_cmd.h @@ -862,7 +862,6 @@ typedef struct MppEncH265CuCfg_t { RK_U32 strong_intra_smoothing_enabled_flag; /* INTRA_SMOOTH */ RK_U32 pcm_enabled_flag; /* default: 0, enable ipcm */ RK_U32 pcm_loop_filter_disabled_flag; - } MppEncH265CuCfg; typedef struct MppEncH265RefCfg_t { @@ -1213,4 +1212,4 @@ typedef struct MppEncUserDataSet_t { MppEncUserDataFull *datas; } MppEncUserDataSet; -#endif /* __RK_VENC_CMD_H__ */ \ No newline at end of file +#endif /* __RK_VENC_CMD_H__ */ diff --git a/hardware/mpp/src/mpi_enc_utils.c b/hardware/mpp/src/mpi_enc_utils.c index e190305..db15bba 100644 --- a/hardware/mpp/src/mpi_enc_utils.c +++ b/hardware/mpp/src/mpi_enc_utils.c @@ -362,7 +362,7 @@ static MPP_RET test_mpp_enc_cfg_setup(MpiEncTestData *p) MppCtx ctx; MppEncCfg cfg; - if (NULL == p) + if (p == NULL) return MPP_ERR_NULL_PTR; mpi = p->mpi; diff --git a/hardware/rga/include/GrallocOps.h b/hardware/rga/include/GrallocOps.h index 2533da2..4c5ca52 100755 --- a/hardware/rga/include/GrallocOps.h +++ b/hardware/rga/include/GrallocOps.h @@ -18,4 +18,4 @@ #ifndef _rk_graphic_buffer_h_ #define _rk_graphic_buffer_h_ -#endif //_rk_graphic_buffer_h_ \ No newline at end of file +#endif // _rk_graphic_buffer_h_ diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index 91355e3..b089a59 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -87,7 +87,7 @@ class Condition; * recursive, i.e. the same thread can't lock it multiple times. */ class CAPABILITY("mutex") Mutex { - public: +public: enum { PRIVATE = 0, SHARED = 1 @@ -110,25 +110,28 @@ class CAPABILITY("mutex") Mutex { // Manages the mutex automatically. It'll be locked when Autolock is // constructed and released when Autolock goes out of scope. class SCOPED_CAPABILITY Autolock { - public: - inline explicit Autolock(Mutex& mutex) ACQUIRE(mutex) : mLock(mutex) { + public: + inline explicit Autolock(Mutex& mutex) ACQUIRE(mutex) : mLock(mutex) + { mLock.lock(); } - inline explicit Autolock(Mutex* mutex) ACQUIRE(mutex) : mLock(*mutex) { + inline explicit Autolock(Mutex* mutex) ACQUIRE(mutex) : mLock(*mutex) + { mLock.lock(); } - inline ~Autolock() RELEASE() { + inline ~Autolock() RELEASE() + { mLock.unlock(); } - private: + private: Mutex& mLock; // Cannot be copied or moved - declarations only Autolock(const Autolock&); Autolock& operator=(const Autolock&); }; - private: +private: friend class Condition; // A mutex cannot be copied @@ -139,13 +142,16 @@ class CAPABILITY("mutex") Mutex { }; // --------------------------------------------------------------------------- -inline Mutex::Mutex() { +inline Mutex::Mutex() +{ pthread_mutex_init(&mMutex, nullptr); } -inline Mutex::Mutex(__attribute__((unused)) const char* name) { +inline Mutex::Mutex(__attribute__((unused)) const char* name) +{ pthread_mutex_init(&mMutex, nullptr); } -inline Mutex::Mutex(int type, __attribute__((unused)) const char* name) { +inline Mutex::Mutex(int type, __attribute__((unused)) const char* name) +{ if (type == SHARED) { pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); @@ -156,19 +162,24 @@ inline Mutex::Mutex(int type, __attribute__((unused)) const char* name) { pthread_mutex_init(&mMutex, nullptr); } } -inline Mutex::~Mutex() { +inline Mutex::~Mutex() +{ pthread_mutex_destroy(&mMutex); } -inline int32_t Mutex::lock() { +inline int32_t Mutex::lock() +{ return -pthread_mutex_lock(&mMutex); } -inline void Mutex::unlock() { +inline void Mutex::unlock() +{ pthread_mutex_unlock(&mMutex); } -inline int32_t Mutex::tryLock() { +inline int32_t Mutex::tryLock() +{ return -pthread_mutex_trylock(&mMutex); } -inline int32_t Mutex::timedLock(int64_t timeoutNs) { +inline int32_t Mutex::timedLock(int64_t timeoutNs) +{ timespec now; clock_gettime(CLOCK_REALTIME, &now); timeoutNs += now.tv_sec*1000000000 + now.tv_nsec; @@ -188,4 +199,4 @@ inline int32_t Mutex::timedLock(int64_t timeoutNs) { */ typedef Mutex::Autolock AutoMutex; -#endif // _LIBS_RGA_MUTEX_H \ No newline at end of file +#endif // _LIBS_RGA_MUTEX_H diff --git a/hardware/rga/include/RgaSingleton.h b/hardware/rga/include/RgaSingleton.h index 5c8232b..30020ac 100755 --- a/hardware/rga/include/RgaSingleton.h +++ b/hardware/rga/include/RgaSingleton.h @@ -28,8 +28,9 @@ template class Singleton { - public: - static TYPE& getInstance() { +public: + static TYPE& getInstance() + { Mutex::Autolock _l(sLock); TYPE* instance = sInstance; if (instance == nullptr) { @@ -39,16 +40,17 @@ class Singleton { return *instance; } - static bool hasInstance() { + static bool hasInstance() + { Mutex::Autolock _l(sLock); return sInstance != nullptr; } - protected: +protected: ~Singleton() { } Singleton() { } - private: +private: Singleton(const Singleton&); Singleton& operator = (const Singleton&); static Mutex sLock; @@ -65,4 +67,4 @@ class Singleton { template<> TYPE* ::Singleton< TYPE >::sInstance(nullptr); /* NOLINT */ \ template class ::Singleton< TYPE >; -#endif //_LIBS_RGA_SINGLETON_H \ No newline at end of file +#endif // _LIBS_RGA_SINGLETON_H diff --git a/hardware/rga/include/RockchipRga.h b/hardware/rga/include/RockchipRga.h index 459cd33..2b4dc70 100755 --- a/hardware/rga/include/RockchipRga.h +++ b/hardware/rga/include/RockchipRga.h @@ -38,8 +38,9 @@ ////////////////////////////////////////////////////////////////////////////////// #include "RgaSingleton.h" -class RockchipRga :public Singleton { - public: +class RockchipRga : public Singleton +{ +public: static inline RockchipRga& get() { return getInstance(); @@ -62,21 +63,24 @@ class RockchipRga :public Singleton { int RkRgaCollorFill(rga_info *dst); int RkRgaCollorPalette(rga_info *src, rga_info *dst, rga_info *lut); int RkRgaFlush(); - void RkRgaSetLogOnceFlag(int log) { + void RkRgaSetLogOnceFlag(int log) + { mLogOnce = log; } - void RkRgaSetAlwaysLogFlag(bool log) { + void RkRgaSetAlwaysLogFlag(bool log) + { mLogAlways = log; } void RkRgaLogOutRgaReq(struct rga_req rgaReg); int RkRgaLogOutUserPara(rga_info *rgaInfo); - inline bool RkRgaIsReady() { + inline bool RkRgaIsReady() + { return mSupportRga; } RockchipRga(); ~RockchipRga(); - private: +private: bool mSupportRga; int mLogOnce; int mLogAlways; @@ -84,4 +88,4 @@ class RockchipRga :public Singleton { friend class Singleton; }; -#endif \ No newline at end of file +#endif diff --git a/hardware/rga/include/drmrga.h b/hardware/rga/include/drmrga.h index 0a638cf..2bfc3f2 100755 --- a/hardware/rga/include/drmrga.h +++ b/hardware/rga/include/drmrga.h @@ -23,7 +23,7 @@ /* flip source image horizontally (around the vertical axis) */ #define HAL_TRANSFORM_FLIP_H 0x01 -/* flip source image vertically (around the horizontal axis)*/ +/* flip source image vertically (around the horizontal axis) */ #define HAL_TRANSFORM_FLIP_V 0x02 /* rotate source image 90 degrees clockwise */ #define HAL_TRANSFORM_ROT_90 0x04 @@ -186,4 +186,4 @@ static inline void rga_set_rotation(rga_info_t *info, int angle) } /*****************************************************************************/ -#endif \ No newline at end of file +#endif diff --git a/hardware/rga/include/platform_gralloc4.h b/hardware/rga/include/platform_gralloc4.h index 8c5c48d..edddb75 100755 --- a/hardware/rga/include/platform_gralloc4.h +++ b/hardware/rga/include/platform_gralloc4.h @@ -32,7 +32,7 @@ * Log: * init. ----Fri Aug 28 10:10:14 2020 - * + * * -------------------------------------------------------------------------------------------------------- */ @@ -101,7 +101,6 @@ void freeBuffer(buffer_handle_t handle); * Inline Functions Implementation * --------------------------------------------------------------------------------------------------------- */ - } -#endif /* __PLATFORM_GRALLOC4_H__ */ \ No newline at end of file +#endif /* __PLATFORM_GRALLOC4_H__ */ diff --git a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp index 9143b40..915129e 100644 --- a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp +++ b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp @@ -56,7 +56,7 @@ RetCode RKCodecNode::Flush(const int32_t streamId) } void RKCodecNode::encodeJpegToMemory(unsigned char* image, int width, int height, - const char* comment, size_t* jpegSize, unsigned char** jpegBuf) + const char* comment, size_t* jpegSize, unsigned char** jpegBuf) { struct jpeg_compress_struct cInfo; struct jpeg_error_mgr jErr; @@ -154,7 +154,6 @@ void RKCodecNode::SerchIFps(unsigned char* buf, size_t bufSize, std::shared_ptr< CAMERA_LOGI("ForkNode::ForkBuffers SetEsKeyFrame == 0 nalu == 0x%{public}x idx = %{public}d\n", nalType, idx); } - } void RKCodecNode::Yuv420ToRGBA8888(std::shared_ptr& buffer) -- Gitee From ddb7b4d9bba9629a14e78af28fa809152f7d4e98 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Fri, 18 Feb 2022 09:35:38 +0800 Subject: [PATCH 06/27] code format Signed-off-by: suxiansheng32 --- .../display/src/display_device/hdi_layer.cpp | 6 ++++-- hardware/display/src/display_gfx/display_gfx.c | 4 ++-- hardware/rga/include/RgaMutex.h | 18 +++++++++--------- hardware/rga/include/RgaSingleton.h | 3 +-- hardware/rga/include/RockchipRga.h | 3 +-- hardware/rga/include/platform_gralloc4.h | 4 ++-- .../src/pipeline_core/node/rk_codec_node.cpp | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/hardware/display/src/display_device/hdi_layer.cpp b/hardware/display/src/display_device/hdi_layer.cpp index c7d690d..1d211d8 100644 --- a/hardware/display/src/display_device/hdi_layer.cpp +++ b/hardware/display/src/display_device/hdi_layer.cpp @@ -89,7 +89,8 @@ int32_t HdiLayer::Init() int32_t HdiLayer::SetLayerSize(IRect *rect) { DISPLAY_CHK_RETURN((rect == nullptr), DISPLAY_NULL_PTR, DISPLAY_LOGE("in rect is nullptr")); - DISPLAY_DEBUGLOG(" displayRect x: %{public}d y : %{public}d w : %{public}d h : %{public}d", rect->x, rect->y, rect->w,rect->h); + DISPLAY_DEBUGLOG(" displayRect x: %{public}d y : %{public}d w : %{public}d h : %{public}d", rect->x, rect->y, + rect->w, rect->h); mDisplayRect = *rect; return DISPLAY_SUCCESS; } @@ -141,7 +142,8 @@ int32_t HdiLayer::SetLayerDirtyRegion(IRect *region) int32_t HdiLayer::SetLayerVisibleRegion(uint32_t num, IRect *rect) { - DISPLAY_DEBUGLOG("id : %{public}d DirtyRegion x: %{public}d y : %{public}d w : %{public}d h : %{public}d", mId, rect->x,rect->y, rect->w, rect->h); + DISPLAY_DEBUGLOG("id : %{public}d DirtyRegion x: %{public}d y : %{public}d w : %{public}d h : %{public}d", mId, + rect->x, rect->y, rect->w, rect->h); return DISPLAY_SUCCESS; } diff --git a/hardware/display/src/display_gfx/display_gfx.c b/hardware/display/src/display_gfx/display_gfx.c index cdcc81e..6e48477 100644 --- a/hardware/display/src/display_gfx/display_gfx.c +++ b/hardware/display/src/display_gfx/display_gfx.c @@ -38,7 +38,7 @@ int32_t rkDeinitGfx() RgaSURF_FORMAT colorSpaceModeChange(PixelFormat color, uint8_t *isYuv) { RgaSURF_FORMAT rkFormat; - switch(color) { + switch (color) { case PIXEL_FMT_RGB_565: /**< RGB565 format */ rkFormat = RK_FORMAT_RGB_565; *isYuv = 0; @@ -200,7 +200,7 @@ int32_t blendTypeChange(BlendType blendType) int32_t rkBlendType; switch (blendType) { case BLEND_SRC: /**< SRC blending */ - rkBlendType = IM_ALPHA_BLEND_SRC; + rkBlendType = IM_ALPHA_BLEND_SRC; break; case BLEND_DST: /**< SRC blending */ rkBlendType = IM_ALPHA_BLEND_DST; diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index b089a59..dc0697b 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -112,17 +112,17 @@ public: class SCOPED_CAPABILITY Autolock { public: inline explicit Autolock(Mutex& mutex) ACQUIRE(mutex) : mLock(mutex) - { - mLock.lock(); - } + { + mLock.lock(); + } inline explicit Autolock(Mutex* mutex) ACQUIRE(mutex) : mLock(*mutex) - { - mLock.lock(); - } + { + mLock.lock(); + } inline ~Autolock() RELEASE() - { - mLock.unlock(); - } + { + mLock.unlock(); + } private: Mutex& mLock; diff --git a/hardware/rga/include/RgaSingleton.h b/hardware/rga/include/RgaSingleton.h index 30020ac..f7e836c 100755 --- a/hardware/rga/include/RgaSingleton.h +++ b/hardware/rga/include/RgaSingleton.h @@ -29,7 +29,7 @@ template class Singleton { public: - static TYPE& getInstance() + static TYPE& getInstance() { Mutex::Autolock _l(sLock); TYPE* instance = sInstance; @@ -39,7 +39,6 @@ public: } return *instance; } - static bool hasInstance() { Mutex::Autolock _l(sLock); diff --git a/hardware/rga/include/RockchipRga.h b/hardware/rga/include/RockchipRga.h index 2b4dc70..5c14222 100755 --- a/hardware/rga/include/RockchipRga.h +++ b/hardware/rga/include/RockchipRga.h @@ -38,8 +38,7 @@ ////////////////////////////////////////////////////////////////////////////////// #include "RgaSingleton.h" -class RockchipRga : public Singleton -{ +class RockchipRga : public Singleton { public: static inline RockchipRga& get() { diff --git a/hardware/rga/include/platform_gralloc4.h b/hardware/rga/include/platform_gralloc4.h index edddb75..9a5d895 100755 --- a/hardware/rga/include/platform_gralloc4.h +++ b/hardware/rga/include/platform_gralloc4.h @@ -23,8 +23,8 @@ * < 习语 和 缩略语 > : * * ----------------------------------------------------------------------------------- - * Usage: - * + * Usage: + * * Note: * * Author: ChenZhen diff --git a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp index 915129e..f94062e 100644 --- a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp +++ b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp @@ -56,7 +56,7 @@ RetCode RKCodecNode::Flush(const int32_t streamId) } void RKCodecNode::encodeJpegToMemory(unsigned char* image, int width, int height, - const char* comment, size_t* jpegSize, unsigned char** jpegBuf) + const char* comment, size_t* jpegSize, unsigned char** jpegBuf) { struct jpeg_compress_struct cInfo; struct jpeg_error_mgr jErr; -- Gitee From 848e6fae0a7e28576ce483c787849ba7bace0372 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Fri, 18 Feb 2022 09:57:28 +0800 Subject: [PATCH 07/27] code format Signed-off-by: suxiansheng32 --- hardware/display/src/display_device/hdi_layer.cpp | 2 +- hardware/display/src/display_gfx/display_gfx.c | 4 ++-- hardware/rga/include/RgaMutex.h | 10 +++++----- hardware/rga/include/RgaSingleton.h | 2 +- rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hardware/display/src/display_device/hdi_layer.cpp b/hardware/display/src/display_device/hdi_layer.cpp index 1d211d8..11bee66 100644 --- a/hardware/display/src/display_device/hdi_layer.cpp +++ b/hardware/display/src/display_device/hdi_layer.cpp @@ -143,7 +143,7 @@ int32_t HdiLayer::SetLayerDirtyRegion(IRect *region) int32_t HdiLayer::SetLayerVisibleRegion(uint32_t num, IRect *rect) { DISPLAY_DEBUGLOG("id : %{public}d DirtyRegion x: %{public}d y : %{public}d w : %{public}d h : %{public}d", mId, - rect->x, rect->y, rect->w, rect->h); + rect->x, rect->y, rect->w, rect->h); return DISPLAY_SUCCESS; } diff --git a/hardware/display/src/display_gfx/display_gfx.c b/hardware/display/src/display_gfx/display_gfx.c index 6e48477..dc8eae5 100644 --- a/hardware/display/src/display_gfx/display_gfx.c +++ b/hardware/display/src/display_gfx/display_gfx.c @@ -200,8 +200,8 @@ int32_t blendTypeChange(BlendType blendType) int32_t rkBlendType; switch (blendType) { case BLEND_SRC: /**< SRC blending */ - rkBlendType = IM_ALPHA_BLEND_SRC; - break; + rkBlendType = IM_ALPHA_BLEND_SRC; + break; case BLEND_DST: /**< SRC blending */ rkBlendType = IM_ALPHA_BLEND_DST; break; diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index dc0697b..1b187e9 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -113,15 +113,15 @@ public: public: inline explicit Autolock(Mutex& mutex) ACQUIRE(mutex) : mLock(mutex) { - mLock.lock(); + mLock.lock(); } inline explicit Autolock(Mutex* mutex) ACQUIRE(mutex) : mLock(*mutex) - { - mLock.lock(); - } + { + mLock.lock(); + } inline ~Autolock() RELEASE() { - mLock.unlock(); + mLock.unlock(); } private: diff --git a/hardware/rga/include/RgaSingleton.h b/hardware/rga/include/RgaSingleton.h index f7e836c..386888a 100755 --- a/hardware/rga/include/RgaSingleton.h +++ b/hardware/rga/include/RgaSingleton.h @@ -39,7 +39,7 @@ public: } return *instance; } - static bool hasInstance() + static bool hasInstance() { Mutex::Autolock _l(sLock); return sInstance != nullptr; diff --git a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp index f94062e..7d57acb7 100644 --- a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp +++ b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp @@ -56,7 +56,7 @@ RetCode RKCodecNode::Flush(const int32_t streamId) } void RKCodecNode::encodeJpegToMemory(unsigned char* image, int width, int height, - const char* comment, size_t* jpegSize, unsigned char** jpegBuf) + const char* comment, size_t* jpegSize, unsigned char** jpegBuf) { struct jpeg_compress_struct cInfo; struct jpeg_error_mgr jErr; -- Gitee From eb9e9a4ef267916bb8081491e2b2872372455789 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Fri, 18 Feb 2022 10:12:15 +0800 Subject: [PATCH 08/27] code format Signed-off-by: suxiansheng32 --- hardware/display/src/display_gfx/display_gfx.c | 4 ++-- hardware/rga/include/RgaMutex.h | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hardware/display/src/display_gfx/display_gfx.c b/hardware/display/src/display_gfx/display_gfx.c index dc8eae5..f22a887 100644 --- a/hardware/display/src/display_gfx/display_gfx.c +++ b/hardware/display/src/display_gfx/display_gfx.c @@ -200,8 +200,8 @@ int32_t blendTypeChange(BlendType blendType) int32_t rkBlendType; switch (blendType) { case BLEND_SRC: /**< SRC blending */ - rkBlendType = IM_ALPHA_BLEND_SRC; - break; + rkBlendType = IM_ALPHA_BLEND_SRC; + break; case BLEND_DST: /**< SRC blending */ rkBlendType = IM_ALPHA_BLEND_DST; break; diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index 1b187e9..757b320 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -112,17 +112,17 @@ public: class SCOPED_CAPABILITY Autolock { public: inline explicit Autolock(Mutex& mutex) ACQUIRE(mutex) : mLock(mutex) - { - mLock.lock(); - } + { + mLock.lock(); + } inline explicit Autolock(Mutex* mutex) ACQUIRE(mutex) : mLock(*mutex) - { - mLock.lock(); - } + { + mLock.lock(); + } inline ~Autolock() RELEASE() - { - mLock.unlock(); - } + { + mLock.unlock(); + } private: Mutex& mLock; -- Gitee From 7b140ed2888a6d99b384dd75900b65318d6aeda0 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Fri, 18 Feb 2022 10:27:13 +0800 Subject: [PATCH 09/27] code format Signed-off-by: suxiansheng32 --- hardware/display/src/display_gfx/display_gfx.c | 2 +- hardware/rga/include/RgaMutex.h | 12 ++++++------ .../camera/src/pipeline_core/node/rk_codec_node.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hardware/display/src/display_gfx/display_gfx.c b/hardware/display/src/display_gfx/display_gfx.c index f22a887..18a1033 100644 --- a/hardware/display/src/display_gfx/display_gfx.c +++ b/hardware/display/src/display_gfx/display_gfx.c @@ -200,7 +200,7 @@ int32_t blendTypeChange(BlendType blendType) int32_t rkBlendType; switch (blendType) { case BLEND_SRC: /**< SRC blending */ - rkBlendType = IM_ALPHA_BLEND_SRC; + rkBlendType = IM_ALPHA_BLEND_SRC; break; case BLEND_DST: /**< SRC blending */ rkBlendType = IM_ALPHA_BLEND_DST; diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index 757b320..d863303 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -112,17 +112,17 @@ public: class SCOPED_CAPABILITY Autolock { public: inline explicit Autolock(Mutex& mutex) ACQUIRE(mutex) : mLock(mutex) - { - mLock.lock(); - } + { + mLock.lock(); + } inline explicit Autolock(Mutex* mutex) ACQUIRE(mutex) : mLock(*mutex) { - mLock.lock(); + mLock.lock(); } inline ~Autolock() RELEASE() - { + { mLock.unlock(); - } + } private: Mutex& mLock; diff --git a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp index 7d57acb7..915129e 100644 --- a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp +++ b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp @@ -56,7 +56,7 @@ RetCode RKCodecNode::Flush(const int32_t streamId) } void RKCodecNode::encodeJpegToMemory(unsigned char* image, int width, int height, - const char* comment, size_t* jpegSize, unsigned char** jpegBuf) + const char* comment, size_t* jpegSize, unsigned char** jpegBuf) { struct jpeg_compress_struct cInfo; struct jpeg_error_mgr jErr; -- Gitee From e4a83d248ddfcd27c514ffe8a4be0f0b570070d6 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Fri, 18 Feb 2022 10:39:46 +0800 Subject: [PATCH 10/27] code format Signed-off-by: suxiansheng32 --- hardware/display/src/display_gfx/display_gfx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware/display/src/display_gfx/display_gfx.c b/hardware/display/src/display_gfx/display_gfx.c index 18a1033..52306c1 100644 --- a/hardware/display/src/display_gfx/display_gfx.c +++ b/hardware/display/src/display_gfx/display_gfx.c @@ -200,8 +200,8 @@ int32_t blendTypeChange(BlendType blendType) int32_t rkBlendType; switch (blendType) { case BLEND_SRC: /**< SRC blending */ - rkBlendType = IM_ALPHA_BLEND_SRC; - break; + rkBlendType = IM_ALPHA_BLEND_SRC; + break; case BLEND_DST: /**< SRC blending */ rkBlendType = IM_ALPHA_BLEND_DST; break; -- Gitee From 51c31082272c6c2c0b0d0ca315f4c4f2f3b1b6d4 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Fri, 18 Feb 2022 10:45:56 +0800 Subject: [PATCH 11/27] code format Signed-off-by: suxiansheng32 --- rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp index 915129e..e3131d9 100644 --- a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp +++ b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp @@ -56,7 +56,7 @@ RetCode RKCodecNode::Flush(const int32_t streamId) } void RKCodecNode::encodeJpegToMemory(unsigned char* image, int width, int height, - const char* comment, size_t* jpegSize, unsigned char** jpegBuf) + const char* comment, size_t* jpegSize, unsigned char** jpegBuf) { struct jpeg_compress_struct cInfo; struct jpeg_error_mgr jErr; -- Gitee From a2b75c29746e72dad79e36008838d0f21811b31d Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Fri, 18 Feb 2022 11:08:37 +0800 Subject: [PATCH 12/27] code format Signed-off-by: suxiansheng32 --- hardware/rga/include/RgaMutex.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index d863303..74be5ca 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -112,9 +112,9 @@ public: class SCOPED_CAPABILITY Autolock { public: inline explicit Autolock(Mutex& mutex) ACQUIRE(mutex) : mLock(mutex) - { - mLock.lock(); - } + { + mLock.lock(); + } inline explicit Autolock(Mutex* mutex) ACQUIRE(mutex) : mLock(*mutex) { mLock.lock(); -- Gitee From 0d4d87782d86738ead7a913b735b3a99c25854dd Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Fri, 18 Feb 2022 15:43:34 +0800 Subject: [PATCH 13/27] Mutex Signed-off-by: suxiansheng32 --- hardware/rga/include/RgaMutex.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index 74be5ca..33b7422 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -123,6 +123,11 @@ public: { mLock.unlock(); } + inline Mutex::Mutex() + { + pthread_mutex_init(&mMutex, nullptr); + } + private: Mutex& mLock; @@ -142,10 +147,11 @@ private: }; // --------------------------------------------------------------------------- +/* inline Mutex::Mutex() { pthread_mutex_init(&mMutex, nullptr); -} +} */ inline Mutex::Mutex(__attribute__((unused)) const char* name) { pthread_mutex_init(&mMutex, nullptr); -- Gitee From 1c25502cc6812f0f6e2dda9f42305ffec54f8867 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Fri, 18 Feb 2022 16:13:19 +0800 Subject: [PATCH 14/27] Mutex Signed-off-by: suxiansheng32 --- hardware/rga/include/RgaMutex.h | 60 ++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index 33b7422..77d1445 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -123,11 +123,53 @@ public: { mLock.unlock(); } - inline Mutex::Mutex() + inline Mutex::Mutex() { pthread_mutex_init(&mMutex, nullptr); } - + inline Mutex::Mutex(__attribute__((unused)) const char* name) + { + pthread_mutex_init(&mMutex, nullptr); + } + inline Mutex::Mutex(int type, __attribute__((unused)) const char* name) + { + if (type == SHARED) { + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); + pthread_mutex_init(&mMutex, &attr); + pthread_mutexattr_destroy(&attr); + } else { + pthread_mutex_init(&mMutex, nullptr); + } + } + inline Mutex::~Mutex() + { + pthread_mutex_destroy(&mMutex); + } + inline int32_t Mutex::lock() + { + return -pthread_mutex_lock(&mMutex); + } + inline void Mutex::unlock() + { + pthread_mutex_unlock(&mMutex); + } + inline int32_t Mutex::tryLock() + { + return -pthread_mutex_trylock(&mMutex); + } + inline int32_t Mutex::timedLock(int64_t timeoutNs) + { + timespec now; + clock_gettime(CLOCK_REALTIME, &now); + timeoutNs += now.tv_sec*1000000000 + now.tv_nsec; + const struct timespec ts = { + static_cast(timeoutNs / 1000000000), /* .tv_sec = */ + static_cast(timeoutNs % 1000000000), /* .tv_nsec = */ + }; + return -pthread_mutex_timedlock(&mMutex, &ts); + } private: Mutex& mLock; @@ -151,11 +193,11 @@ private: inline Mutex::Mutex() { pthread_mutex_init(&mMutex, nullptr); -} */ +} inline Mutex::Mutex(__attribute__((unused)) const char* name) { pthread_mutex_init(&mMutex, nullptr); -} +} inline Mutex::Mutex(int type, __attribute__((unused)) const char* name) { if (type == SHARED) { @@ -167,7 +209,7 @@ inline Mutex::Mutex(int type, __attribute__((unused)) const char* name) } else { pthread_mutex_init(&mMutex, nullptr); } -} +} inline Mutex::~Mutex() { pthread_mutex_destroy(&mMutex); @@ -183,18 +225,18 @@ inline void Mutex::unlock() inline int32_t Mutex::tryLock() { return -pthread_mutex_trylock(&mMutex); -} +} inline int32_t Mutex::timedLock(int64_t timeoutNs) { timespec now; clock_gettime(CLOCK_REALTIME, &now); timeoutNs += now.tv_sec*1000000000 + now.tv_nsec; const struct timespec ts = { - static_cast(timeoutNs / 1000000000), /* .tv_sec = */ - static_cast(timeoutNs % 1000000000), /* .tv_nsec = */ + static_cast(timeoutNs / 1000000000), * .tv_sec = * + static_cast(timeoutNs % 1000000000), * .tv_nsec = * }; return -pthread_mutex_timedlock(&mMutex, &ts); -} +} */ // --------------------------------------------------------------------------- -- Gitee From f512ee9af3786a272484c23d55e415676411635a Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Fri, 18 Feb 2022 16:31:49 +0800 Subject: [PATCH 15/27] Mutex Signed-off-by: suxiansheng32 --- hardware/rga/include/RgaMutex.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index 77d1445..d22bdee 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -193,11 +193,11 @@ private: inline Mutex::Mutex() { pthread_mutex_init(&mMutex, nullptr); -} +} inline Mutex::Mutex(__attribute__((unused)) const char* name) { pthread_mutex_init(&mMutex, nullptr); -} +} inline Mutex::Mutex(int type, __attribute__((unused)) const char* name) { if (type == SHARED) { @@ -209,7 +209,7 @@ inline Mutex::Mutex(int type, __attribute__((unused)) const char* name) } else { pthread_mutex_init(&mMutex, nullptr); } -} +} inline Mutex::~Mutex() { pthread_mutex_destroy(&mMutex); @@ -225,7 +225,7 @@ inline void Mutex::unlock() inline int32_t Mutex::tryLock() { return -pthread_mutex_trylock(&mMutex); -} +} inline int32_t Mutex::timedLock(int64_t timeoutNs) { timespec now; -- Gitee From 5a452d01a592e324acc3091c639cda50b13f420a Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Fri, 18 Feb 2022 17:13:18 +0800 Subject: [PATCH 16/27] code format Signed-off-by: suxiansheng32 --- hardware/rga/include/RgaMutex.h | 55 +++------------------------------ 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index d22bdee..082d205 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -123,53 +123,6 @@ public: { mLock.unlock(); } - inline Mutex::Mutex() - { - pthread_mutex_init(&mMutex, nullptr); - } - inline Mutex::Mutex(__attribute__((unused)) const char* name) - { - pthread_mutex_init(&mMutex, nullptr); - } - inline Mutex::Mutex(int type, __attribute__((unused)) const char* name) - { - if (type == SHARED) { - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); - pthread_mutex_init(&mMutex, &attr); - pthread_mutexattr_destroy(&attr); - } else { - pthread_mutex_init(&mMutex, nullptr); - } - } - inline Mutex::~Mutex() - { - pthread_mutex_destroy(&mMutex); - } - inline int32_t Mutex::lock() - { - return -pthread_mutex_lock(&mMutex); - } - inline void Mutex::unlock() - { - pthread_mutex_unlock(&mMutex); - } - inline int32_t Mutex::tryLock() - { - return -pthread_mutex_trylock(&mMutex); - } - inline int32_t Mutex::timedLock(int64_t timeoutNs) - { - timespec now; - clock_gettime(CLOCK_REALTIME, &now); - timeoutNs += now.tv_sec*1000000000 + now.tv_nsec; - const struct timespec ts = { - static_cast(timeoutNs / 1000000000), /* .tv_sec = */ - static_cast(timeoutNs % 1000000000), /* .tv_nsec = */ - }; - return -pthread_mutex_timedlock(&mMutex, &ts); - } private: Mutex& mLock; @@ -189,7 +142,7 @@ private: }; // --------------------------------------------------------------------------- -/* + inline Mutex::Mutex() { pthread_mutex_init(&mMutex, nullptr); @@ -232,11 +185,11 @@ inline int32_t Mutex::timedLock(int64_t timeoutNs) clock_gettime(CLOCK_REALTIME, &now); timeoutNs += now.tv_sec*1000000000 + now.tv_nsec; const struct timespec ts = { - static_cast(timeoutNs / 1000000000), * .tv_sec = * - static_cast(timeoutNs % 1000000000), * .tv_nsec = * + static_cast(timeoutNs / 1000000000), /* .tv_sec = */ + static_cast(timeoutNs % 1000000000), /* .tv_nsec = */ }; return -pthread_mutex_timedlock(&mMutex, &ts); -} */ +} // --------------------------------------------------------------------------- -- Gitee From 8b0a358cd0ec740d86856344927682669220b29b Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Mon, 21 Feb 2022 09:00:23 +0800 Subject: [PATCH 17/27] code format Signed-off-by: suxiansheng32 --- hardware/rga/include/RgaMutex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index 082d205..45ba565 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -189,7 +189,7 @@ inline int32_t Mutex::timedLock(int64_t timeoutNs) static_cast(timeoutNs % 1000000000), /* .tv_nsec = */ }; return -pthread_mutex_timedlock(&mMutex, &ts); -} +} // --------------------------------------------------------------------------- -- Gitee From a83b4aa335a4c34f2f6498ab8abd680bd704be25 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Mon, 21 Feb 2022 10:44:08 +0800 Subject: [PATCH 18/27] code format Signed-off-by: suxiansheng32 --- hardware/display/src/display_gralloc/display_gralloc_gbm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/display/src/display_gralloc/display_gralloc_gbm.c b/hardware/display/src/display_gralloc/display_gralloc_gbm.c index d1eda98..c5d4601 100644 --- a/hardware/display/src/display_gralloc/display_gralloc_gbm.c +++ b/hardware/display/src/display_gralloc/display_gralloc_gbm.c @@ -48,7 +48,7 @@ typedef struct { const char *str; } ValueStrMap; -static GrallocManager *GetGrallocManager() +static GrallocManager *GetGrallocManager(void) { if (g_grallocManager == NULL) { g_grallocManager = (GrallocManager *)malloc(sizeof(GrallocManager)); -- Gitee From 2c97b57ff5ff36ced6e8461b930819a21db9cc6e Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Mon, 21 Feb 2022 11:46:53 +0800 Subject: [PATCH 19/27] code format Signed-off-by: suxiansheng32 --- hardware/display/src/display_device/hdi_layer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/display/src/display_device/hdi_layer.cpp b/hardware/display/src/display_device/hdi_layer.cpp index 11bee66..3101bc9 100644 --- a/hardware/display/src/display_device/hdi_layer.cpp +++ b/hardware/display/src/display_device/hdi_layer.cpp @@ -15,7 +15,7 @@ #include "hdi_layer.h" #include -#include +#include namespace OHOS { namespace HDI { -- Gitee From 8c128698cfcecad1c8a84bafb4eb9455a612f7bf Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Tue, 22 Feb 2022 10:00:27 +0800 Subject: [PATCH 20/27] code format Signed-off-by: suxiansheng32 --- hardware/rga/include/RgaMutex.h | 96 ++++++++++++++------------------- 1 file changed, 39 insertions(+), 57 deletions(-) diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index 45ba565..5dabf1f 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -93,19 +93,50 @@ public: SHARED = 1 }; - Mutex(); - explicit Mutex(const char* name); - explicit Mutex(int type, const char* name = nullptr); - ~Mutex(); + Mutex() { + pthread_mutex_init(&mMutex, nullptr); + } + explicit Mutex(__attribute__((unused)) const char* name) { + pthread_mutex_init(&mMutex, nullptr); + } + explicit Mutex(int type, __attribute__((unused)) const char* name) { + if (type == SHARED) { + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); + pthread_mutex_init(&mMutex, &attr); + pthread_mutexattr_destroy(&attr); + } else { + pthread_mutex_init(&mMutex, nullptr); + } + } + ~Mutex() { + pthread_mutex_destroy(&mMutex); + } // lock or unlock the mutex - int32_t lock() ACQUIRE(); - void unlock() RELEASE(); + int32_t lock() { + return -pthread_mutex_lock(&mMutex); + } + void unlock() { + pthread_mutex_unlock(&mMutex); + } // lock if possible; returns 0 on success, error otherwise - int32_t tryLock() TRY_ACQUIRE(0); + int32_t tryLock() { + return -pthread_mutex_trylock(&mMutex); + } - int32_t timedLock(int64_t timeoutNs) TRY_ACQUIRE(0); + int32_t timedLock(int64_t timeoutNs) { + timespec now; + clock_gettime(CLOCK_REALTIME, &now); + timeoutNs += now.tv_sec*1000000000 + now.tv_nsec; + const struct timespec ts = { + static_cast(timeoutNs / 1000000000), /* .tv_sec = */ + static_cast(timeoutNs % 1000000000), /* .tv_nsec = */ + }; + return -pthread_mutex_timedlock(&mMutex, &ts); + } // Manages the mutex automatically. It'll be locked when Autolock is // constructed and released when Autolock goes out of scope. @@ -142,55 +173,6 @@ private: }; // --------------------------------------------------------------------------- - -inline Mutex::Mutex() -{ - pthread_mutex_init(&mMutex, nullptr); -} -inline Mutex::Mutex(__attribute__((unused)) const char* name) -{ - pthread_mutex_init(&mMutex, nullptr); -} -inline Mutex::Mutex(int type, __attribute__((unused)) const char* name) -{ - if (type == SHARED) { - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); - pthread_mutex_init(&mMutex, &attr); - pthread_mutexattr_destroy(&attr); - } else { - pthread_mutex_init(&mMutex, nullptr); - } -} -inline Mutex::~Mutex() -{ - pthread_mutex_destroy(&mMutex); -} -inline int32_t Mutex::lock() -{ - return -pthread_mutex_lock(&mMutex); -} -inline void Mutex::unlock() -{ - pthread_mutex_unlock(&mMutex); -} -inline int32_t Mutex::tryLock() -{ - return -pthread_mutex_trylock(&mMutex); -} -inline int32_t Mutex::timedLock(int64_t timeoutNs) -{ - timespec now; - clock_gettime(CLOCK_REALTIME, &now); - timeoutNs += now.tv_sec*1000000000 + now.tv_nsec; - const struct timespec ts = { - static_cast(timeoutNs / 1000000000), /* .tv_sec = */ - static_cast(timeoutNs % 1000000000), /* .tv_nsec = */ - }; - return -pthread_mutex_timedlock(&mMutex, &ts); -} - // --------------------------------------------------------------------------- /* -- Gitee From 61dbbbfd52b504e32b5aec984885a4188015ee7c Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Tue, 22 Feb 2022 10:12:23 +0800 Subject: [PATCH 21/27] code format Signed-off-by: suxiansheng32 --- hardware/rga/include/RgaMutex.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index 5dabf1f..4f2f19d 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -93,13 +93,16 @@ public: SHARED = 1 }; - Mutex() { + Mutex() + { pthread_mutex_init(&mMutex, nullptr); } - explicit Mutex(__attribute__((unused)) const char* name) { + explicit Mutex(__attribute__((unused)) const char* name) + { pthread_mutex_init(&mMutex, nullptr); } - explicit Mutex(int type, __attribute__((unused)) const char* name) { + explicit Mutex(int type, __attribute__((unused)) const char* name) + { if (type == SHARED) { pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); @@ -110,24 +113,29 @@ public: pthread_mutex_init(&mMutex, nullptr); } } - ~Mutex() { + ~Mutex() + { pthread_mutex_destroy(&mMutex); } // lock or unlock the mutex - int32_t lock() { + int32_t lock() + { return -pthread_mutex_lock(&mMutex); } - void unlock() { + void unlock() + { pthread_mutex_unlock(&mMutex); } // lock if possible; returns 0 on success, error otherwise - int32_t tryLock() { + int32_t tryLock() + { return -pthread_mutex_trylock(&mMutex); } - int32_t timedLock(int64_t timeoutNs) { + int32_t timedLock(int64_t timeoutNs) + { timespec now; clock_gettime(CLOCK_REALTIME, &now); timeoutNs += now.tv_sec*1000000000 + now.tv_nsec; -- Gitee From c22c65608aeee08cea71ee3ecb72bbf57e660f91 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Wed, 23 Feb 2022 10:49:39 +0800 Subject: [PATCH 22/27] code format Signed-off-by: suxiansheng32 --- hardware/rga/include/RgaMutex.h | 114 ++++++++++++++++---------------- 1 file changed, 56 insertions(+), 58 deletions(-) diff --git a/hardware/rga/include/RgaMutex.h b/hardware/rga/include/RgaMutex.h index 4f2f19d..91355e3 100755 --- a/hardware/rga/include/RgaMutex.h +++ b/hardware/rga/include/RgaMutex.h @@ -87,90 +87,48 @@ class Condition; * recursive, i.e. the same thread can't lock it multiple times. */ class CAPABILITY("mutex") Mutex { -public: + public: enum { PRIVATE = 0, SHARED = 1 }; - Mutex() - { - pthread_mutex_init(&mMutex, nullptr); - } - explicit Mutex(__attribute__((unused)) const char* name) - { - pthread_mutex_init(&mMutex, nullptr); - } - explicit Mutex(int type, __attribute__((unused)) const char* name) - { - if (type == SHARED) { - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); - pthread_mutex_init(&mMutex, &attr); - pthread_mutexattr_destroy(&attr); - } else { - pthread_mutex_init(&mMutex, nullptr); - } - } - ~Mutex() - { - pthread_mutex_destroy(&mMutex); - } + Mutex(); + explicit Mutex(const char* name); + explicit Mutex(int type, const char* name = nullptr); + ~Mutex(); // lock or unlock the mutex - int32_t lock() - { - return -pthread_mutex_lock(&mMutex); - } - void unlock() - { - pthread_mutex_unlock(&mMutex); - } + int32_t lock() ACQUIRE(); + void unlock() RELEASE(); // lock if possible; returns 0 on success, error otherwise - int32_t tryLock() - { - return -pthread_mutex_trylock(&mMutex); - } + int32_t tryLock() TRY_ACQUIRE(0); - int32_t timedLock(int64_t timeoutNs) - { - timespec now; - clock_gettime(CLOCK_REALTIME, &now); - timeoutNs += now.tv_sec*1000000000 + now.tv_nsec; - const struct timespec ts = { - static_cast(timeoutNs / 1000000000), /* .tv_sec = */ - static_cast(timeoutNs % 1000000000), /* .tv_nsec = */ - }; - return -pthread_mutex_timedlock(&mMutex, &ts); - } + int32_t timedLock(int64_t timeoutNs) TRY_ACQUIRE(0); // Manages the mutex automatically. It'll be locked when Autolock is // constructed and released when Autolock goes out of scope. class SCOPED_CAPABILITY Autolock { - public: - inline explicit Autolock(Mutex& mutex) ACQUIRE(mutex) : mLock(mutex) - { + public: + inline explicit Autolock(Mutex& mutex) ACQUIRE(mutex) : mLock(mutex) { mLock.lock(); } - inline explicit Autolock(Mutex* mutex) ACQUIRE(mutex) : mLock(*mutex) - { + inline explicit Autolock(Mutex* mutex) ACQUIRE(mutex) : mLock(*mutex) { mLock.lock(); } - inline ~Autolock() RELEASE() - { + inline ~Autolock() RELEASE() { mLock.unlock(); } - private: + private: Mutex& mLock; // Cannot be copied or moved - declarations only Autolock(const Autolock&); Autolock& operator=(const Autolock&); }; -private: + private: friend class Condition; // A mutex cannot be copied @@ -181,6 +139,46 @@ private: }; // --------------------------------------------------------------------------- +inline Mutex::Mutex() { + pthread_mutex_init(&mMutex, nullptr); +} +inline Mutex::Mutex(__attribute__((unused)) const char* name) { + pthread_mutex_init(&mMutex, nullptr); +} +inline Mutex::Mutex(int type, __attribute__((unused)) const char* name) { + if (type == SHARED) { + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); + pthread_mutex_init(&mMutex, &attr); + pthread_mutexattr_destroy(&attr); + } else { + pthread_mutex_init(&mMutex, nullptr); + } +} +inline Mutex::~Mutex() { + pthread_mutex_destroy(&mMutex); +} +inline int32_t Mutex::lock() { + return -pthread_mutex_lock(&mMutex); +} +inline void Mutex::unlock() { + pthread_mutex_unlock(&mMutex); +} +inline int32_t Mutex::tryLock() { + return -pthread_mutex_trylock(&mMutex); +} +inline int32_t Mutex::timedLock(int64_t timeoutNs) { + timespec now; + clock_gettime(CLOCK_REALTIME, &now); + timeoutNs += now.tv_sec*1000000000 + now.tv_nsec; + const struct timespec ts = { + static_cast(timeoutNs / 1000000000), /* .tv_sec = */ + static_cast(timeoutNs % 1000000000), /* .tv_nsec = */ + }; + return -pthread_mutex_timedlock(&mMutex, &ts); +} + // --------------------------------------------------------------------------- /* @@ -190,4 +188,4 @@ private: */ typedef Mutex::Autolock AutoMutex; -#endif // _LIBS_RGA_MUTEX_H +#endif // _LIBS_RGA_MUTEX_H \ No newline at end of file -- Gitee From 278fdbabde5af369bb86c915d44fe9d5d3e29fb5 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Wed, 23 Feb 2022 17:44:35 +0800 Subject: [PATCH 23/27] code format Signed-off-by: suxiansheng32 --- hardware/display/src/display_gfx/display_gfx.c | 1 + hardware/display/src/display_gralloc/display_gralloc_gbm.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hardware/display/src/display_gfx/display_gfx.c b/hardware/display/src/display_gfx/display_gfx.c index 52306c1..c760a79 100644 --- a/hardware/display/src/display_gfx/display_gfx.c +++ b/hardware/display/src/display_gfx/display_gfx.c @@ -492,6 +492,7 @@ int32_t GfxInitialize(GfxFuncs **funcs) errno_t eok = memset_s((void *)gfxFuncs, sizeof(GfxFuncs), 0, sizeof(GfxFuncs)); if (eok != EOK) { DISPLAY_LOGE("memset_s failed"); + free(gfxFuncs); return false; } gfxFuncs->InitGfx = rkInitGfx; diff --git a/hardware/display/src/display_gralloc/display_gralloc_gbm.c b/hardware/display/src/display_gralloc/display_gralloc_gbm.c index c5d4601..2dad8c1 100644 --- a/hardware/display/src/display_gralloc/display_gralloc_gbm.c +++ b/hardware/display/src/display_gralloc/display_gralloc_gbm.c @@ -21,11 +21,11 @@ #include #include #include -#include #include #include #include #include +#include #include "wayland_drm_auth_client.h" #include "drm_fourcc.h" #include "hisilicon_drm.h" -- Gitee From 3ed3077f661609b2220481d6c482c1b3fa59d7e4 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Wed, 23 Feb 2022 17:52:38 +0800 Subject: [PATCH 24/27] free Signed-off-by: suxiansheng32 --- hardware/display/src/display_gfx/display_gfx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/display/src/display_gfx/display_gfx.c b/hardware/display/src/display_gfx/display_gfx.c index c760a79..346ca63 100644 --- a/hardware/display/src/display_gfx/display_gfx.c +++ b/hardware/display/src/display_gfx/display_gfx.c @@ -492,7 +492,7 @@ int32_t GfxInitialize(GfxFuncs **funcs) errno_t eok = memset_s((void *)gfxFuncs, sizeof(GfxFuncs), 0, sizeof(GfxFuncs)); if (eok != EOK) { DISPLAY_LOGE("memset_s failed"); - free(gfxFuncs); + free(gfxFuncs); return false; } gfxFuncs->InitGfx = rkInitGfx; -- Gitee From 93560f16e24d53b9dcdf525a3a2e6381b6189a5a Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Thu, 24 Feb 2022 09:25:17 +0800 Subject: [PATCH 25/27] code format Signed-off-by: suxiansheng32 --- hardware/mpp/include/mpp_log.h | 2 +- rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware/mpp/include/mpp_log.h b/hardware/mpp/include/mpp_log.h index d256c52..c87f447 100644 --- a/hardware/mpp/include/mpp_log.h +++ b/hardware/mpp/include/mpp_log.h @@ -33,7 +33,7 @@ #define _mpp_dbg(debug, flag, fmt, ...) \ do { \ - if (debug & flag) \ + if (debug & flag) \ mpp_log(fmt, ## __VA_ARGS__); \ } while (0) diff --git a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp index e3131d9..7d57acb7 100644 --- a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp +++ b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp @@ -56,7 +56,7 @@ RetCode RKCodecNode::Flush(const int32_t streamId) } void RKCodecNode::encodeJpegToMemory(unsigned char* image, int width, int height, - const char* comment, size_t* jpegSize, unsigned char** jpegBuf) + const char* comment, size_t* jpegSize, unsigned char** jpegBuf) { struct jpeg_compress_struct cInfo; struct jpeg_error_mgr jErr; -- Gitee From 7431657c410458c10eee9d3d8556691ce698a9d2 Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Thu, 24 Feb 2022 09:34:46 +0800 Subject: [PATCH 26/27] code format Signed-off-by: suxiansheng32 --- rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp index 7d57acb7..b19e382 100644 --- a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp +++ b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp @@ -56,7 +56,7 @@ RetCode RKCodecNode::Flush(const int32_t streamId) } void RKCodecNode::encodeJpegToMemory(unsigned char* image, int width, int height, - const char* comment, size_t* jpegSize, unsigned char** jpegBuf) + const char* comment, size_t* jpegSize, unsigned char** jpegBuf) { struct jpeg_compress_struct cInfo; struct jpeg_error_mgr jErr; -- Gitee From e4b34a2ceea1c07db51b808225e698b28f5cea2b Mon Sep 17 00:00:00 2001 From: suxiansheng32 Date: Thu, 24 Feb 2022 09:44:46 +0800 Subject: [PATCH 27/27] code formate Signed-off-by: suxiansheng32 --- rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp index b19e382..455b93d 100644 --- a/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp +++ b/rk3568/camera/src/pipeline_core/node/rk_codec_node.cpp @@ -56,7 +56,7 @@ RetCode RKCodecNode::Flush(const int32_t streamId) } void RKCodecNode::encodeJpegToMemory(unsigned char* image, int width, int height, - const char* comment, size_t* jpegSize, unsigned char** jpegBuf) + const char* comment, size_t* jpegSize, unsigned char** jpegBuf) { struct jpeg_compress_struct cInfo; struct jpeg_error_mgr jErr; -- Gitee