All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Ironlake shares the same video sprite controls as Sandybridge
@ 2012-04-10 10:41 Chris Wilson
  2012-04-10 16:01 ` Jesse Barnes
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2012-04-10 10:41 UTC (permalink / raw)
  To: intel-gfx

Well, almost. Just a couple of differences, Ironlake lacks a few of the
RGB formats, only exposing x8r8g8b8, and lacks a couple of unused
features. Given the similarities, we can then reuse the same routines as
already written for Sandybridge to enable overlay support for Ironlake as
well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_sprite.c |   60 ++++++++++++++++++++++++++---------
 1 file changed, 45 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index a464771..da525b6 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -209,7 +209,7 @@ ivb_get_colorkey(struct drm_plane *plane, struct drm_intel_sprite_colorkey *key)
 }
 
 static void
-snb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
+ilk_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
 		 struct drm_i915_gem_object *obj, int crtc_x, int crtc_y,
 		 unsigned int crtc_w, unsigned int crtc_h,
 		 uint32_t x, uint32_t y,
@@ -263,8 +263,8 @@ snb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
 	if (obj->tiling_mode != I915_TILING_NONE)
 		dvscntr |= DVS_TILED;
 
-	/* must disable */
-	dvscntr |= DVS_TRICKLE_FEED_DISABLE;
+	if (IS_GEN6(dev))
+		dvscntr |= DVS_TRICKLE_FEED_DISABLE; /* must disable */
 	dvscntr |= DVS_ENABLE;
 
 	/* Sizes are 0 based */
@@ -296,7 +296,7 @@ snb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
 }
 
 static void
-snb_disable_plane(struct drm_plane *plane)
+ilk_disable_plane(struct drm_plane *plane)
 {
 	struct drm_device *dev = plane->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -334,7 +334,7 @@ intel_disable_primary(struct drm_crtc *crtc)
 }
 
 static int
-snb_update_colorkey(struct drm_plane *plane,
+ilk_update_colorkey(struct drm_plane *plane,
 		    struct drm_intel_sprite_colorkey *key)
 {
 	struct drm_device *dev = plane->dev;
@@ -363,7 +363,7 @@ snb_update_colorkey(struct drm_plane *plane,
 }
 
 static void
-snb_get_colorkey(struct drm_plane *plane, struct drm_intel_sprite_colorkey *key)
+ilk_get_colorkey(struct drm_plane *plane, struct drm_intel_sprite_colorkey *key)
 {
 	struct drm_device *dev = plane->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -617,6 +617,14 @@ static const struct drm_plane_funcs intel_plane_funcs = {
 	.destroy = intel_destroy_plane,
 };
 
+static uint32_t ilk_plane_formats[] = {
+	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_YUYV,
+	DRM_FORMAT_YVYU,
+	DRM_FORMAT_UYVY,
+	DRM_FORMAT_VYUY,
+};
+
 static uint32_t snb_plane_formats[] = {
 	DRM_FORMAT_XBGR8888,
 	DRM_FORMAT_XRGB8888,
@@ -631,34 +639,56 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)
 {
 	struct intel_plane *intel_plane;
 	unsigned long possible_crtcs;
+	const uint32_t *plane_formats;
+	int num_plane_formats;
 	int ret;
 
-	if (!(IS_GEN6(dev) || IS_GEN7(dev)))
+	if (INTEL_INFO(dev)->gen < 5)
 		return -ENODEV;
 
 	intel_plane = kzalloc(sizeof(struct intel_plane), GFP_KERNEL);
 	if (!intel_plane)
 		return -ENOMEM;
 
-	if (IS_GEN6(dev)) {
+	switch (INTEL_INFO(dev)->gen) {
+	case 5:
+	case 6:
 		intel_plane->max_downscale = 16;
-		intel_plane->update_plane = snb_update_plane;
-		intel_plane->disable_plane = snb_disable_plane;
-		intel_plane->update_colorkey = snb_update_colorkey;
-		intel_plane->get_colorkey = snb_get_colorkey;
-	} else if (IS_GEN7(dev)) {
+		intel_plane->update_plane = ilk_update_plane;
+		intel_plane->disable_plane = ilk_disable_plane;
+		intel_plane->update_colorkey = ilk_update_colorkey;
+		intel_plane->get_colorkey = ilk_get_colorkey;
+
+		if (IS_GEN6(dev)) {
+			plane_formats = snb_plane_formats;
+			num_plane_formats = ARRAY_SIZE(snb_plane_formats);
+		} else {
+			plane_formats = ilk_plane_formats;
+			num_plane_formats = ARRAY_SIZE(ilk_plane_formats);
+		}
+		break;
+
+	case 7:
 		intel_plane->max_downscale = 2;
 		intel_plane->update_plane = ivb_update_plane;
 		intel_plane->disable_plane = ivb_disable_plane;
 		intel_plane->update_colorkey = ivb_update_colorkey;
 		intel_plane->get_colorkey = ivb_get_colorkey;
+
+		plane_formats = snb_plane_formats;
+		num_plane_formats = ARRAY_SIZE(snb_plane_formats);
+		break;
+
+	default:
+		return -ENODEV;
 	}
 
 	intel_plane->pipe = pipe;
 	possible_crtcs = (1 << pipe);
 	ret = drm_plane_init(dev, &intel_plane->base, possible_crtcs,
-			     &intel_plane_funcs, snb_plane_formats,
-			     ARRAY_SIZE(snb_plane_formats), false);
+			     &intel_plane_funcs,
+			     plane_formats, num_plane_formats,
+			     false);
 	if (ret)
 		kfree(intel_plane);
 
-- 
1.7.9.5

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

* Re: [PATCH] drm/i915: Ironlake shares the same video sprite controls as Sandybridge
  2012-04-10 10:41 [PATCH] drm/i915: Ironlake shares the same video sprite controls as Sandybridge Chris Wilson
@ 2012-04-10 16:01 ` Jesse Barnes
  2012-04-10 17:20   ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Jesse Barnes @ 2012-04-10 16:01 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 5275 bytes --]

On Tue, 10 Apr 2012 11:41:49 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> Well, almost. Just a couple of differences, Ironlake lacks a few of the
> RGB formats, only exposing x8r8g8b8, and lacks a couple of unused
> features. Given the similarities, we can then reuse the same routines as
> already written for Sandybridge to enable overlay support for Ironlake as
> well.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/intel_sprite.c |   60 ++++++++++++++++++++++++++---------
>  1 file changed, 45 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index a464771..da525b6 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -209,7 +209,7 @@ ivb_get_colorkey(struct drm_plane *plane, struct drm_intel_sprite_colorkey *key)
>  }
>  
>  static void
> -snb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
> +ilk_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
>  		 struct drm_i915_gem_object *obj, int crtc_x, int crtc_y,
>  		 unsigned int crtc_w, unsigned int crtc_h,
>  		 uint32_t x, uint32_t y,
> @@ -263,8 +263,8 @@ snb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
>  	if (obj->tiling_mode != I915_TILING_NONE)
>  		dvscntr |= DVS_TILED;
>  
> -	/* must disable */
> -	dvscntr |= DVS_TRICKLE_FEED_DISABLE;
> +	if (IS_GEN6(dev))
> +		dvscntr |= DVS_TRICKLE_FEED_DISABLE; /* must disable */
>  	dvscntr |= DVS_ENABLE;
>  
>  	/* Sizes are 0 based */
> @@ -296,7 +296,7 @@ snb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
>  }
>  
>  static void
> -snb_disable_plane(struct drm_plane *plane)
> +ilk_disable_plane(struct drm_plane *plane)
>  {
>  	struct drm_device *dev = plane->dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> @@ -334,7 +334,7 @@ intel_disable_primary(struct drm_crtc *crtc)
>  }
>  
>  static int
> -snb_update_colorkey(struct drm_plane *plane,
> +ilk_update_colorkey(struct drm_plane *plane,
>  		    struct drm_intel_sprite_colorkey *key)
>  {
>  	struct drm_device *dev = plane->dev;
> @@ -363,7 +363,7 @@ snb_update_colorkey(struct drm_plane *plane,
>  }
>  
>  static void
> -snb_get_colorkey(struct drm_plane *plane, struct drm_intel_sprite_colorkey *key)
> +ilk_get_colorkey(struct drm_plane *plane, struct drm_intel_sprite_colorkey *key)
>  {
>  	struct drm_device *dev = plane->dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> @@ -617,6 +617,14 @@ static const struct drm_plane_funcs intel_plane_funcs = {
>  	.destroy = intel_destroy_plane,
>  };
>  
> +static uint32_t ilk_plane_formats[] = {
> +	DRM_FORMAT_XRGB8888,
> +	DRM_FORMAT_YUYV,
> +	DRM_FORMAT_YVYU,
> +	DRM_FORMAT_UYVY,
> +	DRM_FORMAT_VYUY,
> +};
> +
>  static uint32_t snb_plane_formats[] = {
>  	DRM_FORMAT_XBGR8888,
>  	DRM_FORMAT_XRGB8888,
> @@ -631,34 +639,56 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)
>  {
>  	struct intel_plane *intel_plane;
>  	unsigned long possible_crtcs;
> +	const uint32_t *plane_formats;
> +	int num_plane_formats;
>  	int ret;
>  
> -	if (!(IS_GEN6(dev) || IS_GEN7(dev)))
> +	if (INTEL_INFO(dev)->gen < 5)
>  		return -ENODEV;
>  
>  	intel_plane = kzalloc(sizeof(struct intel_plane), GFP_KERNEL);
>  	if (!intel_plane)
>  		return -ENOMEM;
>  
> -	if (IS_GEN6(dev)) {
> +	switch (INTEL_INFO(dev)->gen) {
> +	case 5:
> +	case 6:
>  		intel_plane->max_downscale = 16;
> -		intel_plane->update_plane = snb_update_plane;
> -		intel_plane->disable_plane = snb_disable_plane;
> -		intel_plane->update_colorkey = snb_update_colorkey;
> -		intel_plane->get_colorkey = snb_get_colorkey;
> -	} else if (IS_GEN7(dev)) {
> +		intel_plane->update_plane = ilk_update_plane;
> +		intel_plane->disable_plane = ilk_disable_plane;
> +		intel_plane->update_colorkey = ilk_update_colorkey;
> +		intel_plane->get_colorkey = ilk_get_colorkey;
> +
> +		if (IS_GEN6(dev)) {
> +			plane_formats = snb_plane_formats;
> +			num_plane_formats = ARRAY_SIZE(snb_plane_formats);
> +		} else {
> +			plane_formats = ilk_plane_formats;
> +			num_plane_formats = ARRAY_SIZE(ilk_plane_formats);
> +		}
> +		break;
> +
> +	case 7:
>  		intel_plane->max_downscale = 2;
>  		intel_plane->update_plane = ivb_update_plane;
>  		intel_plane->disable_plane = ivb_disable_plane;
>  		intel_plane->update_colorkey = ivb_update_colorkey;
>  		intel_plane->get_colorkey = ivb_get_colorkey;
> +
> +		plane_formats = snb_plane_formats;
> +		num_plane_formats = ARRAY_SIZE(snb_plane_formats);
> +		break;
> +
> +	default:
> +		return -ENODEV;
>  	}
>  
>  	intel_plane->pipe = pipe;
>  	possible_crtcs = (1 << pipe);
>  	ret = drm_plane_init(dev, &intel_plane->base, possible_crtcs,
> -			     &intel_plane_funcs, snb_plane_formats,
> -			     ARRAY_SIZE(snb_plane_formats), false);
> +			     &intel_plane_funcs,
> +			     plane_formats, num_plane_formats,
> +			     false);
>  	if (ret)
>  		kfree(intel_plane);
>  

Looks good.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
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: Ironlake shares the same video sprite controls as Sandybridge
  2012-04-10 16:01 ` Jesse Barnes
@ 2012-04-10 17:20   ` Daniel Vetter
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2012-04-10 17:20 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: intel-gfx

On Tue, Apr 10, 2012 at 09:01:10AM -0700, Jesse Barnes wrote:
> On Tue, 10 Apr 2012 11:41:49 +0100
> Chris Wilson <chris@chris-wilson.co.uk> wrote:
> 
> > Well, almost. Just a couple of differences, Ironlake lacks a few of the
> > RGB formats, only exposing x8r8g8b8, and lacks a couple of unused
> > features. Given the similarities, we can then reuse the same routines as
> > already written for Sandybridge to enable overlay support for Ironlake as
> > well.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Queued for -next, thanks for the patch.
-Daniel
-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

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

end of thread, other threads:[~2012-04-10 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-10 10:41 [PATCH] drm/i915: Ironlake shares the same video sprite controls as Sandybridge Chris Wilson
2012-04-10 16:01 ` Jesse Barnes
2012-04-10 17:20   ` Daniel Vetter

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.