36 #include <drm/i915_drm.h>
42 unsigned int crtc_w,
unsigned int crtc_h,
50 u32 sprctl, sprscale = 0;
87 DRM_DEBUG_DRIVER(
"bad pixel format, assuming RGBX888\n");
113 if (crtc_w != src_w || crtc_h != src_h) {
146 ivb_disable_plane(
struct drm_plane *plane)
151 int pipe = intel_plane->
pipe;
165 ivb_update_colorkey(
struct drm_plane *plane,
170 struct intel_plane *intel_plane;
198 struct intel_plane *intel_plane;
221 unsigned int crtc_w,
unsigned int crtc_h,
229 u32 dvscntr, dvsscale;
265 DRM_DEBUG_DRIVER(
"bad pixel format, assuming RGBX888\n");
287 if (
IS_GEN5(dev) || crtc_w != src_w || crtc_h != src_h)
308 ilk_disable_plane(
struct drm_plane *plane)
313 int pipe = intel_plane->
pipe;
341 intel_disable_primary(
struct drm_crtc *crtc)
358 ilk_update_colorkey(
struct drm_plane *plane,
363 struct intel_plane *intel_plane;
391 struct intel_plane *intel_plane;
414 unsigned int crtc_w,
unsigned int crtc_h,
424 int pipe = intel_plane->
pipe;
426 int x = src_x >> 16, y = src_y >> 16;
427 int primary_w = crtc->
mode.hdisplay, primary_h = crtc->
mode.vdisplay;
428 bool disable_primary =
false;
433 old_obj = intel_plane->
obj;
442 if (crtc_x >= primary_w || crtc_y >= primary_h)
446 if (intel_plane->
pipe != intel_crtc->
pipe)
454 if ((crtc_x < 0) && ((crtc_x + crtc_w) > 0)) {
458 if ((crtc_x + crtc_w) <= 0)
460 if ((crtc_x + crtc_w) > primary_w)
461 crtc_w = primary_w - crtc_x;
463 if ((crtc_y < 0) && ((crtc_y + crtc_h) > 0)) {
467 if ((crtc_y + crtc_h) <= 0)
469 if (crtc_y + crtc_h > primary_h)
470 crtc_h = primary_h - crtc_y;
472 if (!crtc_w || !crtc_h)
479 if (((src_w * src_h) / (crtc_w * crtc_h)) > intel_plane->
max_downscale)
486 if ((crtc_x == 0) && (crtc_y == 0) &&
487 (crtc_w == primary_w) && (crtc_h == primary_h))
488 disable_primary =
true;
496 intel_plane->
obj = obj;
502 if (!disable_primary)
503 intel_enable_primary(crtc);
505 intel_plane->
update_plane(plane, fb, obj, crtc_x, crtc_y,
506 crtc_w, crtc_h, x, y, src_w, src_h);
509 intel_disable_primary(crtc);
519 if (old_obj != obj) {
534 intel_disable_plane(
struct drm_plane *plane)
541 intel_enable_primary(plane->
crtc);
544 if (!intel_plane->
obj)
556 static void intel_destroy_plane(
struct drm_plane *plane)
559 intel_disable_plane(plane);
565 struct drm_file *file_priv)
570 struct intel_plane *intel_plane;
573 if (!drm_core_check_feature(dev, DRIVER_MODESET))
598 struct drm_file *file_priv)
603 struct intel_plane *intel_plane;
606 if (!drm_core_check_feature(dev, DRIVER_MODESET))
627 .update_plane = intel_update_plane,
628 .disable_plane = intel_disable_plane,
629 .destroy = intel_destroy_plane,
632 static uint32_t ilk_plane_formats[] = {
640 static uint32_t snb_plane_formats[] = {
652 struct intel_plane *intel_plane;
653 unsigned long possible_crtcs;
655 int num_plane_formats;
661 intel_plane = kzalloc(
sizeof(
struct intel_plane),
GFP_KERNEL);
675 plane_formats = snb_plane_formats;
676 num_plane_formats =
ARRAY_SIZE(snb_plane_formats);
678 plane_formats = ilk_plane_formats;
679 num_plane_formats =
ARRAY_SIZE(ilk_plane_formats);
690 plane_formats = snb_plane_formats;
691 num_plane_formats =
ARRAY_SIZE(snb_plane_formats);
700 possible_crtcs = (1 <<
pipe);
703 plane_formats, num_plane_formats,