From patchwork Thu May 17 23:30:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Navare, Manasi" X-Patchwork-Id: 10407861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0907960353 for ; Thu, 17 May 2018 23:28:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9C3E27C0B for ; Thu, 17 May 2018 23:28:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE66927FB0; Thu, 17 May 2018 23:28:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1B6ED27C0B for ; Thu, 17 May 2018 23:28:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EC51E6EC16; Thu, 17 May 2018 23:28:02 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 46D7F89291; Thu, 17 May 2018 23:28:01 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 May 2018 16:28:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,412,1520924400"; d="scan'208";a="200331908" Received: from labuser-z97x-ud5h.jf.intel.com ([10.54.75.151]) by orsmga004.jf.intel.com with ESMTP; 17 May 2018 16:28:00 -0700 From: Manasi Navare To: intel-gfx@lists.freedesktop.org Date: Thu, 17 May 2018 16:30:44 -0700 Message-Id: <1526599846-30099-2-git-send-email-manasi.d.navare@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526599846-30099-1-git-send-email-manasi.d.navare@intel.com> References: <1526599846-30099-1-git-send-email-manasi.d.navare@intel.com> In-Reply-To: <1526349950-1806-1-git-send-email-manasi.d.navare@intel.com> References: <1526349950-1806-1-git-send-email-manasi.d.navare@intel.com> Subject: [Intel-gfx] [PATCH v3 2/4] drm/dsc: Define Display Stream Compression PPS infoframe X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP This patch defines a new header file for all the DSC 1.2 structures and creates a structure for PPS infoframe which will be used to send picture parameter set secondary data packet for display stream compression. All the PPS infoframe syntax elements are taken from DSC 1.2 specification from VESA. v3: * Add a comment for bits_per_component as per DSC spec (Harry Wentland) v2: * Fix the comments for kernel-doc Cc: dri-devel@lists.freedesktop.org Cc: Jani Nikula Cc: Ville Syrjala Cc: Anusha Srivatsa Signed-off-by: Manasi Navare Reviewed-by: Harry Wentland --- include/drm/drm_dsc.h | 442 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 442 insertions(+) create mode 100644 include/drm/drm_dsc.h diff --git a/include/drm/drm_dsc.h b/include/drm/drm_dsc.h new file mode 100644 index 0000000..73bd0f1 --- /dev/null +++ b/include/drm/drm_dsc.h @@ -0,0 +1,442 @@ +/* + * Copyright (C) 2018 Intel Corp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Manasi Navare + */ + +#ifndef DRM_DSC_H_ +#define DRM_DSC_H_ + +#include + +/* VESA Display Stream Compression DSC 1.2 constants */ +#define DSC_NUM_BUF_RANGES 15 + +/** + * struct picture_parameter_set - Represents 128 bytes of Picture Parameter Set + * + * The VESA DSC standard defines picture parameter set (PPS) which display + * stream compression encoders must communicate to decoders. + * The PPS is encapsulated in 128 bytes (PPS 0 through PPS 127). The fields in + * this structure are as per Table 4.1 in Vesa DSC specification v1.1/v1.2. + * The PPS fields that span over more than a byte should be stored in Big Endian + * format. + */ +struct picture_parameter_set { + /** + * @dsc_version_minor: + * PPS0[3:0] - Contains Minor version of DSC + */ + u8 dsc_version_minor:4; + /** + * @dsc_version_major: + * PPS0[7:4] - Contains major version of DSC + */ + u8 dsc_version_major:4; + /** + * @pps_identifier: + * PPS1[7:0] - Application specific identifier that can be + * used to differentiate between different PPS tables. + */ + u8 pps_identifier; + /** + * @pps2_reserved: + * PPS2[7:0]- RESERVED Byte + */ + u8 pps2_reserved; + /** + * @linebuf_depth: + * PPS3[3:0] - Contains linebuffer bit depth used to generate + * the bitstream. (0x0 - 16 bits for DSc 1.2, 0x8 - 8 bits, + * 0xA - 10 bits, 0xB - 11 bits, 0xC - 12 bits, 0xD - 13 bits, + * 0xE - 14 bits for DSC1.2, 0xF - 14 bits for DSC 1.2. + */ + u8 linebuf_depth:4; + /** + * @bits_per_component: + * PPS3[7:4] - Bits per component for the original pixels + * of the encoded picture. + * 0x0 = 16bpc (allowed only when dsc_version_minor = 0x2) + * 0x8 = 8bpc, 0xA = 10bpc, 0xC = 12bpc, 0xE = 14bpc (also + * allowed only when dsc_minor_version = 0x2) + */ + u8 bits_per_component:4; + /** + * @bpp_high: + * PPS4[1:0] - These are the most significant 2 bits of + * compressed BPP bits_per_pixel[9:0] syntax element. + */ + u8 bpp_high:2; + /** + * @vbr_enable: + * PPS4[2] - 0 = VBR disabled, 1 = VBR enabled + */ + u8 vbr_enable:1; + /** + * @simple_422: + * PPS4[3] - Indicates if decoder drops samples to + * reconstruct the 4:2:2 picture. + */ + u8 simple_422:1; + /** + * @convert_rgb: + * PPS4[4] - Indicates if DSC color space conversion is active + */ + u8 convert_rgb:1; + /** + * @block_pred_enable: + * PPS4[5] - Indicates if BP is used to code any groups in picture + */ + u8 block_pred_enable:1; + /** + * @pps4_reserved: + * PPS4[7:6] - Reseved bits + */ + u8 pps4_reserved:2; + /** + * @bpp_low: + * PPS5[7:0] - This indicates the lower significant 8 bits of + * the compressed BPP bits_per_pixel[9:0] element. + */ + u8 bpp_low; + /** + * @pic_height: + * PPS6[7:0], PPS7[7:0] - Specifies the number of pixel rows within + * the raster. + */ + u16 pic_height; + /** + * @pic_width: + * PPS8[7:0], PPS9[7:0] - Number of pixel columns within the raster. + */ + u16 pic_width; + /** + * @slice_height: + * PPS10[7:0], PPS11[7:0] - Slice height in units of pixels. + */ + u16 slice_height; + /** + * @slice_width: + * PPS12[7:0], PPS13[7:0] - Slice width in terms of pixels. + */ + u16 slice_width; + /** + * @chunk_size: + * PPS14[7:0], PPS15[7:0] - Size in units of bytes of the chunks + * that are used for slice multiplexing. + */ + u16 chunk_size; + /** + * @initial_xmit_delay_high: + * PPS16[1:0] - Most Significant two bits of initial transmission delay. + * It specifies the number of pixel times that the encoder waits before + * transmitting data from its rate buffer. + */ + u8 initial_xmit_delay_high:2; + /** + * @pps16_reserved: + * PPS16[7:2] - Reserved + */ + u8 pps16_reserved:6; + /** + * @initial_xmit_delay_low: + * PPS17[7:0] - Least significant 8 bits of initial transmission delay. + */ + u8 initial_xmit_delay_low; + /** + * @initial_dec_delay: + * + * PPS18[7:0], PPS19[7:0] - Initial decoding delay which is the number + * of pixel times that the decoder accumulates data in its rate buffer + * before starting to decode and output pixels. + */ + u16 initial_dec_delay; + /** + * @pps20_reserved: + * + * PPS20[7:0] - Reserved + */ + u8 pps20_reserved; + /** + * @initial_scale_value: + * PPS21[5:0] - Initial rcXformScale factor used at beginning + * of a slice. + */ + u8 initial_scale_value:6; + /** + * @pps21_reserved: + * PPS21[7:6] - Reserved + */ + u8 pps21_reserved:2; + /** + * @scale_increment_interval: + * PPS22[7:0], PPS23[7:0] - Number of group times between incrementing + * the rcXformScale factor at end of a slice. + */ + u16 scale_increment_interval; + /** + * @scale_decrement_interval_high: + * PPS24[3:0] - Higher 4 bits indicating number of group times between + * decrementing the rcXformScale factor at beginning of a slice. + */ + u8 scale_decrement_interval_high:4; + /** + * @pps24_reserved: + * PPS24[7:4] - Reserved + */ + u8 pps24_reserved:4; + /** + * @scale_decrement_interval_low: + * PPS25[7:0] - Lower 8 bits of scale decrement interval + */ + u8 scale_decrement_interval_low; + /** + * @pps26_reserved: + * PPS26[7:0] + */ + u8 pps26_reserved; + /** + * @first_line_bpg_offset: + * PPS27[4:0] - Number of additional bits that are allocated + * for each group on first line of a slice. + */ + u8 first_line_bpg_offset:5; + /** + * @pps27_reserved: + * PPS27[7:5] + */ + u8 pps27_reserved:3; + /** + * @nfl_bpg_offset: + * PPS28[7:0], PPS29[7:0] - Number of bits including frac bits + * deallocated for each group for groups after the first line of slice. + */ + u16 nfl_bpg_offset; + /** + * @slice_bpg_offset: + * PPS30, PPS31[7:0] - Number of bits that are deallocated for each + * group to enforce the slice constraint. + */ + u16 slice_bpg_offset; + /** + * @initial_offset: + * PPS32,33[7:0] - Initial value for rcXformOffset + */ + u16 initial_offset; + /** + * @final_offset: + * PPS34,35[7:0] - Maximum end-of-slice value for rcXformOffset + */ + u16 final_offset; + /** + * @flatness_min_qp: + * PPS36[4:0] - Minimum QP at which flatness is signaled and + * flatness QP adjustment is made. + */ + u8 flatness_min_qp:5; + /** + * @pps36_reserved: + * PPS36[7:5] - Reserved + */ + u8 pps36_reserved:3; + /** + * @flatness_max_qp: + * PPS37[4:0] - Max QP at which flatness is signalled and + * the flatness adjustment is made. + */ + u8 flatness_max_qp:5; + /** + * @pps37_reserved: + * PPS37[7:5] + */ + u8 pps37_reserved:3; + /** + * @rc_model_size: + * PPS38,39[7:0] - Number of bits within RC Model. + */ + u16 rc_model_size; + /** + * @rc_edge_factor: + * PPS40[3:0] - Ratio of current activity vs, previous + * activity to determine presence of edge. + */ + u8 rc_edge_factor:4; + /** + * @pps40_reserved: + * PPS40[7:4] + */ + u8 pps40_reserved:4; + /** + * @rc_quant_incr_limit0: + * PPS41[4:0] - QP threshold used in short term RC + */ + u8 rc_quant_incr_limit0:5; + /** + * @pps41_reserved: + * PPS41[7:5] + */ + u8 pps41_reserved:3; + /** + * @rc_quant_incr_limit1: + * PPS42[4:0] - QP threshold used in short term RC + */ + u8 rc_quant_incr_limit1:5; + /** + * @pps42_reserved: + * PPS42[7:5] + */ + u8 pps42_reserved:3; + /** + * @rc_tgt_offset_lo: + * Lower end of the variability range around the target + * bits per group that is allowed by short term RC. + */ + u8 rc_tgt_offset_lo:4; + /** + * @rc_tgt_offset_hi: + * Upper end of the variability range around the target + * bits per group that i allowed by short term rc. + */ + u8 rc_tgt_offset_hi:4; + /** + * @rc_buf_thresh: + * PPS44[7:0] - PPS57[7:0] - Specifies the thresholds in RC model for + * the 15 ranges defined by 14 thresholds. + */ + u8 rc_buf_thresh[DSC_NUM_BUF_RANGES - 1]; + /** + * @rc_range_parameters: + * PPS58[7:0] - PPS87[7:0] + * Parameters that correspond to each of the 15 ranges. + */ + u16 rc_range_parameters[DSC_NUM_BUF_RANGES]; + /** + * @native_422: + * PPS88[0] - 0 = Native 4:2:2 not used + * 1 = Native 4:2:2 used + */ + u8 native_422:1; + /** + * @native_420: + * PPS88[1] - 0 = Native 4:2:0 not used + * 1 = Native 4:2:0 not used. + */ + u8 native_420:1; + /** + * @pps88_reserved: + * PPS[7:2] - Reserved 6 bits + */ + u8 pps88_reserved:6; + /** + * @second_line_bpg_offset: + * PPS89[4:0] - Additional bits/group budget for the + * second line of a slice in Native 4:2:0 mode. + * Set to 0 if DSC minor version is 1 or native420 is 0. + */ + u8 second_line_bpg_offset:5; + /** + * @pps89_reserved: + * PPS89[7:5] - Reserved + */ + u8 pps89_reserved:3; + /** + * @nsl_bpg_offset: + * PPS90[7:0], PPS91[7:0] - Number of bits that are deallocated + * for each group that is not in the second line of a slice. + */ + u16 nsl_bpg_offset; + /** + * @second_line_offset_adj: + * PPS92[7:0], PPS93[7:0] - Used as offset adjustment for the second + * line in Native 4:2:0 mode. + */ + u16 second_line_offset_adj; + /** + * @pps_long_94_reserved: + * PPS 94, 95, 96, 97 - Reserved + */ + u32 pps_long_94_reserved; + /** + * @pps_long_98_reserved: + * PPS 98, 99, 100, 101 - Reserved + */ + u32 pps_long_98_reserved; + /** + * @pps_long_102_reserved: + * PPS 102, 103, 104, 105 - Reserved + */ + u32 pps_long_102_reserved; + /** + * @pps_long_106_reserved: + * PPS 106, 107, 108, 109 - reserved + */ + u32 pps_long_106_reserved; + /** + * @pps_long_110_reserved: + * PPS 110, 111, 112, 113 - reserved + */ + u32 pps_long_110_reserved; + /** + * @pps_long_114_reserved: + * PPS 114 - 117 - reserved + */ + u32 pps_long_114_reserved; + /** + * @pps_long_118_reserved: + * PPS 118 - 121 - reserved + */ + u32 pps_long_118_reserved; + /** + * @pps_long_122_reserved: + * PPS 122- 125 - reserved + */ + u32 pps_long_122_reserved; + /** + * @pps_short_126_reserved: + * PPS 126, 127 - reserved + */ + u16 pps_short_126_reserved; +}; + +/** + * struct drm_dsc_pps_infoframe - DSC infoframe carrying the Picture Parameter + * Set Metadata + * + * This structure represents the DSC PPS infoframe required to send the Picture + * Parameter Set metadata required before enabling VESA Display Stream + * Compression. This is based on the DP Secondary Data Packet structure and + * comprises of SDP Header as defined in drm_dp_helper.h and PPS payload. + * + * @pps_header: + * + * Header for PPS as per DP SDP header format + * + * @pps_payload: + * + * PPS payload fields as per DSC specification Table 4-1 + */ +struct drm_dsc_pps_infoframe { + struct dp_sdp_header pps_header; + struct picture_parameter_set pps_payload; +} __packed; + +#endif /* _DRM_DSC_H_ */