From: Shashank Sharma <shashank.sharma@xxxxxxxxx> 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 <shashank.sharma@xxxxxxxxx> --- 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 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx