@@ -1687,12 +1687,26 @@ static void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
16871687 de -> cmd_len = 0 ;
16881688 de -> dpbno_col = ~0U ;
16891689
1690- de -> luma_stride = ctx -> dst_fmt .height * 128 ;
1691- de -> frame_luma_addr =
1692- vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 0 );
1693- de -> chroma_stride = de -> luma_stride / 2 ;
1694- de -> frame_chroma_addr =
1695- vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 1 );
1690+ switch (ctx -> dst_fmt .pixelformat ) {
1691+ case V4L2_PIX_FMT_NV12MT_COL128 :
1692+ case V4L2_PIX_FMT_NV12MT_10_COL128 :
1693+ de -> luma_stride = ctx -> dst_fmt .height * 128 ;
1694+ de -> frame_luma_addr =
1695+ vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 0 );
1696+ de -> chroma_stride = de -> luma_stride / 2 ;
1697+ de -> frame_chroma_addr =
1698+ vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 1 );
1699+ break ;
1700+ case V4L2_PIX_FMT_NV12_COL128 :
1701+ case V4L2_PIX_FMT_NV12_10_COL128 :
1702+ de -> luma_stride = ctx -> dst_fmt .plane_fmt [0 ].bytesperline * 128 ;
1703+ de -> frame_luma_addr =
1704+ vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 0 );
1705+ de -> chroma_stride = de -> luma_stride ;
1706+ de -> frame_chroma_addr = de -> frame_luma_addr +
1707+ (ctx -> dst_fmt .height * 128 );
1708+ break ;
1709+ }
16961710 de -> frame_aux = NULL ;
16971711
16981712 if (s -> sps .bit_depth_luma_minus8 !=
@@ -1704,15 +1718,16 @@ static void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
17041718 goto fail ;
17051719 }
17061720 if (s -> sps .bit_depth_luma_minus8 == 0 ) {
1707- if (ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_COL128 ) {
1721+ if (ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_COL128 &&
1722+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12_COL128 ) {
17081723 v4l2_err (& dev -> v4l2_dev ,
17091724 "Pixel format %#x != NV12MT_COL128 for 8-bit output" ,
17101725 ctx -> dst_fmt .pixelformat );
17111726 goto fail ;
17121727 }
17131728 } else if (s -> sps .bit_depth_luma_minus8 == 2 ) {
1714- if (ctx -> dst_fmt .pixelformat !=
1715- V4L2_PIX_FMT_NV12MT_10_COL128 ) {
1729+ if (ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_10_COL128 &&
1730+ ctx -> dst_fmt . pixelformat != V4L2_PIX_FMT_NV12_10_COL128 ) {
17161731 v4l2_err (& dev -> v4l2_dev ,
17171732 "Pixel format %#x != NV12MT_10_COL128 for 10-bit output" ,
17181733 ctx -> dst_fmt .pixelformat );
@@ -1723,20 +1738,41 @@ static void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
17231738 s -> sps .bit_depth_luma_minus8 + 8 );
17241739 goto fail ;
17251740 }
1726- if (run -> dst -> vb2_buf .num_planes != 2 ) {
1727- v4l2_warn (& dev -> v4l2_dev , "Capture planes (%d) != 2\n" ,
1728- run -> dst -> vb2_buf .num_planes );
1729- goto fail ;
1730- }
1731- if (run -> dst -> planes [0 ].length < ctx -> dst_fmt .plane_fmt [0 ].sizeimage ||
1732- run -> dst -> planes [1 ].length < ctx -> dst_fmt .plane_fmt [1 ].sizeimage ) {
1733- v4l2_warn (& dev -> v4l2_dev ,
1734- "Capture planes length (%d/%d) < sizeimage (%d/%d)\n" ,
1735- run -> dst -> planes [0 ].length ,
1736- run -> dst -> planes [1 ].length ,
1737- ctx -> dst_fmt .plane_fmt [0 ].sizeimage ,
1738- ctx -> dst_fmt .plane_fmt [1 ].sizeimage );
1739- goto fail ;
1741+
1742+ switch (ctx -> dst_fmt .pixelformat ) {
1743+ case V4L2_PIX_FMT_NV12MT_COL128 :
1744+ case V4L2_PIX_FMT_NV12MT_10_COL128 :
1745+ if (run -> dst -> vb2_buf .num_planes != 2 ) {
1746+ v4l2_warn (& dev -> v4l2_dev , "Capture planes (%d) != 2\n" ,
1747+ run -> dst -> vb2_buf .num_planes );
1748+ goto fail ;
1749+ }
1750+ if (run -> dst -> planes [0 ].length < ctx -> dst_fmt .plane_fmt [0 ].sizeimage ||
1751+ run -> dst -> planes [1 ].length < ctx -> dst_fmt .plane_fmt [1 ].sizeimage ) {
1752+ v4l2_warn (& dev -> v4l2_dev ,
1753+ "Capture planes length (%d/%d) < sizeimage (%d/%d)\n" ,
1754+ run -> dst -> planes [0 ].length ,
1755+ run -> dst -> planes [1 ].length ,
1756+ ctx -> dst_fmt .plane_fmt [0 ].sizeimage ,
1757+ ctx -> dst_fmt .plane_fmt [1 ].sizeimage );
1758+ goto fail ;
1759+ }
1760+ break ;
1761+ case V4L2_PIX_FMT_NV12_COL128 :
1762+ case V4L2_PIX_FMT_NV12_10_COL128 :
1763+ if (run -> dst -> vb2_buf .num_planes != 1 ) {
1764+ v4l2_warn (& dev -> v4l2_dev , "Capture planes (%d) != 1\n" ,
1765+ run -> dst -> vb2_buf .num_planes );
1766+ goto fail ;
1767+ }
1768+ if (run -> dst -> planes [0 ].length < ctx -> dst_fmt .plane_fmt [0 ].sizeimage ) {
1769+ v4l2_warn (& dev -> v4l2_dev ,
1770+ "Capture planes length (%d) < sizeimage (%d)\n" ,
1771+ run -> dst -> planes [0 ].length ,
1772+ ctx -> dst_fmt .plane_fmt [0 ].sizeimage );
1773+ goto fail ;
1774+ }
1775+ break ;
17401776 }
17411777
17421778 /*
@@ -1896,8 +1932,13 @@ static void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
18961932
18971933 de -> ref_addrs [i ][0 ] =
18981934 vb2_dma_contig_plane_dma_addr (buf , 0 );
1899- de -> ref_addrs [i ][1 ] =
1900- vb2_dma_contig_plane_dma_addr (buf , 1 );
1935+ if (ctx -> dst_fmt .pixelformat == V4L2_PIX_FMT_NV12MT_COL128 ||
1936+ ctx -> dst_fmt .pixelformat == V4L2_PIX_FMT_NV12MT_10_COL128 )
1937+ de -> ref_addrs [i ][1 ] =
1938+ vb2_dma_contig_plane_dma_addr (buf , 1 );
1939+ else
1940+ de -> ref_addrs [i ][1 ] = de -> ref_addrs [i ][0 ] +
1941+ (ctx -> dst_fmt .height * 128 );
19011942 }
19021943
19031944 /* Move DPB from temp */
@@ -2564,9 +2605,11 @@ static int try_ctrl_sps(struct v4l2_ctrl *ctrl)
25642605 return 0 ;
25652606
25662607 if ((sps -> bit_depth_luma_minus8 == 0 &&
2567- ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_COL128 ) ||
2608+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_COL128 &&
2609+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12_COL128 ) ||
25682610 (sps -> bit_depth_luma_minus8 == 2 &&
2569- ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_10_COL128 )) {
2611+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_10_COL128 &&
2612+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12_10_COL128 )) {
25702613 v4l2_warn (& dev -> v4l2_dev ,
25712614 "SPS luma depth %d does not match capture format\n" ,
25722615 sps -> bit_depth_luma_minus8 + 8 );
0 commit comments