Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1804463ybn; Thu, 26 Sep 2019 02:27:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDYY5MH7xj+WyVX69At0e2AD8bnaGSDv0F8yGaBX/EestM5RmMkh/mV7cd6ZucdoY0PWKW X-Received: by 2002:a17:907:411d:: with SMTP id nw21mr2142785ejb.8.1569490048126; Thu, 26 Sep 2019 02:27:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569490048; cv=none; d=google.com; s=arc-20160816; b=MDu60ZIpZ6zPMrtgX/bZ3v+mBd8bftl6Ng3Jm7OBBiyfiqHVWcbwHgyH7LGtJihCXb dKFLaTufxxTN122NYmTmK81x9+J5L2jaovEBlqjVQfuaP0cTqym6hsll0StzF+2sYkaE Wi0t4e8pRZatevVzYYkBS+JkCM5/ot4lSZo+bceYCvEAQRmJZKJ/rOosmc9/KaAuhwxV toCZnm3Cbx0k5+MUqCm3dZjHhHd54P260ALcLRlm4tmo8ug3Nzyd3FZ459pCXzMk8pMB LmdeTNd7SK15vzeeOuh7QX5b4BNnwUNgSCLqYHEKgKBnlGzC7X/nxl/JFHntCfDML4kL hOKw== 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=ddWQ3e9vHUeS7QwhcX63ArnYYmogOBgFlXbNBTnw9zs=; b=uo/tgUoF2G/gPcOopqpdFvlqWoPf+tSN7L3pGJPe55ESpHS41ILVg2CG2p9vbdVjPj KIX8w19+h+8IRVa82HkL+jJ5D+mEG3DjUwWnnNm8ffZ4FLAPgd8P0DiREj9WpMM53cRw gEiXDBpQJNXIALOEbep1qZwHezZW1myoDcW8lOIoy7Z7b3bbQ7JIPccGw4qViGwU8pix GF4GufqhOXt+5dmIisOfoSbwdUcm/gl+YkJzHBsGFELxyQBrCw2rO4+6/7BVTGj+/aLX FLh+ou8RVhLnJtxkdLn3wyFtZ5TquNzH6Otjc0+QHGjsE+kF9+rOWBkLGrBfuLBMVVgO yFAg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id op4si659807ejb.77.2019.09.26.02.27.04; Thu, 26 Sep 2019 02:27:28 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389702AbfIYKZm (ORCPT + 99 others); Wed, 25 Sep 2019 06:25:42 -0400 Received: from foss.arm.com ([217.140.110.172]:46072 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729779AbfIYKZm (ORCPT ); Wed, 25 Sep 2019 06:25:42 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A572D1570; Wed, 25 Sep 2019 03:25:41 -0700 (PDT) Received: from e110455-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 62B5E3F694; Wed, 25 Sep 2019 03:25:41 -0700 (PDT) Received: by e110455-lin.cambridge.arm.com (Postfix, from userid 1000) id 2BF45682851; Wed, 25 Sep 2019 11:25:40 +0100 (BST) Date: Wed, 25 Sep 2019 11:25:40 +0100 From: Liviu Dudau To: "Lowry Li (Arm Technology China)" Cc: "james qian wang (Arm Technology China)" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , Brian Starkey , Mihail Atanassov , "Julien Yin (Arm Technology China)" , "Jonathan Chai (Arm Technology China)" , Ayan Halder , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , nd Subject: Re: [PATCH v2 2/2] drm/komeda: Adds layer horizontal input size limitation check for D71 Message-ID: <20190925102540.oepvakvcshyrhc3u@e110455-lin.cambridge.arm.com> References: <20190924080022.19250-1-lowry.li@arm.com> <20190924080022.19250-3-lowry.li@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190924080022.19250-3-lowry.li@arm.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 24, 2019 at 08:00:49AM +0000, Lowry Li (Arm Technology China) wrote: > From: "Lowry Li (Arm Technology China)" > > Adds maximum line size check according to the AFBC decoder limitation > and special Line size limitation(2046) for format: YUV420_10BIT and X0L2. > > Signed-off-by: Lowry Li (Arm Technology China) Reviewed-by: Liviu Dudau Best regards, Liviu > --- > .../arm/display/komeda/d71/d71_component.c | 49 +++++++++++++++++++ > 1 file changed, 49 insertions(+) > > diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c > index 357837b9d6ed..6740b8422f11 100644 > --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c > +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c > @@ -349,7 +349,56 @@ static void d71_layer_dump(struct komeda_component *c, struct seq_file *sf) > seq_printf(sf, "%sAD_V_CROP:\t\t0x%X\n", prefix, v[2]); > } > > +static int d71_layer_validate(struct komeda_component *c, > + struct komeda_component_state *state) > +{ > + struct komeda_layer_state *st = to_layer_st(state); > + struct komeda_layer *layer = to_layer(c); > + struct drm_plane_state *plane_st; > + struct drm_framebuffer *fb; > + u32 fourcc, line_sz, max_line_sz; > + > + plane_st = drm_atomic_get_new_plane_state(state->obj.state, > + state->plane); > + fb = plane_st->fb; > + fourcc = fb->format->format; > + > + if (drm_rotation_90_or_270(st->rot)) > + line_sz = st->vsize - st->afbc_crop_t - st->afbc_crop_b; > + else > + line_sz = st->hsize - st->afbc_crop_l - st->afbc_crop_r; > + > + if (fb->modifier) { > + if ((fb->modifier & AFBC_FORMAT_MOD_BLOCK_SIZE_MASK) == > + AFBC_FORMAT_MOD_BLOCK_SIZE_32x8) > + max_line_sz = layer->line_sz; > + else > + max_line_sz = layer->line_sz / 2; > + > + if (line_sz > max_line_sz) { > + DRM_DEBUG_ATOMIC("afbc request line_sz: %d exceed the max afbc line_sz: %d.\n", > + line_sz, max_line_sz); > + return -EINVAL; > + } > + } > + > + if (fourcc == DRM_FORMAT_YUV420_10BIT && line_sz > 2046 && (st->afbc_crop_l % 4)) { > + DRM_DEBUG_ATOMIC("YUV420_10BIT input_hsize: %d exceed the max size 2046.\n", > + line_sz); > + return -EINVAL; > + } > + > + if (fourcc == DRM_FORMAT_X0L2 && line_sz > 2046 && (st->addr[0] % 16)) { > + DRM_DEBUG_ATOMIC("X0L2 input_hsize: %d exceed the max size 2046.\n", > + line_sz); > + return -EINVAL; > + } > + > + return 0; > +} > + > static const struct komeda_component_funcs d71_layer_funcs = { > + .validate = d71_layer_validate, > .update = d71_layer_update, > .disable = d71_layer_disable, > .dump_register = d71_layer_dump, > -- > 2.17.1 > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯