1 /* 2 * Copyright (C) 2016 Rockchip Electronics Co.Ltd 3 * Authors: 4 * Zhiqin Wei <wzq@rock-chips.com> 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License as published by the 8 * Free Software Foundation; either version 2 of the License, or (at your 9 * option) any later version. 10 * 11 */ 12 13 #include <stdint.h> 14 //#include <vector> 15 #include <sys/types.h> 16 17 ////////////////////////////////////////////////////////////////////////////////// 18 #include <stdlib.h> 19 #include <stdio.h> 20 #include <string.h> 21 #include <errno.h> 22 #include <time.h> 23 #include <unistd.h> 24 25 #include <sys/mman.h> 26 #include <linux/stddef.h> 27 28 #include "stdio.h" 29 30 #include "drmrga.h" 31 32 #include "RockchipRgaMacro.h" 33 34 ////////////////////////////////////////////////////////////////////////////////// 35 36 // ------------------------------------------------------------------------------- 37 38 class RockchipRga 39 { 40 /************************************public**************************************/ 41 42 public: 43 44 RockchipRga(); 45 ~RockchipRga(); 46 47 int RkRgaInit(); 48 void RkRgaDeInit(); 49 int RkRgaAllocBuffer(int drm_fd /* input */, bo_t *bo_info, 50 int width, int height, int bpp); 51 int RkRgaFreeBuffer(int drm_fd /* input */, bo_t *bo_info); 52 int RkRgaGetAllocBuffer(bo_t *bo_info, int width, int height, int bpp); 53 int RkRgaGetMmap(bo_t *bo_info); 54 int RkRgaUnmap(bo_t *bo_info); 55 int RkRgaFree(bo_t *bo_info); 56 int RkRgaGetBufferFd(bo_t *bo_info, int *fd); 57 int RkRgaBlit(rga_info *src, rga_info *dst, rga_info *src1); 58 int RkRgaCollorFill(rga_info *dst); 59 60 RkRgaSetLogOnceFlag(int log)61 void RkRgaSetLogOnceFlag(int log) {mLogOnce = log;} RkRgaSetAlwaysLogFlag(bool log)62 void RkRgaSetAlwaysLogFlag(bool log) {mLogAlways = log;} 63 void RkRgaLogOutRgaReq(struct rga_req rgaReg); 64 int RkRgaLogOutUserPara(rga_info *rgaInfo); RkRgaIsReady()65 inline bool RkRgaIsReady() { return mSupportRga; } 66 67 /************************************private***********************************/ 68 private: 69 bool mSupportRga; 70 int mLogOnce; 71 int mLogAlways; 72 void * mContext; 73 }; 74 75 // --------------------------------------------------------------------------- 76 77 78