From patchwork Fri Mar 31 15:25:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 9656627 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 32947601D2 for ; Fri, 31 Mar 2017 15:25:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 255D128616 for ; Fri, 31 Mar 2017 15:25:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A5E0286CB; Fri, 31 Mar 2017 15:25:38 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 25D4828616 for ; Fri, 31 Mar 2017 15:25:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9BF926EADF; Fri, 31 Mar 2017 15:25:36 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail.bwidawsk.net (zangief.bwidawsk.net [107.170.211.233]) by gabe.freedesktop.org (Postfix) with ESMTPS id 34C536EADC; Fri, 31 Mar 2017 15:25:35 +0000 (UTC) Received: by mail.bwidawsk.net (Postfix, from userid 5001) id E7AFD1226A5; Fri, 31 Mar 2017 08:25:34 -0700 (PDT) Received: from bolo_yeung.intel.com (c-73-37-61-163.hsd1.or.comcast.net [73.37.61.163]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.bwidawsk.net (Postfix) with ESMTPSA id 7E0A312269B; Fri, 31 Mar 2017 08:25:29 -0700 (PDT) From: Ben Widawsky To: Intel GFX , DRI Development Date: Fri, 31 Mar 2017 08:25:23 -0700 Message-Id: <20170331152523.10814-1-ben@bwidawsk.net> X-Mailer: git-send-email 2.12.1 In-Reply-To: <20170330085749.GE30290@intel.com> References: <20170330085749.GE30290@intel.com> Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH] squash! drm/i915: Add format modifiers for Intel 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-Virus-Scanned: ClamAV using ClamSMTP make sprite and cursor have separate functions --- Ville, I think this addresses most of your comments. I'm guessing you're going to ask for separate gen sprite plane functions, but I think this looks pretty decent as is. --- drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++------ drivers/gpu/drm/i915/intel_sprite.c | 51 ++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index a5edcc910f4a..3f7ce8c39bc8 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -13535,18 +13535,16 @@ static bool skl_mod_supported(uint32_t format, uint64_t modifier) } } -static bool intel_plane_format_mod_supported(struct drm_plane *plane, - uint32_t format, - uint64_t modifier) +static bool intel_primary_plane_format_mod_supported(struct drm_plane *plane, + uint32_t format, + uint64_t modifier) { struct drm_i915_private *dev_priv = to_i915(plane->dev); if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID)) return false; - if (plane->base.type == DRM_PLANE_TYPE_PRIMARY) - return modifier == DRM_FORMAT_MOD_LINEAR && - format == DRM_FORMAT_ARGB8888; + BUG_ON(plane->base.type != DRM_PLANE_TYPE_PRIMARY); if (INTEL_GEN(dev_priv) >= 9) return skl_mod_supported(format, modifier); @@ -13558,6 +13556,18 @@ static bool intel_plane_format_mod_supported(struct drm_plane *plane, return false; } +static bool intel_cursor_plane_format_mod_supported(struct drm_plane *plane, + uint32_t format, + uint64_t modifier) +{ + if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID)) + return false; + + BUG_ON(plane->base.type != DRM_PLANE_TYPE_CURSOR); + + return modifier == DRM_FORMAT_MOD_LINEAR && format == DRM_FORMAT_ARGB8888; +} + const struct drm_plane_funcs intel_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, @@ -13567,7 +13577,7 @@ const struct drm_plane_funcs intel_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, - .format_mod_supported = intel_plane_format_mod_supported, + .format_mod_supported = intel_primary_plane_format_mod_supported, }; static int @@ -13704,7 +13714,7 @@ static const struct drm_plane_funcs intel_cursor_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, - .format_mod_supported = intel_plane_format_mod_supported, + .format_mod_supported = intel_cursor_plane_format_mod_supported, }; static struct intel_plane * diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index bf18d9edc66f..dae8e8a943b9 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -30,6 +30,7 @@ * support. */ #include +#include #include #include #include @@ -1102,6 +1103,56 @@ static const uint64_t skl_plane_format_modifiers[] = { DRM_FORMAT_MOD_INVALID }; +static bool intel_sprite_plane_format_mod_supported(struct drm_plane *plane, + uint32_t format, + uint64_t modifier) +{ + struct drm_i915_private *dev_priv = to_i915(plane->dev); + + if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID)) + return false; + + BUG_ON(plane->base.type != DRM_PLANE_TYPE_OVERLAY); + + switch (format) { + case DRM_FORMAT_XBGR2101010: + case DRM_FORMAT_ABGR2101010: + if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) + return true; + break; + case DRM_FORMAT_RGB565: + case DRM_FORMAT_ABGR8888: + case DRM_FORMAT_ARGB8888: + if (INTEL_GEN(dev_priv) >= 9 || IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) + return true; + break; + case DRM_FORMAT_XBGR8888: + if (INTEL_GEN(dev_priv) >= 6) + return true; + break; + case DRM_FORMAT_XRGB8888: + case DRM_FORMAT_YUYV: + case DRM_FORMAT_YVYU: + case DRM_FORMAT_UYVY: + case DRM_FORMAT_VYUY: + return true; + } + + return false; +} + +const struct drm_plane_funcs intel_sprite_plane_funcs = { + .update_plane = drm_atomic_helper_update_plane, + .disable_plane = drm_atomic_helper_disable_plane, + .destroy = intel_plane_destroy, + .set_property = drm_atomic_helper_plane_set_property, + .atomic_get_property = intel_plane_atomic_get_property, + .atomic_set_property = intel_plane_atomic_set_property, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_sprite_plane_format_mod_supported, +}; + struct intel_plane * intel_sprite_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe, int plane)