diff mbox

drm: Add aux plane verification in addFB2

Message ID 1446457811-6910-1-git-send-email-vandana.kannan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

vandana.kannan@intel.com Nov. 2, 2015, 9:50 a.m. UTC
For render compression, userspace passes aux stride and offset values as an
additional entry in the fb structure. This should not be treated as garbage
and discarded as data belonging to no plane.
This patch introduces a check related to AUX plane to support the
scenario of render compression.

Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Vandana Kannan <vandana.kannan@intel.com>
---
 drivers/gpu/drm/drm_crtc.c  | 16 +++++++++++++++-
 drivers/gpu/drm/drm_ioctl.c |  3 +++
 include/drm/drm_crtc.h      |  3 +++
 include/uapi/drm/drm.h      |  1 +
 include/uapi/drm/drm_mode.h |  1 +
 5 files changed, 23 insertions(+), 1 deletion(-)

Comments

kernel test robot Nov. 2, 2015, 10:31 a.m. UTC | #1
Hi Vandana,

[auto build test WARNING on drm/drm-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Vandana-Kannan/drm-Add-aux-plane-verification-in-addFB2/20151102-172316
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/i915/i915_irq.c:2584: warning: No description found for parameter 'wedged'
   drivers/gpu/drm/i915/i915_irq.c:2584: warning: No description found for parameter 'fmt'
   include/drm/drm_crtc.h:310: warning: No description found for parameter 'mode_blob'
   include/drm/drm_crtc.h:737: warning: No description found for parameter 'tile_blob_ptr'
   include/drm/drm_crtc.h:776: warning: No description found for parameter 'rotation'
   include/drm/drm_crtc.h:872: warning: No description found for parameter 'mutex'
   include/drm/drm_crtc.h:872: warning: No description found for parameter 'helper_private'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tile_idr'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'delayed_event'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'edid_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'dpms_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'path_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tile_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'plane_type_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'rotation_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'prop_src_x'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'prop_src_y'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'prop_src_w'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'prop_src_h'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'prop_crtc_x'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'prop_crtc_y'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'prop_crtc_w'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'prop_crtc_h'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'prop_fb_id'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'prop_crtc_id'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'prop_active'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'prop_mode_id'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'dvi_i_subconnector_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'dvi_i_select_subconnector_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tv_subconnector_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tv_select_subconnector_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tv_mode_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tv_left_margin_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tv_right_margin_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tv_top_margin_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tv_bottom_margin_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tv_brightness_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tv_contrast_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tv_flicker_reduction_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tv_overscan_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tv_saturation_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'tv_hue_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'scaling_mode_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'aspect_ratio_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'dirty_info_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'suggested_x_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'suggested_y_property'
   include/drm/drm_crtc.h:1160: warning: No description found for parameter 'allow_fb_modifiers'
>> include/drm/drm_crtc.h:1160: warning: No description found for parameter 'allow_aux_plane'
   include/drm/drm_fb_helper.h:148: warning: No description found for parameter 'connector_info'
   include/drm/drm_dp_helper.h:713: warning: No description found for parameter 'i2c_nack_count'
   include/drm/drm_dp_helper.h:713: warning: No description found for parameter 'i2c_defer_count'
   drivers/gpu/drm/drm_dp_mst_topology.c:2227: warning: No description found for parameter 'connector'
   include/drm/drm_dp_mst_helper.h:97: warning: No description found for parameter 'cached_edid'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'max_dpcd_transaction_bytes'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'sink_count'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'total_slots'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'avail_slots'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'total_pbn'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'qlock'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_msg_downq'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_msg_upq'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_down_in_progress'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_up_in_progress'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payload_lock'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'proposed_vcpis'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payloads'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payload_mask'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'vcpi_mask'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_waitq'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'work'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_work'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_list'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_lock'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_work'
   drivers/gpu/drm/drm_dp_mst_topology.c:2227: warning: No description found for parameter 'connector'
   drivers/gpu/drm/drm_irq.c:173: warning: No description found for parameter 'flags'
   include/drm/drmP.h:168: warning: No description found for parameter 'fmt'
   include/drm/drmP.h:184: warning: No description found for parameter 'fmt'
   include/drm/drmP.h:202: warning: No description found for parameter 'fmt'
   include/drm/drmP.h:247: warning: No description found for parameter 'dev'
   include/drm/drmP.h:247: warning: No description found for parameter 'data'
   include/drm/drmP.h:247: warning: No description found for parameter 'file_priv'
   include/drm/drmP.h:280: warning: No description found for parameter 'ioctl'
   include/drm/drmP.h:280: warning: No description found for parameter '_func'
   include/drm/drmP.h:280: warning: No description found for parameter '_flags'
   include/drm/drmP.h:353: warning: cannot understand function prototype: 'struct drm_lock_data '
   include/drm/drmP.h:406: warning: cannot understand function prototype: 'struct drm_driver '
   include/drm/drmP.h:656: warning: cannot understand function prototype: 'struct drm_info_list '
   include/drm/drmP.h:666: warning: cannot understand function prototype: 'struct drm_info_node '
   include/drm/drmP.h:676: warning: cannot understand function prototype: 'struct drm_minor '
   include/drm/drmP.h:724: warning: cannot understand function prototype: 'struct drm_device '
   drivers/gpu/drm/i915/i915_irq.c:2584: warning: No description found for parameter 'wedged'
   drivers/gpu/drm/i915/i915_irq.c:2584: warning: No description found for parameter 'fmt'
   drivers/gpu/drm/i915/i915_irq.c:2584: warning: No description found for parameter 'wedged'
   drivers/gpu/drm/i915/i915_irq.c:2584: warning: No description found for parameter 'fmt'
   drivers/gpu/drm/i915/i915_irq.c:2584: warning: No description found for parameter 'wedged'
   drivers/gpu/drm/i915/i915_irq.c:2584: warning: No description found for parameter 'fmt'
   drivers/gpu/drm/i915/i915_irq.c:2584: warning: No description found for parameter 'wedged'
   drivers/gpu/drm/i915/i915_irq.c:2584: warning: No description found for parameter 'fmt'
   drivers/gpu/drm/i915/i915_gem.c:421: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:421: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:421: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:686: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:686: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:686: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'obj'
   drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'args'
   drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:1029: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:1029: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:1029: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:1194: warning: No description found for parameter 'rps'
   drivers/gpu/drm/i915/i915_gem.c:1400: warning: No description found for parameter 'req'
   drivers/gpu/drm/i915/i915_gem.c:1435: warning: No description found for parameter 'obj'
   drivers/gpu/drm/i915/i915_gem.c:1435: warning: No description found for parameter 'readonly'
   drivers/gpu/drm/i915/i915_gem.c:1558: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:1558: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:1558: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:1621: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:1621: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:1621: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:1666: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:1666: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:1666: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:1954: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:1954: warning: No description found for parameter 'size'
   drivers/gpu/drm/i915/i915_gem.c:1954: warning: No description found for parameter 'tiling_mode'
   drivers/gpu/drm/i915/i915_gem.c:1954: warning: No description found for parameter 'fenced'
   drivers/gpu/drm/i915/i915_gem.c:1954: warning: Excess function parameter 'obj' description in 'i915_gem_get_gtt_alignment'
   drivers/gpu/drm/i915/i915_gem.c:2817: warning: No description found for parameter 'ring'
   drivers/gpu/drm/i915/i915_gem.c:2946: warning: No description found for parameter 'obj'
   drivers/gpu/drm/i915/i915_gem.c:2996: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:2996: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:2996: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:2996: warning: Excess function parameter 'DRM_IOCTL_ARGS' description in 'i915_gem_wait_ioctl'
   drivers/gpu/drm/i915/i915_gem.c:3365: warning: No description found for parameter 'obj'
   drivers/gpu/drm/i915/i915_gem.c:3365: warning: No description found for parameter 'vm'
   drivers/gpu/drm/i915/i915_gem.c:3365: warning: No description found for parameter 'ggtt_view'
   drivers/gpu/drm/i915/i915_gem.c:3365: warning: No description found for parameter 'alignment'
   drivers/gpu/drm/i915/i915_gem.c:3365: warning: No description found for parameter 'flags'
   drivers/gpu/drm/i915/i915_gem.c:3600: warning: No description found for parameter 'obj'
   drivers/gpu/drm/i915/i915_gem.c:3600: warning: No description found for parameter 'write'
   drivers/gpu/drm/i915/i915_gem.c:3675: warning: No description found for parameter 'obj'
   drivers/gpu/drm/i915/i915_gem.c:3675: warning: No description found for parameter 'cache_level'
   drivers/gpu/drm/i915/i915_gem.c:3949: warning: No description found for parameter 'obj'
   drivers/gpu/drm/i915/i915_gem.c:3949: warning: No description found for parameter 'write'
   drivers/gpu/drm/i915/intel_lrc.c:871: warning: No description found for parameter 'params'

vim +/allow_aux_plane +1160 include/drm/drm_crtc.h

5bb2bbf5 Dave Airlie    2014-11-10  1144  	struct drm_property *suggested_y_property;
5bb2bbf5 Dave Airlie    2014-11-10  1145  
019d96cb Dave Airlie    2011-09-29  1146  	/* dumb ioctl parameters */
019d96cb Dave Airlie    2011-09-29  1147  	uint32_t preferred_depth, prefer_shadow;
62f2104f Keith Packard  2013-07-22  1148  
62f2104f Keith Packard  2013-07-22  1149  	/* whether async page flip is supported or not */
62f2104f Keith Packard  2013-07-22  1150  	bool async_page_flip;
8716ed4e Alex Deucher   2014-02-12  1151  
e3eb3250 Rob Clark      2015-02-05  1152  	/* whether the driver supports fb modifiers */
e3eb3250 Rob Clark      2015-02-05  1153  	bool allow_fb_modifiers;
e3eb3250 Rob Clark      2015-02-05  1154  
43447534 Vandana Kannan 2015-11-02  1155  	/* whether the driver supports render compression */
43447534 Vandana Kannan 2015-11-02  1156  	bool allow_aux_plane;
43447534 Vandana Kannan 2015-11-02  1157  
8716ed4e Alex Deucher   2014-02-12  1158  	/* cursor size */
8716ed4e Alex Deucher   2014-02-12  1159  	uint32_t cursor_width, cursor_height;
f453ba04 Dave Airlie    2008-11-07 @1160  };
f453ba04 Dave Airlie    2008-11-07  1161  
dd275956 Rob Clark      2014-11-25  1162  /**
dd275956 Rob Clark      2014-11-25  1163   * drm_for_each_plane_mask - iterate over planes specified by bitmask
dd275956 Rob Clark      2014-11-25  1164   * @plane: the loop cursor
dd275956 Rob Clark      2014-11-25  1165   * @dev: the DRM device
dd275956 Rob Clark      2014-11-25  1166   * @plane_mask: bitmask of plane indices
dd275956 Rob Clark      2014-11-25  1167   *
dd275956 Rob Clark      2014-11-25  1168   * Iterate over all planes specified by bitmask.

:::::: The code at line 1160 was first introduced by commit
:::::: f453ba0460742ad027ae0c4c7d61e62817b3e7ef DRM: add mode setting support

:::::: TO: Dave Airlie <airlied@redhat.com>
:::::: CC: Dave Airlie <airlied@linux.ie>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Sivakumar Thulasimani Nov. 2, 2015, 4:41 p.m. UTC | #2
On 11/2/2015 3:20 PM, Vandana Kannan wrote:
> For render compression, userspace passes aux stride and offset values as an
> additional entry in the fb structure. This should not be treated as garbage
> and discarded as data belonging to no plane.
> This patch introduces a check related to AUX plane to support the
> scenario of render compression.
>
> Suggested-by: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Vandana Kannan <vandana.kannan@intel.com>
> ---
>   drivers/gpu/drm/drm_crtc.c  | 16 +++++++++++++++-
>   drivers/gpu/drm/drm_ioctl.c |  3 +++
>   include/drm/drm_crtc.h      |  3 +++
>   include/uapi/drm/drm.h      |  1 +
>   include/uapi/drm/drm_mode.h |  1 +
>   5 files changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 24c5434..7dbc0f0 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -3204,6 +3204,13 @@ static int framebuffer_check(const struct drm_mode_fb_cmd2 *r)
>   		}
>   	}
>   
> +	if (r->flags & DRM_MODE_FB_AUX_PLANE) {
> +		if (num_planes == 4)
how can num_planes be 4 since the max it can get seems to be 3.

regards,
Sivakumar
> +			return -EINVAL;
> +
> +		num_planes++;
> +	}
> +
>   	for (i = num_planes; i < 4; i++) {
>   		if (r->modifier[i]) {
>   			DRM_DEBUG_KMS("non-zero modifier for unused plane %d\n", i);
> @@ -3242,7 +3249,8 @@ internal_framebuffer_create(struct drm_device *dev,
>   	struct drm_framebuffer *fb;
>   	int ret;
>   
> -	if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS)) {
> +	if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS |
> +		DRM_MODE_FB_AUX_PLANE)) {
>   		DRM_DEBUG_KMS("bad framebuffer flags 0x%08x\n", r->flags);
>   		return ERR_PTR(-EINVAL);
>   	}
> @@ -3264,6 +3272,12 @@ internal_framebuffer_create(struct drm_device *dev,
>   		return ERR_PTR(-EINVAL);
>   	}
>   
> +	if (r->flags & DRM_MODE_FB_AUX_PLANE &&
> +	    !dev->mode_config.allow_aux_plane) {
> +		DRM_DEBUG_KMS("driver does not support render compression\n");
> +		return ERR_PTR(-EINVAL);
> +	}
> +
>   	ret = framebuffer_check(r);
>   	if (ret)
>   		return ERR_PTR(ret);
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 8ce2a0c..ee00782 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -312,6 +312,9 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>   	case DRM_CAP_ADDFB2_MODIFIERS:
>   		req->value = dev->mode_config.allow_fb_modifiers;
>   		break;
> +	case DRM_CAP_RENDER_COMPRESSION:
> +		req->value = dev->mode_config.allow_aux_plane;
> +		break;
>   	default:
>   		return -EINVAL;
>   	}
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 3f0c690..a5a9da2 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -1152,6 +1152,9 @@ struct drm_mode_config {
>   	/* whether the driver supports fb modifiers */
>   	bool allow_fb_modifiers;
>   
> +	/* whether the driver supports render compression */
> +	bool allow_aux_plane;
> +
>   	/* cursor size */
>   	uint32_t cursor_width, cursor_height;
>   };
> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
> index 3801584..0834bf7 100644
> --- a/include/uapi/drm/drm.h
> +++ b/include/uapi/drm/drm.h
> @@ -631,6 +631,7 @@ struct drm_gem_open {
>   #define DRM_CAP_CURSOR_WIDTH		0x8
>   #define DRM_CAP_CURSOR_HEIGHT		0x9
>   #define DRM_CAP_ADDFB2_MODIFIERS	0x10
> +#define DRM_CAP_RENDER_COMPRESSION	0x11
>   
>   /** DRM_IOCTL_GET_CAP ioctl argument type */
>   struct drm_get_cap {
> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index 6c11ca4..de59ace 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -354,6 +354,7 @@ struct drm_mode_fb_cmd {
>   
>   #define DRM_MODE_FB_INTERLACED	(1<<0) /* for interlaced framebuffers */
>   #define DRM_MODE_FB_MODIFIERS	(1<<1) /* enables ->modifer[] */
> +#define DRM_MODE_FB_AUX_PLANE   (1<<2) /* for compressed buffer */
>   
>   struct drm_mode_fb_cmd2 {
>   	__u32 fb_id;
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 24c5434..7dbc0f0 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -3204,6 +3204,13 @@  static int framebuffer_check(const struct drm_mode_fb_cmd2 *r)
 		}
 	}
 
+	if (r->flags & DRM_MODE_FB_AUX_PLANE) {
+		if (num_planes == 4)
+			return -EINVAL;
+
+		num_planes++;
+	}
+
 	for (i = num_planes; i < 4; i++) {
 		if (r->modifier[i]) {
 			DRM_DEBUG_KMS("non-zero modifier for unused plane %d\n", i);
@@ -3242,7 +3249,8 @@  internal_framebuffer_create(struct drm_device *dev,
 	struct drm_framebuffer *fb;
 	int ret;
 
-	if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS)) {
+	if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS |
+		DRM_MODE_FB_AUX_PLANE)) {
 		DRM_DEBUG_KMS("bad framebuffer flags 0x%08x\n", r->flags);
 		return ERR_PTR(-EINVAL);
 	}
@@ -3264,6 +3272,12 @@  internal_framebuffer_create(struct drm_device *dev,
 		return ERR_PTR(-EINVAL);
 	}
 
+	if (r->flags & DRM_MODE_FB_AUX_PLANE &&
+	    !dev->mode_config.allow_aux_plane) {
+		DRM_DEBUG_KMS("driver does not support render compression\n");
+		return ERR_PTR(-EINVAL);
+	}
+
 	ret = framebuffer_check(r);
 	if (ret)
 		return ERR_PTR(ret);
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 8ce2a0c..ee00782 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -312,6 +312,9 @@  static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
 	case DRM_CAP_ADDFB2_MODIFIERS:
 		req->value = dev->mode_config.allow_fb_modifiers;
 		break;
+	case DRM_CAP_RENDER_COMPRESSION:
+		req->value = dev->mode_config.allow_aux_plane;
+		break;
 	default:
 		return -EINVAL;
 	}
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 3f0c690..a5a9da2 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1152,6 +1152,9 @@  struct drm_mode_config {
 	/* whether the driver supports fb modifiers */
 	bool allow_fb_modifiers;
 
+	/* whether the driver supports render compression */
+	bool allow_aux_plane;
+
 	/* cursor size */
 	uint32_t cursor_width, cursor_height;
 };
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 3801584..0834bf7 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -631,6 +631,7 @@  struct drm_gem_open {
 #define DRM_CAP_CURSOR_WIDTH		0x8
 #define DRM_CAP_CURSOR_HEIGHT		0x9
 #define DRM_CAP_ADDFB2_MODIFIERS	0x10
+#define DRM_CAP_RENDER_COMPRESSION	0x11
 
 /** DRM_IOCTL_GET_CAP ioctl argument type */
 struct drm_get_cap {
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 6c11ca4..de59ace 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -354,6 +354,7 @@  struct drm_mode_fb_cmd {
 
 #define DRM_MODE_FB_INTERLACED	(1<<0) /* for interlaced framebuffers */
 #define DRM_MODE_FB_MODIFIERS	(1<<1) /* enables ->modifer[] */
+#define DRM_MODE_FB_AUX_PLANE   (1<<2) /* for compressed buffer */
 
 struct drm_mode_fb_cmd2 {
 	__u32 fb_id;