drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
Subsystems (2)
PATCH 1/1 drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
Since GLK, some plane configuration settings have moved to the PLANE_COLOR_CTL register. Refactor handling of the register to work like PLANE_CTL. This also allows us to fix the set/read of the plane Alpha Mode for GLK+.
--- drivers/gpu/drm/i915/i915_reg.h | 12 +++++--- drivers/gpu/drm/i915/intel_display.c | 60 +++++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/intel_drv.h | 5 +++ drivers/gpu/drm/i915/intel_sprite.c | 14 +++++---- 4 files changed, 76 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +8 -4
@@ -6263,7 +6263,7 @@ enum {#define _PLANE_CTL_2_A 0x70280#define _PLANE_CTL_3_A 0x70380#define PLANE_CTL_ENABLE (1 << 31) -#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) +#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30)/* Pre-GLK */ #define PLANE_CTL_FORMAT_MASK (0xf << 24)#define PLANE_CTL_FORMAT_YUV422 ( 0 << 24)#define PLANE_CTL_FORMAT_NV12 ( 1 << 24)
@@ -6273,7 +6273,7 @@ enum {#define PLANE_CTL_FORMAT_AYUV ( 8 << 24)#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24)#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24) -#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23)/* Pre-GLK */ #define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21)#define PLANE_CTL_KEY_ENABLE_SOURCE ( 1 << 21)#define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)
@@ -6286,13 +6286,13 @@ enum {#define PLANE_CTL_YUV422_VYUY ( 3 << 16)#define PLANE_CTL_DECOMPRESSION_ENABLE (1 << 15)#define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14) -#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13)/* Pre-GLK */ #define PLANE_CTL_TILED_MASK (0x7 << 10)#define PLANE_CTL_TILED_LINEAR ( 0 << 10)#define PLANE_CTL_TILED_X ( 1 << 10)#define PLANE_CTL_TILED_Y ( 4 << 10)#define PLANE_CTL_TILED_YF ( 5 << 10) -#define PLANE_CTL_ALPHA_MASK (0x3 << 4) +#define PLANE_CTL_ALPHA_MASK (0x3 << 4)/* Pre-GLK */ #define PLANE_CTL_ALPHA_DISABLE ( 0 << 4)#define PLANE_CTL_ALPHA_SW_PREMULTIPLY ( 2 << 4)#define PLANE_CTL_ALPHA_HW_PREMULTIPLY ( 3 << 4)
@@ -6332,6 +6332,10 @@ enum {#define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30)#define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23)#define PLANE_COLOR_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_COLOR_ALPHA_MASK (0x3 << 4) +#define PLANE_COLOR_ALPHA_DISABLE (0 << 4) +#define PLANE_COLOR_ALPHA_SW_PREMULTIPLY (2 << 4) +#define PLANE_COLOR_ALPHA_HW_PREMULTIPLY (3 << 4)#define _PLANE_BUF_CFG_1_A 0x7027c#define _PLANE_BUF_CFG_2_A 0x7037c#define _PLANE_NV12_BUF_CFG_1_A 0x70278
drivers/gpu/drm/i915/intel_display.c +55 -5
103 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +5 -0
@@ -420,6 +420,9 @@ struct intel_plane_state {/* plane control register */ u32 ctl; +/* plane color control register */ +u32 color_ctl; +/* * scaler_id * = -1 : not using a scaler
@@ -1492,6 +1495,8 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state)return i915_ggtt_offset (state->vma); } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state);u32 skl_plane_ctl (const struct intel_crtc_state *crtc_state,const struct intel_plane_state *plane_state); u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,
drivers/gpu/drm/i915/intel_sprite.c +8 -6
@@ -240,6 +240,7 @@ skl_update_plane(struct intel_plane *plane,enum plane_id plane_id = plane->id;enum pipe pipe = plane->pipe;u32 plane_ctl = plane_state->ctl; +u32 plane_color_ctl = plane_state->color_ctl;const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;u32 surf_addr = plane_state->main.offset;unsigned int rotation = plane_state->base.rotation;
@@ -263,13 +264,9 @@ skl_update_plane(struct intel_plane *plane,spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); -if (IS_GEMINILAKE (dev_priv) ||IS_CANNONLAKE (dev_priv)) { +if (IS_GEMINILAKE (dev_priv) ||INTEL_GEN (dev_priv) >=10 )I915_WRITE_FW (PLANE_COLOR_CTL (pipe, plane_id), -PLANE_COLOR_PIPE_GAMMA_ENABLE | -PLANE_COLOR_PIPE_CSC_ENABLE | -PLANE_COLOR_PLANE_GAMMA_DISABLE ); - } - + plane_color_ctl);if (key->flags) {I915_WRITE_FW (PLANE_KEYVAL (pipe, plane_id), key->min_value);I915_WRITE_FW (PLANE_KEYMAX (pipe, plane_id), key->max_value);
@@ -978,6 +975,11 @@ intel_check_sprite_plane(struct intel_plane *plane, state->ctl =g4x_sprite_ctl (crtc_state, state); } +if (IS_GEMINILAKE (dev_priv) ||INTEL_GEN (dev_priv) >=10 ) + state->color_ctl =glk_plane_color_ctl (crtc_state, state); +else + state->color_ctl =0 ; +return 0 ; }
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
== Series Details ==
== Series Details ==
Series: drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
URL : https://patchwork.freedesktop.org/series/33087/
State : warning
== Summary ==
Series 33087v1 drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
https://patchwork.freedesktop.org/api/1.0/series/33087/revisions/1/mbox/
Test gem_ctx_switch:
Subgroup basic-default-heavy:
pass -> INCOMPLETE (fi-glk-dsi) fdo#103359
Test kms_force_connector_basic:
Subgroup prune-stale-modes:
pass -> SKIP (fi-snb-2520m)
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
pass -> INCOMPLETE (fi-kbl-7567u) fdo#102846fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#102846 https://bugs.freedesktop.org/show_bug.cgi?id=102846
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:449s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:380s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:526s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:277s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:507s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:500s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:507s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:496s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:432s fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:267s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:585s fi-glk-dsi total:32 pass:22 dwarn:0 dfail:0 fail:0 skip:9 fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:433s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:431s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:430s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:461s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:489s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:576s fi-kbl-7567u total:245 pass:228 dwarn:0 dfail:0 fail:0 skip:16 fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:585s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:570s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:454s fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:594s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:650s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:525s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:504s fi-snb-2520m total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:568s
fi-cfl-s failed to connect after reboot
2faf7577f4edf6e233c89b3b217440bcb87b651f drm-tip: 2017y-11m-02d-15h-33m-01s UTC integration manifest 60b48de7835a drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6933/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 75 lines · James Ausmus
Since GLK, some plane configuration settings have moved to the
PLANE_COLOR_CTLregister. Refactor handling of the register to work likePLANE_CTL. This also allows us to fix the set/read of the plane Alpha Mode for GLK+.Signed-off-by James Ausmus <[email protected]>Cc Paulo Zanoni <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 12 +++++--- drivers/gpu/drm/i915/intel_display.c | 60 +++++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/intel_drv.h | 5 +++ drivers/gpu/drm/i915/intel_sprite.c | 14 +++++---- 4 files changed, 76 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/i915_reg.h +8
-4@@ -6263,7 +6263,7 @@ enum {#define _PLANE_CTL_2_A 0x70280#define _PLANE_CTL_3_A 0x70380#define PLANE_CTL_ENABLE (1 << 31) -#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) +#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30)/* Pre-GLK */ #define PLANE_CTL_FORMAT_MASK (0xf << 24)#define PLANE_CTL_FORMAT_YUV422 ( 0 << 24)#define PLANE_CTL_FORMAT_NV12 ( 1 << 24)@@ -6273,7 +6273,7 @@ enum {#define PLANE_CTL_FORMAT_AYUV ( 8 << 24)#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24)#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24) -#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23)/* Pre-GLK */ #define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21)#define PLANE_CTL_KEY_ENABLE_SOURCE ( 1 << 21)#define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)@@ -6286,13 +6286,13 @@ enum {#define PLANE_CTL_YUV422_VYUY ( 3 << 16)#define PLANE_CTL_DECOMPRESSION_ENABLE (1 << 15)#define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14) -#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13)/* Pre-GLK */ #define PLANE_CTL_TILED_MASK (0x7 << 10)#define PLANE_CTL_TILED_LINEAR ( 0 << 10)#define PLANE_CTL_TILED_X ( 1 << 10)#define PLANE_CTL_TILED_Y ( 4 << 10)#define PLANE_CTL_TILED_YF ( 5 << 10) -#define PLANE_CTL_ALPHA_MASK (0x3 << 4) +#define PLANE_CTL_ALPHA_MASK (0x3 << 4)/* Pre-GLK */ #define PLANE_CTL_ALPHA_DISABLE ( 0 << 4)#define PLANE_CTL_ALPHA_SW_PREMULTIPLY ( 2 << 4)#define PLANE_CTL_ALPHA_HW_PREMULTIPLY ( 3 << 4)@@ -6332,6 +6332,10 @@ enum {#define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30)#define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23)#define PLANE_COLOR_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_COLOR_ALPHA_MASK (0x3 << 4) +#define PLANE_COLOR_ALPHA_DISABLE (0 << 4) +#define PLANE_COLOR_ALPHA_SW_PREMULTIPLY (2 << 4) +#define PLANE_COLOR_ALPHA_HW_PREMULTIPLY (3 << 4)#define _PLANE_BUF_CFG_1_A 0x7027c#define _PLANE_BUF_CFG_2_A 0x7037c#define _PLANE_NV12_BUF_CFG_1_A 0x70278drivers/gpu/drm/i915/intel_display.c +4
-0@@ -3466,6 +3466,29 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)return 0 ; } +static u32 glk_plane_ctl_format (uint32_t pixel_format) +{ +/* GLK+ moves the alpha mask to a different register */ +return skl_plane_ctl_format (pixel_format) & ~PLANE_CTL_ALPHA_MASK ;
drivers/gpu/drm/i915/intel_display.c static u32 skl_plane_ctl_format(uint32_t pixel_format) · line 3482
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+} + +static u32 glk_plane_color_ctl_alpha (uint32_t pixel_format) +{ +switch (pixel_format) { +/* +* XXX: For ARBG/ABGR formats we default to expecting scanout buffers +* to be already pre-multiplied. We need to add a knob (or a different +* DRM_FORMAT) for user-space to configure that. +*/
Why is this comment getting added to the glk function? It's a generic issue that affects all platforms with alpha blending.
drivers/gpu/drm/i915/intel_display.c static u32 skl_plane_ctl_format(uint32_t pixel_format) · line 3486
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +4
-0+case DRM_FORMAT_ABGR8888 : +return PLANE_COLOR_ALPHA_SW_PREMULTIPLY ; +case DRM_FORMAT_ARGB8888 : +return PLANE_COLOR_ALPHA_SW_PREMULTIPLY ;
case A:
case B:
return FOO;
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +5
-0+default : +return PLANE_COLOR_ALPHA_DISABLE ; + } +} +static u32 skl_plane_ctl_tiling (uint64_t fb_modifier) {switch (fb_modifier) {
drivers/gpu/drm/i915/intel_display.c u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, · line 3548
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-1@@ -3522,14 +3545,16 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, plane_ctl =PLANE_CTL_ENABLE ; -if (!IS_GEMINILAKE (dev_priv) && !IS_CANNONLAKE (dev_priv)) { +if (!IS_GEMINILAKE (dev_priv) && !(INTEL_GEN (dev_priv) >=10 )) {
Please flip this entire logic around:
if (GEN >= 10 || IS_GLK) {
...Quoted 44 lines
drivers/gpu/drm/i915/intel_display.c +18
-2plane_ctl |=PLANE_CTL_PIPE_GAMMA_ENABLE |PLANE_CTL_PIPE_CSC_ENABLE |PLANE_CTL_PLANE_GAMMA_DISABLE ; + plane_ctl |=skl_plane_ctl_format (fb->format->format); + }else { + plane_ctl |=glk_plane_ctl_format (fb->format->format); } - plane_ctl |=skl_plane_ctl_format (fb->format->format); plane_ctl |=skl_plane_ctl_tiling (fb->modifier); plane_ctl |=skl_plane_ctl_rotation (rotation);@@ -3541,6 +3566,20 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,return plane_ctl; } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +const struct drm_framebuffer *fb = plane_state->base.fb; +u32 plane_color_ctl =0 ; + + plane_color_ctl |=PLANE_COLOR_PIPE_GAMMA_ENABLE ; + plane_color_ctl |=PLANE_COLOR_PIPE_CSC_ENABLE ; + plane_color_ctl |=PLANE_COLOR_PLANE_GAMMA_DISABLE ; + plane_color_ctl |=glk_plane_color_ctl_alpha (fb->format->format); + +return plane_color_ctl; +} + static int __intel_display_resume(struct drm_device *dev, struct drm_atomic_state *state,@@ -8425,7 +8464,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -u32 val, base, offset, stride_mult, tiling; +u32 val, base, offset, stride_mult, tiling, alpha;int pipe = crtc->pipe;int fourcc, pixel_format;unsigned int aligned_height;
drivers/gpu/drm/i915/intel_display.c skylake_get_initial_plane_config(struct intel_crtc *crtc, · line 8490
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +2
-0@@ -8447,9 +8486,16 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, goto error; pixel_format = val &PLANE_CTL_FORMAT_MASK ; + +if (!IS_GEMINILAKE (dev_priv) && !(INTEL_GEN (dev_priv) >=10 )) {
ditto
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c +7
-2+ alpha = val &PLANE_CTL_ALPHA_MASK ; + }else { + alpha =I915_READ (PLANE_COLOR_CTL (pipe,0 )); + alpha &=PLANE_COLOR_ALPHA_MASK ; + } + fourcc =skl_format_to_fourcc (pixel_format, - val &PLANE_CTL_ORDER_RGBX , - val &PLANE_CTL_ALPHA_MASK ); + val &PLANE_CTL_ORDER_RGBX , alpha); fb->format =drm_format_info (fourcc); tiling = val &PLANE_CTL_TILED_MASK ;
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct intel_plane *plane, · line 12865
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +1
-0@@ -12816,6 +12862,10 @@ intel_check_primary_plane(struct intel_plane *plane, state->ctl =i9xx_plane_ctl (crtc_state, state); } +if (IS_GEMINILAKE (dev_priv) ||INTEL_GEN (dev_priv) >=10 )
I prefer the order to go from new to old. Makes for a more logical read if we add another branch to the if statement with a more recent platforms eg.
if (LATEST)
... else if (SLIGHTLY_OLDER || EVEN_OLDER) ...
Quoted 42 lines
drivers/gpu/drm/i915/intel_display.c +3
-0+ state->color_ctl =glk_plane_color_ctl (crtc_state, state); + else + state->color_ctl = 0;return 0 ; }drivers/gpu/drm/i915/intel_drv.h +5
-0@@ -420,6 +420,9 @@ struct intel_plane_state {/* plane control register */ u32 ctl; +/* plane color control register */ +u32 color_ctl; +/* * scaler_id * = -1 : not using a scaler @@ -1492,6 +1495,8 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state)return i915_ggtt_offset (state->vma); } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state);u32 skl_plane_ctl (const struct intel_crtc_state *crtc_state,const struct intel_plane_state *plane_state); u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,drivers/gpu/drm/i915/intel_sprite.c +1
-0@@ -240,6 +240,7 @@ skl_update_plane(struct intel_plane *plane,enum plane_id plane_id = plane->id;enum pipe pipe = plane->pipe;u32 plane_ctl = plane_state->ctl; +u32 plane_color_ctl = plane_state->color_ctl;const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;u32 surf_addr = plane_state->main.offset;unsigned int rotation = plane_state->base.rotation;
drivers/gpu/drm/i915/intel_sprite.c skl_update_plane(struct intel_plane *plane, · line 267
Quoted 5 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-1@@ -263,13 +264,9 @@ skl_update_plane(struct intel_plane *plane,spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); -if (IS_GEMINILAKE (dev_priv) ||IS_CANNONLAKE (dev_priv)) { +if (IS_GEMINILAKE (dev_priv) ||INTEL_GEN (dev_priv) >=10 )
ditto
Quoted 11 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-5I915_WRITE_FW (PLANE_COLOR_CTL (pipe, plane_id), -PLANE_COLOR_PIPE_GAMMA_ENABLE | -PLANE_COLOR_PIPE_CSC_ENABLE | -PLANE_COLOR_PLANE_GAMMA_DISABLE ); - } - + plane_color_ctl);if (key->flags) {I915_WRITE_FW (PLANE_KEYVAL (pipe, plane_id), key->min_value);I915_WRITE_FW (PLANE_KEYMAX (pipe, plane_id), key->max_value);
drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct intel_plane *plane, · line 978
Quoted 4 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-0@@ -978,6 +975,11 @@ intel_check_sprite_plane(struct intel_plane *plane, state->ctl =g4x_sprite_ctl (crtc_state, state); } +if (IS_GEMINILAKE (dev_priv) ||INTEL_GEN (dev_priv) >=10 )
ditto
Quoted 14 lines
drivers/gpu/drm/i915/intel_sprite.c +4
-0+ state->color_ctl =glk_plane_color_ctl (crtc_state, state); + else + state->color_ctl = 0; +return 0 ; }Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 81 lines · Ville Syrjälä
Quoted 80 lines · James Ausmus
Since GLK, some plane configuration settings have moved to the
PLANE_COLOR_CTLregister. Refactor handling of the register to work likePLANE_CTL. This also allows us to fix the set/read of the plane Alpha Mode for GLK+.Signed-off-by James Ausmus <[email protected]>Cc Paulo Zanoni <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 12 +++++--- drivers/gpu/drm/i915/intel_display.c | 60 +++++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/intel_drv.h | 5 +++ drivers/gpu/drm/i915/intel_sprite.c | 14 +++++---- 4 files changed, 76 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/i915_reg.h +8
-4@@ -6263,7 +6263,7 @@ enum {#define _PLANE_CTL_2_A 0x70280#define _PLANE_CTL_3_A 0x70380#define PLANE_CTL_ENABLE (1 << 31) -#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) +#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30)/* Pre-GLK */ #define PLANE_CTL_FORMAT_MASK (0xf << 24)#define PLANE_CTL_FORMAT_YUV422 ( 0 << 24)#define PLANE_CTL_FORMAT_NV12 ( 1 << 24)@@ -6273,7 +6273,7 @@ enum {#define PLANE_CTL_FORMAT_AYUV ( 8 << 24)#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24)#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24) -#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23)/* Pre-GLK */ #define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21)#define PLANE_CTL_KEY_ENABLE_SOURCE ( 1 << 21)#define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)@@ -6286,13 +6286,13 @@ enum {#define PLANE_CTL_YUV422_VYUY ( 3 << 16)#define PLANE_CTL_DECOMPRESSION_ENABLE (1 << 15)#define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14) -#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13)/* Pre-GLK */ #define PLANE_CTL_TILED_MASK (0x7 << 10)#define PLANE_CTL_TILED_LINEAR ( 0 << 10)#define PLANE_CTL_TILED_X ( 1 << 10)#define PLANE_CTL_TILED_Y ( 4 << 10)#define PLANE_CTL_TILED_YF ( 5 << 10) -#define PLANE_CTL_ALPHA_MASK (0x3 << 4) +#define PLANE_CTL_ALPHA_MASK (0x3 << 4)/* Pre-GLK */ #define PLANE_CTL_ALPHA_DISABLE ( 0 << 4)#define PLANE_CTL_ALPHA_SW_PREMULTIPLY ( 2 << 4)#define PLANE_CTL_ALPHA_HW_PREMULTIPLY ( 3 << 4)@@ -6332,6 +6332,10 @@ enum {#define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30)#define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23)#define PLANE_COLOR_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_COLOR_ALPHA_MASK (0x3 << 4) +#define PLANE_COLOR_ALPHA_DISABLE (0 << 4) +#define PLANE_COLOR_ALPHA_SW_PREMULTIPLY (2 << 4) +#define PLANE_COLOR_ALPHA_HW_PREMULTIPLY (3 << 4)#define _PLANE_BUF_CFG_1_A 0x7027c#define _PLANE_BUF_CFG_2_A 0x7037c#define _PLANE_NV12_BUF_CFG_1_A 0x70278drivers/gpu/drm/i915/intel_display.c +9
-0@@ -3466,6 +3466,29 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)return 0 ; } +static u32 glk_plane_ctl_format (uint32_t pixel_format) +{ +/* GLK+ moves the alpha mask to a different register */ +return skl_plane_ctl_format (pixel_format) & ~PLANE_CTL_ALPHA_MASK ; +} + +static u32 glk_plane_color_ctl_alpha (uint32_t pixel_format) +{ +switch (pixel_format) {
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static u32 skl_plane_ctl_format(uint32_t pixel_format) · line 3482
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +5
-0+/* +* XXX: For ARBG/ABGR formats we default to expecting scanout buffers +* to be already pre-multiplied. We need to add a knob (or a different +* DRM_FORMAT) for user-space to configure that. +*/ Why is this comment getting added to the glk function? It's a generic issue that affects all platforms with alpha blending.
Copy-pasta from the skl_plane_ctl_format function - I'll drop it.
Thanks for the review!
-James
Quoted 184 lines
drivers/gpu/drm/i915/intel_display.c static u32 skl_plane_ctl_format(uint32_t pixel_format) · line 3486
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +4
-0+case DRM_FORMAT_ABGR8888 : +return PLANE_COLOR_ALPHA_SW_PREMULTIPLY ; +case DRM_FORMAT_ARGB8888 : +return PLANE_COLOR_ALPHA_SW_PREMULTIPLY ;case A:
case B:return FOO;Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +5
-0+default : +return PLANE_COLOR_ALPHA_DISABLE ; + } +} +static u32 skl_plane_ctl_tiling (uint64_t fb_modifier) {switch (fb_modifier) {drivers/gpu/drm/i915/intel_display.c u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, · line 3548
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-1@@ -3522,14 +3545,16 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, plane_ctl =PLANE_CTL_ENABLE ; -if (!IS_GEMINILAKE (dev_priv) && !IS_CANNONLAKE (dev_priv)) { +if (!IS_GEMINILAKE (dev_priv) && !(INTEL_GEN (dev_priv) >=10 )) {Please flip this entire logic around:
if (GEN >= 10 || IS_GLK) { ...Quoted 44 lines
drivers/gpu/drm/i915/intel_display.c +18
-2plane_ctl |=PLANE_CTL_PIPE_GAMMA_ENABLE |PLANE_CTL_PIPE_CSC_ENABLE |PLANE_CTL_PLANE_GAMMA_DISABLE ; + plane_ctl |=skl_plane_ctl_format (fb->format->format); + }else { + plane_ctl |=glk_plane_ctl_format (fb->format->format); } - plane_ctl |=skl_plane_ctl_format (fb->format->format); plane_ctl |=skl_plane_ctl_tiling (fb->modifier); plane_ctl |=skl_plane_ctl_rotation (rotation);@@ -3541,6 +3566,20 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,return plane_ctl; } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +const struct drm_framebuffer *fb = plane_state->base.fb; +u32 plane_color_ctl =0 ; + + plane_color_ctl |=PLANE_COLOR_PIPE_GAMMA_ENABLE ; + plane_color_ctl |=PLANE_COLOR_PIPE_CSC_ENABLE ; + plane_color_ctl |=PLANE_COLOR_PLANE_GAMMA_DISABLE ; + plane_color_ctl |=glk_plane_color_ctl_alpha (fb->format->format); + +return plane_color_ctl; +} + static int __intel_display_resume(struct drm_device *dev, struct drm_atomic_state *state,@@ -8425,7 +8464,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -u32 val, base, offset, stride_mult, tiling; +u32 val, base, offset, stride_mult, tiling, alpha;int pipe = crtc->pipe;int fourcc, pixel_format;unsigned int aligned_height;drivers/gpu/drm/i915/intel_display.c skylake_get_initial_plane_config(struct intel_crtc *crtc, · line 8490
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +2
-0@@ -8447,9 +8486,16 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, goto error; pixel_format = val &PLANE_CTL_FORMAT_MASK ; + +if (!IS_GEMINILAKE (dev_priv) && !(INTEL_GEN (dev_priv) >=10 )) {ditto
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c +7
-2+ alpha = val &PLANE_CTL_ALPHA_MASK ; + }else { + alpha =I915_READ (PLANE_COLOR_CTL (pipe,0 )); + alpha &=PLANE_COLOR_ALPHA_MASK ; + } + fourcc =skl_format_to_fourcc (pixel_format, - val &PLANE_CTL_ORDER_RGBX , - val &PLANE_CTL_ALPHA_MASK ); + val &PLANE_CTL_ORDER_RGBX , alpha); fb->format =drm_format_info (fourcc); tiling = val &PLANE_CTL_TILED_MASK ;drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct intel_plane *plane, · line 12865
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +1
-0@@ -12816,6 +12862,10 @@ intel_check_primary_plane(struct intel_plane *plane, state->ctl =i9xx_plane_ctl (crtc_state, state); } +if (IS_GEMINILAKE (dev_priv) ||INTEL_GEN (dev_priv) >=10 )I prefer the order to go from new to old. Makes for a more logical read if we add another branch to the if statement with a more recent platforms eg.
if (LATEST)
... else if (SLIGHTLY_OLDER || EVEN_OLDER) ...Quoted 42 lines
drivers/gpu/drm/i915/intel_display.c +3
-0+ state->color_ctl =glk_plane_color_ctl (crtc_state, state); + else + state->color_ctl = 0;return 0 ; }drivers/gpu/drm/i915/intel_drv.h +5
-0@@ -420,6 +420,9 @@ struct intel_plane_state {/* plane control register */ u32 ctl; +/* plane color control register */ +u32 color_ctl; +/* * scaler_id * = -1 : not using a scaler @@ -1492,6 +1495,8 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state)return i915_ggtt_offset (state->vma); } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state);u32 skl_plane_ctl (const struct intel_crtc_state *crtc_state,const struct intel_plane_state *plane_state); u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,drivers/gpu/drm/i915/intel_sprite.c +1
-0@@ -240,6 +240,7 @@ skl_update_plane(struct intel_plane *plane,enum plane_id plane_id = plane->id;enum pipe pipe = plane->pipe;u32 plane_ctl = plane_state->ctl; +u32 plane_color_ctl = plane_state->color_ctl;const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;u32 surf_addr = plane_state->main.offset;unsigned int rotation = plane_state->base.rotation;drivers/gpu/drm/i915/intel_sprite.c skl_update_plane(struct intel_plane *plane, · line 267
Quoted 5 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-1@@ -263,13 +264,9 @@ skl_update_plane(struct intel_plane *plane,spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); -if (IS_GEMINILAKE (dev_priv) ||IS_CANNONLAKE (dev_priv)) { +if (IS_GEMINILAKE (dev_priv) ||INTEL_GEN (dev_priv) >=10 )ditto
Quoted 11 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-5I915_WRITE_FW (PLANE_COLOR_CTL (pipe, plane_id), -PLANE_COLOR_PIPE_GAMMA_ENABLE | -PLANE_COLOR_PIPE_CSC_ENABLE | -PLANE_COLOR_PLANE_GAMMA_DISABLE ); - } - + plane_color_ctl);if (key->flags) {I915_WRITE_FW (PLANE_KEYVAL (pipe, plane_id), key->min_value);I915_WRITE_FW (PLANE_KEYMAX (pipe, plane_id), key->max_value);drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct intel_plane *plane, · line 978
Quoted 4 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-0@@ -978,6 +975,11 @@ intel_check_sprite_plane(struct intel_plane *plane, state->ctl =g4x_sprite_ctl (crtc_state, state); } +if (IS_GEMINILAKE (dev_priv) ||INTEL_GEN (dev_priv) >=10 )ditto
Quoted 7 lines
drivers/gpu/drm/i915/intel_sprite.c +4
-0+ state->color_ctl =glk_plane_color_ctl (crtc_state, state); + else + state->color_ctl = 0; +return 0 ; }
Quoted 11 lines
Quoted 7 lines
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
In reply to James AusmusSince GLK, some plane configuration settings have moved to the PLANE_COLOR_CTL register. Refactor handling of the register to work like PLANE_CTL. This also allows us to fix the set/read of the plane Alpha Mode for GLK+.
v2: Adjust ordering of platform checks to be newest->oldest, drop redundant comment about alpha blending. (Ville)
--- drivers/gpu/drm/i915/i915_reg.h | 12 +++++--- drivers/gpu/drm/i915/intel_display.c | 55 ++++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_drv.h | 5 ++++ drivers/gpu/drm/i915/intel_sprite.c | 14 +++++---- 4 files changed, 71 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +8 -4
@@ -6263,7 +6263,7 @@ enum {#define _PLANE_CTL_2_A 0x70280#define _PLANE_CTL_3_A 0x70380#define PLANE_CTL_ENABLE (1 << 31) -#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) +#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30)/* Pre-GLK */ #define PLANE_CTL_FORMAT_MASK (0xf << 24)#define PLANE_CTL_FORMAT_YUV422 ( 0 << 24)#define PLANE_CTL_FORMAT_NV12 ( 1 << 24)
@@ -6273,7 +6273,7 @@ enum {#define PLANE_CTL_FORMAT_AYUV ( 8 << 24)#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24)#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24) -#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23)/* Pre-GLK */ #define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21)#define PLANE_CTL_KEY_ENABLE_SOURCE ( 1 << 21)#define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)
@@ -6286,13 +6286,13 @@ enum {#define PLANE_CTL_YUV422_VYUY ( 3 << 16)#define PLANE_CTL_DECOMPRESSION_ENABLE (1 << 15)#define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14) -#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13)/* Pre-GLK */ #define PLANE_CTL_TILED_MASK (0x7 << 10)#define PLANE_CTL_TILED_LINEAR ( 0 << 10)#define PLANE_CTL_TILED_X ( 1 << 10)#define PLANE_CTL_TILED_Y ( 4 << 10)#define PLANE_CTL_TILED_YF ( 5 << 10) -#define PLANE_CTL_ALPHA_MASK (0x3 << 4) +#define PLANE_CTL_ALPHA_MASK (0x3 << 4)/* Pre-GLK */ #define PLANE_CTL_ALPHA_DISABLE ( 0 << 4)#define PLANE_CTL_ALPHA_SW_PREMULTIPLY ( 2 << 4)#define PLANE_CTL_ALPHA_HW_PREMULTIPLY ( 3 << 4)
@@ -6332,6 +6332,10 @@ enum {#define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30)#define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23)#define PLANE_COLOR_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_COLOR_ALPHA_MASK (0x3 << 4) +#define PLANE_COLOR_ALPHA_DISABLE (0 << 4) +#define PLANE_COLOR_ALPHA_SW_PREMULTIPLY (2 << 4) +#define PLANE_COLOR_ALPHA_HW_PREMULTIPLY (3 << 4)#define _PLANE_BUF_CFG_1_A 0x7027c#define _PLANE_BUF_CFG_2_A 0x7037c#define _PLANE_NV12_BUF_CFG_1_A 0x70278
drivers/gpu/drm/i915/intel_display.c +50 -5
98 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +5 -0
@@ -425,6 +425,9 @@ struct intel_plane_state {/* plane control register */ u32 ctl; +/* plane color control register */ +u32 color_ctl; +/* * scaler_id * = -1 : not using a scaler
@@ -1504,6 +1507,8 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state)return i915_ggtt_offset (state->vma); } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state);u32 skl_plane_ctl (const struct intel_crtc_state *crtc_state,const struct intel_plane_state *plane_state); u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,
drivers/gpu/drm/i915/intel_sprite.c +8 -6
@@ -240,6 +240,7 @@ skl_update_plane(struct intel_plane *plane,enum plane_id plane_id = plane->id;enum pipe pipe = plane->pipe;u32 plane_ctl = plane_state->ctl; +u32 plane_color_ctl = plane_state->color_ctl;const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;u32 surf_addr = plane_state->main.offset;unsigned int rotation = plane_state->base.rotation;
@@ -263,13 +264,9 @@ skl_update_plane(struct intel_plane *plane,spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); -if (IS_GEMINILAKE (dev_priv) ||IS_CANNONLAKE (dev_priv)) { +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv))I915_WRITE_FW (PLANE_COLOR_CTL (pipe, plane_id), -PLANE_COLOR_PIPE_GAMMA_ENABLE | -PLANE_COLOR_PIPE_CSC_ENABLE | -PLANE_COLOR_PLANE_GAMMA_DISABLE ); - } - + plane_color_ctl);if (key->flags) {I915_WRITE_FW (PLANE_KEYVAL (pipe, plane_id), key->min_value);I915_WRITE_FW (PLANE_KEYMAX (pipe, plane_id), key->max_value);
@@ -978,6 +975,11 @@ intel_check_sprite_plane(struct intel_plane *plane, state->ctl =g4x_sprite_ctl (crtc_state, state); } +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) + state->color_ctl =glk_plane_color_ctl (crtc_state, state); +else + state->color_ctl =0 ; +return 0 ; }
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 72 lines · James Ausmus
Since GLK, some plane configuration settings have moved to the
PLANE_COLOR_CTLregister. Refactor handling of the register to work likePLANE_CTL. This also allows us to fix the set/read of the plane Alpha Mode for GLK+.v2: Adjust ordering of platform checks to be
newest->oldest, drop redundant comment about alpha blending. (Ville)Signed-off-by James Ausmus <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 12 +++++--- drivers/gpu/drm/i915/intel_display.c | 55 ++++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_drv.h | 5 ++++ drivers/gpu/drm/i915/intel_sprite.c | 14 +++++---- 4 files changed, 71 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/i915_reg.h +8
-4@@ -6263,7 +6263,7 @@ enum {#define _PLANE_CTL_2_A 0x70280#define _PLANE_CTL_3_A 0x70380#define PLANE_CTL_ENABLE (1 << 31) -#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) +#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30)/* Pre-GLK */ #define PLANE_CTL_FORMAT_MASK (0xf << 24)#define PLANE_CTL_FORMAT_YUV422 ( 0 << 24)#define PLANE_CTL_FORMAT_NV12 ( 1 << 24)@@ -6273,7 +6273,7 @@ enum {#define PLANE_CTL_FORMAT_AYUV ( 8 << 24)#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24)#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24) -#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23)/* Pre-GLK */ #define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21)#define PLANE_CTL_KEY_ENABLE_SOURCE ( 1 << 21)#define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)@@ -6286,13 +6286,13 @@ enum {#define PLANE_CTL_YUV422_VYUY ( 3 << 16)#define PLANE_CTL_DECOMPRESSION_ENABLE (1 << 15)#define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14) -#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13)/* Pre-GLK */ #define PLANE_CTL_TILED_MASK (0x7 << 10)#define PLANE_CTL_TILED_LINEAR ( 0 << 10)#define PLANE_CTL_TILED_X ( 1 << 10)#define PLANE_CTL_TILED_Y ( 4 << 10)#define PLANE_CTL_TILED_YF ( 5 << 10) -#define PLANE_CTL_ALPHA_MASK (0x3 << 4) +#define PLANE_CTL_ALPHA_MASK (0x3 << 4)/* Pre-GLK */ #define PLANE_CTL_ALPHA_DISABLE ( 0 << 4)#define PLANE_CTL_ALPHA_SW_PREMULTIPLY ( 2 << 4)#define PLANE_CTL_ALPHA_HW_PREMULTIPLY ( 3 << 4)@@ -6332,6 +6332,10 @@ enum {#define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30)#define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23)#define PLANE_COLOR_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_COLOR_ALPHA_MASK (0x3 << 4) +#define PLANE_COLOR_ALPHA_DISABLE (0 << 4) +#define PLANE_COLOR_ALPHA_SW_PREMULTIPLY (2 << 4) +#define PLANE_COLOR_ALPHA_HW_PREMULTIPLY (3 << 4)#define _PLANE_BUF_CFG_1_A 0x7027c#define _PLANE_BUF_CFG_2_A 0x7037c#define _PLANE_NV12_BUF_CFG_1_A 0x70278drivers/gpu/drm/i915/intel_display.c +0
-0
drivers/gpu/drm/i915/intel_display.c static u32 skl_plane_ctl_format(uint32_t pixel_format) · line 3472
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +4
-0@@ -3466,6 +3466,23 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)return 0 ; } +static u32 glk_plane_ctl_format (uint32_t pixel_format) +{ +/* GLK+ moves the alpha mask to a different register */ +return skl_plane_ctl_format (pixel_format) & ~PLANE_CTL_ALPHA_MASK ;
I think it would be less confusing to extract the alpha stuff from skl_plane_ctl_format() into skl_plane_ctl_alpha().
I guess with that we wouldn't even need glk_plane_ctl_format()?
Quoted 85 lines
drivers/gpu/drm/i915/intel_display.c +41
-5+} + +static u32 glk_plane_color_ctl_alpha (uint32_t pixel_format) +{ +switch (pixel_format) { +case DRM_FORMAT_ABGR8888 : +case DRM_FORMAT_ARGB8888 : +return PLANE_COLOR_ALPHA_SW_PREMULTIPLY ; +default : +return PLANE_COLOR_ALPHA_DISABLE ; + } +} +static u32 skl_plane_ctl_tiling (uint64_t fb_modifier) {switch (fb_modifier) {@@ -3522,14 +3539,16 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, plane_ctl =PLANE_CTL_ENABLE ; -if (!IS_GEMINILAKE (dev_priv) && !IS_CANNONLAKE (dev_priv)) { +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) { + plane_ctl |=glk_plane_ctl_format (fb->format->format); + }else { plane_ctl |=PLANE_CTL_PIPE_GAMMA_ENABLE |PLANE_CTL_PIPE_CSC_ENABLE |PLANE_CTL_PLANE_GAMMA_DISABLE ; + plane_ctl |=skl_plane_ctl_format (fb->format->format); } - plane_ctl |=skl_plane_ctl_format (fb->format->format); plane_ctl |=skl_plane_ctl_tiling (fb->modifier); plane_ctl |=skl_plane_ctl_rotation (rotation);@@ -3541,6 +3560,20 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,return plane_ctl; } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +const struct drm_framebuffer *fb = plane_state->base.fb; +u32 plane_color_ctl =0 ; + + plane_color_ctl |=PLANE_COLOR_PIPE_GAMMA_ENABLE ; + plane_color_ctl |=PLANE_COLOR_PIPE_CSC_ENABLE ; + plane_color_ctl |=PLANE_COLOR_PLANE_GAMMA_DISABLE ; + plane_color_ctl |=glk_plane_color_ctl_alpha (fb->format->format); + +return plane_color_ctl; +} + static int __intel_display_resume(struct drm_device *dev, struct drm_atomic_state *state,@@ -8426,7 +8459,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -u32 val, base, offset, stride_mult, tiling; +u32 val, base, offset, stride_mult, tiling, alpha;int pipe = crtc->pipe;int fourcc, pixel_format;unsigned int aligned_height;@@ -8448,9 +8481,16 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, goto error; pixel_format = val &PLANE_CTL_FORMAT_MASK ; + +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) { + alpha =I915_READ (PLANE_COLOR_CTL (pipe,0 )); + alpha &=PLANE_COLOR_ALPHA_MASK ; + }else { + alpha = val &PLANE_CTL_ALPHA_MASK ; + } + fourcc =skl_format_to_fourcc (pixel_format, - val &PLANE_CTL_ORDER_RGBX , - val &PLANE_CTL_ALPHA_MASK ); + val &PLANE_CTL_ORDER_RGBX , alpha); fb->format =drm_format_info (fourcc); tiling = val &PLANE_CTL_TILED_MASK ;
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct intel_plane *plane, · line 12877
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +4
-0@@ -12831,6 +12871,11 @@ intel_check_primary_plane(struct intel_plane *plane, state->ctl =i9xx_plane_ctl (crtc_state, state); } +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) + state->color_ctl =glk_plane_color_ctl (crtc_state, state); +else + state->color_ctl =0 ;
The else branch doesn't seem necessary since we never use color_ctl on other platforms.
Quoted 32 lines
drivers/gpu/drm/i915/intel_display.c +1
-0+return 0 ; }drivers/gpu/drm/i915/intel_drv.h +5
-0@@ -425,6 +425,9 @@ struct intel_plane_state {/* plane control register */ u32 ctl; +/* plane color control register */ +u32 color_ctl; +/* * scaler_id * = -1 : not using a scaler @@ -1504,6 +1507,8 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state)return i915_ggtt_offset (state->vma); } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state);u32 skl_plane_ctl (const struct intel_crtc_state *crtc_state,const struct intel_plane_state *plane_state); u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,drivers/gpu/drm/i915/intel_sprite.c +0
-0
drivers/gpu/drm/i915/intel_sprite.c skl_update_plane(struct intel_plane *plane, · line 243
Quoted 4 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-0@@ -240,6 +240,7 @@ skl_update_plane(struct intel_plane *plane,enum plane_id plane_id = plane->id;enum pipe pipe = plane->pipe;u32 plane_ctl = plane_state->ctl; +u32 plane_color_ctl = plane_state->color_ctl;
Having a local variable for this seems rather pointless. Probably you could do a patch to nuke the local variables for the control register as well, for all platforms.
Another thing I think we should do is move most of the primary plane stuff from intel_display.c to intel_sprite.c, and rename intel_sprite.c to intel_plane.c. Would allow us to make more things static, and it would shrink intel_display.c a little bit.
Quoted 20 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-6const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;u32 surf_addr = plane_state->main.offset;unsigned int rotation = plane_state->base.rotation;@@ -263,13 +264,9 @@ skl_update_plane(struct intel_plane *plane,spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); -if (IS_GEMINILAKE (dev_priv) ||IS_CANNONLAKE (dev_priv)) { +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv))I915_WRITE_FW (PLANE_COLOR_CTL (pipe, plane_id), -PLANE_COLOR_PIPE_GAMMA_ENABLE | -PLANE_COLOR_PIPE_CSC_ENABLE | -PLANE_COLOR_PLANE_GAMMA_DISABLE ); - } - + plane_color_ctl);if (key->flags) {I915_WRITE_FW (PLANE_KEYVAL (pipe, plane_id), key->min_value);I915_WRITE_FW (PLANE_KEYMAX (pipe, plane_id), key->max_value);
drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct intel_plane *plane, · line 981
Quoted 7 lines
drivers/gpu/drm/i915/intel_sprite.c +4
-0@@ -978,6 +975,11 @@ intel_check_sprite_plane(struct intel_plane *plane, state->ctl =g4x_sprite_ctl (crtc_state, state); } +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) + state->color_ctl =glk_plane_color_ctl (crtc_state, state); +else + state->color_ctl =0 ;
No need for the else here either.
Quoted 6 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-0+return 0 ; }Signature · 1 line
2.14.1
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 84 lines · Ville Syrjälä
Quoted 72 lines · James Ausmus
Since GLK, some plane configuration settings have moved to the
PLANE_COLOR_CTLregister. Refactor handling of the register to work likePLANE_CTL. This also allows us to fix the set/read of the plane Alpha Mode for GLK+.v2: Adjust ordering of platform checks to be
newest->oldest, drop redundant comment about alpha blending. (Ville)Signed-off-by James Ausmus <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 12 +++++--- drivers/gpu/drm/i915/intel_display.c | 55 ++++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_drv.h | 5 ++++ drivers/gpu/drm/i915/intel_sprite.c | 14 +++++---- 4 files changed, 71 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/i915_reg.h +8
-4@@ -6263,7 +6263,7 @@ enum {#define _PLANE_CTL_2_A 0x70280#define _PLANE_CTL_3_A 0x70380#define PLANE_CTL_ENABLE (1 << 31) -#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) +#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30)/* Pre-GLK */ #define PLANE_CTL_FORMAT_MASK (0xf << 24)#define PLANE_CTL_FORMAT_YUV422 ( 0 << 24)#define PLANE_CTL_FORMAT_NV12 ( 1 << 24)@@ -6273,7 +6273,7 @@ enum {#define PLANE_CTL_FORMAT_AYUV ( 8 << 24)#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24)#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24) -#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23)/* Pre-GLK */ #define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21)#define PLANE_CTL_KEY_ENABLE_SOURCE ( 1 << 21)#define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)@@ -6286,13 +6286,13 @@ enum {#define PLANE_CTL_YUV422_VYUY ( 3 << 16)#define PLANE_CTL_DECOMPRESSION_ENABLE (1 << 15)#define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14) -#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13)/* Pre-GLK */ #define PLANE_CTL_TILED_MASK (0x7 << 10)#define PLANE_CTL_TILED_LINEAR ( 0 << 10)#define PLANE_CTL_TILED_X ( 1 << 10)#define PLANE_CTL_TILED_Y ( 4 << 10)#define PLANE_CTL_TILED_YF ( 5 << 10) -#define PLANE_CTL_ALPHA_MASK (0x3 << 4) +#define PLANE_CTL_ALPHA_MASK (0x3 << 4)/* Pre-GLK */ #define PLANE_CTL_ALPHA_DISABLE ( 0 << 4)#define PLANE_CTL_ALPHA_SW_PREMULTIPLY ( 2 << 4)#define PLANE_CTL_ALPHA_HW_PREMULTIPLY ( 3 << 4)@@ -6332,6 +6332,10 @@ enum {#define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30)#define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23)#define PLANE_COLOR_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_COLOR_ALPHA_MASK (0x3 << 4) +#define PLANE_COLOR_ALPHA_DISABLE (0 << 4) +#define PLANE_COLOR_ALPHA_SW_PREMULTIPLY (2 << 4) +#define PLANE_COLOR_ALPHA_HW_PREMULTIPLY (3 << 4)#define _PLANE_BUF_CFG_1_A 0x7027c#define _PLANE_BUF_CFG_2_A 0x7037c#define _PLANE_NV12_BUF_CFG_1_A 0x70278drivers/gpu/drm/i915/intel_display.c +0
-0drivers/gpu/drm/i915/intel_display.c static u32 skl_plane_ctl_format(uint32_t pixel_format) · line 3472
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +4
-0@@ -3466,6 +3466,23 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)return 0 ; } +static u32 glk_plane_ctl_format (uint32_t pixel_format) +{ +/* GLK+ moves the alpha mask to a different register */ +return skl_plane_ctl_format (pixel_format) & ~PLANE_CTL_ALPHA_MASK ;I think it would be less confusing to extract the alpha stuff from
skl_plane_ctl_format()intoskl_plane_ctl_alpha().
Quoted 1 line
I guess with that we wouldn't even need
glk_plane_ctl_format()?
Yeah, I like that better. As a matter of fact, the mask and definitions are the same between PLANE_CTL and PLANE_COLOR_CTL - would it be cleaner to just rename the defines to PLANE_ALPHA_*, name the function skl_plane_alpha, and then be able to use the single function for both PLANE_CTL and PLANE_COLOR_CTL usages?
Quoted 89 lines
Quoted 89 lines
drivers/gpu/drm/i915/intel_display.c +41
-5+} + +static u32 glk_plane_color_ctl_alpha (uint32_t pixel_format) +{ +switch (pixel_format) { +case DRM_FORMAT_ABGR8888 : +case DRM_FORMAT_ARGB8888 : +return PLANE_COLOR_ALPHA_SW_PREMULTIPLY ; +default : +return PLANE_COLOR_ALPHA_DISABLE ; + } +} +static u32 skl_plane_ctl_tiling (uint64_t fb_modifier) {switch (fb_modifier) {@@ -3522,14 +3539,16 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, plane_ctl =PLANE_CTL_ENABLE ; -if (!IS_GEMINILAKE (dev_priv) && !IS_CANNONLAKE (dev_priv)) { +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) { + plane_ctl |=glk_plane_ctl_format (fb->format->format); + }else { plane_ctl |=PLANE_CTL_PIPE_GAMMA_ENABLE |PLANE_CTL_PIPE_CSC_ENABLE |PLANE_CTL_PLANE_GAMMA_DISABLE ; + plane_ctl |=skl_plane_ctl_format (fb->format->format); } - plane_ctl |=skl_plane_ctl_format (fb->format->format); plane_ctl |=skl_plane_ctl_tiling (fb->modifier); plane_ctl |=skl_plane_ctl_rotation (rotation);@@ -3541,6 +3560,20 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,return plane_ctl; } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +const struct drm_framebuffer *fb = plane_state->base.fb; +u32 plane_color_ctl =0 ; + + plane_color_ctl |=PLANE_COLOR_PIPE_GAMMA_ENABLE ; + plane_color_ctl |=PLANE_COLOR_PIPE_CSC_ENABLE ; + plane_color_ctl |=PLANE_COLOR_PLANE_GAMMA_DISABLE ; + plane_color_ctl |=glk_plane_color_ctl_alpha (fb->format->format); + +return plane_color_ctl; +} + static int __intel_display_resume(struct drm_device *dev, struct drm_atomic_state *state,@@ -8426,7 +8459,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -u32 val, base, offset, stride_mult, tiling; +u32 val, base, offset, stride_mult, tiling, alpha;int pipe = crtc->pipe;int fourcc, pixel_format;unsigned int aligned_height;@@ -8448,9 +8481,16 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, goto error; pixel_format = val &PLANE_CTL_FORMAT_MASK ; + +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) { + alpha =I915_READ (PLANE_COLOR_CTL (pipe,0 )); + alpha &=PLANE_COLOR_ALPHA_MASK ; + }else { + alpha = val &PLANE_CTL_ALPHA_MASK ; + } + fourcc =skl_format_to_fourcc (pixel_format, - val &PLANE_CTL_ORDER_RGBX , - val &PLANE_CTL_ALPHA_MASK ); + val &PLANE_CTL_ORDER_RGBX , alpha); fb->format =drm_format_info (fourcc); tiling = val &PLANE_CTL_TILED_MASK ;@@ -12831,6 +12871,11 @@ intel_check_primary_plane(struct intel_plane *plane, state->ctl =i9xx_plane_ctl (crtc_state, state); }
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct intel_plane *plane, · line 12877
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +4
-0+if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) + state->color_ctl =glk_plane_color_ctl (crtc_state, state); +else + state->color_ctl =0 ;The else branch doesn't seem necessary since we never use
color_ctlon other platforms.
OK - wasn't sure if it was better to leave it uninitialized since it's not used, or uselessly initialize it. :)
Quoted 33 lines
Quoted 33 lines
drivers/gpu/drm/i915/intel_display.c +1
-0+return 0 ; }drivers/gpu/drm/i915/intel_drv.h +5
-0@@ -425,6 +425,9 @@ struct intel_plane_state {/* plane control register */ u32 ctl; +/* plane color control register */ +u32 color_ctl; +/* * scaler_id * = -1 : not using a scaler @@ -1504,6 +1507,8 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state)return i915_ggtt_offset (state->vma); } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state);u32 skl_plane_ctl (const struct intel_crtc_state *crtc_state,const struct intel_plane_state *plane_state); u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,drivers/gpu/drm/i915/intel_sprite.c +0
-0@@ -240,6 +240,7 @@ skl_update_plane(struct intel_plane *plane,
Quoted 8 lines
drivers/gpu/drm/i915/intel_sprite.c skl_update_plane(struct intel_plane *plane, · line 243
Quoted 4 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-0enum plane_id plane_id = plane->id;enum pipe pipe = plane->pipe;u32 plane_ctl = plane_state->ctl; +u32 plane_color_ctl = plane_state->color_ctl;Having a local variable for this seems rather pointless. Probably you could do a patch to nuke the local variables for the control register as well, for all platforms.
I'll drop the new local, and follow up with a patch to drop plane_ctl as well.
Quoted 5 lines
Another thing I think we should do is move most of the primary plane stuff from
intel_display.ctointel_sprite.c, and renameintel_sprite.ctointel_plane.c. Would allow us to make more things static, and it would shrinkintel_display.ca little bit.
Sounds good - I'll throw it on my TODO, unless someone else wants to get to it before me. :)
Quoted 24 lines
Quoted 24 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-6const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;u32 surf_addr = plane_state->main.offset;unsigned int rotation = plane_state->base.rotation;@@ -263,13 +264,9 @@ skl_update_plane(struct intel_plane *plane,spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); -if (IS_GEMINILAKE (dev_priv) ||IS_CANNONLAKE (dev_priv)) { +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv))I915_WRITE_FW (PLANE_COLOR_CTL (pipe, plane_id), -PLANE_COLOR_PIPE_GAMMA_ENABLE | -PLANE_COLOR_PIPE_CSC_ENABLE | -PLANE_COLOR_PLANE_GAMMA_DISABLE ); - } - + plane_color_ctl);if (key->flags) {I915_WRITE_FW (PLANE_KEYVAL (pipe, plane_id), key->min_value);I915_WRITE_FW (PLANE_KEYMAX (pipe, plane_id), key->max_value);@@ -978,6 +975,11 @@ intel_check_sprite_plane(struct intel_plane *plane, state->ctl =g4x_sprite_ctl (crtc_state, state); }
Quoted 6 lines
drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct intel_plane *plane, · line 981
Quoted 4 lines
drivers/gpu/drm/i915/intel_sprite.c +4
-0+if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) + state->color_ctl =glk_plane_color_ctl (crtc_state, state); +else + state->color_ctl =0 ;No need for the else here either.
ACK
Thanks for the review!
-James
Quoted 11 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-0+return 0 ; }Signature · 1 line
2.14.1Signature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 85 lines · James Ausmus
Quoted 84 lines · Ville Syrjälä
Quoted 72 lines · James Ausmus
Since GLK, some plane configuration settings have moved to the
PLANE_COLOR_CTLregister. Refactor handling of the register to work likePLANE_CTL. This also allows us to fix the set/read of the plane Alpha Mode for GLK+.v2: Adjust ordering of platform checks to be
newest->oldest, drop redundant comment about alpha blending. (Ville)Signed-off-by James Ausmus <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 12 +++++--- drivers/gpu/drm/i915/intel_display.c | 55 ++++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_drv.h | 5 ++++ drivers/gpu/drm/i915/intel_sprite.c | 14 +++++---- 4 files changed, 71 insertions(+), 15 deletions(-)drivers/gpu/drm/i915/i915_reg.h +8
-4@@ -6263,7 +6263,7 @@ enum {#define _PLANE_CTL_2_A 0x70280#define _PLANE_CTL_3_A 0x70380#define PLANE_CTL_ENABLE (1 << 31) -#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) +#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30)/* Pre-GLK */ #define PLANE_CTL_FORMAT_MASK (0xf << 24)#define PLANE_CTL_FORMAT_YUV422 ( 0 << 24)#define PLANE_CTL_FORMAT_NV12 ( 1 << 24)@@ -6273,7 +6273,7 @@ enum {#define PLANE_CTL_FORMAT_AYUV ( 8 << 24)#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24)#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24) -#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23)/* Pre-GLK */ #define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21)#define PLANE_CTL_KEY_ENABLE_SOURCE ( 1 << 21)#define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)@@ -6286,13 +6286,13 @@ enum {#define PLANE_CTL_YUV422_VYUY ( 3 << 16)#define PLANE_CTL_DECOMPRESSION_ENABLE (1 << 15)#define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14) -#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13)/* Pre-GLK */ #define PLANE_CTL_TILED_MASK (0x7 << 10)#define PLANE_CTL_TILED_LINEAR ( 0 << 10)#define PLANE_CTL_TILED_X ( 1 << 10)#define PLANE_CTL_TILED_Y ( 4 << 10)#define PLANE_CTL_TILED_YF ( 5 << 10) -#define PLANE_CTL_ALPHA_MASK (0x3 << 4) +#define PLANE_CTL_ALPHA_MASK (0x3 << 4)/* Pre-GLK */ #define PLANE_CTL_ALPHA_DISABLE ( 0 << 4)#define PLANE_CTL_ALPHA_SW_PREMULTIPLY ( 2 << 4)#define PLANE_CTL_ALPHA_HW_PREMULTIPLY ( 3 << 4)@@ -6332,6 +6332,10 @@ enum {#define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30)#define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23)#define PLANE_COLOR_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_COLOR_ALPHA_MASK (0x3 << 4) +#define PLANE_COLOR_ALPHA_DISABLE (0 << 4) +#define PLANE_COLOR_ALPHA_SW_PREMULTIPLY (2 << 4) +#define PLANE_COLOR_ALPHA_HW_PREMULTIPLY (3 << 4)#define _PLANE_BUF_CFG_1_A 0x7027c#define _PLANE_BUF_CFG_2_A 0x7037c#define _PLANE_NV12_BUF_CFG_1_A 0x70278drivers/gpu/drm/i915/intel_display.c +0
-0drivers/gpu/drm/i915/intel_display.c static u32 skl_plane_ctl_format(uint32_t pixel_format) · line 3472
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +4
-0@@ -3466,6 +3466,23 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)return 0 ; } +static u32 glk_plane_ctl_format (uint32_t pixel_format) +{ +/* GLK+ moves the alpha mask to a different register */ +return skl_plane_ctl_format (pixel_format) & ~PLANE_CTL_ALPHA_MASK ;I think it would be less confusing to extract the alpha stuff from
skl_plane_ctl_format()intoskl_plane_ctl_alpha().
Quoted 7 lines
Quoted 1 line
I guess with that we wouldn't even need
glk_plane_ctl_format()?Yeah, I like that better. As a matter of fact, the mask and definitions are the same between
PLANE_CTLandPLANE_COLOR_CTL- would it be cleaner to just rename the defines to PLANE_ALPHA_*, name the functionskl_plane_alpha, and then be able to use the single function for bothPLANE_CTLandPLANE_COLOR_CTLusages?
Probably not. At least I was scratching my head again recently with the DDI_PORT_WIDTH() defines which get used with two otherwise totally different registers. I cooked up a patch to duplicate the defines to make sure I won't have to be confused again. Didn't send those out yet though.
Quoted 98 lines
Quoted 90 lines
Quoted 90 lines
drivers/gpu/drm/i915/intel_display.c +41
-5+} + +static u32 glk_plane_color_ctl_alpha (uint32_t pixel_format) +{ +switch (pixel_format) { +case DRM_FORMAT_ABGR8888 : +case DRM_FORMAT_ARGB8888 : +return PLANE_COLOR_ALPHA_SW_PREMULTIPLY ; +default : +return PLANE_COLOR_ALPHA_DISABLE ; + } +} +static u32 skl_plane_ctl_tiling (uint64_t fb_modifier) {switch (fb_modifier) {@@ -3522,14 +3539,16 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, plane_ctl =PLANE_CTL_ENABLE ; -if (!IS_GEMINILAKE (dev_priv) && !IS_CANNONLAKE (dev_priv)) { +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) { + plane_ctl |=glk_plane_ctl_format (fb->format->format); + }else { plane_ctl |=PLANE_CTL_PIPE_GAMMA_ENABLE |PLANE_CTL_PIPE_CSC_ENABLE |PLANE_CTL_PLANE_GAMMA_DISABLE ; + plane_ctl |=skl_plane_ctl_format (fb->format->format); } - plane_ctl |=skl_plane_ctl_format (fb->format->format); plane_ctl |=skl_plane_ctl_tiling (fb->modifier); plane_ctl |=skl_plane_ctl_rotation (rotation);@@ -3541,6 +3560,20 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,return plane_ctl; } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +const struct drm_framebuffer *fb = plane_state->base.fb; +u32 plane_color_ctl =0 ; + + plane_color_ctl |=PLANE_COLOR_PIPE_GAMMA_ENABLE ; + plane_color_ctl |=PLANE_COLOR_PIPE_CSC_ENABLE ; + plane_color_ctl |=PLANE_COLOR_PLANE_GAMMA_DISABLE ; + plane_color_ctl |=glk_plane_color_ctl_alpha (fb->format->format); + +return plane_color_ctl; +} + static int __intel_display_resume(struct drm_device *dev, struct drm_atomic_state *state,@@ -8426,7 +8459,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -u32 val, base, offset, stride_mult, tiling; +u32 val, base, offset, stride_mult, tiling, alpha;int pipe = crtc->pipe;int fourcc, pixel_format;unsigned int aligned_height;@@ -8448,9 +8481,16 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, goto error; pixel_format = val &PLANE_CTL_FORMAT_MASK ; + +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) { + alpha =I915_READ (PLANE_COLOR_CTL (pipe,0 )); + alpha &=PLANE_COLOR_ALPHA_MASK ; + }else { + alpha = val &PLANE_CTL_ALPHA_MASK ; + } + fourcc =skl_format_to_fourcc (pixel_format, - val &PLANE_CTL_ORDER_RGBX , - val &PLANE_CTL_ALPHA_MASK ); + val &PLANE_CTL_ORDER_RGBX , alpha); fb->format =drm_format_info (fourcc); tiling = val &PLANE_CTL_TILED_MASK ;@@ -12831,6 +12871,11 @@ intel_check_primary_plane(struct intel_plane *plane, state->ctl =i9xx_plane_ctl (crtc_state, state); }Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct intel_plane *plane, · line 12877
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +4
-0+if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) + state->color_ctl =glk_plane_color_ctl (crtc_state, state); +else + state->color_ctl =0 ;The else branch doesn't seem necessary since we never use
color_ctlon other platforms.
Quoted 2 lines
OK - wasn't sure if it was better to leave it uninitialized since it's not used, or uselessly initialize it. :)
We zero initialize most things we allocate, and depend on that fact elsewhere as well.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+ (rev2)
In reply to James Ausmus== Series Details ==
== Series Details ==
Series: drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+ (rev2)
URL : https://patchwork.freedesktop.org/series/33087/
State : success
== Summary ==
Series 33087v2 drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
https://patchwork.freedesktop.org/api/1.0/series/33087/revisions/2/mbox/
Test gem_exec_reloc:
Subgroup basic-cpu-active:
pass -> FAIL (fi-gdg-551) fdo#102582 +4
Test kms_busy:
Subgroup basic-flip-b:
fail -> PASS (fi-bwr-2160)
Test drv_module_reload:
Subgroup basic-no-display:
fail -> PASS (fi-hsw-4770r) fdo#103534fdo#102582 https://bugs.freedesktop.org/show_bug.cgi?id=102582
fdo#103534 https://bugs.freedesktop.org/show_bug.cgi?id=103534
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:446s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:453s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:380s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:540s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:277s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:506s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:503s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:504s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:494s fi-cfl-s total:289 pass:254 dwarn:3 dfail:0 fail:0 skip:32 time:565s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:432s fi-gdg-551 total:289 pass:174 dwarn:1 dfail:0 fail:5 skip:109 time:261s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:584s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:432s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:430s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:426s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:499s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:464s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:490s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:576s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:482s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:588s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:573s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:454s fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:595s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:653s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:520s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:502s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:460s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:584s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:424s
de359919ae463cdaef6bc6890156df84e19dee2a drm-tip: 2017y-11m-03d-14h-00m-37s UTC integration manifest 3f6947568e46 drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6945/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: failure for drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+ (rev2)
In reply to James Ausmus== Series Details ==
== Series Details ==
Series: drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+ (rev2)
URL : https://patchwork.freedesktop.org/series/33087/
State : failure
== Summary ==
Test kms_flip:
Subgroup flip-vs-dpms-interruptible:
pass -> INCOMPLETE (shard-hsw)shard-hsw total:2526 pass:1425 dwarn:0 dfail:1 fail:8 skip:1091 time:9248s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6945/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 1/1 drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
In reply to James AusmusSince GLK, some plane configuration settings have moved to the PLANE_COLOR_CTL register. Refactor handling of the register to work like PLANE_CTL. This also allows us to fix the set/read of the plane Alpha Mode for GLK+.
v2: Adjust ordering of platform checks to be newest->oldest, drop redundant comment about alpha blending. (Ville)
v3: Move Alpha Mode bits out of skl_plane_ctl_format into skl_plane_ctl_alpha, and drop glk_plane_ctl_format, drop initialization of state->color_ctl on platforms that don't use it, and drop color_ctl local var. (Ville)
--- drivers/gpu/drm/i915/i915_reg.h | 12 ++++-- drivers/gpu/drm/i915/intel_display.c | 71 +++++++++++++++++++++++++++++------- drivers/gpu/drm/i915/intel_drv.h | 5 +++ drivers/gpu/drm/i915/intel_sprite.c | 11 +++--- 4 files changed, 76 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +8 -4
@@ -6263,7 +6263,7 @@ enum {#define _PLANE_CTL_2_A 0x70280#define _PLANE_CTL_3_A 0x70380#define PLANE_CTL_ENABLE (1 << 31) -#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) +#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30)/* Pre-GLK */ #define PLANE_CTL_FORMAT_MASK (0xf << 24)#define PLANE_CTL_FORMAT_YUV422 ( 0 << 24)#define PLANE_CTL_FORMAT_NV12 ( 1 << 24)
@@ -6273,7 +6273,7 @@ enum {#define PLANE_CTL_FORMAT_AYUV ( 8 << 24)#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24)#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24) -#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23)/* Pre-GLK */ #define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21)#define PLANE_CTL_KEY_ENABLE_SOURCE ( 1 << 21)#define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)
@@ -6286,13 +6286,13 @@ enum {#define PLANE_CTL_YUV422_VYUY ( 3 << 16)#define PLANE_CTL_DECOMPRESSION_ENABLE (1 << 15)#define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14) -#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13)/* Pre-GLK */ #define PLANE_CTL_TILED_MASK (0x7 << 10)#define PLANE_CTL_TILED_LINEAR ( 0 << 10)#define PLANE_CTL_TILED_X ( 1 << 10)#define PLANE_CTL_TILED_Y ( 4 << 10)#define PLANE_CTL_TILED_YF ( 5 << 10) -#define PLANE_CTL_ALPHA_MASK (0x3 << 4) +#define PLANE_CTL_ALPHA_MASK (0x3 << 4)/* Pre-GLK */ #define PLANE_CTL_ALPHA_DISABLE ( 0 << 4)#define PLANE_CTL_ALPHA_SW_PREMULTIPLY ( 2 << 4)#define PLANE_CTL_ALPHA_HW_PREMULTIPLY ( 3 << 4)
@@ -6332,6 +6332,10 @@ enum {#define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30)#define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23)#define PLANE_COLOR_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_COLOR_ALPHA_MASK (0x3 << 4) +#define PLANE_COLOR_ALPHA_DISABLE (0 << 4) +#define PLANE_COLOR_ALPHA_SW_PREMULTIPLY (2 << 4) +#define PLANE_COLOR_ALPHA_HW_PREMULTIPLY (3 << 4)#define _PLANE_BUF_CFG_1_A 0x7027c#define _PLANE_BUF_CFG_2_A 0x7037c#define _PLANE_NV12_BUF_CFG_1_A 0x70278
drivers/gpu/drm/i915/intel_display.c +58 -13
116 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +5 -0
@@ -425,6 +425,9 @@ struct intel_plane_state {/* plane control register */ u32 ctl; +/* plane color control register */ +u32 color_ctl; +/* * scaler_id * = -1 : not using a scaler
@@ -1504,6 +1507,8 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state)return i915_ggtt_offset (state->vma); } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state);u32 skl_plane_ctl (const struct intel_crtc_state *crtc_state,const struct intel_plane_state *plane_state); u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,
drivers/gpu/drm/i915/intel_sprite.c +5 -6
@@ -263,13 +263,9 @@ skl_update_plane(struct intel_plane *plane,spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); -if (IS_GEMINILAKE (dev_priv) ||IS_CANNONLAKE (dev_priv)) { +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv))I915_WRITE_FW (PLANE_COLOR_CTL (pipe, plane_id), -PLANE_COLOR_PIPE_GAMMA_ENABLE | -PLANE_COLOR_PIPE_CSC_ENABLE | -PLANE_COLOR_PLANE_GAMMA_DISABLE ); - } - + plane_state->color_ctl);if (key->flags) {I915_WRITE_FW (PLANE_KEYVAL (pipe, plane_id), key->min_value);I915_WRITE_FW (PLANE_KEYMAX (pipe, plane_id), key->max_value);
@@ -978,6 +974,9 @@ intel_check_sprite_plane(struct intel_plane *plane, state->ctl =g4x_sprite_ctl (crtc_state, state); } +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) + state->color_ctl =glk_plane_color_ctl (crtc_state, state); +return 0 ; }
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 83 lines · James Ausmus
Since GLK, some plane configuration settings have moved to the
PLANE_COLOR_CTLregister. Refactor handling of the register to work likePLANE_CTL. This also allows us to fix the set/read of the plane Alpha Mode for GLK+.v2: Adjust ordering of platform checks to be
newest->oldest, drop redundant comment about alpha blending. (Ville)v3: Move Alpha Mode bits out of
skl_plane_ctl_formatintoskl_plane_ctl_alpha, and dropglk_plane_ctl_format, drop initialization ofstate->color_ctlon platforms that don't use it, and dropcolor_ctllocal var. (Ville)Signed-off-by James Ausmus <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 12 ++++-- drivers/gpu/drm/i915/intel_display.c | 71 +++++++++++++++++++++++++++++------- drivers/gpu/drm/i915/intel_drv.h | 5 +++ drivers/gpu/drm/i915/intel_sprite.c | 11 +++--- 4 files changed, 76 insertions(+), 23 deletions(-)drivers/gpu/drm/i915/i915_reg.h +8
-4@@ -6263,7 +6263,7 @@ enum {#define _PLANE_CTL_2_A 0x70280#define _PLANE_CTL_3_A 0x70380#define PLANE_CTL_ENABLE (1 << 31) -#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) +#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30)/* Pre-GLK */ #define PLANE_CTL_FORMAT_MASK (0xf << 24)#define PLANE_CTL_FORMAT_YUV422 ( 0 << 24)#define PLANE_CTL_FORMAT_NV12 ( 1 << 24)@@ -6273,7 +6273,7 @@ enum {#define PLANE_CTL_FORMAT_AYUV ( 8 << 24)#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24)#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24) -#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23)/* Pre-GLK */ #define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21)#define PLANE_CTL_KEY_ENABLE_SOURCE ( 1 << 21)#define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)@@ -6286,13 +6286,13 @@ enum {#define PLANE_CTL_YUV422_VYUY ( 3 << 16)#define PLANE_CTL_DECOMPRESSION_ENABLE (1 << 15)#define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14) -#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13)/* Pre-GLK */ #define PLANE_CTL_TILED_MASK (0x7 << 10)#define PLANE_CTL_TILED_LINEAR ( 0 << 10)#define PLANE_CTL_TILED_X ( 1 << 10)#define PLANE_CTL_TILED_Y ( 4 << 10)#define PLANE_CTL_TILED_YF ( 5 << 10) -#define PLANE_CTL_ALPHA_MASK (0x3 << 4) +#define PLANE_CTL_ALPHA_MASK (0x3 << 4)/* Pre-GLK */ #define PLANE_CTL_ALPHA_DISABLE ( 0 << 4)#define PLANE_CTL_ALPHA_SW_PREMULTIPLY ( 2 << 4)#define PLANE_CTL_ALPHA_HW_PREMULTIPLY ( 3 << 4)@@ -6332,6 +6332,10 @@ enum {#define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30)#define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23)#define PLANE_COLOR_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_COLOR_ALPHA_MASK (0x3 << 4) +#define PLANE_COLOR_ALPHA_DISABLE (0 << 4) +#define PLANE_COLOR_ALPHA_SW_PREMULTIPLY (2 << 4) +#define PLANE_COLOR_ALPHA_HW_PREMULTIPLY (3 << 4)#define _PLANE_BUF_CFG_1_A 0x7027c#define _PLANE_BUF_CFG_2_A 0x7037c#define _PLANE_NV12_BUF_CFG_1_A 0x70278drivers/gpu/drm/i915/intel_display.c +0
-3@@ -3436,17 +3436,10 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)return PLANE_CTL_FORMAT_XRGB_8888 |PLANE_CTL_ORDER_RGBX ;case DRM_FORMAT_XRGB8888 :return PLANE_CTL_FORMAT_XRGB_8888 ; -/* -* XXX: For ARBG/ABGR formats we default to expecting scanout buffers -* to be already pre-multiplied. We need to add a knob (or a different
drivers/gpu/drm/i915/intel_display.c static u32 skl_plane_ctl_format(uint32_t pixel_format) · line 3442
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +2
-6-* DRM_FORMAT) for user-space to configure that. -*/ case DRM_FORMAT_ABGR8888 : -return PLANE_CTL_FORMAT_XRGB_8888 |PLANE_CTL_ORDER_RGBX | -PLANE_CTL_ALPHA_SW_PREMULTIPLY ; +return PLANE_CTL_FORMAT_XRGB_8888 |PLANE_CTL_ORDER_RGBX ;case DRM_FORMAT_ARGB8888 : -return PLANE_CTL_FORMAT_XRGB_8888 | -PLANE_CTL_ALPHA_SW_PREMULTIPLY ; +return PLANE_CTL_FORMAT_XRGB_8888 ;
I believe some of the cases are now returning identical values. Could collapse those together.
Otherwise lgtm so
Quoted 161 lines
drivers/gpu/drm/i915/intel_display.c +56
-4case DRM_FORMAT_XRGB2101010 :return PLANE_CTL_FORMAT_XRGB_2101010 ;case DRM_FORMAT_XBGR2101010 :@@ -3466,6 +3459,33 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)return 0 ; } +/* +* XXX: For ARBG/ABGR formats we default to expecting scanout buffers +* to be already pre-multiplied. We need to add a knob (or a different +* DRM_FORMAT) for user-space to configure that. +*/ +static u32 skl_plane_ctl_alpha (uint32_t pixel_format) +{ +switch (pixel_format) { +case DRM_FORMAT_ABGR8888 : +case DRM_FORMAT_ARGB8888 : +return PLANE_CTL_ALPHA_SW_PREMULTIPLY ; +default : +return PLANE_CTL_ALPHA_DISABLE ; + } +} + +static u32 glk_plane_color_ctl_alpha (uint32_t pixel_format) +{ +switch (pixel_format) { +case DRM_FORMAT_ABGR8888 : +case DRM_FORMAT_ARGB8888 : +return PLANE_COLOR_ALPHA_SW_PREMULTIPLY ; +default : +return PLANE_COLOR_ALPHA_DISABLE ; + } +} +static u32 skl_plane_ctl_tiling (uint64_t fb_modifier) {switch (fb_modifier) {@@ -3522,7 +3542,8 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, plane_ctl =PLANE_CTL_ENABLE ; -if (!IS_GEMINILAKE (dev_priv) && !IS_CANNONLAKE (dev_priv)) { +if (INTEL_GEN (dev_priv) <10 && !IS_GEMINILAKE (dev_priv)) { + plane_ctl |=skl_plane_ctl_alpha (fb->format->format); plane_ctl |=PLANE_CTL_PIPE_GAMMA_ENABLE | PLANE_CTL_PIPE_CSC_ENABLE |@@ -3541,6 +3562,20 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,return plane_ctl; } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +const struct drm_framebuffer *fb = plane_state->base.fb; +u32 plane_color_ctl =0 ; + + plane_color_ctl |=PLANE_COLOR_PIPE_GAMMA_ENABLE ; + plane_color_ctl |=PLANE_COLOR_PIPE_CSC_ENABLE ; + plane_color_ctl |=PLANE_COLOR_PLANE_GAMMA_DISABLE ; + plane_color_ctl |=glk_plane_color_ctl_alpha (fb->format->format); + +return plane_color_ctl; +} + static int __intel_display_resume(struct drm_device *dev, struct drm_atomic_state *state,@@ -8426,7 +8461,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -u32 val, base, offset, stride_mult, tiling; +u32 val, base, offset, stride_mult, tiling, alpha;int pipe = crtc->pipe;int fourcc, pixel_format;unsigned int aligned_height;@@ -8448,9 +8483,16 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, goto error; pixel_format = val &PLANE_CTL_FORMAT_MASK ; + +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) { + alpha =I915_READ (PLANE_COLOR_CTL (pipe,0 )); + alpha &=PLANE_COLOR_ALPHA_MASK ; + }else { + alpha = val &PLANE_CTL_ALPHA_MASK ; + } + fourcc =skl_format_to_fourcc (pixel_format, - val &PLANE_CTL_ORDER_RGBX , - val &PLANE_CTL_ALPHA_MASK ); + val &PLANE_CTL_ORDER_RGBX , alpha); fb->format =drm_format_info (fourcc); tiling = val &PLANE_CTL_TILED_MASK ;@@ -12831,6 +12873,9 @@ intel_check_primary_plane(struct intel_plane *plane, state->ctl =i9xx_plane_ctl (crtc_state, state); } +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) + state->color_ctl =glk_plane_color_ctl (crtc_state, state); +return 0 ; }drivers/gpu/drm/i915/intel_drv.h +5
-0@@ -425,6 +425,9 @@ struct intel_plane_state {/* plane control register */ u32 ctl; +/* plane color control register */ +u32 color_ctl; +/* * scaler_id * = -1 : not using a scaler @@ -1504,6 +1507,8 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state)return i915_ggtt_offset (state->vma); } +u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state);u32 skl_plane_ctl (const struct intel_crtc_state *crtc_state,const struct intel_plane_state *plane_state); u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,drivers/gpu/drm/i915/intel_sprite.c +5
-6@@ -263,13 +263,9 @@ skl_update_plane(struct intel_plane *plane,spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); -if (IS_GEMINILAKE (dev_priv) ||IS_CANNONLAKE (dev_priv)) { +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv))I915_WRITE_FW (PLANE_COLOR_CTL (pipe, plane_id), -PLANE_COLOR_PIPE_GAMMA_ENABLE | -PLANE_COLOR_PIPE_CSC_ENABLE | -PLANE_COLOR_PLANE_GAMMA_DISABLE ); - } - + plane_state->color_ctl);if (key->flags) {I915_WRITE_FW (PLANE_KEYVAL (pipe, plane_id), key->min_value);I915_WRITE_FW (PLANE_KEYMAX (pipe, plane_id), key->max_value);@@ -978,6 +974,9 @@ intel_check_sprite_plane(struct intel_plane *plane, state->ctl =g4x_sprite_ctl (crtc_state, state); } +if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv)) + state->color_ctl =glk_plane_color_ctl (crtc_state, state); +return 0 ; }Signature · 1 line
2.14.1
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+ (rev3)
In reply to James Ausmus== Series Details ==
== Series Details ==
Series: drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+ (rev3)
URL : https://patchwork.freedesktop.org/series/33087/
State : failure
== Summary ==
Series 33087v3 drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
https://patchwork.freedesktop.org/api/1.0/series/33087/revisions/3/mbox/
Test gem_basic:
Subgroup create-close:
dmesg-warn -> PASS (fi-cfl-s)
Subgroup create-fd-close:
dmesg-warn -> PASS (fi-cfl-s)
Test gem_exec_reloc:
Subgroup basic-cpu-active:
pass -> FAIL (fi-gdg-551) fdo#102582 +6
Subgroup basic-write-cpu-active:
pass -> FAIL (fi-gdg-551)
Test kms_pipe_crc_basic:
Subgroup read-crc-pipe-c:
dmesg-warn -> PASS (fi-bsw-n3050)
Subgroup suspend-read-crc-pipe-a:
pass -> FAIL (fi-skl-6700k)fdo#102582 https://bugs.freedesktop.org/show_bug.cgi?id=102582
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:442s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:456s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:378s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:534s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:277s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:508s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:505s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:505s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:496s fi-cfl-s total:289 pass:254 dwarn:3 dfail:0 fail:0 skip:32 time:557s fi-cnl-y total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:596s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:425s fi-gdg-551 total:289 pass:170 dwarn:1 dfail:0 fail:9 skip:109 time:260s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:588s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:430s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:435s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:431s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:499s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:463s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:490s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:573s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:479s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:588s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:564s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:451s fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:593s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:654s fi-skl-6700k total:289 pass:264 dwarn:0 dfail:0 fail:1 skip:24 time:522s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:504s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:460s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:564s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:421s
8b0ae6b50a229dc661a02f4034252ee854cc9b83 drm-tip: 2017y-11m-03d-17h-15m-57s UTC integration manifest d714b22fcb5b drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6953/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+ (rev3)
In reply to James Ausmus== Series Details ==
== Series Details ==
Series: drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+ (rev3)
URL : https://patchwork.freedesktop.org/series/33087/
State : failure
== Summary ==
Series 33087v3 drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
https://patchwork.freedesktop.org/api/1.0/series/33087/revisions/3/mbox/
Test gem_sync:
Subgroup basic-all:
pass -> SKIP (fi-pnv-d510)
Subgroup basic-each:
pass -> SKIP (fi-pnv-d510)
Subgroup basic-many-each:
pass -> SKIP (fi-pnv-d510)
Subgroup basic-store-all:
pass -> SKIP (fi-pnv-d510)
Subgroup basic-store-each:
pass -> SKIP (fi-pnv-d510)
Test gem_tiled_blits:
Subgroup basic:
pass -> SKIP (fi-pnv-d510)
Test gem_tiled_fence_blits:
Subgroup basic:
pass -> SKIP (fi-pnv-d510)
Test gem_wait:
Subgroup basic-busy-all:
pass -> SKIP (fi-pnv-d510)
pass -> FAIL (fi-glk-dsi)
Subgroup basic-wait-all:
pass -> SKIP (fi-pnv-d510)
Subgroup basic-await-all:
pass -> SKIP (fi-pnv-d510)
Test kms_busy:
Subgroup basic-flip-a:
pass -> SKIP (fi-pnv-d510)
Subgroup basic-flip-b:
pass -> SKIP (fi-pnv-d510)
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
fail -> PASS (fi-gdg-551) fdo#102618
pass -> SKIP (fi-pnv-d510)
Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-c:
pass -> INCOMPLETE (fi-glk-1)fdo#102618 https://bugs.freedesktop.org/show_bug.cgi?id=102618
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:440s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:456s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:380s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:543s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:276s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:499s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:505s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:506s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:486s fi-cfl-s total:289 pass:254 dwarn:3 dfail:0 fail:0 skip:32 time:551s fi-cnl-y total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:600s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:428s fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:263s fi-glk-1 total:237 pass:210 dwarn:0 dfail:0 fail:0 skip:26 fi-glk-dsi total:289 pass:257 dwarn:0 dfail:0 fail:2 skip:30 time:506s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:433s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:431s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:424s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:492s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:458s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:575s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:479s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:577s fi-pnv-d510 total:289 pass:209 dwarn:1 dfail:0 fail:0 skip:79 time:551s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:449s fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:598s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:651s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:519s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:504s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:459s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:581s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:420s
4295e1469b2127d79d2d02ef34d065509bdded97 drm-tip: 2017y-11m-06d-15h-35m-57s UTC integration manifest 7dce92f9f142 drm/i915/glk: Refactor handling of PLANE_COLOR_CTL for GLK+
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6977/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx