From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57777C388F3 for ; Sat, 28 Sep 2019 01:29:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2D0A220872 for ; Sat, 28 Sep 2019 01:29:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="d/L9Vu5+"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="oi+Ph7Va"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="h6pZjOQg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D0A220872 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=JIVFIygT4Rq7fGx6X7lYkf5F/OAOEWdaw84I7JuGzAE=; b=d/L9Vu5+Oi4xKwZS39M4ZW+4gr jXZiXW7zDNKrEPNsLblDl6uCPELuww2sMrxbdMioVF1jRO80DAs2UZjFExRe+X8k95HZMyhR0N592 rUN56QQRKSqaavsOhvXmnGQf0ilRVwFY2kQE1L57h+FZviuruu1JtqhuLMHcHS67V4BpR6yywix/z GxFMy+HAWrFvFMUBHfONGfnJQZ9SR03kdVhIo+Uqs8eK6xoaew+AIT+5JPu0XcT0JTx7BejqU7qfu M+XHq7+5zUJ8fLaPYEqKJ3OOxZTNnxifwenbwMsz8KJGoEgjlhkrQ1TwHA099IRWFcTqEOl4uOlUP bMAnwuKw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iE1Y3-0007uE-P4; Sat, 28 Sep 2019 01:29:23 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iE1Y0-0007tT-MK for linux-arm-kernel@lists.infradead.org; Sat, 28 Sep 2019 01:29:22 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5C65F61242; Sat, 28 Sep 2019 01:29:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1569634160; bh=m/+SNT1ylRadZlQdB8fVjW39Gd/vKBoLUGrjef6eP84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oi+Ph7Vappbne3npRkZ6MeD+lNwg7p5YgfNDSDcbgL+9aPewzYZdGBmHEYFEXcLv8 +O7awEY5dbMi1NIdlijWU88Vk9sGvVzL01eiGBzJi5yDad6PZwfLBiaKvBhFBsh4ut /8QwdCjDavmuEgM/22YbkX/FFxhW1eyL42Y4Wz8k= Received: from jeykumar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jsanka@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id DE709611D1; Sat, 28 Sep 2019 01:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1569634159; bh=m/+SNT1ylRadZlQdB8fVjW39Gd/vKBoLUGrjef6eP84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h6pZjOQgOd2DEBcM8QQGQMWPVGaH4T/lHuZNiJrNEC83GtpsvXDS2yt1asqWGg2B1 Yt2WCZYZEpHqjxBfjpgQWKStzp5NANfuL+KkOzi+AdaGD36k0V91cmBnssOHdwsyQ9 NXWLwfsApOixzdz2aw0fSqfWU24MLfnLv1jrgkGE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org DE709611D1 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jsanka@codeaurora.org From: Jeykumar Sankaran To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] drm: add fb max width/height fields to drm_mode_config Date: Fri, 27 Sep 2019 18:28:51 -0700 Message-Id: <1569634131-13875-2-git-send-email-jsanka@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1569634131-13875-1-git-send-email-jsanka@codeaurora.org> References: <1569634131-13875-1-git-send-email-jsanka@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190927_182920_776628_AF44A044 X-CRM114-Status: GOOD ( 13.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jeykumar Sankaran , jcrouse@codeaurora.org, seanpaul@chromium.org, robdclark@gmail.com, narmstrong@baylibre.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org The mode_config max width/height values determine the maximum resolution the pixel reader can handle. But the same values are used to restrict the size of the framebuffer creation. Hardware's with scaling blocks can operate on framebuffers larger/smaller than that of the pixel reader resolutions by scaling them down/up before rendering. This changes adds a separate framebuffer max width/height fields in drm_mode_config to allow vendors to set if they are different than that of the default max resolution values. Vendors setting these fields should fix their mode_set paths too by filtering and validating the modes against the appropriate max fields in their mode_valid() implementations. Signed-off-by: Neil Armstrong Signed-off-by: Jeykumar Sankaran --- drivers/gpu/drm/drm_framebuffer.c | 15 +++++++++++---- include/drm/drm_mode_config.h | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 5756431..2083168 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -300,14 +300,21 @@ struct drm_framebuffer * return ERR_PTR(-EINVAL); } - if ((config->min_width > r->width) || (r->width > config->max_width)) { + if ((config->min_width > r->width) || + (!config->max_fb_width && r->width > config->max_width) || + (config->max_fb_width && r->width > config->max_fb_width)) { DRM_DEBUG_KMS("bad framebuffer width %d, should be >= %d && <= %d\n", - r->width, config->min_width, config->max_width); + r->width, config->min_width, config->max_fb_width ? + config->max_fb_width : config->max_width); return ERR_PTR(-EINVAL); } - if ((config->min_height > r->height) || (r->height > config->max_height)) { + + if ((config->min_height > r->height) || + (!config->max_fb_height && r->height > config->max_height) || + (config->max_fb_height && r->height > config->max_fb_height)) { DRM_DEBUG_KMS("bad framebuffer height %d, should be >= %d && <= %d\n", - r->height, config->min_height, config->max_height); + r->height, config->min_height, config->max_fb_width ? + config->max_fb_height : config->max_height); return ERR_PTR(-EINVAL); } diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 3bcbe30..c6394ed 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -339,6 +339,8 @@ struct drm_mode_config_funcs { * @min_height: minimum fb pixel height on this device * @max_width: maximum fb pixel width on this device * @max_height: maximum fb pixel height on this device + * @max_fb_width: maximum fb buffer width if differs from max_width + * @max_fb_height: maximum fb buffer height if differs from max_height * @funcs: core driver provided mode setting functions * @fb_base: base address of the framebuffer * @poll_enabled: track polling support for this device @@ -523,6 +525,7 @@ struct drm_mode_config { int min_width, min_height; int max_width, max_height; + int max_fb_width, max_fb_height; const struct drm_mode_config_funcs *funcs; resource_size_t fb_base; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel