Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp4196947ybn; Fri, 27 Sep 2019 18:31:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNu2dg/FTlulYfA2AhV2P8UZASRLneJrnJbCDsYzylpLHa7HkNBp0JoqvPUV1b6ej7nHBu X-Received: by 2002:a17:906:168f:: with SMTP id s15mr10060561ejd.109.1569634315772; Fri, 27 Sep 2019 18:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569634315; cv=none; d=google.com; s=arc-20160816; b=Bu+MnijpPXO4/NreahnapIO3GcFScLuy7wjXIVpk8c357mn2eYhoIcy/Z6Y84YgxdJ lB/vwdmyKYYT4VTB70DhWXD4sMzDw5Ez8Dtjn5Z/sEIThOckRm2aosKi4/G/uh0OUfXw UgypONvQDlEFUWK6RRV5I6/tuAeMvDdm/t/oaGx6Agom0fA9GMMDbG9mEGzgINc+1nzK dL3NYhFz1QxTFuMAlIHGdMs/OjbuYzXKv7WagqUrOGGRxf0DXqnjSHSV+/N5rM1AkR94 EkRWBALuzzLelYmWxKjMLElT1qJJmgkEZFiog9M6zzJCJNDLtIYJ8uHaUgMMTC6li5rX lFRg== 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=KS9wou13LSlDfJ4FDrRiycStlZ/oOkfq65IguUpOiCWRs/R5LKxU3vqoK+ftmsPSHn LUva0SSEjasLJcblxHaKQetzIgo7FW5pz7Y1eBQT2/+2xCqGX3LVauBqG9kV9Y/Rnyia 2CRYyHZo4J1AYrdIzZOutdjGC7uDofO3oU0AUlQu2lXQjUsPJnUlbAzsfBoULJxGYg/l 7pVNu9krufEd0dUcEZVJ0FHzoLuR80TKj19PMqDsosTHJdMOen2bWoLU0S/BUpe58w5n UXMsTTiJmvfrejlkG4S9IC609UulLxgI8GNchqUIRCzAa8YPudW7RhYyebHACSGlPOHj 8WmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=oi+Ph7Va; dkim=pass header.i=@codeaurora.org header.s=default header.b=h6pZjOQg; 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 f45si2874076eda.345.2019.09.27.18.31.31; Fri, 27 Sep 2019 18:31: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=oi+Ph7Va; dkim=pass header.i=@codeaurora.org header.s=default header.b=h6pZjOQg; 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 S1728375AbfI1B3W (ORCPT + 99 others); Fri, 27 Sep 2019 21:29:22 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:44150 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725306AbfI1B3V (ORCPT ); Fri, 27 Sep 2019 21:29:21 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 982EE616FE; 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= 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 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 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: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> 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