diff mbox

[04/22] drm: Add set property support for color manager

Message ID 1444418952-5671-5-git-send-email-shashank.sharma@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sharma, Shashank Oct. 9, 2015, 7:28 p.m. UTC
As per DRM color manager design, if a userspace wants to set a correction
blob, it prepares it and sends the blob_id to kernel via set_property
call. DRM framework takes this blob_id, gets the blob, and saves it
in the CRTC state, so that, during the atomic_commit, the color correction
values from the blob can referred and applied on display controller
registers.

This patch adds this set_property support for color correction blobs
in drm framework.

Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
Signed-off-by: Kausal malladi <kausalmalladi@gmail.com>
---
 drivers/gpu/drm/drm_atomic.c | 53 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 51 insertions(+), 2 deletions(-)

Comments

kernel test robot Oct. 9, 2015, 8:39 p.m. UTC | #1
Hi Shashank,

[auto build test WARNING on next-20151009 -- if it's inappropriate base, please ignore]

reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged'
   drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt'
>> drivers/gpu/drm/drm_atomic.c:407: warning: No description found for parameter 'dev'
   include/drm/drm_crtc.h:315: warning: No description found for parameter 'mode_blob'
   include/drm/drm_crtc.h:315: warning: No description found for parameter 'palette_before_ctm_blob'
   include/drm/drm_crtc.h:315: warning: No description found for parameter 'palette_after_ctm_blob'
   include/drm/drm_crtc.h:315: warning: No description found for parameter 'ctm_blob'
   include/drm/drm_crtc.h:747: warning: No description found for parameter 'tile_blob_ptr'
   include/drm/drm_crtc.h:786: warning: No description found for parameter 'rotation'
   include/drm/drm_crtc.h:882: warning: No description found for parameter 'mutex'
   include/drm/drm_crtc.h:882: warning: No description found for parameter 'helper_private'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tile_idr'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'delayed_event'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'edid_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'dpms_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'path_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tile_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'plane_type_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'rotation_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_src_x'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_src_y'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_src_w'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_src_h'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_x'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_y'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_w'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_h'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_fb_id'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_id'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_active'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_mode_id'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'dvi_i_subconnector_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'dvi_i_select_subconnector_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_subconnector_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_select_subconnector_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_mode_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_left_margin_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_right_margin_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_top_margin_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_bottom_margin_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_brightness_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_contrast_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_flicker_reduction_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_overscan_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_saturation_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_hue_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'scaling_mode_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'aspect_ratio_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'dirty_info_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'suggested_x_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'suggested_y_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_palette_before_ctm_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_palette_after_ctm_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_ctm_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_coeff_before_ctm_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_coeff_after_ctm_property'
   include/drm/drm_crtc.h:1176: warning: No description found for parameter 'allow_fb_modifiers'
   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:2226: 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:2226: 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:164: warning: No description found for parameter 'fmt'
   include/drm/drmP.h:180: warning: No description found for parameter 'fmt'
   include/drm/drmP.h:198: warning: No description found for parameter 'fmt'
   include/drm/drmP.h:238: warning: No description found for parameter 'dev'
   include/drm/drmP.h:238: warning: No description found for parameter 'data'
   include/drm/drmP.h:238: warning: No description found for parameter 'file_priv'
   include/drm/drmP.h:271: warning: No description found for parameter 'ioctl'
   include/drm/drmP.h:271: warning: No description found for parameter '_func'
   include/drm/drmP.h:271: warning: No description found for parameter '_flags'
   include/drm/drmP.h:344: warning: cannot understand function prototype: 'struct drm_lock_data '
   include/drm/drmP.h:397: warning: cannot understand function prototype: 'struct drm_driver '
   include/drm/drmP.h:647: warning: cannot understand function prototype: 'struct drm_info_list '
   include/drm/drmP.h:657: warning: cannot understand function prototype: 'struct drm_info_node '
   include/drm/drmP.h:667: warning: cannot understand function prototype: 'struct drm_minor '
   include/drm/drmP.h:715: warning: cannot understand function prototype: 'struct drm_device '
   drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged'
   drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt'
   drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged'

vim +/dev +407 drivers/gpu/drm/drm_atomic.c

   391	
   392	/**
   393	 * drm_atomic_crtc_set_blob - find and set a blob
   394	 * @state_blob: reference pointer to the color blob in the crtc_state
   395	 * @blob_id: blob_id coming from set_property() call
   396	 *
   397	 * Set a color correction blob (originating from a set blob property) on the
   398	 * desired CRTC state. This function will take reference of the blob property
   399	 * in the CRTC state, finds the blob based on blob_id (which comes from
   400	 * set_property call) and set the blob at the proper place.
   401	 *
   402	 * RETURNS:
   403	 * Zero on success, error code on failure.
   404	 */
   405	int drm_atomic_crtc_set_blob(struct drm_device *dev,
   406		struct drm_property_blob **state_blob, uint32_t blob_id)
 > 407	{
   408		struct drm_property_blob *blob;
   409	
   410		blob = drm_property_lookup_blob(dev, blob_id);
   411		if (!blob) {
   412			DRM_DEBUG_KMS("Invalid Blob ID\n");
   413			return -EINVAL;
   414		}
   415	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Emil Velikov Oct. 9, 2015, 10:25 p.m. UTC | #2
Hi Shashank,

On 9 October 2015 at 20:28, Shashank Sharma <shashank.sharma@intel.com> wrote:
> As per DRM color manager design, if a userspace wants to set a correction
> blob, it prepares it and sends the blob_id to kernel via set_property
> call. DRM framework takes this blob_id, gets the blob, and saves it
> in the CRTC state, so that, during the atomic_commit, the color correction
> values from the blob can referred and applied on display controller
> registers.
>
> This patch adds this set_property support for color correction blobs
> in drm framework.
>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> Signed-off-by: Kausal malladi <kausalmalladi@gmail.com>
> ---
>  drivers/gpu/drm/drm_atomic.c | 53 ++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 51 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 7bb3845..0b286d2 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -390,6 +390,38 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
>  EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);
>
>  /**
> + * drm_atomic_crtc_set_blob - find and set a blob
> + * @state_blob: reference pointer to the color blob in the crtc_state
> + * @blob_id: blob_id coming from set_property() call
> + *
> + * Set a color correction blob (originating from a set blob property) on the
> + * desired CRTC state. This function will take reference of the blob property
> + * in the CRTC state, finds the blob based on blob_id (which comes from
> + * set_property call) and set the blob at the proper place.
> + *
> + * RETURNS:
> + * Zero on success, error code on failure.
> + */
> +int drm_atomic_crtc_set_blob(struct drm_device *dev,
> +       struct drm_property_blob **state_blob, uint32_t blob_id)
You are missing the function declaration. Set it as static perhaps ?

Regards,
Emil
Sharma, Shashank Oct. 10, 2015, 4:50 a.m. UTC | #3
Regards
Shashank

On 10/10/2015 3:55 AM, Emil Velikov wrote:
> Hi Shashank,
>
> On 9 October 2015 at 20:28, Shashank Sharma <shashank.sharma@intel.com> wrote:
>> As per DRM color manager design, if a userspace wants to set a correction
>> blob, it prepares it and sends the blob_id to kernel via set_property
>> call. DRM framework takes this blob_id, gets the blob, and saves it
>> in the CRTC state, so that, during the atomic_commit, the color correction
>> values from the blob can referred and applied on display controller
>> registers.
>>
>> This patch adds this set_property support for color correction blobs
>> in drm framework.
>>
>> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
>> Signed-off-by: Kausal malladi <kausalmalladi@gmail.com>
>> ---
>>   drivers/gpu/drm/drm_atomic.c | 53 ++++++++++++++++++++++++++++++++++++++++++--
>>   1 file changed, 51 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
>> index 7bb3845..0b286d2 100644
>> --- a/drivers/gpu/drm/drm_atomic.c
>> +++ b/drivers/gpu/drm/drm_atomic.c
>> @@ -390,6 +390,38 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
>>   EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);
>>
>>   /**
>> + * drm_atomic_crtc_set_blob - find and set a blob
>> + * @state_blob: reference pointer to the color blob in the crtc_state
>> + * @blob_id: blob_id coming from set_property() call
>> + *
>> + * Set a color correction blob (originating from a set blob property) on the
>> + * desired CRTC state. This function will take reference of the blob property
>> + * in the CRTC state, finds the blob based on blob_id (which comes from
>> + * set_property call) and set the blob at the proper place.
>> + *
>> + * RETURNS:
>> + * Zero on success, error code on failure.
>> + */
>> +int drm_atomic_crtc_set_blob(struct drm_device *dev,
>> +       struct drm_property_blob **state_blob, uint32_t blob_id)
> You are missing the function declaration. Set it as static perhaps ?
>
Yes, This was meant to be used internally, I can make it static.
> Regards,
> Emil
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 7bb3845..0b286d2 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -390,6 +390,38 @@  int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
 EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);
 
 /**
+ * drm_atomic_crtc_set_blob - find and set a blob
+ * @state_blob: reference pointer to the color blob in the crtc_state
+ * @blob_id: blob_id coming from set_property() call
+ *
+ * Set a color correction blob (originating from a set blob property) on the
+ * desired CRTC state. This function will take reference of the blob property
+ * in the CRTC state, finds the blob based on blob_id (which comes from
+ * set_property call) and set the blob at the proper place.
+ *
+ * RETURNS:
+ * Zero on success, error code on failure.
+ */
+int drm_atomic_crtc_set_blob(struct drm_device *dev,
+	struct drm_property_blob **state_blob, uint32_t blob_id)
+{
+	struct drm_property_blob *blob;
+
+	blob = drm_property_lookup_blob(dev, blob_id);
+	if (!blob) {
+		DRM_DEBUG_KMS("Invalid Blob ID\n");
+		return -EINVAL;
+	}
+
+	if (*state_blob)
+		drm_property_unreference_blob(*state_blob);
+
+	/* Attach the blob to be committed in state */
+	*state_blob = blob;
+	return 0;
+}
+
+/**
  * drm_atomic_crtc_set_property - set property on CRTC
  * @crtc: the drm CRTC to set a property on
  * @state: the state object to update with the new property value
@@ -422,8 +454,25 @@  int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
 		if (mode)
 			drm_property_unreference_blob(mode);
 		return ret;
-	}
-	else if (crtc->funcs->atomic_set_property)
+	} else if (property == config->cm_palette_after_ctm_property) {
+		ret = drm_atomic_crtc_set_blob(dev,
+				&state->palette_after_ctm_blob, val);
+		if (ret)
+			DRM_ERROR("Failed to load blob palette_after_ctm\n");
+		return ret;
+	} else if (property == config->cm_palette_before_ctm_property) {
+		ret = drm_atomic_crtc_set_blob(dev,
+				&state->palette_before_ctm_blob, val);
+		if (ret)
+			DRM_ERROR("Failed to load blob palette_before_ctm\n");
+		return ret;
+	} else if (property == config->cm_ctm_property) {
+		ret = drm_atomic_crtc_set_blob(dev,
+				&state->ctm_blob, val);
+		if (ret)
+			DRM_ERROR("Failed to load blob ctm\n");
+		return ret;
+	} else if (crtc->funcs->atomic_set_property)
 		return crtc->funcs->atomic_set_property(crtc, state, property, val);
 	else
 		return -EINVAL;