drm/i915/skl: Add support for SKL background color
Subsystems (4)
PATCH v9 1/1 drm/i915/skl: Add support for SKL background color
This patch adds support for Skylake display pipe background color.
v2:
- added property documentation to drm DocBook (Daniel Vetter)
- moved property to drm_mode_config (Daniel Vetter)
- change to set property to NULL once it is freed. (me)
- change to make sure gamma/csc settings were retained during color change (me)
- change to make sure background color is restored after a power event (me)
v3:
- change to add gen check before writing background color (Matt Roper)
v4:
- change to increase color from 8bpc to 16bpc (Daniel Vetter)
v5:
- removed initialization of background color to 0 (Damien Lespiau)
- added change log to commit message (Damien Lespiau)
v6:
- optmization to use _PIPE() (Damien Lespiau)
- updated max limit value in DocBook (Damien Lespiau)
- simplied color conversion equation (Damien Lespiau)
- always enable gamma and csc to align with update plane (Damien Lespiau)
- move resume restoration code to haswell_crtc_enable (Damien Lespiau)
v7:
- remove superfluous comments (Damien)
- remove unused variables left over between v5 and v6 (Damien)
v8:
- remove the destruction of the property, DRM core does that for us (Damien)
v9:
- add ULL to a 64bits constant
--- Documentation/DocBook/drm.tmpl | 10 ++++++- drivers/gpu/drm/i915/i915_reg.h | 10 +++++++ drivers/gpu/drm/i915/intel_display.c | 54 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ include/drm/drm_crtc.h | 3 ++ 5 files changed, 78 insertions(+), 1 deletion(-)
Documentation/DocBook/drm.tmpl +9 -1
@@ -2834,7 +2834,7 @@ void intel_crt_init(struct drm_device *dev) <td valign="top" >TBD</td> </tr> <tr> - <td rowspan="21" valign="top" >i915</td> + <td rowspan="22" valign="top" >i915</td> <td rowspan="2" valign="top" >Generic</td> <td valign="top" >"Broadcast RGB"</td> <td valign="top" >ENUM</td>
@@ -2858,6 +2858,14 @@ void intel_crt_init(struct drm_device *dev) <td valign="top" >TBD</td> </tr> <tr> + <td rowspan="1" valign="top" >CRTC</td> + <td valign="top" >“background_color”</td> + <td valign="top" >Range</td> + <td valign="top" >Min=0, Max=0xFFFFFFFFFFFF</td> + <td valign="top" >CRTC</td> + <td valign="top" >Background color in 16bpc BGR (B-MSB, R-LSB)</td> + </tr> + <tr> <td rowspan="17" valign="top" >SDVO-TV</td> <td valign="top" >“mode”</td> <td valign="top" >ENUM</td>
drivers/gpu/drm/i915/i915_reg.h +10 -0
@@ -6758,6 +6758,16 @@ enum skl_disp_power_wells {#define PIPE_CSC_POSTOFF_ME (pipe) _PIPE(pipe, _PIPE_A_CSC_POSTOFF_ME, _PIPE_B_CSC_POSTOFF_ME)#define PIPE_CSC_POSTOFF_LO (pipe) _PIPE(pipe, _PIPE_A_CSC_POSTOFF_LO, _PIPE_B_CSC_POSTOFF_LO) +/* Skylake pipe bottom color */ +#define _PIPE_BOTTOM_COLOR_A 0x70034 +#define _PIPE_BOTTOM_COLOR_B 0x71034 +#define _PIPE_BOTTOM_COLOR_C 0x72034 +#define PIPE_BOTTOM_GAMMA_ENABLE (1 << 31) +#define PIPE_BOTTOM_CSC_ENABLE (1 << 30) +#define PIPE_BOTTOM_COLOR_MASK 0x3FFFFFFF +#define PIPE_BOTTOM_COLOR (pipe) \ + _PIPE(pipe, _PIPE_BOTTOM_COLOR_A, _PIPE_BOTTOM_COLOR_B) +/* MIPI DSI registers */ #define _MIPI_PORT (port, a, c) _PORT3(port, a, 0, c)/* ports A and C only */
drivers/gpu/drm/i915/intel_display.c +54 -0
84 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -493,6 +493,8 @@ struct intel_crtc {struct intel_mmio_flip mmio_flip;struct intel_crtc_atomic_commit atomic; + +uint32_t background_color; };struct intel_plane_wm_parameters {
include/drm/drm_crtc.h +3 -0
@@ -1122,6 +1122,9 @@ struct drm_mode_config {struct drm_property *prop_crtc_id;struct drm_property *prop_active; +/* crtc properties */ +struct drm_property *background_color_property; +/* DVI-I properties */ struct drm_property *dvi_i_subconnector_property;struct drm_property *dvi_i_select_subconnector_property;
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
drivers/gpu/drm/i915/intel_display.c static const struct drm_crtc_funcs intel_crtc_funcs = { · line 11703
Quoted 5 lines · Chandra Konduru
drivers/gpu/drm/i915/intel_display.c +1
-0@@ -11660,6 +11700,7 @@ static const struct drm_crtc_funcs intel_crtc_funcs = { .page_flip = intel_crtc_page_flip, .atomic_duplicate_state = intel_crtc_duplicate_state, .atomic_destroy_state = intel_crtc_destroy_state, + .set_property = intel_crtc_set_property,
So in my internals mail about whether atomic blocks this I've missed that atm we can't do any atomic crtc properties. And I really don't want to slow down the atomic conversion by piling up more legacy cruft first, so I think properties on the crtc like this one will get stalled a bit despite what I've claimed.
I guess we need to discuss this in our mtg tomorrow. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 61 lines · Chandra Konduru
This patch adds support for Skylake display pipe background color.
v2:
- added property documentation to drm DocBook (Daniel Vetter)
- moved property todrm_mode_config(Daniel Vetter)
- change to set property to NULL once it is freed. (me)
- change to make sure gamma/csc settings were retained during color change (me)
- change to make sure background color is restored after a power event (me)v3:
- change to add gen check before writing background color (Matt Roper)v4:
- change to increase color from 8bpc to 16bpc (Daniel Vetter)v5:
- removed initialization of background color to 0 (Damien Lespiau)
- added change log to commit message (Damien Lespiau)v6:
- optmization to use_PIPE()(Damien Lespiau)
- updated max limit value in DocBook (Damien Lespiau)
- simplied color conversion equation (Damien Lespiau)
- always enable gamma and csc to align with update plane (Damien Lespiau)
- move resume restoration code tohaswell_crtc_enable(Damien Lespiau)v7:
- remove superfluous comments (Damien)
- remove unused variables left over between v5 and v6 (Damien)v8:
- remove the destruction of the property, DRM core does that for us (Damien)v9:
- add ULL to a 64bits constantReviewed-by Damien Lespiau <[email protected]>Signed-off-by Chandra Konduru <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- Documentation/DocBook/drm.tmpl | 10 ++++++- drivers/gpu/drm/i915/i915_reg.h | 10 +++++++ drivers/gpu/drm/i915/intel_display.c | 54 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ include/drm/drm_crtc.h | 3 ++ 5 files changed, 78 insertions(+), 1 deletion(-)Documentation/DocBook/drm.tmpl +1
-1@@ -2834,7 +2834,7 @@ void intel_crt_init(struct drm_device *dev) <td valign="top" >TBD</td> </tr> <tr> - <td rowspan="21" valign="top" >i915</td> + <td rowspan="22" valign="top" >i915</td> <td rowspan="2" valign="top" >Generic</td> <td valign="top" >"Broadcast RGB"</td> <td valign="top" >ENUM</td>
Documentation/DocBook/drm.tmpl void intel_crt_init(struct drm_device *dev) · line 2866
Quoted 9 lines
Documentation/DocBook/drm.tmpl +6
-0@@ -2858,6 +2858,14 @@ void intel_crt_init(struct drm_device *dev) <td valign="top" >TBD</td> </tr> <tr> + <td rowspan="1" valign="top" >CRTC</td> + <td valign="top" >“background_color”</td> + <td valign="top" >Range</td> + <td valign="top" >Min=0, Max=0xFFFFFFFFFFFF</td> + <td valign="top" >CRTC</td> + <td valign="top" >Background color in 16bpc BGR (B-MSB, R-LSB)</td>
I'd prefer to settle on ARGB msb->lsb layout, unless there's already precedent for something else. I think it's the most common component order around, and so should result in least amount of code to stuff the bits into the hardware registers.
Quoted 153 lines
Documentation/DocBook/drm.tmpl +2
-0+ </tr> + <tr> <td rowspan="17" valign="top" >SDVO-TV</td> <td valign="top" >“mode”</td> <td valign="top" >ENUM</td>drivers/gpu/drm/i915/i915_reg.h +10
-0@@ -6758,6 +6758,16 @@ enum skl_disp_power_wells {#define PIPE_CSC_POSTOFF_ME (pipe) _PIPE(pipe, _PIPE_A_CSC_POSTOFF_ME, _PIPE_B_CSC_POSTOFF_ME)#define PIPE_CSC_POSTOFF_LO (pipe) _PIPE(pipe, _PIPE_A_CSC_POSTOFF_LO, _PIPE_B_CSC_POSTOFF_LO) +/* Skylake pipe bottom color */ +#define _PIPE_BOTTOM_COLOR_A 0x70034 +#define _PIPE_BOTTOM_COLOR_B 0x71034 +#define _PIPE_BOTTOM_COLOR_C 0x72034 +#define PIPE_BOTTOM_GAMMA_ENABLE (1 << 31) +#define PIPE_BOTTOM_CSC_ENABLE (1 << 30) +#define PIPE_BOTTOM_COLOR_MASK 0x3FFFFFFF +#define PIPE_BOTTOM_COLOR (pipe) \ + _PIPE(pipe, _PIPE_BOTTOM_COLOR_A, _PIPE_BOTTOM_COLOR_B) +/* MIPI DSI registers */ #define _MIPI_PORT (port, a, c) _PORT3(port, a, 0, c)/* ports A and C only */ drivers/gpu/drm/i915/intel_display.c +54
-0@@ -4413,6 +4413,20 @@ static void haswell_mode_set_planes_workaround(struct intel_crtc *crtc)intel_wait_for_vblank (dev, other_active_crtc->pipe); } +static void skl_crtc_set_background_color (struct intel_crtc *intel_crtc) +{ +struct drm_device *dev = intel_crtc->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; + +if (INTEL_INFO (dev)->gen <9 ) +return ; + +I915_WRITE (PIPE_BOTTOM_COLOR (intel_crtc->pipe), + intel_crtc->background_color | +PIPE_BOTTOM_GAMMA_ENABLE | +PIPE_BOTTOM_CSC_ENABLE ); +} +static void haswell_crtc_enable (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;@@ -4474,6 +4488,8 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)*/ intel_crtc_load_lut (crtc); +skl_crtc_set_background_color (intel_crtc); +intel_ddi_set_pipe_settings (crtc);intel_ddi_enable_transcoder_func (crtc);@@ -9882,6 +9898,30 @@ out_hang:return ret; } +static int intel_crtc_set_property (struct drm_crtc *crtc, +struct drm_property *property,uint64_t val) +{ +struct drm_device *dev = crtc->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int i; + +if (INTEL_INFO (dev)->gen >=9 ) { +if (property == dev->mode_config.background_color_property) { +uint64_t bottom =0 ; + +/* BGR 16bpc ==> RGB 10bpc */ +for (i =0 ; i <3 ; i++) + bottom |= (((val >> (i *16 +6 )) &0x3FF ) << ((2 - i) *10 )); + + intel_crtc->background_color = (uint32_t ) bottom; + +skl_crtc_set_background_color (intel_crtc); + } +return 0 ; + } +return -EINVAL ; +} +static struct drm_crtc_helper_funcs intel_helper_funcs = { .mode_set_base_atomic = intel_pipe_set_base_atomic, .load_lut = intel_crtc_load_lut,@@ -11660,6 +11700,7 @@ static const struct drm_crtc_funcs intel_crtc_funcs = { .page_flip = intel_crtc_page_flip, .atomic_duplicate_state = intel_crtc_duplicate_state, .atomic_destroy_state = intel_crtc_destroy_state, + .set_property = intel_crtc_set_property, }; static bool ibx_pch_dpll_get_hw_state(struct drm_i915_private *dev_priv,@@ -12341,6 +12382,19 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)drm_crtc_helper_add (&intel_crtc->base, &intel_helper_funcs);WARN_ON (drm_crtc_index (&intel_crtc->base) != intel_crtc->pipe); + +/* background color = 48 bit quantity: MSB BGR 16bpc LSB */ +if (INTEL_INFO (dev)->gen >=9 && + !dev->mode_config.background_color_property) + dev->mode_config.background_color_property = +drm_property_create_range (dev,0 ,"background_color" ,0 , +0xFFFFFFFFFFFFULL ); + +if (dev->mode_config.background_color_property) +drm_object_attach_property (&intel_crtc->base.base, + dev->mode_config.background_color_property, + intel_crtc->background_color); +return ; fail:drivers/gpu/drm/i915/intel_drv.h +2
-0@@ -493,6 +493,8 @@ struct intel_crtc {struct intel_mmio_flip mmio_flip;struct intel_crtc_atomic_commit atomic; + +uint32_t background_color; };struct intel_plane_wm_parameters {include/drm/drm_crtc.h +3
-0@@ -1122,6 +1122,9 @@ struct drm_mode_config {struct drm_property *prop_crtc_id;struct drm_property *prop_active; +/* crtc properties */ +struct drm_property *background_color_property; +/* DVI-I properties */ struct drm_property *dvi_i_subconnector_property;struct drm_property *dvi_i_select_subconnector_property;Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 11 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Monday, April 27, 2015 8:28 AMDocumentation/DocBook/drm.tmpl void intel_crt_init(struct drm_device *dev) · line 2866
Quoted 2 lines · Chandra Konduru
This patch adds support for Skylake display pipe background color.
Documentation/DocBook/drm.tmpl +1
-0+ <td valign="top" >Background color in 16bpc BGR (B-MSB, R-LSB)</td>I'd prefer to settle on ARGB
msb->lsblayout, unless there's already precedent for something else. I think it's the most common component order around, and so should result in least amount of code to stuff the bits into the hardware registers.
To give some background on this, initially using ARGB msb->lsb layout to stuff bit into hw regs, but changed to BGR msb->lsb per feedback. Before reversing/ respunning, would like to have an agreement. Daniel/Damien, are you ok with reversing the order to align with hw? Or just keep the way current patch doing?
Quoted 16 lines
drivers/gpu/drm/i915/intel_display.c out_hang:
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +8
-0+static int intel_crtc_set_property (struct drm_crtc *crtc, +struct drm_property *property,uint64_t val) { +struct drm_device *dev = crtc->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int i; + +if (INTEL_INFO (dev)->gen >=9 ) { +if (property == dev->mode_config.background_color_property){
drivers/gpu/drm/i915/intel_display.c out_hang:
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +5
-0+uint64_t bottom =0 ; + +/* BGR 16bpc ==> RGB 10bpc */ +for (i =0 ; i <3 ; i++) + bottom |= (((val >> (i * 16 + 6)) & 0x3FF) << ((2 -i) * 10));
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c out_hang: · line 9923
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +9
-0+ + intel_crtc->background_color = (uint32_t ) bottom; + +skl_crtc_set_background_color (intel_crtc); + } +return 0 ; + } +return -EINVAL ; +}
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 12 lines · Chandra
Quoted 11 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Monday, April 27, 2015 8:28 AMDocumentation/DocBook/drm.tmpl void intel_crt_init(struct drm_device *dev) · line 2866
Quoted 2 lines · Chandra Konduru
This patch adds support for Skylake display pipe background color.
Documentation/DocBook/drm.tmpl +1
-0+ <td valign="top" >Background color in 16bpc BGR (B-MSB, R-LSB)</td>I'd prefer to settle on ARGB
msb->lsblayout, unless there's already precedent for something else. I think it's the most common component order around, and so should result in least amount of code to stuff the bits into the hardware registers.
Quoted 4 lines
To give some background on this, initially using ARGB
msb->lsblayout to stuff bit into hw regs, but changed to BGRmsb->lsbper feedback. Before reversing/ respunning, would like to have an agreement. Daniel/Damien, are you ok with reversing the order to align with hw? Or just keep the way current patch doing?
Imo if we want to really end up with a real standard we should have a macro to encode ARGB values and 4 macros to extract the individual parts in some uapi header and use that instead of open-coding shifts. That would need to be a drm core header ofc. The exact layout is probably irrelevant anyway.
-Daniel
Quoted 31 lines
Quoted 17 lines
drivers/gpu/drm/i915/intel_display.c out_hang:
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +8
-0+static int intel_crtc_set_property (struct drm_crtc *crtc, +struct drm_property *property,uint64_t val) { +struct drm_device *dev = crtc->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int i; + +if (INTEL_INFO (dev)->gen >=9 ) { +if (property == dev->mode_config.background_color_property){
drivers/gpu/drm/i915/intel_display.c out_hang:
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +5
-0+uint64_t bottom =0 ; + +/* BGR 16bpc ==> RGB 10bpc */ +for (i =0 ; i <3 ; i++) + bottom |= (((val >> (i * 16 + 6)) & 0x3FF) << ((2 -i) * 10));
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c out_hang: · line 9923
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +9
-0+ + intel_crtc->background_color = (uint32_t ) bottom; + +skl_crtc_set_background_color (intel_crtc); + } +return 0 ; + } +return -EINVAL ; +}_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 18 lines · Daniel Vetter
Quoted 12 lines · Chandra
Quoted 11 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Monday, April 27, 2015 8:28 AMDocumentation/DocBook/drm.tmpl void intel_crt_init(struct drm_device *dev) · line 2866
Quoted 2 lines · Chandra Konduru
This patch adds support for Skylake display pipe background color.
Documentation/DocBook/drm.tmpl +1
-0+ <td valign="top" >Background color in 16bpc BGR (B-MSB, R-LSB)</td>I'd prefer to settle on ARGB
msb->lsblayout, unless there's already precedent for something else. I think it's the most common component order around, and so should result in least amount of code to stuff the bits into the hardware registers.Quoted 4 lines
To give some background on this, initially using ARGB
msb->lsblayout to stuff bit into hw regs, but changed to BGRmsb->lsbper feedback. Before reversing/ respunning, would like to have an agreement. Daniel/Damien, are you ok with reversing the order to align with hw? Or just keep the way current patch doing?
Quoted 4 lines
Imo if we want to really end up with a real standard we should have a macro to encode ARGB values and 4 macros to extract the individual parts in some uapi header and use that instead of open-coding shifts. That would need to be a drm core header ofc.
Sounds like a decent idea.
Quoted 2 lines
The exact layout is probably irrelevant
anyway.
I think going with (A)RGB makes it much easier to parse when you're looking at the hex string. That's the order those things usually come in.
Which brings another point to mind. Should we define a new property type for color data? Would make it easier to pretty-print in userland. Using decimal for color data isn't very useful after all.
Quoted 38 lines
-Daniel
Quoted 31 lines
Quoted 17 lines
drivers/gpu/drm/i915/intel_display.c out_hang:
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +8
-0+static int intel_crtc_set_property (struct drm_crtc *crtc, +struct drm_property *property,uint64_t val) { +struct drm_device *dev = crtc->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int i; + +if (INTEL_INFO (dev)->gen >=9 ) { +if (property == dev->mode_config.background_color_property){
drivers/gpu/drm/i915/intel_display.c out_hang:
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +5
-0+uint64_t bottom =0 ; + +/* BGR 16bpc ==> RGB 10bpc */ +for (i =0 ; i <3 ; i++) + bottom |= (((val >> (i * 16 + 6)) & 0x3FF) << ((2 -i) * 10));
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c out_hang: · line 9923
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +9
-0+ + intel_crtc->background_color = (uint32_t ) bottom; + +skl_crtc_set_background_color (intel_crtc); + } +return 0 ; + } +return -EINVAL ; +}_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 3 lines · Ville Syrjälä
Which brings another point to mind. Should we define a new property type for color data? Would make it easier to pretty-print in userland. Using decimal for color data isn't very useful after all.
Maybe a hex type might be useful, but not even sure about that one. I'd expect a proliferation of various types if we go as fine-grained as color at least.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx