Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp328413ybn; Tue, 1 Oct 2019 21:56:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQuliXK4YWv3TCjW09SQs+1I9XS34AIdORY9Roc4UkfZZMHEnKJ+eQxvkk3FU5dnXH1TXi X-Received: by 2002:a17:906:cf82:: with SMTP id um2mr1436526ejb.254.1569992214526; Tue, 01 Oct 2019 21:56:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569992214; cv=none; d=google.com; s=arc-20160816; b=FrrbDh0HOdcTu9jMLSTUnQDeHgE9nYuuDqEQSj6SoqtM8jVfJtCCqzD/yx7aOqDe/Y 58rABC3hn7brx0TGb+Su8XMBw9AbnB42RxYveUVlXjpgoP3/s0aTfABz81M4a8PqNkF3 qCoP5HQoYmjGICQM/EdAem4D6mDSCQjwGr+DAHQg302d7K1OxyJ8g4mzDmLBeM3G+N99 rJyi7i//L29O0MmCLnLy7lcVNh3YYDUBRd3jRw5A3dJQLOxkXWai38SlLQKMtwwhyemf y2alNJTnN9Y/809pzrj4YDaHKuR5jsFTYypy2K06J/HngZaTZsH+IyVdQHe2xSbtFs7t wbsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature; bh=8olJzM8TykbU/2AAY1FiWhPky68AmV+zTgeSVfj1ri4=; b=B6LFl1SlL/k3CAf+0LVmPNl3w7Cuitzx90HphExPaXupLm73FRIgFPibspnqadIHyB za+1Z7+tfTnGq91cxN8VQbOji1yQulXSO6w/yf761Iq5hkb1u4Kj4j2TPXfHzZMk4q+6 /U0MDJ+ooblwppwxFPWARXWc9s9ZTFAx5uHJs3TQ8ZhPGnrA+C4kVhZqLiF4XXrewWyl 8yW4gNL79I4t0gB7mbCYFiWKJwqGXLXaH0Msf94WGB3vQZQBXcL32ik9zwvINpo+wNnz KlMS47Gkk6/XYsFZkVbV980oC/i+QUuvPpl2cUL/A69L0QYCV0YCCT8rPlG2bRSu7cr+ 609g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=XngETgFC; dkim=pass header.i=@codeaurora.org header.s=default header.b=ScTLBS4j; 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 c21si9938353ejs.390.2019.10.01.21.56.30; Tue, 01 Oct 2019 21:56:54 -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=XngETgFC; dkim=pass header.i=@codeaurora.org header.s=default header.b=ScTLBS4j; 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 S1727750AbfJAVU6 (ORCPT + 99 others); Tue, 1 Oct 2019 17:20:58 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:52228 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726852AbfJAVU6 (ORCPT ); Tue, 1 Oct 2019 17:20:58 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D6A9E602CC; Tue, 1 Oct 2019 21:20:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1569964856; bh=w+jS0hrugZUADs46Yt3kI36QvmBAu57QkggIGJ3Zzcg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XngETgFCZ50XD0tTyUCFvvDFcbcTOY9PbEvDMs2pEECOi4kY8moKQCvLuyPo38hx6 BCEcuVXCybcaLjxytJ9hre60UDVZg6FS1Yvsethbd2VujOW74+wrFT5vban2XPbyI+ MflOMFE7mUqMGm/k4mHKJcqTWrXvMVfe0r1gnhZ0= 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 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 9C946608CE; Tue, 1 Oct 2019 21:20:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1569964855; bh=w+jS0hrugZUADs46Yt3kI36QvmBAu57QkggIGJ3Zzcg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ScTLBS4jA/VVSV/lMquq7GY7mIfey+8XcH5U6L+lWBFpEy1O+3RsYRoanjpwA8OL7 c0SET8Uf7eGiB1bsB+6YYs/maf4YL/1PIXIOiozQrzF3LjteIltl34GaMHslVhv7L9 vfdi7tRDLt/vzoiuMZ0vA8yGNJh3fAMYshB4cKBw= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 01 Oct 2019 14:20:55 -0700 From: Jeykumar Sankaran To: =?UTF-8?Q?Ville_Syrj=C3=A4l=C3=A4?= Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, seanpaul@chromium.org, narmstrong@baylibre.com Subject: Re: [PATCH] drm: add fb max width/height fields to drm_mode_config In-Reply-To: <20190930103931.GZ1208@intel.com> References: <1569634131-13875-1-git-send-email-jsanka@codeaurora.org> <1569634131-13875-2-git-send-email-jsanka@codeaurora.org> <20190930103931.GZ1208@intel.com> Message-ID: X-Sender: jsanka@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-09-30 03:39, Ville Syrjälä wrote: > On Fri, Sep 27, 2019 at 06:28:51PM -0700, Jeykumar Sankaran wrote: >> The mode_config max width/height values determine the maximum >> resolution the pixel reader can handle. > > Not according to the docs I "fixed" a while ago. > >> 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. > > If you're going to change the meaning of the old values you need > to fix the drivers too. > > Personally I don't see too much point in this since you most likely > want to validate all the other timings as well, and so likely need > some kind of mode_valid implementation anyway. Hence to validate > modes there's not much benefit of having global min/max values. > https://patchwork.kernel.org/patch/10467155/ I believe you are referring to this patch. I am primarily interested in the scaling scenario mentioned here. MSM and a few other hardware have scaling block that are used both ways: 1) Where FB limits are larger than the display limits. Scalar blocks are used to downscale the framebuffers and render within display limits. In this scenario, with your patch, are you suggesting the drivers maintain the display limits locally and use those values in fill_modes() / mode_valid() to filter out invalid modes explicitly instead of mode_config.max_width/height? 2) Where FB limits are smaller than display limits. Enforced for performance reasons on low tier hardware. It reduces the fetch bandwidth and uses post blending scalar block to scale up the pixel stream to match the display resolution. Any suggestions on how this topology can be handled with a single set of max/min values? Thanks and Regards, Jeykumar S. >> >> 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 >> >> _______________________________________________ >> dri-devel mailing list >> dri-devel@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/dri-devel > > -- > Ville Syrjälä > Intel -- Jeykumar S