All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Allow disabling the destination colorkey for overlay
@ 2015-04-02  9:35 Chris Wilson
  2015-04-02 10:10 ` Ville Syrjälä
  2015-04-02 17:00 ` shuang.he
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2015-04-02  9:35 UTC (permalink / raw)
  To: intel-gfx

Sometimes userspace wants a true overlay that is never clipped. In such
cases, we need to disable the destination colorkey. However, it is
currently unconditionally enabled in the overlay with no means of
disabling. So rectify that by always default to on, and extending the
UPDATE_ATTR ioctl to support explicit disabling of the colorkey.

This is contrast to the spite code which requires explicit enabling of
either the destination or source colorkey. Handling source colorkey is
still todo for the overlay. (Of course it may be worth migrating overlay
to sprite before then.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
The recent discussion over colorkey reminded me about this feature
discrepancy in the overlay. 2013!
---
 drivers/gpu/drm/i915/intel_overlay.c | 30 +++++++++++++++++++-----------
 include/uapi/drm/i915_drm.h          |  1 +
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index 36400bbbf715..936cf160bb7d 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -175,7 +175,8 @@ struct intel_overlay {
 	bool active;
 	bool pfit_active;
 	u32 pfit_vscale_ratio; /* shifted-point number, (1<<12) == 1.0 */
-	u32 color_key;
+	u32 color_key:24;
+	u32 color_key_enabled:1;
 	u32 brightness, contrast, saturation;
 	u32 old_xscale, old_yscale;
 	/* register access */
@@ -630,31 +631,36 @@ static void update_colorkey(struct intel_overlay *overlay,
 			    struct overlay_registers __iomem *regs)
 {
 	u32 key = overlay->color_key;
+	u32 flags;
+
+	flags = 0;
+	if (overlay->color_key_enabled)
+		flags |= DST_KEY_ENABLE;
 
 	switch (overlay->crtc->base.primary->fb->bits_per_pixel) {
 	case 8:
-		iowrite32(0, &regs->DCLRKV);
-		iowrite32(CLK_RGB8I_MASK | DST_KEY_ENABLE, &regs->DCLRKM);
+		key = 0;
+		flags |= CLK_RGB8I_MASK;
 		break;
 
 	case 16:
 		if (overlay->crtc->base.primary->fb->depth == 15) {
-			iowrite32(RGB15_TO_COLORKEY(key), &regs->DCLRKV);
-			iowrite32(CLK_RGB15_MASK | DST_KEY_ENABLE,
-				  &regs->DCLRKM);
+			key = RGB15_TO_COLORKEY(key);
+			flags |= CLK_RGB15_MASK;
 		} else {
-			iowrite32(RGB16_TO_COLORKEY(key), &regs->DCLRKV);
-			iowrite32(CLK_RGB16_MASK | DST_KEY_ENABLE,
-				  &regs->DCLRKM);
+			key = RGB16_TO_COLORKEY(key);
+			flags |= CLK_RGB16_MASK;
 		}
 		break;
 
 	case 24:
 	case 32:
-		iowrite32(key, &regs->DCLRKV);
-		iowrite32(CLK_RGB24_MASK | DST_KEY_ENABLE, &regs->DCLRKM);
+		flags |= CLK_RGB24_MASK;
 		break;
 	}
+
+	iowrite32(key, &regs->DCLRKV);
+	iowrite32(flags, &regs->DCLRKM);
 }
 
 static u32 overlay_cmd_reg(struct put_image_params *params)
@@ -1331,6 +1337,7 @@ int intel_overlay_attrs(struct drm_device *dev, void *data,
 			I915_WRITE(OGAMC5, attrs->gamma5);
 		}
 	}
+	overlay->color_key_enabled = (attrs->flags & I915_OVERLAY_DISABLE_DEST_COLORKEY) == 0;
 
 	ret = 0;
 out_unlock:
@@ -1397,6 +1404,7 @@ void intel_setup_overlay(struct drm_device *dev)
 
 	/* init all values */
 	overlay->color_key = 0x0101fe;
+	overlay->color_key_enabled = true;
 	overlay->brightness = -19;
 	overlay->contrast = 75;
 	overlay->saturation = 146;
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 006f026f1ce0..c2e679be8903 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -998,6 +998,7 @@ struct drm_intel_overlay_put_image {
 /* flags */
 #define I915_OVERLAY_UPDATE_ATTRS	(1<<0)
 #define I915_OVERLAY_UPDATE_GAMMA	(1<<1)
+#define I915_OVERLAY_DISABLE_DEST_COLORKEY	(1<<2)
 struct drm_intel_overlay_attrs {
 	__u32 flags;
 	__u32 color_key;
-- 
2.1.4

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

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

* Re: [PATCH] drm/i915: Allow disabling the destination colorkey for overlay
  2015-04-02  9:35 [PATCH] drm/i915: Allow disabling the destination colorkey for overlay Chris Wilson
@ 2015-04-02 10:10 ` Ville Syrjälä
  2015-04-02 17:00 ` shuang.he
  1 sibling, 0 replies; 3+ messages in thread
From: Ville Syrjälä @ 2015-04-02 10:10 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Thu, Apr 02, 2015 at 10:35:08AM +0100, Chris Wilson wrote:
> Sometimes userspace wants a true overlay that is never clipped. In such
> cases, we need to disable the destination colorkey. However, it is
> currently unconditionally enabled in the overlay with no means of
> disabling. So rectify that by always default to on, and extending the
> UPDATE_ATTR ioctl to support explicit disabling of the colorkey.
> 
> This is contrast to the spite code which requires explicit enabling of
> either the destination or source colorkey. Handling source colorkey is
> still todo for the overlay. (Of course it may be worth migrating overlay
> to sprite before then.)
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Looks all right to me.

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

> ---
> The recent discussion over colorkey reminded me about this feature
> discrepancy in the overlay. 2013!
> ---
>  drivers/gpu/drm/i915/intel_overlay.c | 30 +++++++++++++++++++-----------
>  include/uapi/drm/i915_drm.h          |  1 +
>  2 files changed, 20 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
> index 36400bbbf715..936cf160bb7d 100644
> --- a/drivers/gpu/drm/i915/intel_overlay.c
> +++ b/drivers/gpu/drm/i915/intel_overlay.c
> @@ -175,7 +175,8 @@ struct intel_overlay {
>  	bool active;
>  	bool pfit_active;
>  	u32 pfit_vscale_ratio; /* shifted-point number, (1<<12) == 1.0 */
> -	u32 color_key;
> +	u32 color_key:24;
> +	u32 color_key_enabled:1;
>  	u32 brightness, contrast, saturation;
>  	u32 old_xscale, old_yscale;
>  	/* register access */
> @@ -630,31 +631,36 @@ static void update_colorkey(struct intel_overlay *overlay,
>  			    struct overlay_registers __iomem *regs)
>  {
>  	u32 key = overlay->color_key;
> +	u32 flags;
> +
> +	flags = 0;
> +	if (overlay->color_key_enabled)
> +		flags |= DST_KEY_ENABLE;
>  
>  	switch (overlay->crtc->base.primary->fb->bits_per_pixel) {
>  	case 8:
> -		iowrite32(0, &regs->DCLRKV);
> -		iowrite32(CLK_RGB8I_MASK | DST_KEY_ENABLE, &regs->DCLRKM);
> +		key = 0;
> +		flags |= CLK_RGB8I_MASK;
>  		break;
>  
>  	case 16:
>  		if (overlay->crtc->base.primary->fb->depth == 15) {
> -			iowrite32(RGB15_TO_COLORKEY(key), &regs->DCLRKV);
> -			iowrite32(CLK_RGB15_MASK | DST_KEY_ENABLE,
> -				  &regs->DCLRKM);
> +			key = RGB15_TO_COLORKEY(key);
> +			flags |= CLK_RGB15_MASK;
>  		} else {
> -			iowrite32(RGB16_TO_COLORKEY(key), &regs->DCLRKV);
> -			iowrite32(CLK_RGB16_MASK | DST_KEY_ENABLE,
> -				  &regs->DCLRKM);
> +			key = RGB16_TO_COLORKEY(key);
> +			flags |= CLK_RGB16_MASK;
>  		}
>  		break;
>  
>  	case 24:
>  	case 32:
> -		iowrite32(key, &regs->DCLRKV);
> -		iowrite32(CLK_RGB24_MASK | DST_KEY_ENABLE, &regs->DCLRKM);
> +		flags |= CLK_RGB24_MASK;
>  		break;
>  	}
> +
> +	iowrite32(key, &regs->DCLRKV);
> +	iowrite32(flags, &regs->DCLRKM);
>  }
>  
>  static u32 overlay_cmd_reg(struct put_image_params *params)
> @@ -1331,6 +1337,7 @@ int intel_overlay_attrs(struct drm_device *dev, void *data,
>  			I915_WRITE(OGAMC5, attrs->gamma5);
>  		}
>  	}
> +	overlay->color_key_enabled = (attrs->flags & I915_OVERLAY_DISABLE_DEST_COLORKEY) == 0;
>  
>  	ret = 0;
>  out_unlock:
> @@ -1397,6 +1404,7 @@ void intel_setup_overlay(struct drm_device *dev)
>  
>  	/* init all values */
>  	overlay->color_key = 0x0101fe;
> +	overlay->color_key_enabled = true;
>  	overlay->brightness = -19;
>  	overlay->contrast = 75;
>  	overlay->saturation = 146;
> diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
> index 006f026f1ce0..c2e679be8903 100644
> --- a/include/uapi/drm/i915_drm.h
> +++ b/include/uapi/drm/i915_drm.h
> @@ -998,6 +998,7 @@ struct drm_intel_overlay_put_image {
>  /* flags */
>  #define I915_OVERLAY_UPDATE_ATTRS	(1<<0)
>  #define I915_OVERLAY_UPDATE_GAMMA	(1<<1)
> +#define I915_OVERLAY_DISABLE_DEST_COLORKEY	(1<<2)
>  struct drm_intel_overlay_attrs {
>  	__u32 flags;
>  	__u32 color_key;
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

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

* Re: [PATCH] drm/i915: Allow disabling the destination colorkey for overlay
  2015-04-02  9:35 [PATCH] drm/i915: Allow disabling the destination colorkey for overlay Chris Wilson
  2015-04-02 10:10 ` Ville Syrjälä
@ 2015-04-02 17:00 ` shuang.he
  1 sibling, 0 replies; 3+ messages in thread
From: shuang.he @ 2015-04-02 17:00 UTC (permalink / raw)
  To: shuang.he, ethan.gao, intel-gfx, chris

Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 6119
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
PNV                 -2              272/272              270/272
ILK                 -2              302/302              300/302
SNB                                  303/303              303/303
IVB                                  338/338              338/338
BYT                 -1              287/287              286/287
HSW                                  361/361              361/361
BDW                                  308/308              308/308
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
 PNV  igt@gem_tiled_pread_pwrite      FAIL(3)PASS(8)      FAIL(1)PASS(1)
 PNV  igt@gem_userptr_blits@coherency-sync      CRASH(5)PASS(6)      CRASH(1)PASS(1)
*ILK  igt@gem_workarounds@suspend-resume      PASS(2)      NO_RESULT(1)PASS(1)
*ILK  igt@kms_flip@flip-vs-dpms-interruptible      PASS(2)      DMESG_WARN(1)PASS(1)
(dmesg patch applied)drm:drm_edid_block_valid[drm]]*ERROR*EDID_checksum_is_invalid,remainder_is@EDID checksum is .* remainder is
*BYT  igt@gem_exec_bad_domains@conflicting-write-domain      PASS(10)      FAIL(1)PASS(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2015-04-02 17:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-02  9:35 [PATCH] drm/i915: Allow disabling the destination colorkey for overlay Chris Wilson
2015-04-02 10:10 ` Ville Syrjälä
2015-04-02 17:00 ` shuang.he

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.