All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately
@ 2019-01-26  1:28 Matt Roper
  2019-01-26  2:42 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Matt Roper @ 2019-01-26  1:28 UTC (permalink / raw)
  To: intel-gfx

Use of the new DRM_COLOR_LUT_NON_DECREASING test was a bit over-zealous;
it doesn't actually need to be applied to the degamma on "bdw-style"
platforms.  Likewise, we overlooked the fact that CHV should have that
test applied to the gamma LUT as well as the degamma LUT.

Rather than adding more complicated platform checking to
intel_color_check(), let's just store the appropriate set of LUT
validation flags for each platform in the intel_device_info structure.

Fixes: 85e2d61e4976 ("drm/i915: Validate userspace-provided color management LUT's (v4)")
References: https://lists.freedesktop.org/archives/intel-gfx/2019-January/187634.html
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/i915_pci.c          | 10 ++++++++--
 drivers/gpu/drm/i915/intel_color.c       | 19 +++++--------------
 drivers/gpu/drm/i915/intel_device_info.h |  2 ++
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 44c23ac60347..17f5a605b0b3 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -69,9 +69,15 @@
 #define BDW_COLORS \
 	.color = { .degamma_lut_size = 512, .gamma_lut_size = 512 }
 #define CHV_COLORS \
-	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257 }
+	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257, \
+		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
+		   .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
+	}
 #define GLK_COLORS \
-	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024 }
+	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024, \
+		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
+					DRM_COLOR_LUT_EQUAL_CHANNELS, \
+	}
 
 /* Keep in gen based order, and chronological order within a gen */
 
diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
index bc7589656a8f..cd08f58b1e47 100644
--- a/drivers/gpu/drm/i915/intel_color.c
+++ b/drivers/gpu/drm/i915/intel_color.c
@@ -609,24 +609,15 @@ int intel_color_check(struct intel_crtc_state *crtc_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
 	size_t gamma_length, degamma_length;
-	uint32_t tests = DRM_COLOR_LUT_NON_DECREASING;
+	u32 gamma_tests, degamma_tests;
 
 	degamma_length = INTEL_INFO(dev_priv)->color.degamma_lut_size;
 	gamma_length = INTEL_INFO(dev_priv)->color.gamma_lut_size;
+	degamma_tests = INTEL_INFO(dev_priv)->color.degamma_lut_tests;
+	gamma_tests = INTEL_INFO(dev_priv)->color.gamma_lut_tests;
 
-	/*
-	 * All of our platforms mandate that the degamma curve be
-	 * non-decreasing.  Additionally, GLK and gen11 only accept a single
-	 * value for red, green, and blue in the degamma table.  Make sure
-	 * userspace didn't try to pass us something we can't handle.
-	 *
-	 * We don't have any extra hardware constraints on the gamma table,
-	 * so no need to explicitly check it.
-	 */
-	if (IS_GEMINILAKE(dev_priv) || INTEL_GEN(dev_priv) >= 10)
-		tests |= DRM_COLOR_LUT_EQUAL_CHANNELS;
-
-	if (drm_color_lut_check(crtc_state->base.degamma_lut, tests) != 0)
+	if (drm_color_lut_check(crtc_state->base.degamma_lut, degamma_tests) ||
+	    drm_color_lut_check(crtc_state->base.gamma_lut, gamma_tests))
 		return -EINVAL;
 
 	/*
diff --git a/drivers/gpu/drm/i915/intel_device_info.h b/drivers/gpu/drm/i915/intel_device_info.h
index 957c6527f76b..7bf09cef591a 100644
--- a/drivers/gpu/drm/i915/intel_device_info.h
+++ b/drivers/gpu/drm/i915/intel_device_info.h
@@ -189,6 +189,8 @@ struct intel_device_info {
 	struct color_luts {
 		u16 degamma_lut_size;
 		u16 gamma_lut_size;
+		u32 degamma_lut_tests;
+		u32 gamma_lut_tests;
 	} color;
 };
 
-- 
2.14.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Apply LUT validation checks to platforms more accurately
  2019-01-26  1:28 [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately Matt Roper
@ 2019-01-26  2:42 ` Patchwork
  2019-01-26  3:00 ` ✓ Fi.CI.BAT: success " Patchwork
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2019-01-26  2:42 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Apply LUT validation checks to platforms more accurately
URL   : https://patchwork.freedesktop.org/series/55765/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
0088726a8c5a drm/i915: Apply LUT validation checks to platforms more accurately
-:20: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#20: 
References: https://lists.freedesktop.org/archives/intel-gfx/2019-January/187634.html

total: 0 errors, 1 warnings, 0 checks, 54 lines checked

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915: Apply LUT validation checks to platforms more accurately
  2019-01-26  1:28 [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately Matt Roper
  2019-01-26  2:42 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
@ 2019-01-26  3:00 ` Patchwork
  2019-01-26  8:00 ` ✓ Fi.CI.IGT: " Patchwork
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2019-01-26  3:00 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Apply LUT validation checks to platforms more accurately
URL   : https://patchwork.freedesktop.org/series/55765/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5488 -> Patchwork_12050
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/55765/revisions/1/mbox/

Known issues
------------

  Here are the changes found in Patchwork_12050 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@kms_flip@basic-flip-vs-modeset:
    - fi-skl-6700hq:      PASS -> DMESG-WARN [fdo#105998]

  
#### Possible fixes ####

  * igt@kms_busy@basic-flip-a:
    - fi-gdg-551:         FAIL [fdo#103182] -> PASS

  * igt@kms_chamelium@dp-edid-read:
    - fi-kbl-7500u:       WARN -> PASS

  * igt@kms_pipe_crc_basic@read-crc-pipe-a:
    - fi-byt-clapper:     FAIL [fdo#107362] -> PASS

  * igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence:
    - fi-byt-clapper:     FAIL [fdo#103191] / [fdo#107362] -> PASS +1

  
  [fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#105998]: https://bugs.freedesktop.org/show_bug.cgi?id=105998
  [fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362


Participating hosts (44 -> 40)
------------------------------

  Missing    (4): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan 


Build changes
-------------

    * Linux: CI_DRM_5488 -> Patchwork_12050

  CI_DRM_5488: f13eede6ea3e780d900c5220bf09d764a80a3a8f @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4790: dcdf4b04e16312f8f52ad389388d834f9d74b8f0 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12050: 0088726a8c5a80b7accbafe0e21b72c5b6d9ecfd @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

0088726a8c5a drm/i915: Apply LUT validation checks to platforms more accurately

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12050/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* ✓ Fi.CI.IGT: success for drm/i915: Apply LUT validation checks to platforms more accurately
  2019-01-26  1:28 [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately Matt Roper
  2019-01-26  2:42 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
  2019-01-26  3:00 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2019-01-26  8:00 ` Patchwork
  2019-01-28 20:05 ` [PATCH] " Ville Syrjälä
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2019-01-26  8:00 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Apply LUT validation checks to platforms more accurately
URL   : https://patchwork.freedesktop.org/series/55765/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5488_full -> Patchwork_12050_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_12050_full:

### IGT changes ###

#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * {igt@runner@aborted}:
    - shard-kbl:          ( 5 FAIL ) -> ( 4 FAIL )

  
Known issues
------------

  Here are the changes found in Patchwork_12050_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_ctx_isolation@bcs0-s3:
    - shard-kbl:          PASS -> INCOMPLETE [fdo#103665]

  * igt@gem_eio@in-flight-suspend:
    - shard-snb:          PASS -> DMESG-WARN [fdo#102365]

  * igt@kms_busy@basic-modeset-b:
    - shard-hsw:          PASS -> INCOMPLETE [fdo#103540]

  * igt@kms_busy@extended-modeset-hang-newfb-render-a:
    - shard-snb:          NOTRUN -> DMESG-WARN [fdo#107956]

  * igt@kms_color@pipe-a-degamma:
    - shard-apl:          PASS -> FAIL [fdo#104782] / [fdo#108145]

  * igt@kms_cursor_crc@cursor-256x85-random:
    - shard-glk:          PASS -> FAIL [fdo#103232]

  * igt@kms_cursor_crc@cursor-64x21-sliding:
    - shard-apl:          PASS -> FAIL [fdo#103232] +1

  * igt@kms_flip@modeset-vs-vblank-race:
    - shard-apl:          PASS -> FAIL [fdo#103060]

  * igt@kms_plane@plane-position-covered-pipe-c-planes:
    - shard-glk:          PASS -> FAIL [fdo#103166]

  * igt@kms_plane_alpha_blend@pipe-b-alpha-transparant-fb:
    - shard-kbl:          NOTRUN -> FAIL [fdo#108145]

  * igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
    - shard-apl:          PASS -> FAIL [fdo#103166] +2

  * igt@kms_rotation_crc@multiplane-rotation-cropping-top:
    - shard-apl:          PASS -> DMESG-FAIL [fdo#108950]

  
#### Possible fixes ####

  * igt@kms_color@pipe-c-degamma:
    - shard-apl:          FAIL [fdo#104782] -> PASS

  * igt@kms_cursor_crc@cursor-256x85-random:
    - shard-apl:          FAIL [fdo#103232] -> PASS

  * igt@kms_plane_multiple@atomic-pipe-a-tiling-y:
    - shard-glk:          FAIL [fdo#103166] -> PASS +2

  * igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
    - shard-apl:          FAIL [fdo#103166] -> PASS +1

  * igt@kms_setmode@basic:
    - shard-apl:          FAIL [fdo#99912] -> PASS
    - shard-kbl:          FAIL [fdo#99912] -> PASS

  
#### Warnings ####

  * igt@i915_suspend@shrink:
    - shard-snb:          INCOMPLETE [fdo#105411] / [fdo#106886] -> DMESG-WARN [fdo#109244]

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#102365]: https://bugs.freedesktop.org/show_bug.cgi?id=102365
  [fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
  [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
  [fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
  [fdo#106886]: https://bugs.freedesktop.org/show_bug.cgi?id=106886
  [fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#108950]: https://bugs.freedesktop.org/show_bug.cgi?id=108950
  [fdo#109244]: https://bugs.freedesktop.org/show_bug.cgi?id=109244
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912


Participating hosts (7 -> 5)
------------------------------

  Missing    (2): shard-skl shard-iclb 


Build changes
-------------

    * Linux: CI_DRM_5488 -> Patchwork_12050

  CI_DRM_5488: f13eede6ea3e780d900c5220bf09d764a80a3a8f @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4790: dcdf4b04e16312f8f52ad389388d834f9d74b8f0 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12050: 0088726a8c5a80b7accbafe0e21b72c5b6d9ecfd @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12050/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately
  2019-01-26  1:28 [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately Matt Roper
                   ` (2 preceding siblings ...)
  2019-01-26  8:00 ` ✓ Fi.CI.IGT: " Patchwork
@ 2019-01-28 20:05 ` Ville Syrjälä
  2019-01-30  0:49   ` [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately (v2) Matt Roper
  2019-01-30  1:08 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Apply LUT validation checks to platforms more accurately (rev2) Patchwork
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Ville Syrjälä @ 2019-01-28 20:05 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

On Fri, Jan 25, 2019 at 05:28:40PM -0800, Matt Roper wrote:
> Use of the new DRM_COLOR_LUT_NON_DECREASING test was a bit over-zealous;
> it doesn't actually need to be applied to the degamma on "bdw-style"
> platforms.  Likewise, we overlooked the fact that CHV should have that
> test applied to the gamma LUT as well as the degamma LUT.
> 
> Rather than adding more complicated platform checking to
> intel_color_check(), let's just store the appropriate set of LUT
> validation flags for each platform in the intel_device_info structure.
> 
> Fixes: 85e2d61e4976 ("drm/i915: Validate userspace-provided color management LUT's (v4)")
> References: https://lists.freedesktop.org/archives/intel-gfx/2019-January/187634.html
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_pci.c          | 10 ++++++++--
>  drivers/gpu/drm/i915/intel_color.c       | 19 +++++--------------
>  drivers/gpu/drm/i915/intel_device_info.h |  2 ++
>  3 files changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> index 44c23ac60347..17f5a605b0b3 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -69,9 +69,15 @@
>  #define BDW_COLORS \
>  	.color = { .degamma_lut_size = 512, .gamma_lut_size = 512 }
>  #define CHV_COLORS \
> -	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257 }
> +	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257, \
> +		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
> +		   .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
> +	}
>  #define GLK_COLORS \
> -	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024 }
> +	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024, \
> +		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
> +					DRM_COLOR_LUT_EQUAL_CHANNELS, \
> +	}
>  
>  /* Keep in gen based order, and chronological order within a gen */
>  
> diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
> index bc7589656a8f..cd08f58b1e47 100644
> --- a/drivers/gpu/drm/i915/intel_color.c
> +++ b/drivers/gpu/drm/i915/intel_color.c
> @@ -609,24 +609,15 @@ int intel_color_check(struct intel_crtc_state *crtc_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
>  	size_t gamma_length, degamma_length;
> -	uint32_t tests = DRM_COLOR_LUT_NON_DECREASING;
> +	u32 gamma_tests, degamma_tests;
>  
>  	degamma_length = INTEL_INFO(dev_priv)->color.degamma_lut_size;
>  	gamma_length = INTEL_INFO(dev_priv)->color.gamma_lut_size;
> +	degamma_tests = INTEL_INFO(dev_priv)->color.degamma_lut_tests;
> +	gamma_tests = INTEL_INFO(dev_priv)->color.gamma_lut_tests;
>  
> -	/*
> -	 * All of our platforms mandate that the degamma curve be
> -	 * non-decreasing.  Additionally, GLK and gen11 only accept a single
> -	 * value for red, green, and blue in the degamma table.  Make sure
> -	 * userspace didn't try to pass us something we can't handle.
> -	 *
> -	 * We don't have any extra hardware constraints on the gamma table,
> -	 * so no need to explicitly check it.
> -	 */
> -	if (IS_GEMINILAKE(dev_priv) || INTEL_GEN(dev_priv) >= 10)
> -		tests |= DRM_COLOR_LUT_EQUAL_CHANNELS;
> -
> -	if (drm_color_lut_check(crtc_state->base.degamma_lut, tests) != 0)
> +	if (drm_color_lut_check(crtc_state->base.degamma_lut, degamma_tests) ||
> +	    drm_color_lut_check(crtc_state->base.gamma_lut, gamma_tests))

We'll need to exclude the legacy LUT from this test somehow.

>  		return -EINVAL;
>  
>  	/*
> diff --git a/drivers/gpu/drm/i915/intel_device_info.h b/drivers/gpu/drm/i915/intel_device_info.h
> index 957c6527f76b..7bf09cef591a 100644
> --- a/drivers/gpu/drm/i915/intel_device_info.h
> +++ b/drivers/gpu/drm/i915/intel_device_info.h
> @@ -189,6 +189,8 @@ struct intel_device_info {
>  	struct color_luts {
>  		u16 degamma_lut_size;
>  		u16 gamma_lut_size;
> +		u32 degamma_lut_tests;
> +		u32 gamma_lut_tests;
>  	} color;
>  };
>  
> -- 
> 2.14.5

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately (v2)
  2019-01-28 20:05 ` [PATCH] " Ville Syrjälä
@ 2019-01-30  0:49   ` Matt Roper
  2019-01-30 14:28     ` Ville Syrjälä
  0 siblings, 1 reply; 15+ messages in thread
From: Matt Roper @ 2019-01-30  0:49 UTC (permalink / raw)
  To: intel-gfx

Use of the new DRM_COLOR_LUT_NON_DECREASING test was a bit over-zealous;
it doesn't actually need to be applied to the degamma on "bdw-style"
platforms.  Likewise, we overlooked the fact that CHV should have that
test applied to the gamma LUT as well as the degamma LUT.

Rather than adding more complicated platform checking to
intel_color_check(), let's just store the appropriate set of LUT
validation flags for each platform in the intel_device_info structure.

v2:
 - Shuffle around LUT size tests so that the hardware-specific tests
   won't be applied to legacy gamma tables.  (Ville)
 - Add a debug message so that it will be easier to understand why an
   atomic transaction involving incorrectly-sized LUT's got rejected
   by the driver.

Fixes: 85e2d61e4976 ("drm/i915: Validate userspace-provided color management LUT's (v4)")
References: https://lists.freedesktop.org/archives/intel-gfx/2019-January/187634.html
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/i915_pci.c          | 10 ++++--
 drivers/gpu/drm/i915/intel_color.c       | 58 ++++++++++++++++----------------
 drivers/gpu/drm/i915/intel_device_info.h |  2 ++
 3 files changed, 39 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 44c23ac60347..17f5a605b0b3 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -69,9 +69,15 @@
 #define BDW_COLORS \
 	.color = { .degamma_lut_size = 512, .gamma_lut_size = 512 }
 #define CHV_COLORS \
-	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257 }
+	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257, \
+		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
+		   .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
+	}
 #define GLK_COLORS \
-	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024 }
+	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024, \
+		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
+					DRM_COLOR_LUT_EQUAL_CHANNELS, \
+	}
 
 /* Keep in gen based order, and chronological order within a gen */
 
diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
index bc7589656a8f..59b8a644b218 100644
--- a/drivers/gpu/drm/i915/intel_color.c
+++ b/drivers/gpu/drm/i915/intel_color.c
@@ -605,48 +605,48 @@ void intel_color_load_luts(struct intel_crtc_state *crtc_state)
 	dev_priv->display.load_luts(crtc_state);
 }
 
+static int check_lut_size(const struct drm_property_blob *lut, size_t expected)
+{
+	size_t len;
+
+	if (!lut)
+		return 0;
+
+	len = drm_color_lut_size(lut);
+	if (len != expected) {
+		DRM_DEBUG_KMS("Invalid LUT size; got %lu, expected %lu\n",
+			      len, expected);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 int intel_color_check(struct intel_crtc_state *crtc_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
 	size_t gamma_length, degamma_length;
-	uint32_t tests = DRM_COLOR_LUT_NON_DECREASING;
+	u32 gamma_tests, degamma_tests;
 
 	degamma_length = INTEL_INFO(dev_priv)->color.degamma_lut_size;
 	gamma_length = INTEL_INFO(dev_priv)->color.gamma_lut_size;
+	degamma_tests = INTEL_INFO(dev_priv)->color.degamma_lut_tests;
+	gamma_tests = INTEL_INFO(dev_priv)->color.gamma_lut_tests;
 
-	/*
-	 * All of our platforms mandate that the degamma curve be
-	 * non-decreasing.  Additionally, GLK and gen11 only accept a single
-	 * value for red, green, and blue in the degamma table.  Make sure
-	 * userspace didn't try to pass us something we can't handle.
-	 *
-	 * We don't have any extra hardware constraints on the gamma table,
-	 * so no need to explicitly check it.
-	 */
-	if (IS_GEMINILAKE(dev_priv) || INTEL_GEN(dev_priv) >= 10)
-		tests |= DRM_COLOR_LUT_EQUAL_CHANNELS;
+	/* Always allow legacy gamma LUT with no further checking. */
+	if (crtc_state_is_legacy_gamma(crtc_state))
+		return 0;
 
-	if (drm_color_lut_check(crtc_state->base.degamma_lut, tests) != 0)
+	if (check_lut_size(crtc_state->base.degamma_lut, degamma_length) ||
+	    check_lut_size(crtc_state->base.gamma_lut, gamma_length))
 		return -EINVAL;
 
-	/*
-	 * We allow both degamma & gamma luts at the right size or
-	 * NULL.
-	 */
-	if ((!crtc_state->base.degamma_lut ||
-	     drm_color_lut_size(crtc_state->base.degamma_lut) == degamma_length) &&
-	    (!crtc_state->base.gamma_lut ||
-	     drm_color_lut_size(crtc_state->base.gamma_lut) == gamma_length))
-		return 0;
+	if (drm_color_lut_check(crtc_state->base.degamma_lut, degamma_tests) ||
+	    drm_color_lut_check(crtc_state->base.gamma_lut, gamma_tests))
+		return -EINVAL;
 
-	/*
-	 * We also allow no degamma lut/ctm and a gamma lut at the legacy
-	 * size (256 entries).
-	 */
-	if (crtc_state_is_legacy_gamma(crtc_state))
-		return 0;
 
-	return -EINVAL;
+	return 0;
 }
 
 void intel_color_init(struct intel_crtc *crtc)
diff --git a/drivers/gpu/drm/i915/intel_device_info.h b/drivers/gpu/drm/i915/intel_device_info.h
index 957c6527f76b..7bf09cef591a 100644
--- a/drivers/gpu/drm/i915/intel_device_info.h
+++ b/drivers/gpu/drm/i915/intel_device_info.h
@@ -189,6 +189,8 @@ struct intel_device_info {
 	struct color_luts {
 		u16 degamma_lut_size;
 		u16 gamma_lut_size;
+		u32 degamma_lut_tests;
+		u32 gamma_lut_tests;
 	} color;
 };
 
-- 
2.14.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Apply LUT validation checks to platforms more accurately (rev2)
  2019-01-26  1:28 [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately Matt Roper
                   ` (3 preceding siblings ...)
  2019-01-28 20:05 ` [PATCH] " Ville Syrjälä
@ 2019-01-30  1:08 ` Patchwork
  2019-01-30  1:29 ` ✓ Fi.CI.BAT: success " Patchwork
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2019-01-30  1:08 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Apply LUT validation checks to platforms more accurately (rev2)
URL   : https://patchwork.freedesktop.org/series/55765/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
b09041f843be drm/i915: Apply LUT validation checks to platforms more accurately (v2)
-:27: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#27: 
References: https://lists.freedesktop.org/archives/intel-gfx/2019-January/187634.html

total: 0 errors, 1 warnings, 0 checks, 102 lines checked

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915: Apply LUT validation checks to platforms more accurately (rev2)
  2019-01-26  1:28 [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately Matt Roper
                   ` (4 preceding siblings ...)
  2019-01-30  1:08 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Apply LUT validation checks to platforms more accurately (rev2) Patchwork
@ 2019-01-30  1:29 ` Patchwork
  2019-01-30  6:05 ` ✓ Fi.CI.IGT: " Patchwork
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2019-01-30  1:29 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Apply LUT validation checks to platforms more accurately (rev2)
URL   : https://patchwork.freedesktop.org/series/55765/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5506 -> Patchwork_12082
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/55765/revisions/2/mbox/

Known issues
------------

  Here are the changes found in Patchwork_12082 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_selftest@live_execlists:
    - fi-apl-guc:         NOTRUN -> INCOMPLETE [fdo#103927]

  * igt@kms_busy@basic-flip-a:
    - fi-gdg-551:         PASS -> FAIL [fdo#103182]

  * igt@kms_pipe_crc_basic@read-crc-pipe-a:
    - fi-byt-clapper:     PASS -> FAIL [fdo#107362]

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
    - fi-blb-e6850:       PASS -> INCOMPLETE [fdo#107718]

  * igt@prime_vgem@basic-fence-flip:
    - fi-ilk-650:         PASS -> FAIL [fdo#104008]

  
#### Possible fixes ####

  * igt@kms_chamelium@common-hpd-after-suspend:
    - fi-kbl-7567u:       WARN [fdo#109380] -> PASS

  * igt@kms_pipe_crc_basic@nonblocking-crc-pipe-c:
    - fi-kbl-7567u:       {SKIP} [fdo#109271] -> PASS +33

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
    - fi-hsw-4770:        {SKIP} [fdo#109271] -> PASS +3

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#104008]: https://bugs.freedesktop.org/show_bug.cgi?id=104008
  [fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
  [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
  [fdo#108622]: https://bugs.freedesktop.org/show_bug.cgi?id=108622
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109380]: https://bugs.freedesktop.org/show_bug.cgi?id=109380


Participating hosts (44 -> 39)
------------------------------

  Additional (2): fi-byt-j1900 fi-apl-guc 
  Missing    (7): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-skl-6260u fi-icl-y fi-bdw-samus 


Build changes
-------------

    * Linux: CI_DRM_5506 -> Patchwork_12082

  CI_DRM_5506: 864d26b6a3e3b28515324f330b2240391f86f458 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4798: 998e0a4aedf10fb5f7c271018cd80d874668bf55 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12082: b09041f843be63c46d4098be4237f01ca77f0c6d @ git://anongit.freedesktop.org/gfx-ci/linux


== Kernel 32bit build ==

Warning: Kernel 32bit buildtest failed:
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12082/build_32bit.log

  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CC [M]  drivers/gpu/drm/i915/intel_color.o
In file included from ./include/drm/drm_mm.h:49:0,
                 from ./include/drm/drm_vma_manager.h:26,
                 from ./include/drm/drm_gem.h:39,
                 from drivers/gpu/drm/i915/i915_drv.h:52,
                 from drivers/gpu/drm/i915/intel_drv.h:34,
                 from drivers/gpu/drm/i915/intel_color.c:25:
drivers/gpu/drm/i915/intel_color.c: In function ‘check_lut_size’:
drivers/gpu/drm/i915/intel_color.c:617:17: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘size_t {aka unsigned int}’ [-Werror=format=]
   DRM_DEBUG_KMS("Invalid LUT size; got %lu, expected %lu\n",
                 ^
./include/drm/drm_print.h:362:22: note: in definition of macro ‘DRM_DEBUG_KMS’
  drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS__)
                      ^~~
drivers/gpu/drm/i915/intel_color.c:617:17: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘size_t {aka unsigned int}’ [-Werror=format=]
   DRM_DEBUG_KMS("Invalid LUT size; got %lu, expected %lu\n",
                 ^
./include/drm/drm_print.h:362:22: note: in definition of macro ‘DRM_DEBUG_KMS’
  drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS__)
                      ^~~
cc1: all warnings being treated as errors
scripts/Makefile.build:276: recipe for target 'drivers/gpu/drm/i915/intel_color.o' failed
make[4]: *** [drivers/gpu/drm/i915/intel_color.o] Error 1
scripts/Makefile.build:492: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:492: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:492: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1043: recipe for target 'drivers' failed
make: *** [drivers] Error 2


== Linux commits ==

b09041f843be drm/i915: Apply LUT validation checks to platforms more accurately (v2)

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12082/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* ✓ Fi.CI.IGT: success for drm/i915: Apply LUT validation checks to platforms more accurately (rev2)
  2019-01-26  1:28 [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately Matt Roper
                   ` (5 preceding siblings ...)
  2019-01-30  1:29 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2019-01-30  6:05 ` Patchwork
  2019-01-30 18:46 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Apply LUT validation checks to platforms more accurately (rev3) Patchwork
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2019-01-30  6:05 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Apply LUT validation checks to platforms more accurately (rev2)
URL   : https://patchwork.freedesktop.org/series/55765/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5506_full -> Patchwork_12082_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  

Known issues
------------

  Here are the changes found in Patchwork_12082_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@kms_cursor_crc@cursor-128x128-random:
    - shard-apl:          PASS -> FAIL [fdo#103232] +4

  * igt@kms_cursor_crc@cursor-256x256-suspend:
    - shard-glk:          PASS -> FAIL [fdo#103232] +1

  * igt@kms_flip@flip-vs-blocking-wf-vblank:
    - shard-apl:          PASS -> INCOMPLETE [fdo#103927]

  * igt@kms_flip@flip-vs-modeset-interruptible:
    - shard-kbl:          PASS -> DMESG-WARN [fdo#103313] / [fdo#105345]

  * igt@kms_plane@pixel-format-pipe-a-planes:
    - shard-glk:          PASS -> FAIL [fdo#103166]

  * igt@kms_plane_alpha_blend@pipe-c-constant-alpha-max:
    - shard-apl:          PASS -> FAIL [fdo#108145]

  * igt@kms_plane_multiple@atomic-pipe-c-tiling-y:
    - shard-apl:          PASS -> FAIL [fdo#103166]

  * igt@kms_rotation_crc@multiplane-rotation-cropping-top:
    - shard-glk:          PASS -> DMESG-FAIL [fdo#105763] / [fdo#106538]

  * igt@kms_setmode@basic:
    - shard-kbl:          PASS -> FAIL [fdo#99912]

  * igt@perf_pmu@rc6-runtime-pm-long:
    - shard-kbl:          PASS -> FAIL [fdo#105010]

  
#### Possible fixes ####

  * igt@kms_color@pipe-b-ctm-max:
    - shard-apl:          FAIL [fdo#108147] -> PASS

  * igt@kms_cursor_crc@cursor-256x256-suspend:
    - shard-apl:          FAIL [fdo#103191] / [fdo#103232] -> PASS

  * igt@kms_cursor_crc@cursor-64x21-random:
    - shard-apl:          FAIL [fdo#103232] -> PASS +2

  * igt@kms_cursor_crc@cursor-64x64-suspend:
    - shard-snb:          INCOMPLETE [fdo#105411] -> PASS

  * igt@kms_plane@pixel-format-pipe-c-planes-source-clamping:
    - shard-apl:          FAIL [fdo#108948] -> PASS

  * igt@kms_plane_alpha_blend@pipe-c-constant-alpha-max:
    - shard-glk:          FAIL [fdo#108145] -> PASS

  * igt@kms_plane_multiple@atomic-pipe-b-tiling-none:
    - shard-glk:          FAIL [fdo#103166] -> PASS
    - shard-apl:          FAIL [fdo#103166] -> PASS +2

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103313]: https://bugs.freedesktop.org/show_bug.cgi?id=103313
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#105010]: https://bugs.freedesktop.org/show_bug.cgi?id=105010
  [fdo#105345]: https://bugs.freedesktop.org/show_bug.cgi?id=105345
  [fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
  [fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
  [fdo#106538]: https://bugs.freedesktop.org/show_bug.cgi?id=106538
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#108147]: https://bugs.freedesktop.org/show_bug.cgi?id=108147
  [fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912


Participating hosts (7 -> 5)
------------------------------

  Missing    (2): shard-skl shard-iclb 


Build changes
-------------

    * Linux: CI_DRM_5506 -> Patchwork_12082

  CI_DRM_5506: 864d26b6a3e3b28515324f330b2240391f86f458 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4798: 998e0a4aedf10fb5f7c271018cd80d874668bf55 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12082: b09041f843be63c46d4098be4237f01ca77f0c6d @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12082/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately (v2)
  2019-01-30  0:49   ` [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately (v2) Matt Roper
@ 2019-01-30 14:28     ` Ville Syrjälä
  2019-01-30 18:10       ` [CI] drm/i915: Apply LUT validation checks to platforms more accurately (v3) Matt Roper
  2019-01-31  1:12       ` [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately (v2) Matt Roper
  0 siblings, 2 replies; 15+ messages in thread
From: Ville Syrjälä @ 2019-01-30 14:28 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

On Tue, Jan 29, 2019 at 04:49:28PM -0800, Matt Roper wrote:
> Use of the new DRM_COLOR_LUT_NON_DECREASING test was a bit over-zealous;
> it doesn't actually need to be applied to the degamma on "bdw-style"
> platforms.  Likewise, we overlooked the fact that CHV should have that
> test applied to the gamma LUT as well as the degamma LUT.
> 
> Rather than adding more complicated platform checking to
> intel_color_check(), let's just store the appropriate set of LUT
> validation flags for each platform in the intel_device_info structure.
> 
> v2:
>  - Shuffle around LUT size tests so that the hardware-specific tests
>    won't be applied to legacy gamma tables.  (Ville)
>  - Add a debug message so that it will be easier to understand why an
>    atomic transaction involving incorrectly-sized LUT's got rejected
>    by the driver.
> 
> Fixes: 85e2d61e4976 ("drm/i915: Validate userspace-provided color management LUT's (v4)")
> References: https://lists.freedesktop.org/archives/intel-gfx/2019-January/187634.html
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_pci.c          | 10 ++++--
>  drivers/gpu/drm/i915/intel_color.c       | 58 ++++++++++++++++----------------
>  drivers/gpu/drm/i915/intel_device_info.h |  2 ++
>  3 files changed, 39 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> index 44c23ac60347..17f5a605b0b3 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -69,9 +69,15 @@
>  #define BDW_COLORS \
>  	.color = { .degamma_lut_size = 512, .gamma_lut_size = 512 }
>  #define CHV_COLORS \
> -	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257 }
> +	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257, \
> +		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
> +		   .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
> +	}
>  #define GLK_COLORS \
> -	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024 }
> +	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024, \
> +		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
> +					DRM_COLOR_LUT_EQUAL_CHANNELS, \
> +	}
>  
>  /* Keep in gen based order, and chronological order within a gen */
>  
> diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
> index bc7589656a8f..59b8a644b218 100644
> --- a/drivers/gpu/drm/i915/intel_color.c
> +++ b/drivers/gpu/drm/i915/intel_color.c
> @@ -605,48 +605,48 @@ void intel_color_load_luts(struct intel_crtc_state *crtc_state)
>  	dev_priv->display.load_luts(crtc_state);
>  }
>  
> +static int check_lut_size(const struct drm_property_blob *lut, size_t expected)
> +{
> +	size_t len;

I'd probably just use int here. size_t makes me think it's in bytes or
something like that.

Otherwise lgtm. Either way
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> +
> +	if (!lut)
> +		return 0;
> +
> +	len = drm_color_lut_size(lut);
> +	if (len != expected) {
> +		DRM_DEBUG_KMS("Invalid LUT size; got %lu, expected %lu\n",
> +			      len, expected);
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
>  int intel_color_check(struct intel_crtc_state *crtc_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
>  	size_t gamma_length, degamma_length;
> -	uint32_t tests = DRM_COLOR_LUT_NON_DECREASING;
> +	u32 gamma_tests, degamma_tests;
>  
>  	degamma_length = INTEL_INFO(dev_priv)->color.degamma_lut_size;
>  	gamma_length = INTEL_INFO(dev_priv)->color.gamma_lut_size;
> +	degamma_tests = INTEL_INFO(dev_priv)->color.degamma_lut_tests;
> +	gamma_tests = INTEL_INFO(dev_priv)->color.gamma_lut_tests;
>  
> -	/*
> -	 * All of our platforms mandate that the degamma curve be
> -	 * non-decreasing.  Additionally, GLK and gen11 only accept a single
> -	 * value for red, green, and blue in the degamma table.  Make sure
> -	 * userspace didn't try to pass us something we can't handle.
> -	 *
> -	 * We don't have any extra hardware constraints on the gamma table,
> -	 * so no need to explicitly check it.
> -	 */
> -	if (IS_GEMINILAKE(dev_priv) || INTEL_GEN(dev_priv) >= 10)
> -		tests |= DRM_COLOR_LUT_EQUAL_CHANNELS;
> +	/* Always allow legacy gamma LUT with no further checking. */
> +	if (crtc_state_is_legacy_gamma(crtc_state))
> +		return 0;
>  
> -	if (drm_color_lut_check(crtc_state->base.degamma_lut, tests) != 0)
> +	if (check_lut_size(crtc_state->base.degamma_lut, degamma_length) ||
> +	    check_lut_size(crtc_state->base.gamma_lut, gamma_length))
>  		return -EINVAL;
>  
> -	/*
> -	 * We allow both degamma & gamma luts at the right size or
> -	 * NULL.
> -	 */
> -	if ((!crtc_state->base.degamma_lut ||
> -	     drm_color_lut_size(crtc_state->base.degamma_lut) == degamma_length) &&
> -	    (!crtc_state->base.gamma_lut ||
> -	     drm_color_lut_size(crtc_state->base.gamma_lut) == gamma_length))
> -		return 0;
> +	if (drm_color_lut_check(crtc_state->base.degamma_lut, degamma_tests) ||
> +	    drm_color_lut_check(crtc_state->base.gamma_lut, gamma_tests))
> +		return -EINVAL;
>  
> -	/*
> -	 * We also allow no degamma lut/ctm and a gamma lut at the legacy
> -	 * size (256 entries).
> -	 */
> -	if (crtc_state_is_legacy_gamma(crtc_state))
> -		return 0;
>  
> -	return -EINVAL;
> +	return 0;
>  }
>  
>  void intel_color_init(struct intel_crtc *crtc)
> diff --git a/drivers/gpu/drm/i915/intel_device_info.h b/drivers/gpu/drm/i915/intel_device_info.h
> index 957c6527f76b..7bf09cef591a 100644
> --- a/drivers/gpu/drm/i915/intel_device_info.h
> +++ b/drivers/gpu/drm/i915/intel_device_info.h
> @@ -189,6 +189,8 @@ struct intel_device_info {
>  	struct color_luts {
>  		u16 degamma_lut_size;
>  		u16 gamma_lut_size;
> +		u32 degamma_lut_tests;
> +		u32 gamma_lut_tests;
>  	} color;
>  };
>  
> -- 
> 2.14.5

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [CI] drm/i915: Apply LUT validation checks to platforms more accurately (v3)
  2019-01-30 14:28     ` Ville Syrjälä
@ 2019-01-30 18:10       ` Matt Roper
  2019-01-31  1:12       ` [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately (v2) Matt Roper
  1 sibling, 0 replies; 15+ messages in thread
From: Matt Roper @ 2019-01-30 18:10 UTC (permalink / raw)
  To: intel-gfx

Use of the new DRM_COLOR_LUT_NON_DECREASING test was a bit over-zealous;
it doesn't actually need to be applied to the degamma on "bdw-style"
platforms.  Likewise, we overlooked the fact that CHV should have that
test applied to the gamma LUT as well as the degamma LUT.

Rather than adding more complicated platform checking to
intel_color_check(), let's just store the appropriate set of LUT
validation flags for each platform in the intel_device_info structure.

v2:
 - Shuffle around LUT size tests so that the hardware-specific tests
   won't be applied to legacy gamma tables.  (Ville)
 - Add a debug message so that it will be easier to understand why an
   atomic transaction involving incorrectly-sized LUT's got rejected
   by the driver.

v3:
 - Switch size_t's to int's.  (Ville)

Fixes: 85e2d61e4976 ("drm/i915: Validate userspace-provided color management LUT's (v4)")
References: https://lists.freedesktop.org/archives/intel-gfx/2019-January/187634.html
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_pci.c          | 10 ++++--
 drivers/gpu/drm/i915/intel_color.c       | 60 ++++++++++++++++----------------
 drivers/gpu/drm/i915/intel_device_info.h |  2 ++
 3 files changed, 40 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 44c23ac60347..17f5a605b0b3 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -69,9 +69,15 @@
 #define BDW_COLORS \
 	.color = { .degamma_lut_size = 512, .gamma_lut_size = 512 }
 #define CHV_COLORS \
-	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257 }
+	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257, \
+		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
+		   .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
+	}
 #define GLK_COLORS \
-	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024 }
+	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024, \
+		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
+					DRM_COLOR_LUT_EQUAL_CHANNELS, \
+	}
 
 /* Keep in gen based order, and chronological order within a gen */
 
diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
index bc7589656a8f..4b0044cdcf1a 100644
--- a/drivers/gpu/drm/i915/intel_color.c
+++ b/drivers/gpu/drm/i915/intel_color.c
@@ -605,48 +605,48 @@ void intel_color_load_luts(struct intel_crtc_state *crtc_state)
 	dev_priv->display.load_luts(crtc_state);
 }
 
+static int check_lut_size(const struct drm_property_blob *lut, int expected)
+{
+	int len;
+
+	if (!lut)
+		return 0;
+
+	len = drm_color_lut_size(lut);
+	if (len != expected) {
+		DRM_DEBUG_KMS("Invalid LUT size; got %d, expected %d\n",
+			      len, expected);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 int intel_color_check(struct intel_crtc_state *crtc_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
-	size_t gamma_length, degamma_length;
-	uint32_t tests = DRM_COLOR_LUT_NON_DECREASING;
+	int gamma_length, degamma_length;
+	u32 gamma_tests, degamma_tests;
 
 	degamma_length = INTEL_INFO(dev_priv)->color.degamma_lut_size;
 	gamma_length = INTEL_INFO(dev_priv)->color.gamma_lut_size;
+	degamma_tests = INTEL_INFO(dev_priv)->color.degamma_lut_tests;
+	gamma_tests = INTEL_INFO(dev_priv)->color.gamma_lut_tests;
 
-	/*
-	 * All of our platforms mandate that the degamma curve be
-	 * non-decreasing.  Additionally, GLK and gen11 only accept a single
-	 * value for red, green, and blue in the degamma table.  Make sure
-	 * userspace didn't try to pass us something we can't handle.
-	 *
-	 * We don't have any extra hardware constraints on the gamma table,
-	 * so no need to explicitly check it.
-	 */
-	if (IS_GEMINILAKE(dev_priv) || INTEL_GEN(dev_priv) >= 10)
-		tests |= DRM_COLOR_LUT_EQUAL_CHANNELS;
+	/* Always allow legacy gamma LUT with no further checking. */
+	if (crtc_state_is_legacy_gamma(crtc_state))
+		return 0;
 
-	if (drm_color_lut_check(crtc_state->base.degamma_lut, tests) != 0)
+	if (check_lut_size(crtc_state->base.degamma_lut, degamma_length) ||
+	    check_lut_size(crtc_state->base.gamma_lut, gamma_length))
 		return -EINVAL;
 
-	/*
-	 * We allow both degamma & gamma luts at the right size or
-	 * NULL.
-	 */
-	if ((!crtc_state->base.degamma_lut ||
-	     drm_color_lut_size(crtc_state->base.degamma_lut) == degamma_length) &&
-	    (!crtc_state->base.gamma_lut ||
-	     drm_color_lut_size(crtc_state->base.gamma_lut) == gamma_length))
-		return 0;
+	if (drm_color_lut_check(crtc_state->base.degamma_lut, degamma_tests) ||
+	    drm_color_lut_check(crtc_state->base.gamma_lut, gamma_tests))
+		return -EINVAL;
 
-	/*
-	 * We also allow no degamma lut/ctm and a gamma lut at the legacy
-	 * size (256 entries).
-	 */
-	if (crtc_state_is_legacy_gamma(crtc_state))
-		return 0;
 
-	return -EINVAL;
+	return 0;
 }
 
 void intel_color_init(struct intel_crtc *crtc)
diff --git a/drivers/gpu/drm/i915/intel_device_info.h b/drivers/gpu/drm/i915/intel_device_info.h
index 957c6527f76b..7bf09cef591a 100644
--- a/drivers/gpu/drm/i915/intel_device_info.h
+++ b/drivers/gpu/drm/i915/intel_device_info.h
@@ -189,6 +189,8 @@ struct intel_device_info {
 	struct color_luts {
 		u16 degamma_lut_size;
 		u16 gamma_lut_size;
+		u32 degamma_lut_tests;
+		u32 gamma_lut_tests;
 	} color;
 };
 
-- 
2.14.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Apply LUT validation checks to platforms more accurately (rev3)
  2019-01-26  1:28 [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately Matt Roper
                   ` (6 preceding siblings ...)
  2019-01-30  6:05 ` ✓ Fi.CI.IGT: " Patchwork
@ 2019-01-30 18:46 ` Patchwork
  2019-01-30 19:11 ` ✓ Fi.CI.BAT: success " Patchwork
  2019-01-31  1:47 ` ✓ Fi.CI.IGT: " Patchwork
  9 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2019-01-30 18:46 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Apply LUT validation checks to platforms more accurately (rev3)
URL   : https://patchwork.freedesktop.org/series/55765/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
6b4da697cb62 drm/i915: Apply LUT validation checks to platforms more accurately (v3)
-:30: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#30: 
References: https://lists.freedesktop.org/archives/intel-gfx/2019-January/187634.html

total: 0 errors, 1 warnings, 0 checks, 103 lines checked

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915: Apply LUT validation checks to platforms more accurately (rev3)
  2019-01-26  1:28 [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately Matt Roper
                   ` (7 preceding siblings ...)
  2019-01-30 18:46 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Apply LUT validation checks to platforms more accurately (rev3) Patchwork
@ 2019-01-30 19:11 ` Patchwork
  2019-01-31  1:47 ` ✓ Fi.CI.IGT: " Patchwork
  9 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2019-01-30 19:11 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Apply LUT validation checks to platforms more accurately (rev3)
URL   : https://patchwork.freedesktop.org/series/55765/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5512 -> Patchwork_12094
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/55765/revisions/3/mbox/

Known issues
------------

  Here are the changes found in Patchwork_12094 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_suspend@basic-s3:
    - fi-blb-e6850:       PASS -> INCOMPLETE [fdo#107718]

  * igt@kms_busy@basic-flip-b:
    - fi-gdg-551:         NOTRUN -> FAIL [fdo#103182]

  * igt@kms_flip@basic-flip-vs-modeset:
    - fi-skl-6700hq:      PASS -> DMESG-WARN [fdo#105998]

  * igt@kms_frontbuffer_tracking@basic:
    - fi-hsw-peppy:       NOTRUN -> DMESG-FAIL [fdo#102614]

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
    - fi-byt-clapper:     PASS -> FAIL [fdo#103191] / [fdo#107362]

  * igt@pm_rpm@basic-rte:
    - fi-byt-j1900:       PASS -> FAIL [fdo#108800]

  
#### Possible fixes ####

  * igt@kms_frontbuffer_tracking@basic:
    - {fi-icl-u2}:        FAIL [fdo#103167] -> PASS

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#105998]: https://bugs.freedesktop.org/show_bug.cgi?id=105998
  [fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
  [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
  [fdo#108800]: https://bugs.freedesktop.org/show_bug.cgi?id=108800
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278


Participating hosts (42 -> 41)
------------------------------

  Additional (3): fi-hsw-peppy fi-gdg-551 fi-pnv-d510 
  Missing    (4): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan 


Build changes
-------------

    * Linux: CI_DRM_5512 -> Patchwork_12094

  CI_DRM_5512: bf1da2552de642ebce4ea3f91a3259ef819b13ce @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4801: 6f6bacf12759fb319ade3ba37861ae711f8a5cd9 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12094: 6b4da697cb6231b1dea53e79b2c2d954aa904247 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

6b4da697cb62 drm/i915: Apply LUT validation checks to platforms more accurately (v3)

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12094/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately (v2)
  2019-01-30 14:28     ` Ville Syrjälä
  2019-01-30 18:10       ` [CI] drm/i915: Apply LUT validation checks to platforms more accurately (v3) Matt Roper
@ 2019-01-31  1:12       ` Matt Roper
  1 sibling, 0 replies; 15+ messages in thread
From: Matt Roper @ 2019-01-31  1:12 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

On Wed, Jan 30, 2019 at 04:28:47PM +0200, Ville Syrjälä wrote:
> On Tue, Jan 29, 2019 at 04:49:28PM -0800, Matt Roper wrote:
> > Use of the new DRM_COLOR_LUT_NON_DECREASING test was a bit over-zealous;
> > it doesn't actually need to be applied to the degamma on "bdw-style"
> > platforms.  Likewise, we overlooked the fact that CHV should have that
> > test applied to the gamma LUT as well as the degamma LUT.
> > 
> > Rather than adding more complicated platform checking to
> > intel_color_check(), let's just store the appropriate set of LUT
> > validation flags for each platform in the intel_device_info structure.
> > 
> > v2:
> >  - Shuffle around LUT size tests so that the hardware-specific tests
> >    won't be applied to legacy gamma tables.  (Ville)
> >  - Add a debug message so that it will be easier to understand why an
> >    atomic transaction involving incorrectly-sized LUT's got rejected
> >    by the driver.
> > 
> > Fixes: 85e2d61e4976 ("drm/i915: Validate userspace-provided color management LUT's (v4)")
> > References: https://lists.freedesktop.org/archives/intel-gfx/2019-January/187634.html
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_pci.c          | 10 ++++--
> >  drivers/gpu/drm/i915/intel_color.c       | 58 ++++++++++++++++----------------
> >  drivers/gpu/drm/i915/intel_device_info.h |  2 ++
> >  3 files changed, 39 insertions(+), 31 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> > index 44c23ac60347..17f5a605b0b3 100644
> > --- a/drivers/gpu/drm/i915/i915_pci.c
> > +++ b/drivers/gpu/drm/i915/i915_pci.c
> > @@ -69,9 +69,15 @@
> >  #define BDW_COLORS \
> >  	.color = { .degamma_lut_size = 512, .gamma_lut_size = 512 }
> >  #define CHV_COLORS \
> > -	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257 }
> > +	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257, \
> > +		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
> > +		   .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
> > +	}
> >  #define GLK_COLORS \
> > -	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024 }
> > +	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024, \
> > +		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
> > +					DRM_COLOR_LUT_EQUAL_CHANNELS, \
> > +	}
> >  
> >  /* Keep in gen based order, and chronological order within a gen */
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
> > index bc7589656a8f..59b8a644b218 100644
> > --- a/drivers/gpu/drm/i915/intel_color.c
> > +++ b/drivers/gpu/drm/i915/intel_color.c
> > @@ -605,48 +605,48 @@ void intel_color_load_luts(struct intel_crtc_state *crtc_state)
> >  	dev_priv->display.load_luts(crtc_state);
> >  }
> >  
> > +static int check_lut_size(const struct drm_property_blob *lut, size_t expected)
> > +{
> > +	size_t len;
> 
> I'd probably just use int here. size_t makes me think it's in bytes or
> something like that.
> 
> Otherwise lgtm. Either way
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Switched to int's and BAT is still happy, so applied to dinq.  Thanks
for the review.


Matt

> 
> > +
> > +	if (!lut)
> > +		return 0;
> > +
> > +	len = drm_color_lut_size(lut);
> > +	if (len != expected) {
> > +		DRM_DEBUG_KMS("Invalid LUT size; got %lu, expected %lu\n",
> > +			      len, expected);
> > +		return -EINVAL;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> >  int intel_color_check(struct intel_crtc_state *crtc_state)
> >  {
> >  	struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
> >  	size_t gamma_length, degamma_length;
> > -	uint32_t tests = DRM_COLOR_LUT_NON_DECREASING;
> > +	u32 gamma_tests, degamma_tests;
> >  
> >  	degamma_length = INTEL_INFO(dev_priv)->color.degamma_lut_size;
> >  	gamma_length = INTEL_INFO(dev_priv)->color.gamma_lut_size;
> > +	degamma_tests = INTEL_INFO(dev_priv)->color.degamma_lut_tests;
> > +	gamma_tests = INTEL_INFO(dev_priv)->color.gamma_lut_tests;
> >  
> > -	/*
> > -	 * All of our platforms mandate that the degamma curve be
> > -	 * non-decreasing.  Additionally, GLK and gen11 only accept a single
> > -	 * value for red, green, and blue in the degamma table.  Make sure
> > -	 * userspace didn't try to pass us something we can't handle.
> > -	 *
> > -	 * We don't have any extra hardware constraints on the gamma table,
> > -	 * so no need to explicitly check it.
> > -	 */
> > -	if (IS_GEMINILAKE(dev_priv) || INTEL_GEN(dev_priv) >= 10)
> > -		tests |= DRM_COLOR_LUT_EQUAL_CHANNELS;
> > +	/* Always allow legacy gamma LUT with no further checking. */
> > +	if (crtc_state_is_legacy_gamma(crtc_state))
> > +		return 0;
> >  
> > -	if (drm_color_lut_check(crtc_state->base.degamma_lut, tests) != 0)
> > +	if (check_lut_size(crtc_state->base.degamma_lut, degamma_length) ||
> > +	    check_lut_size(crtc_state->base.gamma_lut, gamma_length))
> >  		return -EINVAL;
> >  
> > -	/*
> > -	 * We allow both degamma & gamma luts at the right size or
> > -	 * NULL.
> > -	 */
> > -	if ((!crtc_state->base.degamma_lut ||
> > -	     drm_color_lut_size(crtc_state->base.degamma_lut) == degamma_length) &&
> > -	    (!crtc_state->base.gamma_lut ||
> > -	     drm_color_lut_size(crtc_state->base.gamma_lut) == gamma_length))
> > -		return 0;
> > +	if (drm_color_lut_check(crtc_state->base.degamma_lut, degamma_tests) ||
> > +	    drm_color_lut_check(crtc_state->base.gamma_lut, gamma_tests))
> > +		return -EINVAL;
> >  
> > -	/*
> > -	 * We also allow no degamma lut/ctm and a gamma lut at the legacy
> > -	 * size (256 entries).
> > -	 */
> > -	if (crtc_state_is_legacy_gamma(crtc_state))
> > -		return 0;
> >  
> > -	return -EINVAL;
> > +	return 0;
> >  }
> >  
> >  void intel_color_init(struct intel_crtc *crtc)
> > diff --git a/drivers/gpu/drm/i915/intel_device_info.h b/drivers/gpu/drm/i915/intel_device_info.h
> > index 957c6527f76b..7bf09cef591a 100644
> > --- a/drivers/gpu/drm/i915/intel_device_info.h
> > +++ b/drivers/gpu/drm/i915/intel_device_info.h
> > @@ -189,6 +189,8 @@ struct intel_device_info {
> >  	struct color_luts {
> >  		u16 degamma_lut_size;
> >  		u16 gamma_lut_size;
> > +		u32 degamma_lut_tests;
> > +		u32 gamma_lut_tests;
> >  	} color;
> >  };
> >  
> > -- 
> > 2.14.5
> 
> -- 
> Ville Syrjälä
> Intel

-- 
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* ✓ Fi.CI.IGT: success for drm/i915: Apply LUT validation checks to platforms more accurately (rev3)
  2019-01-26  1:28 [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately Matt Roper
                   ` (8 preceding siblings ...)
  2019-01-30 19:11 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2019-01-31  1:47 ` Patchwork
  9 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2019-01-31  1:47 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Apply LUT validation checks to platforms more accurately (rev3)
URL   : https://patchwork.freedesktop.org/series/55765/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5512_full -> Patchwork_12094_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_12094_full:

### IGT changes ###

#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * {igt@runner@aborted}:
    - shard-snb:          NOTRUN -> FAIL

  
Known issues
------------

  Here are the changes found in Patchwork_12094_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_workarounds@suspend-resume:
    - shard-kbl:          PASS -> INCOMPLETE [fdo#103665]

  * igt@kms_cursor_crc@cursor-128x42-sliding:
    - shard-apl:          PASS -> FAIL [fdo#103232] +1

  * igt@kms_cursor_crc@cursor-64x64-sliding:
    - shard-glk:          PASS -> FAIL [fdo#103232]

  * igt@kms_cursor_legacy@2x-long-nonblocking-modeset-vs-cursor-atomic:
    - shard-glk:          PASS -> FAIL [fdo#105454] / [fdo#106509]

  * igt@kms_flip@flip-vs-blocking-wf-vblank:
    - shard-snb:          PASS -> DMESG-WARN [fdo#107469]

  * igt@kms_plane@pixel-format-pipe-b-planes-source-clamping:
    - shard-apl:          PASS -> FAIL [fdo#108948]

  * igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
    - shard-apl:          PASS -> FAIL [fdo#103166]

  
#### Possible fixes ####

  * igt@gem_eio@reset-stress:
    - shard-hsw:          INCOMPLETE [fdo#103540] / [fdo#109482] -> PASS

  * igt@kms_color@pipe-a-degamma:
    - shard-apl:          FAIL [fdo#104782] / [fdo#108145] -> PASS

  * igt@kms_cursor_crc@cursor-128x128-random:
    - shard-apl:          FAIL [fdo#103232] -> PASS

  * igt@kms_cursor_crc@cursor-128x128-sliding:
    - shard-glk:          FAIL [fdo#103232] -> PASS

  * igt@kms_flip@2x-flip-vs-modeset:
    - shard-hsw:          DMESG-WARN [fdo#102614] -> PASS

  * igt@kms_flip@flip-vs-expired-vblank:
    - shard-kbl:          FAIL [fdo#102887] / [fdo#105363] -> PASS

  * igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
    - shard-glk:          FAIL [fdo#108145] -> PASS

  * igt@kms_plane_multiple@atomic-pipe-c-tiling-y:
    - shard-apl:          FAIL [fdo#103166] -> PASS +1

  * igt@kms_setmode@basic:
    - shard-apl:          FAIL [fdo#99912] -> PASS

  * igt@pm_rc6_residency@rc6-accuracy:
    - shard-kbl:          {SKIP} [fdo#109271] -> PASS

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
  [fdo#102887]: https://bugs.freedesktop.org/show_bug.cgi?id=102887
  [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
  [fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
  [fdo#105454]: https://bugs.freedesktop.org/show_bug.cgi?id=105454
  [fdo#106509]: https://bugs.freedesktop.org/show_bug.cgi?id=106509
  [fdo#107469]: https://bugs.freedesktop.org/show_bug.cgi?id=107469
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109482]: https://bugs.freedesktop.org/show_bug.cgi?id=109482
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912


Participating hosts (7 -> 5)
------------------------------

  Missing    (2): shard-skl shard-iclb 


Build changes
-------------

    * Linux: CI_DRM_5512 -> Patchwork_12094

  CI_DRM_5512: bf1da2552de642ebce4ea3f91a3259ef819b13ce @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4801: 6f6bacf12759fb319ade3ba37861ae711f8a5cd9 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12094: 6b4da697cb6231b1dea53e79b2c2d954aa904247 @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12094/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-01-31  1:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-26  1:28 [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately Matt Roper
2019-01-26  2:42 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2019-01-26  3:00 ` ✓ Fi.CI.BAT: success " Patchwork
2019-01-26  8:00 ` ✓ Fi.CI.IGT: " Patchwork
2019-01-28 20:05 ` [PATCH] " Ville Syrjälä
2019-01-30  0:49   ` [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately (v2) Matt Roper
2019-01-30 14:28     ` Ville Syrjälä
2019-01-30 18:10       ` [CI] drm/i915: Apply LUT validation checks to platforms more accurately (v3) Matt Roper
2019-01-31  1:12       ` [PATCH] drm/i915: Apply LUT validation checks to platforms more accurately (v2) Matt Roper
2019-01-30  1:08 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Apply LUT validation checks to platforms more accurately (rev2) Patchwork
2019-01-30  1:29 ` ✓ Fi.CI.BAT: success " Patchwork
2019-01-30  6:05 ` ✓ Fi.CI.IGT: " Patchwork
2019-01-30 18:46 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Apply LUT validation checks to platforms more accurately (rev3) Patchwork
2019-01-30 19:11 ` ✓ Fi.CI.BAT: success " Patchwork
2019-01-31  1:47 ` ✓ Fi.CI.IGT: " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.