xref: /rockchip-linux_mpp/mpp/hal/inc/hal_dec_task.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1 /*
2 *
3 * Copyright 2015 Rockchip Electronics Co. LTD
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 
18 #ifndef __HAL_DEC_TASK__
19 #define __HAL_DEC_TASK__
20 
21 #include "hal_task.h"
22 #include "mpp_callback.h"
23 
24 #define MAX_DEC_REF_NUM     17
25 
26 /*
27  * modified by parser and encoder
28  *
29  * number   : the number of the data pointer array element
30  * data     : the address of the pointer array, parser will add its data here
31  */
32 typedef struct MppSyntax_t {
33     RK_U32              number;
34     void                *data;
35 } MppSyntax;
36 
37 typedef union HalDecTaskFlag_t {
38     RK_U64          val;
39     struct {
40         RK_U32      eos              : 1;
41         RK_U32      info_change      : 1;
42 
43         /*
44          * Different error flags for task
45          *
46          * parse_err :
47          * When set it means fatal error happened at parsing stage
48          * This task should not enable hardware just output a empty frame with
49          * error flag.
50          *
51          * ref_err :
52          * When set it means current task is ok but it contains reference frame
53          * with error which will introduce error pixels to this frame.
54          *
55          * used_for_ref :
56          * When set it means this output frame will be used as reference frame
57          * for further decoding. When there is error on decoding this frame
58          * if used_for_ref is set then the frame will set errinfo flag
59          * if used_for_ref is cleared then the frame will set discard flag.
60          */
61         RK_U32      parse_err        : 1;
62         RK_U32      ref_err          : 1;
63         RK_U32      used_for_ref     : 1;
64 
65         RK_U32      wait_done        : 1;
66         RK_U32      reserved0        : 1;
67         RK_U32      ref_info_valid   : 1;
68         RK_U32      ref_miss         : 16;
69         RK_U32      ref_used         : 16;
70     };
71 } HalDecTaskFlag;
72 
73 typedef struct HalDecTask_t {
74     // set by parser to signal that it is valid
75     RK_U32          valid;
76     HalDecTaskFlag  flags;
77 
78     // current tesk protocol syntax information
79     MppSyntax       syntax;
80 
81     // packet need to be copied to hardware buffer
82     // parser will create this packet and mpp_dec will copy it to hardware bufffer
83     MppPacket       input_packet;
84     RK_S32          input_no_copy;
85 
86     // current task input slot index
87     RK_S32          input;
88 
89     RK_S32          reg_index;
90     // for test purpose
91     // current tesk output slot index
92     RK_S32          output;
93 
94     // current task reference slot index, -1 for unused
95     RK_S32          refer[MAX_DEC_REF_NUM];
96 } HalDecTask;
97 
98 typedef union HalDecVprocTaskFlag_t {
99     RK_U32          val;
100 
101     struct {
102         RK_U32      eos              : 1;
103         RK_U32      info_change      : 1;
104     };
105 } HalDecVprocTaskFlag;
106 
107 typedef struct HalDecVprocTask_t {
108     // input slot index for post-process
109     HalDecVprocTaskFlag     flags;
110 
111     RK_S32                  input;
112 } HalDecVprocTask;
113 
114 typedef union HalTask_u {
115     HalDecTask              dec;
116     HalDecVprocTask         dec_vproc;
117 } HalTaskInfo;
118 
119 #endif /* __HAL_DEC_TASK__ */
120