From patchwork Thu Nov 9 12:05:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Juha-Pekka Heikkila X-Patchwork-Id: 10050859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2AD4A601EA for ; Thu, 9 Nov 2017 12:06:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20C692ABFF for ; Thu, 9 Nov 2017 12:06:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15A5D2AC5F; Thu, 9 Nov 2017 12:06:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BD63E2ABFF for ; Thu, 9 Nov 2017 12:06:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A33E6E8B2; Thu, 9 Nov 2017 12:06:29 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0AAFB6E8B2 for ; Thu, 9 Nov 2017 12:06:27 +0000 (UTC) Received: by mail-pg0-x242.google.com with SMTP id p9so4500013pgc.8 for ; Thu, 09 Nov 2017 04:06:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yv5y4kOvm9nZ6SJkOVzVphKBBG3vAu9h8OnUAlK0ZUw=; b=XScgdNA+OyBNmBMq2+PWmyAufTZ1syVrq+vQVR1OmRnhCXROjs0pJumDG+K+UXcsq9 5JpXofr4ROwjwt4ag+etpZGj53kvICSxiHSnpIVeBLaa4l0k78CYIWwj6zruu5GzciQW vC0UvNYcWda/GvGAywqUNU2ouJRwfdC62oqvucWlWYgBpY1qfvPXChtizZbzxnVmLk3M 1ndk3Ro4XC7Y1gh2vYmDvfJliOn0b9cun9US4qr1HT59nKrcRsuSlM7io4EZPor3msrp h4pC3ufn9V+dGhFC89kkSFijSD44v1cpQRf1dd6Ern2F2xGH+K1TDFPrvoYeNcLI/krG uhpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yv5y4kOvm9nZ6SJkOVzVphKBBG3vAu9h8OnUAlK0ZUw=; b=lDwGz/iLAmjp7zyeXn1278U4/eOhdLNK0zerV2/kJVpqzEE/Wq/b+o3IeqXJ4tI8fA Ao104E6pBrS2RbDZ/e7uOuSuC4XMvOXSrrmps5xRmJhW5qUbwHvd6YwND28NWoj1O152 5TZXiertCUvGKQ9F0/pBxpvO1dEAHLAKZ3THKHc6vgeKdlO0Lil4yGlD1wQGvWujqOBr PDP9KqBKwALy9JuaLxiVGifGJaKj0b5ASo76kiO8UMnPzvu0q5x5mQQa/d0f9xjzdH95 uInS41Cr5Dl+eKbfTVmm5NCTeYP6LicRc/eZK1Z83zDn6UZF/E+ssoiGZziU7elMO1aA ZrCw== X-Gm-Message-State: AJaThX7cxEY0+4MF8SjFRV0YeWUYV641Rn9a29WM7nSZIHsZfUSZyVIE D2MSk2Zq1mTzWCFZewQAk2llhg== X-Google-Smtp-Source: ABhQp+Q5fmf0pvsJ6fYXCOXaCz4XbYCVUoeyuub1zqcTFx7AmEv34EXqc/d2QxCAZVVUO5C+ATBdAw== X-Received: by 10.101.85.9 with SMTP id f9mr246594pgr.263.1510229187036; Thu, 09 Nov 2017 04:06:27 -0800 (PST) Received: from jheikkil-mobl.fi.intel.com ([192.55.54.41]) by smtp.gmail.com with ESMTPSA id j8sm11301163pff.131.2017.11.09.04.06.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Nov 2017 04:06:26 -0800 (PST) From: Juha-Pekka Heikkila To: intel-gfx@lists.freedesktop.org Date: Thu, 9 Nov 2017 14:05:59 +0200 Message-Id: <1510229160-329-2-git-send-email-juhapekka.heikkila@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510229160-329-1-git-send-email-juhapekka.heikkila@gmail.com> References: <1510229160-329-1-git-send-email-juhapekka.heikkila@gmail.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/2] drm/i915: Move rotation validity check into its own function 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP This makes intel_plane_atomic_check_with_state() generally shorter. v2: (Ville Syrjälä) move all rotation related checks from intel_plane_atomic_check_with_state into new function and don't pass dev_priv pointer around. Signed-off-by: Juha-Pekka Heikkila --- drivers/gpu/drm/i915/intel_atomic_plane.c | 81 ++++++++++++++++++------------- 1 file changed, 48 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c index 8e6dc15..ffd36fb 100644 --- a/drivers/gpu/drm/i915/intel_atomic_plane.c +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c @@ -107,6 +107,53 @@ intel_plane_destroy_state(struct drm_plane *plane, drm_atomic_helper_plane_destroy_state(plane, state); } +static bool intel_valid_rotation(const struct drm_plane_state *plane_state) +{ + struct intel_plane *plane = to_intel_plane(plane_state->plane); + struct drm_i915_private *dev_priv = to_i915(plane->base.dev); + + if (plane_state->fb && + drm_rotation_90_or_270(plane_state->rotation)) { + struct drm_format_name_buf format_name; + + if (plane_state->fb->modifier != I915_FORMAT_MOD_Y_TILED && + plane_state->fb->modifier != I915_FORMAT_MOD_Yf_TILED) { + DRM_DEBUG_KMS("Y/Yf tiling required for 90/270!\n"); + return false; + } + + /* + * 90/270 is not allowed with RGB64 16:16:16:16, + * RGB 16-bit 5:6:5, and Indexed 8-bit. + * TBD: Add RGB64 case once its added in supported format + * list. + */ + switch (plane_state->fb->format->format) { + case DRM_FORMAT_C8: + case DRM_FORMAT_RGB565: + DRM_DEBUG_KMS( + "Unsupported pixel format %s for 90/270!\n", + drm_get_format_name( + plane_state->fb->format->format, + &format_name)); + return false; + default: + break; + } + } + + /* CHV ignores the mirror bit when the rotate bit is set :( */ + if (IS_CHERRYVIEW(dev_priv) && + plane_state->rotation & DRM_MODE_ROTATE_180 && + plane_state->rotation & DRM_MODE_REFLECT_X) { + DRM_DEBUG_KMS("Cannot rotate and reflect at the same time\n"); + return false; + } + + return true; + +} + int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state, struct intel_crtc_state *crtc_state, const struct intel_plane_state *old_plane_state, @@ -137,40 +184,8 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_ intel_state->clip.y2 = crtc_state->base.enable ? crtc_state->pipe_src_h : 0; - if (state->fb && drm_rotation_90_or_270(state->rotation)) { - struct drm_format_name_buf format_name; - - if (state->fb->modifier != I915_FORMAT_MOD_Y_TILED && - state->fb->modifier != I915_FORMAT_MOD_Yf_TILED) { - DRM_DEBUG_KMS("Y/Yf tiling required for 90/270!\n"); - return -EINVAL; - } - - /* - * 90/270 is not allowed with RGB64 16:16:16:16, - * RGB 16-bit 5:6:5, and Indexed 8-bit. - * TBD: Add RGB64 case once its added in supported format list. - */ - switch (state->fb->format->format) { - case DRM_FORMAT_C8: - case DRM_FORMAT_RGB565: - DRM_DEBUG_KMS("Unsupported pixel format %s for 90/270!\n", - drm_get_format_name(state->fb->format->format, - &format_name)); - return -EINVAL; - - default: - break; - } - } - - /* CHV ignores the mirror bit when the rotate bit is set :( */ - if (IS_CHERRYVIEW(dev_priv) && - state->rotation & DRM_MODE_ROTATE_180 && - state->rotation & DRM_MODE_REFLECT_X) { - DRM_DEBUG_KMS("Cannot rotate and reflect at the same time\n"); + if (!intel_valid_rotation(state)) return -EINVAL; - } intel_state->base.visible = false; ret = intel_plane->check_plane(intel_plane, crtc_state, intel_state);