From patchwork Wed Dec 21 00:12:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Kristian_H=C3=B8gsberg?= X-Patchwork-Id: 9482391 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 35EB760237 for ; Wed, 21 Dec 2016 00:12:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AE1E27FA8 for ; Wed, 21 Dec 2016 00:12:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B854281AA; Wed, 21 Dec 2016 00:12:40 +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 71AB027FA8 for ; Wed, 21 Dec 2016 00:12:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 31C576E004; Wed, 21 Dec 2016 00:12:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id DF8B86EF55 for ; Wed, 21 Dec 2016 00:12:31 +0000 (UTC) Received: by mail-pg0-x243.google.com with SMTP id w68so7994589pgw.3 for ; Tue, 20 Dec 2016 16:12:31 -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; bh=k/4RTAXPF1JuwnoEh0lXxhfUUAjJ5SrC6/nqxB2kbd4=; b=IOrn6Ty5UIuvKWdR4gqazzXOBItrvh7dTikEiXBjbokm6kMb2JL947qo0WNM53V/rN XqJRcj34r3KEMEEqCkrNRN51q9WCBtBeUurenms5WzaqOWn+UPWTGuWRef2QH39hUJUG RjshyYRc+S40vl5Z4KDd2KrPF9aF5x6DtdwxJjkDtJKp7tr6jw9j7etrIXkBMebijjWa n+wrNM+8HQBhKCeP8FlHFyPXWLojtJ/Fy9Pe5+P6Qlx8NNgdMxuLDVpVLdFb5WvVMZ3f bwnCQLAw9Rxq+6RkzfpiqtqbqckuldK6GTsOPymLtirwCygZx0Kip3DBNRQ2GzQoiPr/ skFQ== 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; bh=k/4RTAXPF1JuwnoEh0lXxhfUUAjJ5SrC6/nqxB2kbd4=; b=dWNO2yk8x2wnm6LM0FiT5gutgyTBTG6gGlAmWu8XJbN/0M2Oh99GdxEbDs/kcGMMyK frLMyb2wHUWwpRtgyY7i3sulyLfgWkdlZhVNYNLxGNtLY610AlL5N9k/7bhef2urP7fH xtgFNQAVKP/krUlQLlPt2iEPOZ4abxintItCZePA9POnhA5e+CrWY/hf7zbF8pILtpwt min1ILgMUiBGJjoU8rryFaPLBpq6ALru4vEtpLCOGsyZ1/zdEXAR1oRIaQYPmeQSoZCQ fL9Ks9xU3fN8FKGQFdOsJR71NvadKtoeks8h2qVkKP17VHW23n2Y8iS0W6y/hEc+0/Ds gFxw== X-Gm-Message-State: AIkVDXKWZ118IaF2jyZqluf73oYGQ3Po9pQ97m/zQCPn811MiGfJ3b+zJMiME+WYyS55Uw== X-Received: by 10.99.114.91 with SMTP id c27mr2936758pgn.163.1482279151191; Tue, 20 Dec 2016 16:12:31 -0800 (PST) Received: from owl.local ([2620:15c:f:fd00:196b:357f:d485:3c17]) by smtp.gmail.com with ESMTPSA id b71sm41598182pfj.62.2016.12.20.16.12.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Dec 2016 16:12:30 -0800 (PST) From: "Kristian H. Kristensen" To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] i915: Add format modifiers for Intel Date: Tue, 20 Dec 2016 16:12:22 -0800 Message-Id: <20161221001222.21864-2-hoegsberg@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161221001222.21864-1-hoegsberg@gmail.com> References: <20161221001222.21864-1-hoegsberg@gmail.com> Cc: "Kristian H. Kristensen" , ben@widawsk.net X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Kristian H. Kristensen --- drivers/gpu/drm/i915/intel_display.c | 35 ++++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/intel_sprite.c | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 9c198fb..6150636 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -61,6 +61,11 @@ static const uint32_t i8xx_primary_formats[] = { DRM_FORMAT_XRGB8888, }; +static const struct drm_format_modifier i8xx_format_modifiers[] = { + { .formats = 0x0f, .modifier = DRM_FORMAT_MOD_NONE }, + { .formats = 0x0f, .modifier = I915_FORMAT_MOD_X_TILED } +}; + /* Primary plane formats for gen >= 4 */ static const uint32_t i965_primary_formats[] = { DRM_FORMAT_C8, @@ -71,6 +76,11 @@ static const uint32_t i965_primary_formats[] = { DRM_FORMAT_XBGR2101010, }; +static const struct drm_format_modifier i965_format_modifiers[] = { + { .formats = 0x3f, .modifier = DRM_FORMAT_MOD_NONE }, + { .formats = 0x3f, .modifier = I915_FORMAT_MOD_X_TILED } +}; + static const uint32_t skl_primary_formats[] = { DRM_FORMAT_C8, DRM_FORMAT_RGB565, @@ -86,6 +96,12 @@ static const uint32_t skl_primary_formats[] = { DRM_FORMAT_VYUY, }; +static const struct drm_format_modifier skl_format_modifiers[] = { + { .formats = 0xfff, .modifier = DRM_FORMAT_MOD_NONE }, + { .formats = 0xff, .modifier = I915_FORMAT_MOD_X_TILED }, + { .formats = 0x3f, .modifier = I915_FORMAT_MOD_Y_TILED } +}; + /* Cursor formats */ static const uint32_t intel_cursor_formats[] = { DRM_FORMAT_ARGB8888, @@ -14962,6 +14978,8 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) const uint32_t *intel_primary_formats; unsigned int supported_rotations; unsigned int num_formats; + const struct drm_format_modifier *intel_format_modifiers; + unsigned int num_format_modifiers; int ret; primary = kzalloc(sizeof(*primary), GFP_KERNEL); @@ -14999,24 +15017,32 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) if (INTEL_GEN(dev_priv) >= 9) { intel_primary_formats = skl_primary_formats; num_formats = ARRAY_SIZE(skl_primary_formats); + intel_format_modifiers = skl_format_modifiers; + num_format_modifiers = ARRAY_SIZE(skl_format_modifiers); primary->update_plane = skylake_update_primary_plane; primary->disable_plane = skylake_disable_primary_plane; } else if (HAS_PCH_SPLIT(dev_priv)) { intel_primary_formats = i965_primary_formats; num_formats = ARRAY_SIZE(i965_primary_formats); + intel_format_modifiers = i965_format_modifiers; + num_format_modifiers = ARRAY_SIZE(i965_format_modifiers); primary->update_plane = ironlake_update_primary_plane; primary->disable_plane = i9xx_disable_primary_plane; } else if (INTEL_GEN(dev_priv) >= 4) { intel_primary_formats = i965_primary_formats; num_formats = ARRAY_SIZE(i965_primary_formats); + intel_format_modifiers = i965_format_modifiers; + num_format_modifiers = ARRAY_SIZE(i965_format_modifiers); primary->update_plane = i9xx_update_primary_plane; primary->disable_plane = i9xx_disable_primary_plane; } else { intel_primary_formats = i8xx_primary_formats; num_formats = ARRAY_SIZE(i8xx_primary_formats); + intel_format_modifiers = i8xx_format_modifiers; + num_format_modifiers = ARRAY_SIZE(i8xx_format_modifiers); primary->update_plane = i9xx_update_primary_plane; primary->disable_plane = i9xx_disable_primary_plane; @@ -15026,21 +15052,24 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) ret = drm_universal_plane_init(&dev_priv->drm, &primary->base, 0, &intel_plane_funcs, intel_primary_formats, num_formats, - NULL, 0, + intel_format_modifiers, + num_format_modifiers, DRM_PLANE_TYPE_PRIMARY, "plane 1%c", pipe_name(pipe)); else if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv)) ret = drm_universal_plane_init(&dev_priv->drm, &primary->base, 0, &intel_plane_funcs, intel_primary_formats, num_formats, - NULL, 0, + intel_format_modifiers, + num_format_modifiers, DRM_PLANE_TYPE_PRIMARY, "primary %c", pipe_name(pipe)); else ret = drm_universal_plane_init(&dev_priv->drm, &primary->base, 0, &intel_plane_funcs, intel_primary_formats, num_formats, - NULL, 0, + intel_format_modifiers, + num_format_modifiers, DRM_PLANE_TYPE_PRIMARY, "plane %c", plane_name(primary->plane)); if (ret) diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index ff766c0..a919d9e 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -989,6 +989,11 @@ static const uint32_t ilk_plane_formats[] = { DRM_FORMAT_VYUY, }; +static const struct drm_format_modifier ilk_plane_format_modifiers[] = { + { .formats = 0x1f, .modifier = DRM_FORMAT_MOD_NONE }, + { .formats = 0x1f, .modifier = I915_FORMAT_MOD_X_TILED } +}; + static const uint32_t snb_plane_formats[] = { DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB8888, @@ -998,6 +1003,11 @@ static const uint32_t snb_plane_formats[] = { DRM_FORMAT_VYUY, }; +static const struct drm_format_modifier snb_plane_format_modifiers[] = { + { .formats = 0x3f, .modifier = DRM_FORMAT_MOD_NONE }, + { .formats = 0x3f, .modifier = I915_FORMAT_MOD_X_TILED } +}; + static const uint32_t vlv_plane_formats[] = { DRM_FORMAT_RGB565, DRM_FORMAT_ABGR8888, @@ -1012,6 +1022,11 @@ static const uint32_t vlv_plane_formats[] = { DRM_FORMAT_VYUY, }; +static const struct drm_format_modifier vlv_plane_format_modifiers[] = { + { .formats = 0x7ff, .modifier = DRM_FORMAT_MOD_NONE }, + { .formats = 0x7ff, .modifier = I915_FORMAT_MOD_X_TILED } +}; + static uint32_t skl_plane_formats[] = { DRM_FORMAT_RGB565, DRM_FORMAT_ABGR8888, @@ -1024,6 +1039,12 @@ static uint32_t skl_plane_formats[] = { DRM_FORMAT_VYUY, }; +static const struct drm_format_modifier skl_plane_format_modifiers[] = { + { .formats = 0x1ff, .modifier = DRM_FORMAT_MOD_NONE }, + { .formats = 0x1ff, .modifier = I915_FORMAT_MOD_X_TILED }, + { .formats = 0x01f, .modifier = I915_FORMAT_MOD_Y_TILED } +}; + struct intel_plane * intel_sprite_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe, int plane) @@ -1032,8 +1053,9 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, struct intel_plane_state *state = NULL; unsigned long possible_crtcs; const uint32_t *plane_formats; + const struct drm_format_modifier *modifiers; unsigned int supported_rotations; - int num_plane_formats; + int num_plane_formats, num_modifiers; int ret; intel_plane = kzalloc(sizeof(*intel_plane), GFP_KERNEL); @@ -1058,6 +1080,8 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, plane_formats = skl_plane_formats; num_plane_formats = ARRAY_SIZE(skl_plane_formats); + modifiers = skl_plane_format_modifiers; + num_modifiers = ARRAY_SIZE(skl_plane_format_modifiers); } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { intel_plane->can_scale = false; intel_plane->max_downscale = 1; @@ -1067,6 +1091,8 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, plane_formats = vlv_plane_formats; num_plane_formats = ARRAY_SIZE(vlv_plane_formats); + modifiers = vlv_plane_format_modifiers; + num_modifiers = ARRAY_SIZE(vlv_plane_format_modifiers); } else if (INTEL_GEN(dev_priv) >= 7) { if (IS_IVYBRIDGE(dev_priv)) { intel_plane->can_scale = true; @@ -1081,6 +1107,8 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, plane_formats = snb_plane_formats; num_plane_formats = ARRAY_SIZE(snb_plane_formats); + modifiers = snb_plane_format_modifiers; + num_modifiers = ARRAY_SIZE(snb_plane_format_modifiers); } else { intel_plane->can_scale = true; intel_plane->max_downscale = 16; @@ -1091,9 +1119,13 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, if (IS_GEN6(dev_priv)) { plane_formats = snb_plane_formats; num_plane_formats = ARRAY_SIZE(snb_plane_formats); + modifiers = snb_plane_format_modifiers; + num_modifiers = ARRAY_SIZE(snb_plane_format_modifiers); } else { plane_formats = ilk_plane_formats; num_plane_formats = ARRAY_SIZE(ilk_plane_formats); + modifiers = ilk_plane_format_modifiers; + num_modifiers = ARRAY_SIZE(ilk_plane_format_modifiers); } } @@ -1121,12 +1153,14 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base, possible_crtcs, &intel_plane_funcs, plane_formats, num_plane_formats, + modifiers, num_modifiers, DRM_PLANE_TYPE_OVERLAY, "plane %d%c", plane + 2, pipe_name(pipe)); else ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base, possible_crtcs, &intel_plane_funcs, plane_formats, num_plane_formats, + modifiers, num_modifiers, DRM_PLANE_TYPE_OVERLAY, "sprite %c", sprite_name(pipe, plane)); if (ret)