@@ -1748,12 +1748,26 @@ static void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
17481748 de -> bit_copy_gptr = ctx -> bitbufs + ctx -> p1idx ;
17491749 de -> bit_copy_len = 0 ;
17501750
1751- de -> luma_stride = ctx -> dst_fmt .height * 128 ;
1752- de -> frame_luma_addr =
1753- vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 0 );
1754- de -> chroma_stride = de -> luma_stride / 2 ;
1755- de -> frame_chroma_addr =
1756- vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 1 );
1751+ switch (ctx -> dst_fmt .pixelformat ) {
1752+ case V4L2_PIX_FMT_NV12MT_COL128 :
1753+ case V4L2_PIX_FMT_NV12MT_10_COL128 :
1754+ de -> luma_stride = ctx -> dst_fmt .height * 128 ;
1755+ de -> frame_luma_addr =
1756+ vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 0 );
1757+ de -> chroma_stride = de -> luma_stride / 2 ;
1758+ de -> frame_chroma_addr =
1759+ vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 1 );
1760+ break ;
1761+ case V4L2_PIX_FMT_NV12_COL128 :
1762+ case V4L2_PIX_FMT_NV12_10_COL128 :
1763+ de -> luma_stride = ctx -> dst_fmt .plane_fmt [0 ].bytesperline * 128 ;
1764+ de -> frame_luma_addr =
1765+ vb2_dma_contig_plane_dma_addr (& run -> dst -> vb2_buf , 0 );
1766+ de -> chroma_stride = de -> luma_stride ;
1767+ de -> frame_chroma_addr = de -> frame_luma_addr +
1768+ (ctx -> dst_fmt .height * 128 );
1769+ break ;
1770+ }
17571771 de -> frame_aux = NULL ;
17581772
17591773 if (s -> sps .bit_depth_luma_minus8 !=
@@ -1766,15 +1780,19 @@ static void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
17661780 }
17671781 if (s -> sps .bit_depth_luma_minus8 == 0 ) {
17681782 if (ctx -> dst_fmt .pixelformat !=
1769- V4L2_PIX_FMT_NV12MT_COL128 ) {
1783+ V4L2_PIX_FMT_NV12MT_COL128 &&
1784+ ctx -> dst_fmt .pixelformat !=
1785+ V4L2_PIX_FMT_NV12_COL128 ) {
17701786 v4l2_err (& dev -> v4l2_dev ,
17711787 "Pixel format %#x != NV12MT_COL128 for 8-bit output" ,
17721788 ctx -> dst_fmt .pixelformat );
17731789 goto fail ;
17741790 }
17751791 } else if (s -> sps .bit_depth_luma_minus8 == 2 ) {
17761792 if (ctx -> dst_fmt .pixelformat !=
1777- V4L2_PIX_FMT_NV12MT_10_COL128 ) {
1793+ V4L2_PIX_FMT_NV12MT_10_COL128 &&
1794+ ctx -> dst_fmt .pixelformat !=
1795+ V4L2_PIX_FMT_NV12_10_COL128 ) {
17781796 v4l2_err (& dev -> v4l2_dev ,
17791797 "Pixel format %#x != NV12MT_10_COL128 for 10-bit output" ,
17801798 ctx -> dst_fmt .pixelformat );
@@ -1786,20 +1804,40 @@ static void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
17861804 s -> sps .bit_depth_luma_minus8 + 8 );
17871805 goto fail ;
17881806 }
1789- if (run -> dst -> vb2_buf .num_planes != 2 ) {
1790- v4l2_warn (& dev -> v4l2_dev , "Capture planes (%d) != 2\n" ,
1791- run -> dst -> vb2_buf .num_planes );
1792- goto fail ;
1793- }
1794- if (run -> dst -> planes [0 ].length < ctx -> dst_fmt .plane_fmt [0 ].sizeimage ||
1795- run -> dst -> planes [1 ].length < ctx -> dst_fmt .plane_fmt [1 ].sizeimage ) {
1796- v4l2_warn (& dev -> v4l2_dev ,
1797- "Capture planes length (%d/%d) < sizeimage (%d/%d)\n" ,
1798- run -> dst -> planes [0 ].length ,
1799- run -> dst -> planes [1 ].length ,
1800- ctx -> dst_fmt .plane_fmt [0 ].sizeimage ,
1801- ctx -> dst_fmt .plane_fmt [1 ].sizeimage );
1802- goto fail ;
1807+ switch (ctx -> dst_fmt .pixelformat ) {
1808+ case V4L2_PIX_FMT_NV12MT_COL128 :
1809+ case V4L2_PIX_FMT_NV12MT_10_COL128 :
1810+ if (run -> dst -> vb2_buf .num_planes != 2 ) {
1811+ v4l2_warn (& dev -> v4l2_dev , "Capture planes (%d) != 2\n" ,
1812+ run -> dst -> vb2_buf .num_planes );
1813+ goto fail ;
1814+ }
1815+ if (run -> dst -> planes [0 ].length < ctx -> dst_fmt .plane_fmt [0 ].sizeimage ||
1816+ run -> dst -> planes [1 ].length < ctx -> dst_fmt .plane_fmt [1 ].sizeimage ) {
1817+ v4l2_warn (& dev -> v4l2_dev ,
1818+ "Capture planes length (%d/%d) < sizeimage (%d/%d)\n" ,
1819+ run -> dst -> planes [0 ].length ,
1820+ run -> dst -> planes [1 ].length ,
1821+ ctx -> dst_fmt .plane_fmt [0 ].sizeimage ,
1822+ ctx -> dst_fmt .plane_fmt [1 ].sizeimage );
1823+ goto fail ;
1824+ }
1825+ break ;
1826+ case V4L2_PIX_FMT_NV12_COL128 :
1827+ case V4L2_PIX_FMT_NV12_10_COL128 :
1828+ if (run -> dst -> vb2_buf .num_planes != 1 ) {
1829+ v4l2_warn (& dev -> v4l2_dev , "Capture planes (%d) != 1\n" ,
1830+ run -> dst -> vb2_buf .num_planes );
1831+ goto fail ;
1832+ }
1833+ if (run -> dst -> planes [0 ].length < ctx -> dst_fmt .plane_fmt [0 ].sizeimage ) {
1834+ v4l2_warn (& dev -> v4l2_dev ,
1835+ "Capture planes length (%d) < sizeimage (%d)\n" ,
1836+ run -> dst -> planes [0 ].length ,
1837+ ctx -> dst_fmt .plane_fmt [0 ].sizeimage );
1838+ goto fail ;
1839+ }
1840+ break ;
18031841 }
18041842
18051843 /*
@@ -1993,8 +2031,13 @@ static void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
19932031
19942032 de -> ref_addrs [i ][0 ] =
19952033 vb2_dma_contig_plane_dma_addr (buf , 0 );
1996- de -> ref_addrs [i ][1 ] =
1997- vb2_dma_contig_plane_dma_addr (buf , 1 );
2034+ if (ctx -> dst_fmt .pixelformat == V4L2_PIX_FMT_NV12MT_COL128 ||
2035+ ctx -> dst_fmt .pixelformat == V4L2_PIX_FMT_NV12MT_10_COL128 )
2036+ de -> ref_addrs [i ][1 ] =
2037+ vb2_dma_contig_plane_dma_addr (buf , 1 );
2038+ else
2039+ de -> ref_addrs [i ][1 ] = de -> ref_addrs [i ][0 ] +
2040+ (ctx -> dst_fmt .height * 128 );
19982041 }
19992042
20002043 /* Move DPB from temp */
@@ -2629,9 +2672,11 @@ static int try_ctrl_sps(struct v4l2_ctrl *ctrl)
26292672 return 0 ;
26302673
26312674 if ((sps -> bit_depth_luma_minus8 == 0 &&
2632- ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_COL128 ) ||
2675+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_COL128 &&
2676+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12_COL128 ) ||
26332677 (sps -> bit_depth_luma_minus8 == 2 &&
2634- ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_10_COL128 )) {
2678+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12MT_10_COL128 &&
2679+ ctx -> dst_fmt .pixelformat != V4L2_PIX_FMT_NV12_10_COL128 )) {
26352680 v4l2_warn (& dev -> v4l2_dev ,
26362681 "SPS luma depth %d does not match capture format\n" ,
26372682 sps -> bit_depth_luma_minus8 + 8 );
0 commit comments