From patchwork Tue Feb 6 12:18:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 126991 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2864116ljc; Tue, 6 Feb 2018 04:19:12 -0800 (PST) X-Google-Smtp-Source: AH8x224x3AgznDaXby2yJ0vBUmcoyVmLBonPRtO0l5PcPrzkYsMMNw+VrB8n6PZCwjK9uygZJfvi X-Received: by 10.98.100.139 with SMTP id y133mr2275086pfb.68.1517919552470; Tue, 06 Feb 2018 04:19:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517919552; cv=none; d=google.com; s=arc-20160816; b=L5ItYHGubO6i0MI+mVoSmeDxIddVdvJ09G60sLcNKwOiOCwvSFqPR3keWrNkxIjuRh 7d4UIuoxnzSeMQGDHT/k2krUuyrzcpHo2wnwIL+2LTkSWcafd/UH8zbwUQ6/Nr530wep Jun8Bxc8Bm6T2tZa957I0QV/eFs2M2HHXLZ9Qc8YeTVI7dRmLueiX6L+BHuzB8gDMpkt lUemqn0xqNhmuZYSIo31NGwoebwu10zkZ0FuVxpLwfv20qtBWt/o+m19ZLciEbhxG06F BqMjEk/REXTxA7nobf1Vs4fVS9ibuQIuqlk3WAw9UYAcd4NU73lekB+ZPpvI3JhlkVOu Of4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=F78BrQl/JY/oSpFTjE14Ao9luDbmjnHxLL39eUYoqTg=; b=OHhVCEoZAz0JszxNaL1gtziLmkNZ1EImBh1YWPOsCUzbUj7BfaznNowkzVekSQzxTo MLfVqumnUkACDYYZotiPiSrtTJWwRSLZB/L6HnQnoMCmZWhNWiugIcmvihXGak85hdqM PL8fLP5EuvMg9b5EWOy7A0afSUFihWwf3n8MWIBPFsYj/pi9YSpQSrSHHubkqH/unEJH bt5oOSvBq3pXD9NwealQzb52BfhGpOX66AbuXGzdz6+DpMyt7G2ApzTrAKxFb/gbeWu1 PnZVagbPNj1hjPI+KdZ8EBK3GVz66vggEGHkt5adaTCbGGAicoUJUizGq6HSPcVTXc1i BUhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=I6RyMnDu; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id s19-v6si1403741plp.116.2018.02.06.04.19.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 04:19:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=I6RyMnDu; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 056446E059; Tue, 6 Feb 2018 12:19:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x242.google.com (mail-lf0-x242.google.com [IPv6:2a00:1450:4010:c07::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 621986E3ED for ; Tue, 6 Feb 2018 12:19:08 +0000 (UTC) Received: by mail-lf0-x242.google.com with SMTP id v188so2407153lfa.11 for ; Tue, 06 Feb 2018 04:19:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vbK6vqrT2y6vISmcZ0Vtb1+wEYChM77hizI0k+gQWhs=; b=I6RyMnDu1JlD7FH2PgENUcbcoKetv3M3rZVF9J0nM2pnKVIMmurZQE+Z8NKQz1AK8Y W+quOCxDBLlClgIC/xwdCmk0hxbxqwq0gl3vhx0ROJRFnuHVQxb1iPHUO+Jed641fZY5 Xw8y9HUHE61t3IyacMvddD1hvhglBwsECDRmc= 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=vbK6vqrT2y6vISmcZ0Vtb1+wEYChM77hizI0k+gQWhs=; b=acaQlgbw+drf13ZVxjOsr5priLEhYxIQiXXFTBP7vqdTdQpZBlAPf75REAOU6DRTaJ r6/yFELarf676VCuBmiO/AWBzyZ1yGPNYKqJAFMWpJL0ZB0hRqF0IbZZ1WHnzFur6VI8 SKRaVS4mlYTm9kw4t9GKj9BEdb8k1VU6aC0RZlMw/AylKC2R99bknqLhuQMG3rZs20y9 4XKgAfE2s/p3MG8uQUIIhObFUeQojolRf28zhbk0VqsQj3nMMLyBnExg9kAYWYqjHMZY hjDGcanCsUpNctPe1Vr7/JqkIGr9yqwU8yODlBMCWZUAPR5LJUYTzuOT10I8YsKtw3ai uKeA== X-Gm-Message-State: APf1xPBKqzm2ybtpLgNG+4lQqwXcm9WxCBWi8sJ89FgTAg4AysHGEMXt ulx4OixGCHWjwZAj4k0Jdyf+7Q== X-Received: by 10.46.118.20 with SMTP id r20mr1493914ljc.11.1517919546847; Tue, 06 Feb 2018 04:19:06 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id f11sm598631lja.63.2018.02.06.04.19.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 04:19:06 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt , Peter Ujfalusi , Tomi Valkeinen Subject: [PATCH 1/3] drm: simple_kms_helper: Add mode_valid() callback support Date: Tue, 6 Feb 2018 13:18:52 +0100 Message-Id: <20180206121854.4407-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180206121854.4407-1-linus.walleij@linaro.org> References: <20180206121854.4407-1-linus.walleij@linaro.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The PL111 needs to filter valid modes based on memory bandwidth. I guess it is a pretty simple operation, so we can still claim the DRM KMS helper pipeline is simple after adding this (optional) vtable callback. Signed-off-by: Linus Walleij Reviewed-by: Eric Anholt Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_simple_kms_helper.c | 15 +++++++++++++++ include/drm/drm_simple_kms_helper.h | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c index dc9fd109de14..b7840cf34808 100644 --- a/drivers/gpu/drm/drm_simple_kms_helper.c +++ b/drivers/gpu/drm/drm_simple_kms_helper.c @@ -34,6 +34,20 @@ static const struct drm_encoder_funcs drm_simple_kms_encoder_funcs = { .destroy = drm_encoder_cleanup, }; +static enum drm_mode_status +drm_simple_kms_crtc_mode_valid(struct drm_crtc *crtc, + const struct drm_display_mode *mode) +{ + struct drm_simple_display_pipe *pipe; + + pipe = container_of(crtc, struct drm_simple_display_pipe, crtc); + if (!pipe->funcs || !pipe->funcs->mode_valid) + /* Anything goes */ + return MODE_OK; + + return pipe->funcs->mode_valid(crtc, mode); +} + static int drm_simple_kms_crtc_check(struct drm_crtc *crtc, struct drm_crtc_state *state) { @@ -72,6 +86,7 @@ static void drm_simple_kms_crtc_disable(struct drm_crtc *crtc, } static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_funcs = { + .mode_valid = drm_simple_kms_crtc_mode_valid, .atomic_check = drm_simple_kms_crtc_check, .atomic_enable = drm_simple_kms_crtc_enable, .atomic_disable = drm_simple_kms_crtc_disable, diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h index 6d9adbb46293..ad74cb33c539 100644 --- a/include/drm/drm_simple_kms_helper.h +++ b/include/drm/drm_simple_kms_helper.h @@ -21,6 +21,21 @@ struct drm_simple_display_pipe; * display pipeline */ struct drm_simple_display_pipe_funcs { + /** + * @mode_valid: + * + * This function is called to filter out valid modes from the + * suggestions suggested by the bridge or display. This optional + * hook is passed in when initializing the pipeline. + * + * RETURNS: + * + * MODE_OK if the mode is acceptable. + * MODE_BAD if we need to try something else. + */ + enum drm_mode_status (*mode_valid)(struct drm_crtc *crtc, + const struct drm_display_mode *mode); + /** * @enable: *