From patchwork Mon May 18 23:18:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chandra Konduru X-Patchwork-Id: 6432611 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7312AC0432 for ; Mon, 18 May 2015 23:19:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9425C20421 for ; Mon, 18 May 2015 23:19:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 680272041B for ; Mon, 18 May 2015 23:19:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FDAC6E030; Mon, 18 May 2015 16:19:36 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C64A6E030 for ; Mon, 18 May 2015 16:19:34 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 18 May 2015 16:19:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,455,1427785200"; d="scan'208";a="731425811" Received: from cmkondur-desk2.fm.intel.com ([10.19.123.59]) by orsmga002.jf.intel.com with ESMTP; 18 May 2015 16:19:35 -0700 From: Chandra Konduru To: intel-gfx@lists.freedesktop.org Date: Mon, 18 May 2015 16:18:44 -0700 Message-Id: <1431991124-9034-1-git-send-email-chandra.konduru@intel.com> X-Mailer: git-send-email 1.7.9.5 Cc: daniel.vetter@intel.com, ville.syrjala@intel.com, bin.a.xu@intel.com Subject: [Intel-gfx] [PATCH] drm/i915/skl: don't fail colorkey + scaler request X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is a mplayer video failure reported with xv. This is because there is a request to do both plane scaling and colorkey. Because skl hw doesn't support plane scaling and colorkey at the same time, request is failed which is expected behavior. To make xv operate, this patch allows colorkey continue to work without using scaler. Then behavior would be similar to platforms without plane scaler support. Signed-off-by: Chandra Konduru Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90449 Tested-By: Intel Graphics QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com) Reviewed-by: Ville Syrjälä --- drivers/gpu/drm/i915/intel_display.c | 14 +++++++++----- drivers/gpu/drm/i915/intel_sprite.c | 31 +++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 7ab75c0..fc5cef0 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -4505,9 +4505,10 @@ skl_update_scaler_users( } /* check colorkey */ - if (intel_plane && intel_plane->ckey.flags != I915_SET_COLORKEY_NONE) { - DRM_DEBUG_KMS("PLANE:%d scaling with color key not allowed", - intel_plane->base.base.id); + if (WARN_ON(intel_plane && + intel_plane->ckey.flags != I915_SET_COLORKEY_NONE)) { + DRM_DEBUG_KMS("PLANE:%d scaling %ux%u->%ux%u not allowed with colorkey", + intel_plane->base.base.id, src_w, src_h, dst_w, dst_h); return -EINVAL; } @@ -13049,8 +13050,11 @@ intel_check_primary_plane(struct drm_plane *plane, intel_atomic_get_crtc_state(state->base.state, intel_crtc) : NULL; if (INTEL_INFO(dev)->gen >= 9) { - min_scale = 1; - max_scale = skl_max_scale(intel_crtc, crtc_state); + /* use scaler when colorkey is not required */ + if (to_intel_plane(plane)->ckey.flags == I915_SET_COLORKEY_NONE) { + min_scale = 1; + max_scale = skl_max_scale(intel_crtc, crtc_state); + } can_position = true; } diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 16d0e48..9004e47 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -775,7 +775,7 @@ intel_check_sprite_plane(struct drm_plane *plane, struct drm_rect *dst = &state->dst; const struct drm_rect *clip = &state->clip; int hscale, vscale; - int max_scale, min_scale; + int max_scale, min_scale, can_scale; int pixel_size; int ret; @@ -800,18 +800,29 @@ intel_check_sprite_plane(struct drm_plane *plane, return -EINVAL; } + /* setup can_scale, min_scale, max_scale */ + if (INTEL_INFO(dev)->gen >= 9) { + /* use scaler when colorkey is not required */ + if (intel_plane->ckey.flags == I915_SET_COLORKEY_NONE) { + can_scale = 1; + min_scale = 1; + max_scale = skl_max_scale(intel_crtc, crtc_state); + } else { + can_scale = 0; + min_scale = DRM_PLANE_HELPER_NO_SCALING; + max_scale = DRM_PLANE_HELPER_NO_SCALING; + } + } else { + can_scale = intel_plane->can_scale; + max_scale = intel_plane->max_downscale << 16; + min_scale = intel_plane->can_scale ? 1 : (1 << 16); + } + /* * FIXME the following code does a bunch of fuzzy adjustments to the * coordinates and sizes. We probably need some way to decide whether * more strict checking should be done instead. */ - max_scale = intel_plane->max_downscale << 16; - min_scale = intel_plane->can_scale ? 1 : (1 << 16); - - if (INTEL_INFO(dev)->gen >= 9) { - min_scale = 1; - max_scale = skl_max_scale(intel_crtc, crtc_state); - } drm_rect_rotate(src, fb->width << 16, fb->height << 16, state->base.rotation); @@ -882,7 +893,7 @@ intel_check_sprite_plane(struct drm_plane *plane, * Must keep src and dst the * same if we can't scale. */ - if (!intel_plane->can_scale) + if (!can_scale) crtc_w &= ~1; if (crtc_w == 0) @@ -894,7 +905,7 @@ intel_check_sprite_plane(struct drm_plane *plane, if (state->visible && (src_w != crtc_w || src_h != crtc_h)) { unsigned int width_bytes; - WARN_ON(!intel_plane->can_scale); + WARN_ON(!can_scale); /* FIXME interlacing min height is 6 */