New drm crtc properties
Subsystems (2)
cover New drm crtc properties
From: Akash Goel <[email protected]>
Added new drm crtc properties which provides control to vary the size of horizontal & vertical borders. With this the size of the Panel fitter output or display window can be controlled.
Also added a return type to panel fitter config functions, so that an error could be returned to User space for an invalid configuration.
Akash Goel (3):
drm/i915: Added a return type for panel fitter config functions drm/i915: Initialized 'set_property' fn pointer field of
intel_crtc_funcs structure
drm/i915: New drm crtc property for varying the size of borders
drivers/gpu/drm/i915/i915_drv.h | 10 ++ drivers/gpu/drm/i915/intel_display.c | 128 +++++++++++++++++++- drivers/gpu/drm/i915/intel_dp.c | 17 +-- drivers/gpu/drm/i915/intel_drv.h | 18 ++- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- drivers/gpu/drm/i915/intel_lvds.c | 13 +- drivers/gpu/drm/i915/intel_panel.c | 229 ++++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/intel_sdvo.c | 2 +- drivers/gpu/drm/i915/intel_tv.c | 2 +- 9 files changed, 383 insertions(+), 38 deletions(-)
Signature · 1 line
1.9.2
PATCH 1/3 drm/i915: Added a return type for panel fitter config functions
From: Akash Goel <[email protected]>
This patch changes the return type of panel fitter configuration functions from 'void', so that an error could be returned back to User space, either during the modeset time or when the 'border' property is being set, if the configuation is not valid.
--- drivers/gpu/drm/i915/intel_display.c | 5 +++-- drivers/gpu/drm/i915/intel_dp.c | 17 ++++++++++------- drivers/gpu/drm/i915/intel_drv.h | 6 +++--- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- drivers/gpu/drm/i915/intel_lvds.c | 13 +++++++------ drivers/gpu/drm/i915/intel_panel.c | 10 ++++++---- drivers/gpu/drm/i915/intel_sdvo.c | 2 +- drivers/gpu/drm/i915/intel_tv.c | 2 +- 8 files changed, 32 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -2
@@ -10631,9 +10631,10 @@ static int intel_set_mode(struct drm_crtc *crtc,return ret; } -void intel_crtc_restore_mode (struct drm_crtc *crtc) +int intel_crtc_restore_mode (struct drm_crtc *crtc) { -intel_set_mode (crtc, &crtc->mode, crtc->x, crtc->y, crtc->primary->fb); +return intel_set_mode (crtc, &crtc->mode, crtc->x, crtc->y, + crtc->primary->fb); }#undef for_each_intel_crtc_masked
drivers/gpu/drm/i915/intel_dp.c +10 -7
@@ -824,12 +824,15 @@ intel_dp_compute_config(struct intel_encoder *encoder,if (is_edp (intel_dp) && intel_connector->panel.fixed_mode) {intel_fixed_panel_mode (intel_connector->panel.fixed_mode, adjusted_mode); -if (!HAS_PCH_SPLIT (dev)) -intel_gmch_panel_fitting (intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); -else -intel_pch_panel_fitting (intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); +if (!HAS_PCH_SPLIT (dev)) { +if (!intel_gmch_panel_fitting (intel_crtc, pipe_config, + intel_connector->panel.fitting_mode)) +return false; + }else { +if (!intel_pch_panel_fitting (intel_crtc, pipe_config, + intel_connector->panel.fitting_mode)) +return false; + } }if (adjusted_mode->flags &DRM_MODE_FLAG_DBLCLK )
@@ -3782,7 +3785,7 @@ intel_dp_set_property(struct drm_connector *connector, done:if (intel_encoder->base.crtc) -intel_crtc_restore_mode (intel_encoder->base.crtc); +return intel_crtc_restore_mode (intel_encoder->base.crtc);return 0 ; }
drivers/gpu/drm/i915/intel_drv.h +3 -3
@@ -727,7 +727,7 @@ void intel_mark_busy(struct drm_device *dev);void intel_mark_fb_busy (struct drm_i915_gem_object *obj,struct intel_engine_cs *ring);void intel_mark_idle (struct drm_device *dev); -void intel_crtc_restore_mode (struct drm_crtc *crtc); +int intel_crtc_restore_mode (struct drm_crtc *crtc);void intel_crtc_update_dpms (struct drm_crtc *crtc);void intel_encoder_destroy (struct drm_encoder *encoder);void intel_connector_dpms (struct drm_connector *,int mode);
@@ -918,10 +918,10 @@ int intel_panel_init(struct intel_panel *panel,void intel_panel_fini (struct intel_panel *panel);void intel_fixed_panel_mode (const struct drm_display_mode *fixed_mode,struct drm_display_mode *adjusted_mode); -void intel_pch_panel_fitting (struct intel_crtc *crtc, +bool intel_pch_panel_fitting (struct intel_crtc *crtc,struct intel_crtc_config *pipe_config,int fitting_mode); -void intel_gmch_panel_fitting (struct intel_crtc *crtc, +bool intel_gmch_panel_fitting (struct intel_crtc *crtc,struct intel_crtc_config *pipe_config,int fitting_mode); void intel_panel_set_backlight(struct intel_connector *connector, u32 level,
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
@@ -1128,7 +1128,7 @@ intel_hdmi_set_property(struct drm_connector *connector, done:if (intel_dig_port->base.base.crtc) -intel_crtc_restore_mode (intel_dig_port->base.base.crtc); +return intel_crtc_restore_mode (intel_dig_port->base.base.crtc);return 0 ; }
drivers/gpu/drm/i915/intel_lvds.c +7 -6
@@ -303,12 +303,13 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,if (HAS_PCH_SPLIT (dev)) { pipe_config->has_pch_encoder = true; -intel_pch_panel_fitting (intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); +if (!intel_pch_panel_fitting (intel_crtc, pipe_config, + intel_connector->panel.fitting_mode)) +return false; }else { -intel_gmch_panel_fitting (intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); - +if (!intel_gmch_panel_fitting (intel_crtc, pipe_config, + intel_connector->panel.fitting_mode)) +return false; }/*
@@ -499,7 +500,7 @@ static int intel_lvds_set_property(struct drm_connector *connector,* If the CRTC is enabled, the display will be changed * according to the new panel fitting mode. */ -intel_crtc_restore_mode (crtc); +return intel_crtc_restore_mode (crtc); } }
drivers/gpu/drm/i915/intel_panel.c +6 -4
@@ -96,7 +96,7 @@ intel_find_panel_downclock(struct drm_device *dev, }/* adjusted_mode has been preset to be the panel's fixed mode */ -void +bool intel_pch_panel_fitting (struct intel_crtc *intel_crtc,struct intel_crtc_config *pipe_config,int fitting_mode)
@@ -158,13 +158,14 @@ intel_pch_panel_fitting(struct intel_crtc *intel_crtc,default :WARN (1 ,"bad panel fit mode: %d\n" , fitting_mode); -return ; +return false; } done: pipe_config->pch_pfit.pos = (x <<16 ) | y; pipe_config->pch_pfit.size = (width <<16 ) | height; pipe_config->pch_pfit.enabled = pipe_config->pch_pfit.size !=0 ; +return true; } static void
@@ -300,7 +301,7 @@ static void i9xx_scale_aspect(struct intel_crtc_config *pipe_config, } } -void intel_gmch_panel_fitting (struct intel_crtc *intel_crtc, +bool intel_gmch_panel_fitting (struct intel_crtc *intel_crtc,struct intel_crtc_config *pipe_config,int fitting_mode) {
@@ -352,7 +353,7 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,break ;default :WARN (1 ,"bad panel fit mode: %d\n" , fitting_mode); -return ; +return false; }/* 965+ wants fuzzy fitting */
@@ -374,6 +375,7 @@ out: pipe_config->gmch_pfit.control = pfit_control; pipe_config->gmch_pfit.pgm_ratios = pfit_pgm_ratios; pipe_config->gmch_pfit.lvds_border_bits = border; +return true; }enum drm_connector_status
drivers/gpu/drm/i915/intel_sdvo.c +1 -1
@@ -2223,7 +2223,7 @@ set_value: done:if (intel_sdvo->base.base.crtc) -intel_crtc_restore_mode (intel_sdvo->base.base.crtc); +return intel_crtc_restore_mode (intel_sdvo->base.base.crtc);return 0 ;#undef CHECK_PROPERTY
drivers/gpu/drm/i915/intel_tv.c +1 -1
@@ -1490,7 +1490,7 @@ intel_tv_set_property(struct drm_connector *connector, struct drm_property *prop }if (changed && crtc) -intel_crtc_restore_mode (crtc); +return intel_crtc_restore_mode (crtc); out:return ret; }
Signature · 1 line
1.9.2
Re: [PATCH 1/3] drm/i915: Added a return type for panel fitter config functions
Quoted 27 lines · On Fri, Jun 20, 2014 at 07:25:52PM +0530, [email protected] wrote:
drivers/gpu/drm/i915/intel_dp.c +9
-6@@ -824,12 +824,15 @@ intel_dp_compute_config(struct intel_encoder *encoder,if (is_edp (intel_dp) && intel_connector->panel.fixed_mode) {intel_fixed_panel_mode (intel_connector->panel.fixed_mode, adjusted_mode); -if (!HAS_PCH_SPLIT (dev)) -intel_gmch_panel_fitting (intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); -else -intel_pch_panel_fitting (intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); +if (!HAS_PCH_SPLIT (dev)) { +if (!intel_gmch_panel_fitting (intel_crtc, pipe_config, + intel_connector->panel.fitting_mode)) +return false; + }else { +if (!intel_pch_panel_fitting (intel_crtc, pipe_config, + intel_connector->panel.fitting_mode)) +return false; + } }if (adjusted_mode->flags &DRM_MODE_FLAG_DBLCLK )
drivers/gpu/drm/i915/intel_dp.c intel_dp_set_property(struct drm_connector *connector, · line 3788
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +1
-1@@ -3782,7 +3785,7 @@ intel_dp_set_property(struct drm_connector *connector, done:if (intel_encoder->base.crtc) -intel_crtc_restore_mode (intel_encoder->base.crtc); +return intel_crtc_restore_mode (intel_encoder->base.crtc);
But you don't unwind the property change after failure.
Quoted 18 lines
drivers/gpu/drm/i915/intel_dp.c +0
-0return 0 ; }drivers/gpu/drm/i915/intel_drv.h +1
-1@@ -727,7 +727,7 @@ void intel_mark_busy(struct drm_device *dev);void intel_mark_fb_busy (struct drm_i915_gem_object *obj,struct intel_engine_cs *ring);void intel_mark_idle (struct drm_device *dev); -void intel_crtc_restore_mode (struct drm_crtc *crtc); +int intel_crtc_restore_mode (struct drm_crtc *crtc);void intel_crtc_update_dpms (struct drm_crtc *crtc);void intel_encoder_destroy (struct drm_encoder *encoder);void intel_connector_dpms (struct drm_connector *,int mode);@@ -918,10 +918,10 @@ int intel_panel_init(struct intel_panel *panel,void intel_panel_fini (struct intel_panel *panel);
drivers/gpu/drm/i915/intel_drv.h int intel_panel_init(struct intel_panel *panel, · line 926
Quoted 10 lines
drivers/gpu/drm/i915/intel_drv.h +2
-2void intel_fixed_panel_mode (const struct drm_display_mode *fixed_mode,struct drm_display_mode *adjusted_mode); -void intel_pch_panel_fitting (struct intel_crtc *crtc, +bool intel_pch_panel_fitting (struct intel_crtc *crtc,struct intel_crtc_config *pipe_config,int fitting_mode); -void intel_gmch_panel_fitting (struct intel_crtc *crtc, +bool intel_gmch_panel_fitting (struct intel_crtc *crtc,struct intel_crtc_config *pipe_config,int fitting_mode);
Only make significnt changes like this to one interface at a time. -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 1/3] drm/i915: Added a return type for panel fitter config functions
Quoted 29 lines · Chris Wilson
Quoted 28 lines · On Fri, Jun 20, 2014 at 07:25:52PM +0530, [email protected] wrote:
drivers/gpu/drm/i915/intel_dp.c +9
-6@@ -824,12 +824,15 @@ intel_dp_compute_config(struct intel_encoder *encoder,if (is_edp (intel_dp) && intel_connector->panel.fixed_mode) {intel_fixed_panel_mode (intel_connector->panel.fixed_mode, adjusted_mode); -if (!HAS_PCH_SPLIT (dev)) -intel_gmch_panel_fitting (intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); -else -intel_pch_panel_fitting (intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); +if (!HAS_PCH_SPLIT (dev)) { +if (!intel_gmch_panel_fitting (intel_crtc, pipe_config, + intel_connector->panel.fitting_mode)) +return false; + }else { +if (!intel_pch_panel_fitting (intel_crtc, pipe_config, + intel_connector->panel.fitting_mode)) +return false; + } }if (adjusted_mode->flags &DRM_MODE_FLAG_DBLCLK )@@ -3782,7 +3785,7 @@ intel_dp_set_property(struct drm_connector *connector,
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_set_property(struct drm_connector *connector, · line 3788
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +1
-1done:if (intel_encoder->base.crtc) -intel_crtc_restore_mode (intel_encoder->base.crtc); +return intel_crtc_restore_mode (intel_encoder->base.crtc);But you don't unwind the property change after failure.
Sorry, will handle this in next version of the patch.
Quoted 23 lines
Quoted 23 lines
drivers/gpu/drm/i915/intel_dp.c +0
-0return 0 ; }drivers/gpu/drm/i915/intel_drv.h +2
-2@@ -727,7 +727,7 @@ void intel_mark_busy(struct drm_device *dev);void intel_mark_fb_busy (struct drm_i915_gem_object *obj,struct intel_engine_cs *ring);void intel_mark_idle (struct drm_device *dev); -void intel_crtc_restore_mode (struct drm_crtc *crtc); +int intel_crtc_restore_mode (struct drm_crtc *crtc);void intel_crtc_update_dpms (struct drm_crtc *crtc);void intel_encoder_destroy (struct drm_encoder *encoder);void intel_connector_dpms (struct drm_connector *,int mode);@@ -918,10 +918,10 @@ int intel_panel_init(struct intel_panel *panel,void intel_panel_fini (struct intel_panel *panel);void intel_fixed_panel_mode (const struct drm_display_mode *fixed_mode,struct drm_display_mode *adjusted_mode); -void intel_pch_panel_fitting(struct intel_crtc *crtc, +bool intel_pch_panel_fitting(struct intel_crtc *crtc,
Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h int intel_panel_init(struct intel_panel *panel, · line 926
Quoted 6 lines
drivers/gpu/drm/i915/intel_drv.h +1
-1struct intel_crtc_config *pipe_config, int fitting_mode); -void intel_gmch_panel_fitting (struct intel_crtc *crtc, +bool intel_gmch_panel_fitting (struct intel_crtc *crtc,struct intel_crtc_config *pipe_config,int fitting_mode);Only make significnt changes like this to one interface at a time.
Fine will split this patch in 2 parts.
Quoted 2 lines
-Chris
PATCH 2/3 drm/i915: Initialized 'set_property' fn pointer field of intel_crtc_funcs structure
In reply to [email protected]From: Akash Goel <[email protected]>
This patch defines a new function & assigns that to the 'set_property' function pointer field of the 'intel_crtc_funcs' structure.
--- drivers/gpu/drm/i915/intel_display.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/i915/intel_display.c +9 -0
@@ -11064,11 +11064,20 @@ out_config:return ret; } +static int intel_crtc_set_property (struct drm_crtc *crtc, +struct drm_property *property,uint64_t val) +{ +int ret = -ENOENT ; + +return ret; +} +static const struct drm_crtc_funcs intel_crtc_funcs = { .gamma_set = intel_crtc_gamma_set, .set_config = intel_crtc_set_config, .destroy = intel_crtc_destroy, .page_flip = intel_crtc_page_flip, + .set_property = intel_crtc_set_property, };static void intel_cpu_pll_init (struct drm_device *dev)
Signature · 1 line
1.9.2
PATCH 3/3 drm/i915: New drm crtc property for varying the size of borders
In reply to [email protected]From: Akash Goel <[email protected]>
This patch adds a new drm crtc property for varying the size of the horizontal & vertical borers of the output/display window. This will control the output of Panel fitter.
There are actually 4 separate properties so as to allow a control on the size of each border left/top/bottom/right
Testcase: igt/kms_panel_fitter_test
--- drivers/gpu/drm/i915/i915_drv.h | 10 ++ drivers/gpu/drm/i915/intel_display.c | 118 ++++++++++++++++++- drivers/gpu/drm/i915/intel_drv.h | 12 ++ drivers/gpu/drm/i915/intel_panel.c | 219 ++++++++++++++++++++++++++++++++--- 4 files changed, 344 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +10 -0
@@ -1515,6 +1515,16 @@ struct drm_i915_private {struct drm_property *broadcast_rgb_property;struct drm_property *force_audio_property; +/* +* Properties to dynamically vary the size of the +* borders. This will indirectly control the size +* of the display window i.e Panel fitter output +*/ +struct drm_property *left_border_property; +struct drm_property *right_border_property; +struct drm_property *top_border_property; +struct drm_property *bottom_border_property; +uint32_t hw_context_size;struct list_head context_list;
drivers/gpu/drm/i915/intel_display.c +116 -2
134 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +12 -0
@@ -109,6 +109,14 @@#define INTEL_DSI_VIDEO_MODE 0#define INTEL_DSI_COMMAND_MODE 1 +#define MAX_BORDER_VALUE 256 +enum panel_border { +PANEL_BORDER_LEFT =0 , +PANEL_BORDER_RIGHT , +PANEL_BORDER_TOP , +PANEL_BORDER_BOTTOM , +}; +struct intel_framebuffer {struct drm_framebuffer base;struct drm_i915_gem_object *obj;
@@ -407,6 +415,10 @@ struct intel_crtc {bool cpu_fifo_underrun_disabled;bool pch_fifo_underrun_disabled; +/* border info for the output/display window */ +uint32_t border[4 ]; +bool apply_borders; +/* per-pipe watermark state */ struct {/* watermarks currently being used */
drivers/gpu/drm/i915/intel_panel.c +206 -13
265 lines not on this page · raw message
Signature · 1 line
1.9.2
Quoted 10 lines · On Fri, Jun 20, 2014 at 07:25:51PM +0530, [email protected] wrote:
From: Akash Goel <[email protected]>
Added new drm crtc properties which provides control to vary the size of horizontal & vertical borders. With this the size of the Panel fitter output or display window can be controlled.
Also added a return type to panel fitter config functions, so that an error could be returned to User space for an invalid configuration.
Quoted 5 lines
Akash Goel (3):
drm/i915: Added a return type for panel fitter config functions drm/i915: Initialized 'set_property' fn pointer field of
intel_crtc_funcsstructure
drm/i915: New drm crtc property for varying the size of borders
As an aside, you're missing the new property documentation in Documentation/DocBook/drm.tmpl.
Signature · 1 line
Damien
Quoted 11 lines · Damien Lespiau
Quoted 10 lines · On Fri, Jun 20, 2014 at 07:25:51PM +0530, [email protected] wrote:
From: Akash Goel <[email protected]>
Added new drm crtc properties which provides control to vary the size of horizontal & vertical borders. With this the size of the Panel fitter output or display window can be controlled.
Also added a return type to panel fitter config functions, so that an error could be returned to User space for an invalid configuration.
Quoted 8 lines
Quoted 5 lines
Akash Goel (3):
drm/i915: Added a return type for panel fitter config functions drm/i915: Initialized 'set_property' fn pointer field of
intel_crtc_funcsstructure
drm/i915: New drm crtc property for varying the size of bordersAs an aside, you're missing the new property documentation in
Documentation/DocBook/drm.tmpl.
Sorry, will float the corresponding Documentation patch in the next series.