Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6779264ybn; Mon, 30 Sep 2019 03:42:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKdW931Msa6OuEOcLyGtDQmXk2qxyX3TwRhYIG1OeKObJsRtecHakv9In4sfsFjUfaAZ70 X-Received: by 2002:a50:91d0:: with SMTP id h16mr19468513eda.152.1569840169053; Mon, 30 Sep 2019 03:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569840169; cv=none; d=google.com; s=arc-20160816; b=WJ+Z9MKhXuo5OzpdsiCEYhBd6sVUCXn8YF68g89oHcOzR0w6yp3zzgcWPHTa/vc/es 7fdCN60swM3ZwEXFvuoK3L6WMa362FwyBFOpxRPHVU9JB0Dgkpv7FxFD0nR3DD+7BdAd 8aEAJ8C5aXXOMoCPVKUkopM2kJX19EHzHm98WY0Y2FlYBQsg8UWK0fWwP0Xp8XdPUYKF 7bSnj75j1O47mAFM8bq4jf0UAbfyIwH+YhFsbpWvtyAizPAe6BUBPkvcOtwlYyUftBX/ dqkQrRSBdNyvoSVFUvUQsqqigsedPcPeZP38F9zULhNLHgJ3n4W0irWv1m2HnUKFKFQT IJ4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=LrNooV9GdFW8ZbhiBCCT/YT3fqr5jk38A5QPnwh3FB0=; b=Rq9WtrSUVKcQIkvZwHHk5H5HiWJmlGFAq/ZsR6ZfvyyWhzpbrEsS89p+QtxYHVYVYK MJ6AezERaIUgRsF3JTrZqPGNT4TdH653g5zRR08Ycy4769tB505NcVAimVjJCItUY0P8 ONEzdb+qOQQ3P0oe+DbNunug9D18mX90hvslXv56REjz1/qaY0RiSXETX0VKdIej1hwi UO7ftjb5aemjtbG+AZQBUFanCcOnQBRMTcjG9ZmgFd0jYjLAnMHFXdCF78p2xt+CpXOd EwQXe3lRdlohUReVvET5F3AOxheeM31nO+e6mewu4OgGWksJKtXZmdfKgOGL7OCzyGSt mw/Q== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c9si6475993edv.304.2019.09.30.03.42.25; Mon, 30 Sep 2019 03:42:49 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730805AbfI3Kjg (ORCPT + 99 others); Mon, 30 Sep 2019 06:39:36 -0400 Received: from mga17.intel.com ([192.55.52.151]:55949 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729094AbfI3Kjg (ORCPT ); Mon, 30 Sep 2019 06:39:36 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Sep 2019 03:39:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,565,1559545200"; d="scan'208";a="202839979" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by orsmga002.jf.intel.com with SMTP; 30 Sep 2019 03:39:32 -0700 Received: by stinkbox (sSMTP sendmail emulation); Mon, 30 Sep 2019 13:39:31 +0300 Date: Mon, 30 Sep 2019 13:39:31 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Jeykumar Sankaran 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 Message-ID: <20190930103931.GZ1208@intel.com> References: <1569634131-13875-1-git-send-email-jsanka@codeaurora.org> <1569634131-13875-2-git-send-email-jsanka@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1569634131-13875-2-git-send-email-jsanka@codeaurora.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > 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