From patchwork Tue Feb 20 07:28:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 128857 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4345887ljc; Mon, 19 Feb 2018 23:31:17 -0800 (PST) X-Google-Smtp-Source: AH8x225NE9ZnaM2hjQwFoPRlOiard195SJUcam4qT/IAOj+2f57im7e9m0/P1/oE+YgfJd86aqpU X-Received: by 2002:a17:902:e81:: with SMTP id 1-v6mr16896312plx.169.1519111876944; Mon, 19 Feb 2018 23:31:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519111876; cv=none; d=google.com; s=arc-20160816; b=QGwZzN4KlLx9E9ZCaR9P5TJCKjZCHe91Y+24crECTUWixFXfXoEGJUgjX1Au+eZNZl PkH5x7PmerylfrkexcxKGRr83oTAqP4PgLKatFYILXKfSAg8WjITbQPgvaxft/3s/MtD dldGTojOA+JinGfeI5UDS3sQQGWYQcSOwZivJoRIGIxi+QiGYN5xtZtnE3vRxynYvlvk +E7GumKdHX5EyzVfWv/X2B67CYroooeu9dhNXJqBBqb5nn0PiTtdVJDe1xTjUrE7ZGbf tKwqXpHWfyL+YMMjbMB6zc7KhxLNVqZSe8GGpnnflKslQfxyZHW3UYinBKuXFcqMiMb2 JETA== 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:message-id:date:subject:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=CgYbhv8HewqNIKDrzKS8YGfUqwI+A1xzN20Pt15r27g=; b=vdiFLEzocK79rYkiSqFF4RA+R3aQk+0mIjIgybNrZ+oP72b2BSssEmifhhT97hdJWN 4fsByAI7anKw2DVxaYDJIZT4BWSuPAcKMSb7Rf3A0kv5JWOYymD3qs6JOgYgQM1nJvJI qOwwWWgroHcP92WQaqKpIwtEcN0d+Ed+bbG8lEDQsczdYHjMt3kEV3syI0+Q8daYZVyk CQCeuzLu0AlkpjiQ2ZWcYRol5fNZ4RG1kisy6IxrnWJDsCY3HAQPssjfcJ7YHDEwXRR7 tTEV6eZoUHX04UjPXQ8QCCW8uxYNaaAn+DAl017EC9YMcOiNF4kpAXrKO7hjJSY4U+sY nSmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LpZJhdxi; 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 q17si4768054pgv.144.2018.02.19.23.31.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Feb 2018 23:31:16 -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=LpZJhdxi; 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 8F4A06E345; Tue, 20 Feb 2018 07:31:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2AE7B6E345 for ; Tue, 20 Feb 2018 07:31:12 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id x196so2752235lfd.12 for ; Mon, 19 Feb 2018 23:31:12 -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; bh=FVIcPl/1kFRzBc0kgk5rQZT6Qv5cbgvSuEkYhnMVnP8=; b=LpZJhdximhRwbh+3tKUVbJVobDQbZfTCyjLmoFo1ePfxF9hERnLZlHtmpfCT21EI5j iOt8J6vs+WhbTek5dQDM/7gjdI5+Yyznwxi8htBcGt7rVB8Su25/t6qPSKN8QKSadH+b sZIzzlJOgGwhqQcITRFUoL0dyjhAMbCl3a9iw= 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; bh=FVIcPl/1kFRzBc0kgk5rQZT6Qv5cbgvSuEkYhnMVnP8=; b=jotvANlMh5obB6E7ThR26pQ5C4xKsU5PvJpSs6a4cr68jh+HOVSrFCImcRuDv5BihO I63mlagJkR8VEal0gncF4I7Kli7D33AaaOYuOXvTlnTVOjOV3TZEev4MBfrdIy7KjoKw n5N10INdmk6ZwWc2DEfbb3oC+CLY+ng7dX5Wl5DVrI1Wp+x7Zu9rXecmdiUMGIXdtLlA eTFK9Y+iioTmhXIQX0Dx+ZSqjpdqhI0NphhphxEw2ki69up15c0V3C2HQ8tNKjhel6qE d3HGwuBHHiQsebXpl/jzaSQDTqPBNwcZU8kR/EzONBRvirtx+j3klNIYkI25fXB2R1e+ e3jQ== X-Gm-Message-State: APf1xPARmNcpafmIMDyZ1IgS73LjGJLDzINVSpO17VuwLeZkmu09BMoM uOeVEE00dr5KoQGYqz6VELWHJw== X-Received: by 10.46.99.11 with SMTP id x11mr12079587ljb.136.1519111871318; Mon, 19 Feb 2018 23:31:11 -0800 (PST) Received: from localhost.localdomain (c-cb7471d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.116.203]) by smtp.gmail.com with ESMTPSA id t69sm3131658ljb.36.2018.02.19.23.31.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Feb 2018 23:31:10 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH] drm: simple_kms_helper: Add mode_valid() callback support Date: Tue, 20 Feb 2018 08:28:59 +0100 Message-Id: <20180220072859.3386-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 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. Reviewed-by: Eric Anholt Reviewed-by: Daniel Vetter Signed-off-by: Linus Walleij Reviewed-by: Thierry Reding --- ChangeLog v1->v2: - Fix up the kerneldoc to just refer to the enum. - Collect Eric's and Daniel's review tags. --- drivers/gpu/drm/drm_simple_kms_helper.c | 15 +++++++++++++++ include/drm/drm_simple_kms_helper.h | 14 ++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c index 9f3b1c94802b..652cde9a5a6b 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..d9e4c3c3f009 100644 --- a/include/drm/drm_simple_kms_helper.h +++ b/include/drm/drm_simple_kms_helper.h @@ -21,6 +21,20 @@ 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: + * + * drm_mode_status Enum + */ + enum drm_mode_status (*mode_valid)(struct drm_crtc *crtc, + const struct drm_display_mode *mode); + /** * @enable: *