public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Sharma, Shashank" <shashank.sharma@intel.com>
Cc: annie.j.matheson@intel.com, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, kausalmalladi@gmail.com,
	daniel.vetter@intel.com
Subject: Re: [PATCH 10/23] drm/i915: Add gamma correction handlers
Date: Wed, 23 Sep 2015 15:02:46 +0200	[thread overview]
Message-ID: <20150923130246.GS3383@phenom.ffwll.local> (raw)
In-Reply-To: <5602613D.2070202@intel.com>

On Wed, Sep 23, 2015 at 01:52:21PM +0530, Sharma, Shashank wrote:
> Regards
> Shashank
> 
> On 9/22/2015 6:45 PM, Daniel Vetter wrote:
> >On Wed, Sep 16, 2015 at 11:07:07PM +0530, Shashank Sharma wrote:
> >>I915 driver registers gamma correction as palette correction
> >>property with DRM layer. This patch adds set_property() and get_property()
> >>handlers for pipe level gamma correction.
> >>
> >>The set function attaches the Gamma correction blob to CRTC state, these
> >>values will be committed during atomic commit.
> >>
> >>Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> >>Signed-off-by: Kausal Malladi <kausalmalladi@gmail.com>
> >>---
> >>  drivers/gpu/drm/i915/intel_atomic.c        | 20 ++++++++++++++++++++
> >>  drivers/gpu/drm/i915/intel_color_manager.c | 21 +++++++++++++++++++++
> >>  drivers/gpu/drm/i915/intel_drv.h           |  5 +++++
> >>  3 files changed, 46 insertions(+)
> >>
> >>diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> >>index 500d2998..0b61fef 100644
> >>--- a/drivers/gpu/drm/i915/intel_atomic.c
> >>+++ b/drivers/gpu/drm/i915/intel_atomic.c
> >>@@ -315,6 +315,13 @@ int intel_crtc_atomic_set_property(struct drm_crtc *crtc,
> >>  				   struct drm_property *property,
> >>  				   uint64_t val)
> >>  {
> >>+	struct drm_device *dev = crtc->dev;
> >>+	struct drm_mode_config *config = &dev->mode_config;
> >>+
> >>+	if (property == config->cm_palette_after_ctm_property)
> >>+		return intel_color_manager_set_pipe_gamma(dev, state,
> >>+				&crtc->base, val);
> >>+
> >>  	DRM_DEBUG_KMS("Unknown crtc property '%s'\n", property->name);
> >>  	return -EINVAL;
> >>  }
> >>@@ -324,6 +331,19 @@ int intel_crtc_atomic_get_property(struct drm_crtc *crtc,
> >>  				   struct drm_property *property,
> >>  				   uint64_t *val)
> >>  {
> >>+	struct drm_device *dev = crtc->dev;
> >>+	struct drm_mode_config *config = &dev->mode_config;
> >>+
> >>+	if (property == config->cm_palette_after_ctm_property) {
> >>+		*val = (state->palette_after_ctm_blob) ?
> >>+			state->palette_after_ctm_blob->base.id : 0;
> >>+		goto found;
> >>+	}
> >
> >Since color manager properties are meant as a new standardize KMS
> >extension (we put them into the core drm_crtc_state) the get/set support
> >should also be in the core. See e.g. how the rotation property is handled
> >in drm_atomic_plane_get/set_property. So all this code should be added to
> >drm_atomic_crtc_get/set_property.
> Thanks, sounds like a good one. Will move this.

When moving this please don't forget to add the blob->length sanity checks
mentioned in another thread in this discussion.

> >
> >
> >>+
> >>  	DRM_DEBUG_KMS("Unknown crtc property '%s'\n", property->name);
> >>  	return -EINVAL;
> >>+
> >>+found:
> >>+	DRM_DEBUG_KMS("Found property %s\n", property->name);
> >>+	return 0;
> >>  }
> >>diff --git a/drivers/gpu/drm/i915/intel_color_manager.c b/drivers/gpu/drm/i915/intel_color_manager.c
> >>index 77f58f2..9421bb6 100644
> >>--- a/drivers/gpu/drm/i915/intel_color_manager.c
> >>+++ b/drivers/gpu/drm/i915/intel_color_manager.c
> >>@@ -27,6 +27,27 @@
> >>
> >>  #include "intel_color_manager.h"
> >>
> >>+int intel_color_manager_set_pipe_gamma(struct drm_device *dev,
> >>+		struct drm_crtc_state *crtc_state,
> >>+		struct drm_mode_object *obj, 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 (crtc_state->palette_after_ctm_blob)
> >>+		drm_property_unreference_blob(
> >>+			crtc_state->palette_after_ctm_blob);
> >>+
> >>+	/* Attach the blob to be committed in state */
> >>+	crtc_state->palette_after_ctm_blob = blob;
> >>+	return 0;
> >>+}
> >
> >What is this used for? It looks a bit like legacy property code, and we
> >have a generic helper to make that happen
> >(drm_atomic_helper_crtc_set_property).
> >
> No Daniel, its not the legacy part. Please check atomic_begin() part in the
> next patches. This is like the top half of atomic set_property for CRTC and
> will be applicable for any property. As you already know, to set a property:
> - userspace creates a blob, and sends the blob id via set_property()
> interface
> - set_property() saves the blob_id in the corresponding pointer space in the
> crtc_state()
> - From the atomic_commit_begin() we will extract the values from blob and
> start committing to the registers. Its kind of bottom_half() of atomic
> set_property for CRTC.
> >Generally please don't add functions/structs without also adding a user,
> >it means that reviewers have to constantly jump around in your patch
> >series to figure out how something is used. Instead if you want to split
> >things up really fine add a stub function frist (but including relevant
> >callers) and then fill out the bits separately.
> I think the above explanation should make it clear.

In my defence I'd like to say that I was still jetlagged ;-) Reading
things now again it all looks good.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-09-23 12:59 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 17:36 [PATCH 00/23] Color Management for DRM Shashank Sharma
2015-09-16 17:36 ` [PATCH 01/23] drm: Create Color Management DRM properties Shashank Sharma
2015-09-16 17:51   ` Matt Roper
2015-09-23  8:51     ` Sharma, Shashank
2015-09-16 17:36 ` [PATCH 02/23] drm: Add structure for querying palette color capabilities Shashank Sharma
2015-09-16 17:51   ` Matt Roper
2015-09-22 13:02     ` Daniel Vetter
2015-09-23  8:10       ` Sharma, Shashank
2015-09-23  9:47         ` Smith, Gary K
2015-09-23 11:57           ` Sharma, Shashank
2015-09-23 13:26             ` Daniel Vetter
2015-09-16 17:37 ` [PATCH 03/23] drm: Add color correction blobs in CRTC state Shashank Sharma
2015-09-16 17:37 ` [PATCH 04/23] drm: Add drm structures for palette color property Shashank Sharma
2015-09-21 16:46   ` Ville Syrjälä
2015-09-22  7:57     ` Sharma, Shashank
2015-09-22 13:08   ` Daniel Vetter
2015-09-22 13:53     ` Emil Velikov
2015-09-22 15:00       ` Ville Syrjälä
2015-09-22 16:51         ` Emil Velikov
2015-09-23  8:15     ` Sharma, Shashank
2015-09-23 12:49       ` Daniel Vetter
2015-09-23 12:59         ` Sharma, Shashank
2015-09-23 13:30           ` Daniel Vetter
2015-09-16 17:37 ` [PATCH 05/23] drm: Add structure to set/get a CTM " Shashank Sharma
2015-09-22 13:08   ` Daniel Vetter
2015-09-23  8:16     ` Sharma, Shashank
2015-09-22 15:22   ` Ville Syrjälä
2015-09-16 17:37 ` [PATCH 06/23] drm/i915: Add atomic set property interface for CRTC Shashank Sharma
2015-09-16 17:37 ` [PATCH 07/23] drm/i915: Add atomic get " Shashank Sharma
2015-09-16 17:37 ` [PATCH 08/23] drm/i915: Create color management files Shashank Sharma
2015-09-16 17:37 ` [PATCH 09/23] drm/i915: Register pipe color capabilities Shashank Sharma
2015-09-22 13:24   ` Daniel Vetter
2015-09-23  8:35     ` Sharma, Shashank
2015-09-23 12:52       ` [Intel-gfx] " Daniel Vetter
2015-09-16 17:37 ` [PATCH 10/23] drm/i915: Add gamma correction handlers Shashank Sharma
2015-09-22 13:15   ` [Intel-gfx] " Daniel Vetter
2015-09-22 13:19     ` Daniel Vetter
2015-09-23  8:22     ` [Intel-gfx] " Sharma, Shashank
2015-09-23 13:02       ` Daniel Vetter [this message]
2015-09-26 15:48       ` Sharma, Shashank
2015-09-28  6:43         ` [Intel-gfx] " Daniel Vetter
2015-09-28  8:19           ` Sharma, Shashank
2015-09-28 21:42             ` Matt Roper
2015-09-29  4:29               ` Sharma, Shashank
2015-09-29  4:29                 ` Matheson, Annie J
2015-09-16 17:37 ` [PATCH 11/23] drm/i915: Add pipe deGamma " Shashank Sharma
2015-09-16 17:37 ` [PATCH 12/23] drm/i915: Add pipe CSC " Shashank Sharma
2015-09-16 17:37 ` [PATCH 13/23] drm/i915: CHV: Load gamma color correction values Shashank Sharma
2015-09-16 17:37 ` [PATCH 14/23] drm/i915: CHV: Load degamma " Shashank Sharma
2015-09-16 17:37 ` [PATCH 15/23] drm/i915: CHV: Pipe level Gamma correction Shashank Sharma
2015-09-16 17:37 ` [PATCH 16/23] drm/i915: CHV: Pipe level degamma correction Shashank Sharma
2015-09-16 17:37 ` [PATCH 17/23] drm/i915: CHV: Pipe level CSC correction Shashank Sharma
2015-09-16 17:37 ` [PATCH 18/23] drm/i915: Commit color changes to CRTC Shashank Sharma
2015-09-16 17:37 ` [PATCH 19/23] drm/i915: Attach color properties " Shashank Sharma
2015-09-16 17:37 ` [PATCH 20/23] drm/i915: BDW: Load gamma correction values Shashank Sharma
2015-09-16 17:37 ` [PATCH 21/23] drm/i915: BDW: Pipe level Gamma correction Shashank Sharma
2015-09-30 14:31   ` Rob Bradford
2015-09-30 16:25     ` Sharma, Shashank
2015-09-30 16:31       ` Matheson, Annie J
2015-09-30 17:15         ` Sharma, Shashank
2015-09-30 16:44     ` Ville Syrjälä
2015-09-16 17:37 ` [PATCH 22/23] drm/i915: BDW: Load degamma correction values Shashank Sharma
2015-09-16 17:37 ` [PATCH 23/23] drm/i915: BDW: Pipe level degamma correction Shashank Sharma
2015-09-22 13:27 ` [Intel-gfx] [PATCH 00/23] Color Management for DRM Daniel Vetter
2015-09-23  8:38   ` Sharma, Shashank

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150923130246.GS3383@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=annie.j.matheson@intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kausalmalladi@gmail.com \
    --cc=shashank.sharma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox