From: shashank.sharma@intel.com Subject: [PATCH 10/11] drm/i915: Plug-in color manager init Date: Wed, 23 Jul 2014 23:35:04 +0530 Message-ID: <1406138705-17334-11-git-send-email-shashank.sharma@intel.com> References: <1406138705-17334-1-git-send-email-shashank.sharma@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B4066E68D for ; Wed, 23 Jul 2014 11:02:13 -0700 (PDT) In-Reply-To: <1406138705-17334-1-git-send-email-shashank.sharma@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: intel-gfx@lists.freedesktop.org, ville.syrjala@linux.intel.com, damien.lespiau@intel.com, daniel.vetter@intel.com, shobhit.kumar@intel.com, satheeshakrishna.m@intel.com Cc: =indranil.mukherjee@intel.com List-Id: intel-gfx@lists.freedesktop.org From: Shashank Sharma Call color manager init and attach color properties during the pipe and plane init time. This will register all pipe level properties with each intel_crtc and all plane level properties with each intel_plane objects. Signed-off-by: Shashank Sharma --- drivers/gpu/drm/i915/intel_clrmgr.c | 67 ++++++++++++++++++------------------ drivers/gpu/drm/i915/intel_clrmgr.h | 11 +++++- drivers/gpu/drm/i915/intel_display.c | 4 +++ drivers/gpu/drm/i915/intel_sprite.c | 3 ++ 4 files changed, 51 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_clrmgr.c b/drivers/gpu/drm/i915/intel_clrmgr.c index d0d952b..ab38fab 100644 --- a/drivers/gpu/drm/i915/intel_clrmgr.c +++ b/drivers/gpu/drm/i915/intel_clrmgr.c @@ -532,39 +532,6 @@ error: return false; } -void -intel_attach_plane_color_correction(struct intel_plane *intel_plane) -{ - struct clrmgr_reg_request *features; - - /* Color manager initialized? */ - if (!intel_plane->color_status) { - DRM_ERROR("Color manager not initialized for plane %d\n", - intel_plane->plane); - return; - } - - DRM_DEBUG_DRIVER("\n"); - features = kzalloc(sizeof(struct clrmgr_reg_request), GFP_KERNEL); - if (!features) { - DRM_ERROR("No memory for plane color features\n"); - return; - } - - features->no_of_properties = ARRAY_SIZE(gen6_plane_color_corrections); - memcpy(features->cp, gen6_plane_color_corrections, - features->no_of_properties * - sizeof(struct clrmgr_property)); - - /* Register plane level color properties */ - if (!intel_clrmgr_register_plane_property(intel_plane, features)) - DRM_ERROR("Register plane color property failed\n"); - else - DRM_DEBUG_DRIVER("Attached colot corrections for plane %d\n", - intel_plane->plane); - kfree(features); -} - bool intel_clrmgr_register_pipe_property(struct intel_crtc *intel_crtc, struct clrmgr_reg_request *features) @@ -623,6 +590,40 @@ error: } void +intel_attach_plane_color_correction(struct intel_plane *intel_plane) +{ + struct clrmgr_reg_request *features; + + /* Color manager initialized? */ + if (!intel_plane->color_status) { + DRM_ERROR("Color manager not initialized for plane %d\n", + intel_plane->plane); + return; + } + + DRM_DEBUG_DRIVER("\n"); + features = kzalloc(sizeof(struct clrmgr_reg_request), GFP_KERNEL); + if (!features) { + DRM_ERROR("No memory for plane color features\n"); + return; + } + + features->no_of_properties = ARRAY_SIZE(gen6_plane_color_corrections); + memcpy(features->cp, gen6_plane_color_corrections, + features->no_of_properties * + sizeof(struct clrmgr_property)); + + /* Register plane level color properties */ + if (!intel_clrmgr_register_plane_property(intel_plane, features)) + DRM_ERROR("Register plane color property failed\n"); + else + DRM_DEBUG_DRIVER("Attached colot corrections for plane %d\n", + intel_plane->plane); + kfree(features); +} + + +void intel_attach_pipe_color_correction(struct intel_crtc *intel_crtc) { struct clrmgr_reg_request *features; diff --git a/drivers/gpu/drm/i915/intel_clrmgr.h b/drivers/gpu/drm/i915/intel_clrmgr.h index c1de823..c78d1db 100644 --- a/drivers/gpu/drm/i915/intel_clrmgr.h +++ b/drivers/gpu/drm/i915/intel_clrmgr.h @@ -244,8 +244,17 @@ bool intel_clrmgr_register_pipe_property(struct intel_crtc *intel_crtc, struct clrmgr_reg_request *features); /* +* intel_attach_plane_color_correction: +* Register color correction properties as plane properties +* input: +* - intel_plane : plane to attach color correcection with +*/ +void +intel_attach_plane_color_correction(struct intel_plane *intel_plane); + +/* * intel_attach_pipe_color_correction: -* Register color correction properties as DRM CRTC properties +* Register color correction properties as CRTC properties * input: * - intel_crtc : CRTC to attach color correcection with */ diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index a6181b5..81d9002 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -11835,6 +11835,10 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) intel_crtc->plane = !pipe; } + /* Register color properties */ + intel_crtc->color_status = intel_clrmgr_init(dev); + intel_attach_pipe_color_correction(intel_crtc); + intel_crtc->cursor_base = ~0; intel_crtc->cursor_cntl = ~0; diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index affb429..8fb704c 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -1359,5 +1359,8 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) if (ret) kfree(intel_plane); + /* Register color properties */ + intel_plane->color_status = intel_clrmgr_init(dev); + intel_attach_plane_color_correction(intel_plane); return ret; } -- 1.9.1