leng.fang | 07ca08d | 2023-05-08 07:33:53 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2021 Amlogic, Inc. All rights reserved. |
| 3 | * |
| 4 | * This source code is subject to the terms and conditions defined in the |
| 5 | * file 'LICENSE' which is part of this source code package. |
| 6 | * |
| 7 | * Description: |
| 8 | */ |
| 9 | |
| 10 | #ifndef HWC_UVMDEV_H |
| 11 | #define HWC_UVMDEV_H |
| 12 | |
| 13 | #include <utils/Singleton.h> |
| 14 | |
| 15 | #define META_DATA_SIZE (512) |
| 16 | |
| 17 | /** |
| 18 | * please sync the file in kernel UVM module |
| 19 | * if you change uvm_hook_mod_type. |
| 20 | * include/linux/amlogic/meson_uvm_core.h |
| 21 | */ |
| 22 | enum uvm_hook_mod_type { |
| 23 | VF_SRC_DECODER, |
| 24 | VF_SRC_VDIN, |
| 25 | VF_PROCESS_V4LVIDEO, |
| 26 | VF_PROCESS_DI, |
| 27 | VF_PROCESS_VIDEOCOMPOSER, |
| 28 | VF_PROCESS_DECODER, |
| 29 | PROCESS_NN, |
| 30 | PROCESS_GRALLOC, |
| 31 | PROCESS_AIPQ, |
| 32 | PROCESS_DALTON, |
| 33 | PROCESS_AIFACE, |
| 34 | PROCESS_AICOLOR, |
| 35 | PROCESS_HWC, |
| 36 | PROCESS_INVALID, |
| 37 | }; |
| 38 | |
| 39 | struct uvm_fd_data { |
| 40 | int fd; |
| 41 | int data; |
| 42 | }; |
| 43 | |
| 44 | struct uvm_hook_data { |
| 45 | int mode_type; |
| 46 | int shared_fd; |
| 47 | char data_buf[META_DATA_SIZE + 1]; |
| 48 | }; |
| 49 | |
| 50 | class UvmDev : public android::Singleton<UvmDev> { |
| 51 | public: |
| 52 | UvmDev(); |
| 53 | ~UvmDev(); |
| 54 | |
| 55 | // set SF fd to uvm |
| 56 | int setPid(int pid); |
| 57 | // set UVM buffer fd to driver |
| 58 | int commitDisplay(const int fd, const int commit); |
| 59 | int dettachBuffer(const int fd); |
| 60 | int attachBuffer(const int fd); |
| 61 | int getVideoType(const int fd); |
| 62 | |
| 63 | private: |
| 64 | int mDrvFd; |
| 65 | }; |
| 66 | |
| 67 | #endif /* HWC_UVMDEV_H */ |