@@ -1652,12 +1652,27 @@ void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
16521652 de -> cmd_len = 0 ;
16531653 de -> dpbno_col = ~0U ;
16541654
1655- de -> luma_stride = ctx -> dst_fmt .height * 128 ;
1656- de -> frame_luma_addr =
1657- vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 0 );
1658- de -> chroma_stride = de -> luma_stride / 2 ;
1659- de -> frame_chroma_addr =
1660- vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 1 );
1655+ switch (ctx -> dst_fmt .pixelformat ) {
1656+ case V4L2_PIX_FMT_NV12MT_COL128 :
1657+ case V4L2_PIX_FMT_NV12MT_10_COL128 :
1658+ de -> luma_stride = ctx -> dst_fmt .height * 128 ;
1659+ de -> frame_luma_addr =
1660+ vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 0 );
1661+ de -> chroma_stride = de -> luma_stride / 2 ;
1662+ de -> frame_chroma_addr =
1663+ vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 1 );
1664+ break ;
1665+ case V4L2_PIX_FMT_NV12_COL128 :
1666+ case V4L2_PIX_FMT_NV12_10_COL128 :
1667+ de -> luma_stride = ctx -> dst_fmt .plane_fmt [0 ].bytesperline * 128 ;
1668+ de -> frame_luma_addr =
1669+ vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 0 );
1670+ de -> chroma_stride = de -> luma_stride ;
1671+ de -> frame_chroma_addr = de -> frame_luma_addr +
1672+ (ctx -> dst_fmt .height * 128 );
1673+ break ;
1674+ }
1675+
16611676 de -> frame_aux = NULL ;
16621677
16631678 if (s -> sps .bit_depth_luma_minus8 !=
@@ -1669,15 +1684,16 @@ void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
16691684 goto fail ;
16701685 }
16711686 if (s -> sps .bit_depth_luma_minus8 == 0 ) {
1672- if (ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_COL128 ) {
1687+ if (ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_COL128 &&
1688+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12_COL128 ) {
16731689 v4l2_err (& dev -> v4l2_dev ,
16741690 "Pixel format %#x != NV12MT_COL128 for 8-bit output" ,
16751691 ctx -> dst_fmt .pixelformat );
16761692 goto fail ;
16771693 }
16781694 } else if (s -> sps .bit_depth_luma_minus8 == 2 ) {
1679- if (ctx -> dst_fmt .pixelformat !=
1680- V4L2_PIX_FMT_NV12MT_10_COL128 ) {
1695+ if (ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_10_COL128 &&
1696+ ctx -> dst_fmt . pixelformat != V4L2_PIX_FMT_NV12_10_COL128 ) {
16811697 v4l2_err (& dev -> v4l2_dev ,
16821698 "Pixel format %#x != NV12MT_10_COL128 for 10-bit output" ,
16831699 ctx -> dst_fmt .pixelformat );
@@ -1688,20 +1704,40 @@ void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
16881704 s -> sps .bit_depth_luma_minus8 + 8 );
16891705 goto fail ;
16901706 }
1691- if (run -> dst -> vb2_buf .num_planes != 2 ) {
1692- v4l2_warn (& dev -> v4l2_dev , "Capture planes (%d) != 2\n" ,
1693- run -> dst -> vb2_buf .num_planes );
1694- goto fail ;
1695- }
1696- if (run -> dst -> planes [0 ].length < ctx -> dst_fmt .plane_fmt [0 ].sizeimage ||
1697- run -> dst -> planes [1 ].length < ctx -> dst_fmt .plane_fmt [1 ].sizeimage ) {
1698- v4l2_warn (& dev -> v4l2_dev ,
1699- "Capture planes length (%d/%d) < sizeimage (%d/%d)\n" ,
1700- run -> dst -> planes [0 ].length ,
1701- run -> dst -> planes [1 ].length ,
1702- ctx -> dst_fmt .plane_fmt [0 ].sizeimage ,
1703- ctx -> dst_fmt .plane_fmt [1 ].sizeimage );
1704- goto fail ;
1707+ switch (ctx -> dst_fmt .pixelformat ) {
1708+ case V4L2_PIX_FMT_NV12MT_COL128 :
1709+ case V4L2_PIX_FMT_NV12MT_10_COL128 :
1710+ if (run -> dst -> vb2_buf .num_planes != 2 ) {
1711+ v4l2_warn (& dev -> v4l2_dev , "Capture planes (%d) != 2\n" ,
1712+ run -> dst -> vb2_buf .num_planes );
1713+ goto fail ;
1714+ }
1715+ if (run -> dst -> planes [0 ].length < ctx -> dst_fmt .plane_fmt [0 ].sizeimage ||
1716+ run -> dst -> planes [1 ].length < ctx -> dst_fmt .plane_fmt [1 ].sizeimage ) {
1717+ v4l2_warn (& dev -> v4l2_dev ,
1718+ "Capture planes length (%d/%d) < sizeimage (%d/%d)\n" ,
1719+ run -> dst -> planes [0 ].length ,
1720+ run -> dst -> planes [1 ].length ,
1721+ ctx -> dst_fmt .plane_fmt [0 ].sizeimage ,
1722+ ctx -> dst_fmt .plane_fmt [1 ].sizeimage );
1723+ goto fail ;
1724+ }
1725+ break ;
1726+ case V4L2_PIX_FMT_NV12_COL128 :
1727+ case V4L2_PIX_FMT_NV12_10_COL128 :
1728+ if (run -> dst -> vb2_buf .num_planes != 1 ) {
1729+ v4l2_warn (& dev -> v4l2_dev , "Capture planes (%d) != 1\n" ,
1730+ run -> dst -> vb2_buf .num_planes );
1731+ goto fail ;
1732+ }
1733+ if (run -> dst -> planes [0 ].length < ctx -> dst_fmt .plane_fmt [0 ].sizeimage ) {
1734+ v4l2_warn (& dev -> v4l2_dev ,
1735+ "Capture planes length (%d) < sizeimage (%d)\n" ,
1736+ run -> dst -> planes [0 ].length ,
1737+ ctx -> dst_fmt .plane_fmt [0 ].sizeimage );
1738+ goto fail ;
1739+ }
1740+ break ;
17051741 }
17061742
17071743 /*
@@ -1861,8 +1897,13 @@ void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
18611897
18621898 de -> ref_addrs [i ][0 ] =
18631899 vb2_dma_contig_plane_dma_addr (buf , 0 );
1864- de -> ref_addrs [i ][1 ] =
1865- vb2_dma_contig_plane_dma_addr (buf , 1 );
1900+ if (ctx -> dst_fmt .pixelformat == V4L2_PIX_FMT_NV12MT_COL128 ||
1901+ ctx -> dst_fmt .pixelformat == V4L2_PIX_FMT_NV12MT_10_COL128 )
1902+ de -> ref_addrs [i ][1 ] =
1903+ vb2_dma_contig_plane_dma_addr (buf , 1 );
1904+ else
1905+ de -> ref_addrs [i ][1 ] = de -> ref_addrs [i ][0 ] +
1906+ (ctx -> dst_fmt .height * 128 );
18661907 }
18671908
18681909 /* Move DPB from temp */
@@ -2414,9 +2455,11 @@ static int try_ctrl_sps(struct v4l2_ctrl *ctrl)
24142455 return 0 ;
24152456
24162457 if ((sps -> bit_depth_luma_minus8 == 0 &&
2417- ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_COL128 ) ||
2458+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_COL128 &&
2459+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12_COL128 ) ||
24182460 (sps -> bit_depth_luma_minus8 == 2 &&
2419- ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_10_COL128 )) {
2461+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_10_COL128 &&
2462+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12_10_COL128 )) {
24202463 v4l2_warn (& dev -> v4l2_dev ,
24212464 "SPS luma depth %d does not match capture format\n" ,
24222465 sps -> bit_depth_luma_minus8 + 8 );
0 commit comments