Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp4199355ybn; Fri, 27 Sep 2019 18:34:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzG1Y1L9bGkC9EHBVyH7GcvKRjgYIfnGEAKN1xkZrMhPC6jMXUQKzAXUHcSW0DgZvI35LAn X-Received: by 2002:a50:b6a8:: with SMTP id d37mr7829581ede.63.1569634495844; Fri, 27 Sep 2019 18:34:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569634495; cv=none; d=google.com; s=arc-20160816; b=s/VCsIulJYurIEoHKBb3Au6g1wIeJ9cvcbX9XWeV1uxkrziCj1V6bMP7wYwIdX/lQw mpTbsXAqxb2UNIBHZpDCbAzykR3JlKPa9z7LmUxgPLUZN0bu2c2a8cnXfdXPVIek9h9l BtmPf4qtpT8Kl7pC3ZgsXH9WQYetGLvPQ3s9QbmsfsyoYXrjYPEw+0aASKfUuN/Zl2mX Zwgi9ncaLO8HrQ8txt1HymQrAAuzkUxgnSsQo5JixnriRFjQRzVo3ZE72LdmPFfn2Fu5 DZgSvgc5gnOKbImObaE4yaIn+WopVTXgpTE3Z0pGz5NJfrUcOxq6SrMZWm15cDLKBTGh 5alw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature; bh=4EbGftYVze0h8yPyrxsibNV2X4ysGBjNig4y9ylm+Ww=; b=XUl72YCIKajLuDMbXACtusFND2lhdGAU5CLEAQHicLFgHHQF10fgRVbcCFOauyOcx6 SI53U90RcNa+1ehQlKrjEiSV1cp25a2Ux69xjlNCk276F2gxxDRRJw/ku3RpTcR69wq/ ytG5E0lvlWoN963oUj8mp+rLr05yNFLIAJrxuaxi6rEDb2eIQJQVbYFLcnWew5vfPrMg ItiKBvea248gDwj2UuGQfLHk8spyprakuC9DvPdvnoWOpo9F8fKyTRJluWYWsiOp3gM+ 8+StQzWkhOX2lmAfOea3B9TnLfC2d1uxr38ml5d3urN8kG9/QuXEMFQIyz1f5caOR6R/ eV7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=c17hv9Uh; dkim=pass header.i=@codeaurora.org header.s=default header.b=gWltI+e8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x51si2833261eda.272.2019.09.27.18.34.31; Fri, 27 Sep 2019 18:34:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=c17hv9Uh; dkim=pass header.i=@codeaurora.org header.s=default header.b=gWltI+e8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728500AbfI1Bbp (ORCPT + 99 others); Fri, 27 Sep 2019 21:31:45 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:46112 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725306AbfI1Bbo (ORCPT ); Fri, 27 Sep 2019 21:31:44 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 01FDC61382; Sat, 28 Sep 2019 01:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1569634303; bh=m/+SNT1ylRadZlQdB8fVjW39Gd/vKBoLUGrjef6eP84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c17hv9Uha9O4Yc5WUJbDaV5nqWB8BdZ8/SGEZA+53oA8BJXy1pkp4y784RDbcHdAd 29h33WwL7dII3xllCezwW3NAXzAYQGRu+RCjLElwnRSmQBl5vl7fF4xzg+d0oA9sj0 JMuKwvncRhseWWoa79v086YIoxDK/l1Js8tZilJ4= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 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 48A1D61215; Sat, 28 Sep 2019 01:31:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1569634300; bh=m/+SNT1ylRadZlQdB8fVjW39Gd/vKBoLUGrjef6eP84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gWltI+e8ODxHtIEtclTtLsrsvPIs5a9B4Gwew/tlufCZvnw6SppeDSq0nMs/tFlje UFqToKo/LIIWRdNbhvAbgn6OzKFayULvC1QxqEbhX9fc0hVTCIAcDr2Zy62tdd6QBB FV9gw8s2lve5RsiNGyiCQETZyv7Wr/xhnhdi8GHE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 48A1D61215 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 Cc: Jeykumar Sankaran , narmstrong@baylibre.com, seanpaul@chromium.org, robdclark@gmail.com, jcrouse@codeaurora.org Subject: [PATCH] drm: add fb max width/height fields to drm_mode_config Date: Fri, 27 Sep 2019 18:31:24 -0700 Message-Id: <1569634284-14147-2-git-send-email-jsanka@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1569634284-14147-1-git-send-email-jsanka@codeaurora.org> References: <1569634284-14147-1-git-send-email-jsanka@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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