|
20 | 20 | #define RPF_MAX_WIDTH 8190 |
21 | 21 | #define RPF_MAX_HEIGHT 8190 |
22 | 22 |
|
| 23 | +/* Pre extended display list command data structure. */ |
| 24 | +struct vsp1_extcmd_auto_fld_body { |
| 25 | + u32 top_y0; |
| 26 | + u32 bottom_y0; |
| 27 | + u32 top_c0; |
| 28 | + u32 bottom_c0; |
| 29 | + u32 top_c1; |
| 30 | + u32 bottom_c1; |
| 31 | + u32 reserved0; |
| 32 | + u32 reserved1; |
| 33 | +} __packed; |
| 34 | + |
23 | 35 | /* ----------------------------------------------------------------------------- |
24 | 36 | * Device Access |
25 | 37 | */ |
@@ -64,6 +76,14 @@ static void rpf_configure_stream(struct vsp1_entity *entity, |
64 | 76 | pstride |= format->plane_fmt[1].bytesperline |
65 | 77 | << VI6_RPF_SRCM_PSTRIDE_C_SHIFT; |
66 | 78 |
|
| 79 | + /* |
| 80 | + * pstride has both STRIDE_Y and STRIDE_C, but multiplying the whole |
| 81 | + * of pstride by 2 is conveniently OK here as we are multiplying both |
| 82 | + * values. |
| 83 | + */ |
| 84 | + if (pipe->interlaced) |
| 85 | + pstride *= 2; |
| 86 | + |
67 | 87 | vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_PSTRIDE, pstride); |
68 | 88 |
|
69 | 89 | /* Format */ |
@@ -100,6 +120,9 @@ static void rpf_configure_stream(struct vsp1_entity *entity, |
100 | 120 | top = compose->top; |
101 | 121 | } |
102 | 122 |
|
| 123 | + if (pipe->interlaced) |
| 124 | + top /= 2; |
| 125 | + |
103 | 126 | vsp1_rpf_write(rpf, dlb, VI6_RPF_LOC, |
104 | 127 | (left << VI6_RPF_LOC_HCOORD_SHIFT) | |
105 | 128 | (top << VI6_RPF_LOC_VCOORD_SHIFT)); |
@@ -169,6 +192,36 @@ static void rpf_configure_stream(struct vsp1_entity *entity, |
169 | 192 |
|
170 | 193 | } |
171 | 194 |
|
| 195 | +static void vsp1_rpf_configure_autofld(struct vsp1_rwpf *rpf, |
| 196 | + struct vsp1_dl_list *dl) |
| 197 | +{ |
| 198 | + const struct v4l2_pix_format_mplane *format = &rpf->format; |
| 199 | + struct vsp1_dl_ext_cmd *cmd; |
| 200 | + struct vsp1_extcmd_auto_fld_body *auto_fld; |
| 201 | + u32 offset_y, offset_c; |
| 202 | + |
| 203 | + cmd = vsp1_dl_get_pre_cmd(dl); |
| 204 | + if (WARN_ONCE(!cmd, "Failed to obtain an autofld cmd")) |
| 205 | + return; |
| 206 | + |
| 207 | + /* Re-index our auto_fld to match the current RPF. */ |
| 208 | + auto_fld = cmd->data; |
| 209 | + auto_fld = &auto_fld[rpf->entity.index]; |
| 210 | + |
| 211 | + auto_fld->top_y0 = rpf->mem.addr[0]; |
| 212 | + auto_fld->top_c0 = rpf->mem.addr[1]; |
| 213 | + auto_fld->top_c1 = rpf->mem.addr[2]; |
| 214 | + |
| 215 | + offset_y = format->plane_fmt[0].bytesperline; |
| 216 | + offset_c = format->plane_fmt[1].bytesperline; |
| 217 | + |
| 218 | + auto_fld->bottom_y0 = rpf->mem.addr[0] + offset_y; |
| 219 | + auto_fld->bottom_c0 = rpf->mem.addr[1] + offset_c; |
| 220 | + auto_fld->bottom_c1 = rpf->mem.addr[2] + offset_c; |
| 221 | + |
| 222 | + cmd->flags |= VI6_DL_EXT_AUTOFLD_INT | BIT(16 + rpf->entity.index); |
| 223 | +} |
| 224 | + |
172 | 225 | static void rpf_configure_frame(struct vsp1_entity *entity, |
173 | 226 | struct vsp1_pipeline *pipe, |
174 | 227 | struct vsp1_dl_list *dl, |
@@ -221,6 +274,11 @@ static void rpf_configure_partition(struct vsp1_entity *entity, |
221 | 274 | crop.left += pipe->partition->rpf.left; |
222 | 275 | } |
223 | 276 |
|
| 277 | + if (pipe->interlaced) { |
| 278 | + crop.height = round_down(crop.height / 2, fmtinfo->vsub); |
| 279 | + crop.top = round_down(crop.top / 2, fmtinfo->vsub); |
| 280 | + } |
| 281 | + |
224 | 282 | vsp1_rpf_write(rpf, dlb, VI6_RPF_SRC_BSIZE, |
225 | 283 | (crop.width << VI6_RPF_SRC_BSIZE_BHSIZE_SHIFT) | |
226 | 284 | (crop.height << VI6_RPF_SRC_BSIZE_BVSIZE_SHIFT)); |
@@ -249,9 +307,17 @@ static void rpf_configure_partition(struct vsp1_entity *entity, |
249 | 307 | fmtinfo->swap_uv) |
250 | 308 | swap(mem.addr[1], mem.addr[2]); |
251 | 309 |
|
252 | | - vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_ADDR_Y, mem.addr[0]); |
253 | | - vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_ADDR_C0, mem.addr[1]); |
254 | | - vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_ADDR_C1, mem.addr[2]); |
| 310 | + /* |
| 311 | + * Interlaced pipelines will use the extended pre-cmd to process |
| 312 | + * SRCM_ADDR_{Y,C0,C1} |
| 313 | + */ |
| 314 | + if (pipe->interlaced) { |
| 315 | + vsp1_rpf_configure_autofld(rpf, dl); |
| 316 | + } else { |
| 317 | + vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_ADDR_Y, mem.addr[0]); |
| 318 | + vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_ADDR_C0, mem.addr[1]); |
| 319 | + vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_ADDR_C1, mem.addr[2]); |
| 320 | + } |
255 | 321 | } |
256 | 322 |
|
257 | 323 | static void rpf_partition(struct vsp1_entity *entity, |
|
0 commit comments