@@ -1652,12 +1652,27 @@ void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
1652
1652
de -> cmd_len = 0 ;
1653
1653
de -> dpbno_col = ~0U ;
1654
1654
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
+
1661
1676
de -> frame_aux = NULL ;
1662
1677
1663
1678
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)
1669
1684
goto fail ;
1670
1685
}
1671
1686
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 ) {
1673
1689
v4l2_err (& dev -> v4l2_dev ,
1674
1690
"Pixel format %#x != NV12MT_COL128 for 8-bit output" ,
1675
1691
ctx -> dst_fmt .pixelformat );
1676
1692
goto fail ;
1677
1693
}
1678
1694
} 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 ) {
1681
1697
v4l2_err (& dev -> v4l2_dev ,
1682
1698
"Pixel format %#x != NV12MT_10_COL128 for 10-bit output" ,
1683
1699
ctx -> dst_fmt .pixelformat );
@@ -1688,20 +1704,40 @@ void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
1688
1704
s -> sps .bit_depth_luma_minus8 + 8 );
1689
1705
goto fail ;
1690
1706
}
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 ;
1705
1741
}
1706
1742
1707
1743
/*
@@ -1861,8 +1897,13 @@ void hevc_d_h265_setup(struct hevc_d_ctx *ctx, struct hevc_d_run *run)
1861
1897
1862
1898
de -> ref_addrs [i ][0 ] =
1863
1899
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 );
1866
1907
}
1867
1908
1868
1909
/* Move DPB from temp */
@@ -2414,9 +2455,11 @@ static int try_ctrl_sps(struct v4l2_ctrl *ctrl)
2414
2455
return 0 ;
2415
2456
2416
2457
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 ) ||
2418
2460
(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 )) {
2420
2463
v4l2_warn (& dev -> v4l2_dev ,
2421
2464
"SPS luma depth %d does not match capture format\n" ,
2422
2465
sps -> bit_depth_luma_minus8 + 8 );
0 commit comments