Skip to content

Commit d1686ae

Browse files
ickledanvet
authored andcommitted
drm/i915: Ironlake shares the same video sprite controls as Sandybridge
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> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent e2ba4fb commit d1686ae

File tree

1 file changed

+45
-15
lines changed

1 file changed

+45
-15
lines changed

drivers/gpu/drm/i915/intel_sprite.c

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ ivb_get_colorkey(struct drm_plane *plane, struct drm_intel_sprite_colorkey *key)
209209
}
210210

211211
static void
212-
snb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
212+
ilk_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
213213
struct drm_i915_gem_object *obj, int crtc_x, int crtc_y,
214214
unsigned int crtc_w, unsigned int crtc_h,
215215
uint32_t x, uint32_t y,
@@ -263,8 +263,8 @@ snb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
263263
if (obj->tiling_mode != I915_TILING_NONE)
264264
dvscntr |= DVS_TILED;
265265

266-
/* must disable */
267-
dvscntr |= DVS_TRICKLE_FEED_DISABLE;
266+
if (IS_GEN6(dev))
267+
dvscntr |= DVS_TRICKLE_FEED_DISABLE; /* must disable */
268268
dvscntr |= DVS_ENABLE;
269269

270270
/* Sizes are 0 based */
@@ -296,7 +296,7 @@ snb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
296296
}
297297

298298
static void
299-
snb_disable_plane(struct drm_plane *plane)
299+
ilk_disable_plane(struct drm_plane *plane)
300300
{
301301
struct drm_device *dev = plane->dev;
302302
struct drm_i915_private *dev_priv = dev->dev_private;
@@ -334,7 +334,7 @@ intel_disable_primary(struct drm_crtc *crtc)
334334
}
335335

336336
static int
337-
snb_update_colorkey(struct drm_plane *plane,
337+
ilk_update_colorkey(struct drm_plane *plane,
338338
struct drm_intel_sprite_colorkey *key)
339339
{
340340
struct drm_device *dev = plane->dev;
@@ -363,7 +363,7 @@ snb_update_colorkey(struct drm_plane *plane,
363363
}
364364

365365
static void
366-
snb_get_colorkey(struct drm_plane *plane, struct drm_intel_sprite_colorkey *key)
366+
ilk_get_colorkey(struct drm_plane *plane, struct drm_intel_sprite_colorkey *key)
367367
{
368368
struct drm_device *dev = plane->dev;
369369
struct drm_i915_private *dev_priv = dev->dev_private;
@@ -617,6 +617,14 @@ static const struct drm_plane_funcs intel_plane_funcs = {
617617
.destroy = intel_destroy_plane,
618618
};
619619

620+
static uint32_t ilk_plane_formats[] = {
621+
DRM_FORMAT_XRGB8888,
622+
DRM_FORMAT_YUYV,
623+
DRM_FORMAT_YVYU,
624+
DRM_FORMAT_UYVY,
625+
DRM_FORMAT_VYUY,
626+
};
627+
620628
static uint32_t snb_plane_formats[] = {
621629
DRM_FORMAT_XBGR8888,
622630
DRM_FORMAT_XRGB8888,
@@ -631,34 +639,56 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)
631639
{
632640
struct intel_plane *intel_plane;
633641
unsigned long possible_crtcs;
642+
const uint32_t *plane_formats;
643+
int num_plane_formats;
634644
int ret;
635645

636-
if (!(IS_GEN6(dev) || IS_GEN7(dev)))
646+
if (INTEL_INFO(dev)->gen < 5)
637647
return -ENODEV;
638648

639649
intel_plane = kzalloc(sizeof(struct intel_plane), GFP_KERNEL);
640650
if (!intel_plane)
641651
return -ENOMEM;
642652

643-
if (IS_GEN6(dev)) {
653+
switch (INTEL_INFO(dev)->gen) {
654+
case 5:
655+
case 6:
644656
intel_plane->max_downscale = 16;
645-
intel_plane->update_plane = snb_update_plane;
646-
intel_plane->disable_plane = snb_disable_plane;
647-
intel_plane->update_colorkey = snb_update_colorkey;
648-
intel_plane->get_colorkey = snb_get_colorkey;
649-
} else if (IS_GEN7(dev)) {
657+
intel_plane->update_plane = ilk_update_plane;
658+
intel_plane->disable_plane = ilk_disable_plane;
659+
intel_plane->update_colorkey = ilk_update_colorkey;
660+
intel_plane->get_colorkey = ilk_get_colorkey;
661+
662+
if (IS_GEN6(dev)) {
663+
plane_formats = snb_plane_formats;
664+
num_plane_formats = ARRAY_SIZE(snb_plane_formats);
665+
} else {
666+
plane_formats = ilk_plane_formats;
667+
num_plane_formats = ARRAY_SIZE(ilk_plane_formats);
668+
}
669+
break;
670+
671+
case 7:
650672
intel_plane->max_downscale = 2;
651673
intel_plane->update_plane = ivb_update_plane;
652674
intel_plane->disable_plane = ivb_disable_plane;
653675
intel_plane->update_colorkey = ivb_update_colorkey;
654676
intel_plane->get_colorkey = ivb_get_colorkey;
677+
678+
plane_formats = snb_plane_formats;
679+
num_plane_formats = ARRAY_SIZE(snb_plane_formats);
680+
break;
681+
682+
default:
683+
return -ENODEV;
655684
}
656685

657686
intel_plane->pipe = pipe;
658687
possible_crtcs = (1 << pipe);
659688
ret = drm_plane_init(dev, &intel_plane->base, possible_crtcs,
660-
&intel_plane_funcs, snb_plane_formats,
661-
ARRAY_SIZE(snb_plane_formats), false);
689+
&intel_plane_funcs,
690+
plane_formats, num_plane_formats,
691+
false);
662692
if (ret)
663693
kfree(intel_plane);
664694

0 commit comments

Comments
 (0)