From patchwork Fri Aug 30 09:08:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lowry Li (Arm Technology China)" X-Patchwork-Id: 11123541 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 91D55112C for ; Fri, 30 Aug 2019 09:09:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 711BA23426 for ; Fri, 30 Aug 2019 09:09:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 711BA23426 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D2EB6E10D; Fri, 30 Aug 2019 09:09:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20075.outbound.protection.outlook.com [40.107.2.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1F94F6E10D for ; Fri, 30 Aug 2019 09:09:13 +0000 (UTC) Received: from VI1PR08CA0112.eurprd08.prod.outlook.com (2603:10a6:800:d4::14) by VE1PR08MB4960.eurprd08.prod.outlook.com (2603:10a6:803:110::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2199.21; Fri, 30 Aug 2019 09:09:10 +0000 Received: from VE1EUR03FT003.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::208) by VI1PR08CA0112.outlook.office365.com (2603:10a6:800:d4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.18 via Frontend Transport; Fri, 30 Aug 2019 09:09:10 +0000 Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT003.mail.protection.outlook.com (10.152.18.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.16 via Frontend Transport; Fri, 30 Aug 2019 09:09:08 +0000 Received: ("Tessian outbound 802e738ad7e5:v27"); Fri, 30 Aug 2019 09:09:04 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 29a1aae052f60139 X-CR-MTA-TID: 64aa7808 Received: from 86692351870f.1 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.4.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5CCDC1CC-EB91-48FD-92CB-D5E6C6C9D874.1; Fri, 30 Aug 2019 09:08:59 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02lp2053.outbound.protection.outlook.com [104.47.4.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 86692351870f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 30 Aug 2019 09:08:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YlheBtf8ZWHJ2Hw7JPvGvCWWluQu9Ly6Igfkq2nLgEOppSxRQomePm9jaLczAkwG8W3vuRgtvs+n67usfUQpHz99FGplLtnQW9WGwkP/P5ADSQbPTKY1tVV17VMWVFzn8CylxSdTzy8jtMRMTILCndViO1iM3TVsJdEJIkJt9vB35tBYaZUHjlsySPnLmEzOowFDP4gDLZpjIfNVHS8tmnZWYkKzrE8/z3/ag1Hk6OLhTutaTsDErUZ1yYf8aMSrR9NF/79h4kvGqjlAt6FRY6sCiRZcEbvDsYlFXqzlCh5xfkpoMiP1IiKy1HNVNNpQ+bP/76JM5Ni6D+s8VodA8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GpIUF80gtFUGjYDne1JE3vRJP7DQx8AxPmhShOu2w1k=; b=WzeXXpQIsUdaPtRUPjBp+u3OO2HIYkSEQj4VayfZTi2wmLbWTxl+DY3664K3OSj/XWzTh7MEA/j6tUbyt4g3pbLCoQIfFpmf/FFLRpW3PkORNDcVQiwy43jgOTDX4J7EaEcyxtomfQjYXhceBto/FbDf525yRSVr8sUMqi44Z7w5eOgm7iG107T7ERHJCwMbHtsMKijD97HMOlSCCvfB7ESS44QIt4ggWfeArZ/KOIzrwWaVw1D5yolnpMszCQhiXeSYC3byGfsB07slf6jARJUoy1Znf+nNfMuRUvTlYwu/5Xvf7paEBhzuYat9Y27xxlMkcondsX93dgWhRfmi/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Received: from VI1PR08MB5488.eurprd08.prod.outlook.com (52.133.246.150) by VI1PR08MB3968.eurprd08.prod.outlook.com (20.178.125.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.19; Fri, 30 Aug 2019 09:08:57 +0000 Received: from VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::d09e:254b:4d3b:456b]) by VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::d09e:254b:4d3b:456b%3]) with mapi id 15.20.2220.013; Fri, 30 Aug 2019 09:08:57 +0000 From: "Lowry Li (Arm Technology China)" To: Liviu Dudau , "james qian wang (Arm Technology China)" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , Brian Starkey , Mihail Atanassov Subject: [PATCH v1 1/2] drm/komeda: Add line size support Thread-Topic: [PATCH v1 1/2] drm/komeda: Add line size support Thread-Index: AQHVXxKN6AaTkpDpcEmDMqAZzHd17w== Date: Fri, 30 Aug 2019 09:08:56 +0000 Message-ID: <20190830090835.8747-2-lowry.li@arm.com> References: <20190830090835.8747-1-lowry.li@arm.com> In-Reply-To: <20190830090835.8747-1-lowry.li@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: HK0P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:203:17::14) To VI1PR08MB5488.eurprd08.prod.outlook.com (2603:10a6:803:137::22) Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 51a9fa18-cfe8-4d37-ca15-08d72d29b73f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:VI1PR08MB3968; X-MS-TrafficTypeDiagnostic: VI1PR08MB3968:|VI1PR08MB3968:|VE1PR08MB4960: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:7691;OLM:7691; x-forefront-prvs: 0145758B1D X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(396003)(136003)(376002)(39860400002)(346002)(366004)(199004)(189003)(4326008)(66446008)(2616005)(25786009)(476003)(8676002)(2906002)(6436002)(2201001)(66556008)(81156014)(81166006)(64756008)(11346002)(99286004)(14454004)(66476007)(5660300002)(486006)(26005)(76176011)(50226002)(86362001)(7736002)(71200400001)(6636002)(66066001)(1076003)(66946007)(71190400001)(446003)(305945005)(186003)(53936002)(3846002)(6512007)(110136005)(6486002)(8936002)(2501003)(102836004)(316002)(54906003)(55236004)(478600001)(386003)(6506007)(52116002)(256004)(6116002)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3968; H:VI1PR08MB5488.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: OACPd/AC25T7XvgY2Tk1Ovix+axpgzYcj6eLz3ukHp2aTdiBT1CdJxx3yaUd/kJpy51FX/XvoJuzdeUnuTzlu4/G/49fJ86T7FDlJMbcgQSuCEv4IKbzDLFafRZRMBZk7qthHz0xi7LkwySTrrbXf4575omCHyutoaAZttkNOXp3syduClb7ohL79Ei7JU/s0fwIV9d/aHSQcYeUgYn30TpF7yZT4rpXwd+7MRxHB2TF/BvtnY9Yq+g8O5fxiOxnHYR9tw31OnUBPRe+nqfSbD0SW3bX2Jh93FyHHZc4bRkkbEouf9zTZPxmyULZMfdrom4vs6oDrDDHYjv3rKDOyUoS0ECdOW2NrwTcKDNzywsBZwJn1KrbC9NtFnrlULv43ycEhUTjUZSB/TNZvDJyzEQVn1Q/lLhlC9hyZDBf7CM= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3968 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT003.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(396003)(346002)(376002)(136003)(39860400002)(2980300002)(199004)(189003)(76130400001)(2501003)(50226002)(102836004)(386003)(47776003)(23756003)(66066001)(186003)(6486002)(14454004)(81166006)(8676002)(8936002)(2201001)(6506007)(76176011)(54906003)(81156014)(50466002)(22756006)(26005)(1076003)(99286004)(316002)(7736002)(305945005)(110136005)(36906005)(86362001)(70206006)(486006)(36756003)(63350400001)(25786009)(6636002)(126002)(70586007)(336012)(4326008)(478600001)(476003)(63370400001)(356004)(3846002)(26826003)(2616005)(2906002)(6116002)(11346002)(6512007)(5660300002)(8746002)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4960; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; A:1; MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 8ad5cdfa-d9f5-41aa-dade-08d72d29b00f X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(710020)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:VE1PR08MB4960; NoDisclaimer: True X-Forefront-PRVS: 0145758B1D X-Microsoft-Antispam-Message-Info: JbakFAF5sThIHYJZHUHHrwFCqT1xGfZeHXGXoAo+SIAYbmEuYP9I1SIOsbeSXxBO14Fi6llyaiag5JXzi/DJrsxKOo7iSMjyShpa6S6cVeDGKUgbEoQMEQvT69JdTk9fSpjNbiS0nzcF8fI8skCRn4AkX6gNk+is3rUbTDAHXx1q84xTR28lY5XAnbbv5hG1GsZEkTzOaJbXsezNUFDPtOYaWh/f+aIlPrgHd5WQcnzQ/DckadCoatSV5aaP86IJEloyTMI8WG5+vSEWj3m9TAgwnRIKTL821gNh/NTsrnlzenUEdBiT5AnF35O3LPaUWHFEZ6shuZ4Q87IisNm5bspzLvb27Ll+7FHjJrGOnE/MbxdYIk1HlRykCUS74TRy0WQuvoWV7WiyZWHfElcj9UQkrjqmuzSQXud7U+oRPDM= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2019 09:09:08.5873 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 51a9fa18-cfe8-4d37-ca15-08d72d29b73f X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4960 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GpIUF80gtFUGjYDne1JE3vRJP7DQx8AxPmhShOu2w1k=; b=9X89ydxuQxASrun1aPT6NDR9vslCFk2ASg51fRAqYrUIstf7WR9f+29z8cVnJVkJk0i9W6S4nRC3OgYgo05t7k3sKI1sl5gGBnAuc6+sarNIFLNEYD1UB/IG0JUpu7o3SVLqcpJlB+M+OSgWZ3NwdJN4D1MDnAtQsrNbxZfaq8Q= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GpIUF80gtFUGjYDne1JE3vRJP7DQx8AxPmhShOu2w1k=; b=9X89ydxuQxASrun1aPT6NDR9vslCFk2ASg51fRAqYrUIstf7WR9f+29z8cVnJVkJk0i9W6S4nRC3OgYgo05t7k3sKI1sl5gGBnAuc6+sarNIFLNEYD1UB/IG0JUpu7o3SVLqcpJlB+M+OSgWZ3NwdJN4D1MDnAtQsrNbxZfaq8Q= X-Mailman-Original-Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.freedesktop.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.freedesktop.org; dmarc=temperror action=none header.from=arm.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ayan Halder , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , nd Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On D71, we are using the global line size. From D32, every component have a line size register to indicate the fifo size. So this patch is to set line size support and do the line size check. Signed-off-by: Lowry Li (Arm Technology China) --- .../arm/display/komeda/d71/d71_component.c | 56 ++++++++++++++++--- .../gpu/drm/arm/display/komeda/d71/d71_regs.h | 8 +-- .../drm/arm/display/komeda/komeda_pipeline.h | 2 + .../display/komeda/komeda_pipeline_state.c | 17 ++++++ 4 files changed, 68 insertions(+), 15 deletions(-) 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 c985932954cb..a56dc56a72fb 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c @@ -116,6 +116,23 @@ static void dump_block_header(struct seq_file *sf, void __iomem *reg) i, hdr.output_ids[i]); } +/* On D71, we are using the global line size. From D32, every component have + * a line size register to indicate the fifo size. + */ +static u32 __get_blk_line_size(struct d71_dev *d71, u32 __iomem *reg, + u32 max_default) +{ + if (!d71->periph_addr) + max_default = malidp_read32(reg, BLK_MAX_LINE_SIZE); + + return max_default; +} + +static u32 get_blk_line_size(struct d71_dev *d71, u32 __iomem *reg) +{ + return __get_blk_line_size(d71, reg, d71->max_line_size); +} + static u32 to_rot_ctrl(u32 rot) { u32 lr_ctrl = 0; @@ -423,7 +440,27 @@ static int d71_layer_init(struct d71_dev *d71, layer->color_mgr.fgamma_mgr = d71->glb_lt_mgr; } - set_range(&layer->hsize_in, 4, d71->max_line_size); + if (!d71->periph_addr) { + /* D32 or newer product */ + layer->line_sz = malidp_read32(reg, BLK_MAX_LINE_SIZE); + layer->yuv_line_sz = L_INFO_YUV_MAX_LINESZ(layer_info); + } else if (d71->max_line_size > 2048) { + /* D71 4K */ + layer->line_sz = d71->max_line_size; + layer->yuv_line_sz = layer->line_sz / 2; + } else { + /* D71 2K */ + if (layer->layer_type == KOMEDA_FMT_RICH_LAYER) { + /* rich layer is 4K configuration */ + layer->line_sz = d71->max_line_size * 2; + layer->yuv_line_sz = layer->line_sz / 2; + } else { + layer->line_sz = d71->max_line_size; + layer->yuv_line_sz = 0; + } + } + + set_range(&layer->hsize_in, 4, layer->line_sz); set_range(&layer->vsize_in, 4, d71->max_vsize); malidp_write32(reg, LAYER_PALPHA, D71_PALPHA_DEF_MAP); @@ -676,9 +713,11 @@ static int d71_wb_layer_init(struct d71_dev *d71, wb_layer = to_layer(c); wb_layer->layer_type = KOMEDA_FMT_WB_LAYER; + wb_layer->line_sz = get_blk_line_size(d71, reg); + wb_layer->yuv_line_sz = wb_layer->line_sz; - set_range(&wb_layer->hsize_in, D71_MIN_LINE_SIZE, d71->max_line_size); - set_range(&wb_layer->vsize_in, D71_MIN_VERTICAL_SIZE, d71->max_vsize); + set_range(&wb_layer->hsize_in, 64, wb_layer->line_sz); + set_range(&wb_layer->vsize_in, 64, d71->max_vsize); return 0; } @@ -822,8 +861,8 @@ static int d71_compiz_init(struct d71_dev *d71, if (komeda_product_match(d71->mdev, MALIDP_D77_PRODUCT_ID)) compiz->support_channel_scaling = true; - set_range(&compiz->hsize, D71_MIN_LINE_SIZE, d71->max_line_size); - set_range(&compiz->vsize, D71_MIN_VERTICAL_SIZE, d71->max_vsize); + set_range(&compiz->hsize, 64, get_blk_line_size(d71, reg)); + set_range(&compiz->vsize, 64, d71->max_vsize); return 0; } @@ -980,7 +1019,7 @@ static int d71_scaler_init(struct d71_dev *d71, } scaler = to_scaler(c); - set_range(&scaler->hsize, 4, 2048); + set_range(&scaler->hsize, 4, __get_blk_line_size(d71, reg, 2048)); set_range(&scaler->vsize, 4, 4096); scaler->max_downscaling = 6; scaler->max_upscaling = 64; @@ -1089,7 +1128,7 @@ static int d71_splitter_init(struct d71_dev *d71, splitter = to_splitter(c); - set_range(&splitter->hsize, 4, d71->max_line_size); + set_range(&splitter->hsize, 4, get_blk_line_size(d71, reg)); set_range(&splitter->vsize, 4, d71->max_vsize); return 0; @@ -1240,7 +1279,8 @@ static int d71_merger_init(struct d71_dev *d71, merger = to_merger(c); - set_range(&merger->hsize_merged, 4, 4032); + set_range(&merger->hsize_merged, 4, + __get_blk_line_size(d71, reg, 4032)); set_range(&merger->vsize_merged, 4, 4096); return 0; diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h b/drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h index c1be4594bc92..a58389e623bb 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h @@ -340,6 +340,7 @@ #define L_INFO_RF BIT(0) #define L_INFO_CM BIT(1) #define L_INFO_ABUF_SIZE(x) (((x) >> 4) & 0x7) +#define L_INFO_YUV_MAX_LINESZ(x) (((x) >> 16) & 0xFFFF) /* Scaler registers */ #define SC_COEFFTAB 0x0DC @@ -570,13 +571,6 @@ enum d71_blk_type { #define D71_DEFAULT_PREPRETCH_LINE 5 #define D71_BUS_WIDTH_16_BYTES 16 -#define D71_MIN_LINE_SIZE 64 -#define D71_MIN_VERTICAL_SIZE 64 -#define D71_SC_MIN_LIN_SIZE 4 -#define D71_SC_MIN_VERTICAL_SIZE 4 -#define D71_SC_MAX_LIN_SIZE 2048 -#define D71_SC_MAX_VERTICAL_SIZE 4096 - #define D71_SC_MAX_UPSCALING 64 #define D71_SC_MAX_DOWNSCALING 6 #define D71_SC_SPLIT_OVERLAP 8 diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h index 9fe5624172ee..31d392389566 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h @@ -246,6 +246,8 @@ struct komeda_layer { struct malidp_range hsize_in, vsize_in; struct komeda_color_manager color_mgr; u32 layer_type; /* RICH, SIMPLE or WB */ + u32 line_sz; + u32 yuv_line_sz; /* maximum line size for YUV422 and YUV420 */ u32 supported_rots; /* komeda supports layer split which splits a whole image to two parts * left and right and handle them by two individual layer processors diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c index 6974c4e081bf..957c1c01ca78 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -323,6 +323,7 @@ komeda_layer_check_cfg(struct komeda_layer *layer, struct komeda_data_flow_cfg *dflow) { u32 src_x, src_y, src_w, src_h; + u32 line_sz, max_line_sz; if (!komeda_fb_is_layer_supported(kfb, layer->layer_type, dflow->rot)) return -EINVAL; @@ -352,6 +353,22 @@ komeda_layer_check_cfg(struct komeda_layer *layer, return -EINVAL; } + if (drm_rotation_90_or_270(dflow->rot)) + line_sz = dflow->in_h; + else + line_sz = dflow->in_w; + + if (kfb->base.format->hsub > 1) + max_line_sz = layer->yuv_line_sz; + else + max_line_sz = layer->line_sz; + + if (line_sz > max_line_sz) { + DRM_DEBUG_ATOMIC("Required line_sz: %d exceeds the max size %d\n", + line_sz, max_line_sz); + return -EINVAL; + } + return 0; } From patchwork Fri Aug 30 09:09:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lowry Li (Arm Technology China)" X-Patchwork-Id: 11123545 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 83AE31399 for ; Fri, 30 Aug 2019 09:09:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6253F23426 for ; Fri, 30 Aug 2019 09:09:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6253F23426 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8D1D56E29D; Fri, 30 Aug 2019 09:09:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70081.outbound.protection.outlook.com [40.107.7.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E5B06E286 for ; Fri, 30 Aug 2019 09:09:20 +0000 (UTC) Received: from VI1PR0802CA0001.eurprd08.prod.outlook.com (2603:10a6:800:aa::11) by VE1PR08MB4959.eurprd08.prod.outlook.com (2603:10a6:803:110::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.18; Fri, 30 Aug 2019 09:09:16 +0000 Received: from AM5EUR03FT015.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::209) by VI1PR0802CA0001.outlook.office365.com (2603:10a6:800:aa::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2220.19 via Frontend Transport; Fri, 30 Aug 2019 09:09:15 +0000 Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT015.mail.protection.outlook.com (10.152.16.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2220.16 via Frontend Transport; Fri, 30 Aug 2019 09:09:14 +0000 Received: ("Tessian outbound f83cc93ed55d:v27"); Fri, 30 Aug 2019 09:09:09 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 33a83909e35bc09e X-CR-MTA-TID: 64aa7808 Received: from b8f5e11fa501.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.4.59]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id E6D07AB8-7E5C-4BB6-8533-857B34935776.1; Fri, 30 Aug 2019 09:09:04 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02lp2059.outbound.protection.outlook.com [104.47.4.59]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b8f5e11fa501.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 30 Aug 2019 09:09:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K0Q+hoHo73AcGsGA5vIaMzqnY1k/BzibpKp7qskepjgYnGw+S232JWIBPG44DF6D/pI6ZvdtySvCK8gd96EphIG3AmJwZr5AExOKBZwaIQ/RgxeYQguqqQnt3iT2Xh8Us6F+X0ay42vb6aLTVzW4B4PmktcuOKyIgh6QFCXao0rShu+6U2+3hsj+521wwJvVpyYhUjSHgOHxOxg3YBA5Gv/xX7GJYRAjU7tX4MrmeMnu+maFoQgjFLuqws21HSEV81T9+wZNVOyccbkUb6Rg9s7qn8cUZdtrRB7ocDpJPbMav5rbfzM4mHOa3leUoWVdf46hKVUKpL8Hde8icZ9c9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bSMc1HqSU+dzendcqlE9OfD9/c0XihGFHJVU3k7trI8=; b=T7HNRA4RhQagVLyX0VHsjJZmOpmG7RIDBYC0p/KZ32fCveb9PUMcuhejcWGIgNuHIBGZ9SvAf43b8v2I/lJ5XbJHDUkQlXJPKE/nw5+eXKSjTybAiVAzsIPPwXCpbH7tCL2bVT/aDs8Pc0LF3eNa779FOTUOdqTBiY1qT4uqA7T/EobsoGlZZwsap2E5mg2tbbCHS/FiqxnYkMKP50NbwQ9e4mdOu+Es0pYZ3hbu2fkdnfrzCBIfYbP/A8wAdsF6tKlnY8h/qms13sIhg89H4+bNQA1qtBNxo9pOrgvJXUHCzEdLgwN5SsoedYAaABmYUKRVidTsZYtO+Gk7XH/YBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Received: from VI1PR08MB5488.eurprd08.prod.outlook.com (52.133.246.150) by VI1PR08MB3968.eurprd08.prod.outlook.com (20.178.125.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.19; Fri, 30 Aug 2019 09:09:02 +0000 Received: from VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::d09e:254b:4d3b:456b]) by VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::d09e:254b:4d3b:456b%3]) with mapi id 15.20.2220.013; Fri, 30 Aug 2019 09:09:02 +0000 From: "Lowry Li (Arm Technology China)" To: Liviu Dudau , "james qian wang (Arm Technology China)" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , Brian Starkey , Mihail Atanassov Subject: [PATCH v1 2/2] drm/komeda: Adds layer horizontal input size limitation check for D71 Thread-Topic: [PATCH v1 2/2] drm/komeda: Adds layer horizontal input size limitation check for D71 Thread-Index: AQHVXxKQ/pMPgbpj00WfLBjX5GisAQ== Date: Fri, 30 Aug 2019 09:09:02 +0000 Message-ID: <20190830090835.8747-3-lowry.li@arm.com> References: <20190830090835.8747-1-lowry.li@arm.com> In-Reply-To: <20190830090835.8747-1-lowry.li@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: HK0P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:203:17::14) To VI1PR08MB5488.eurprd08.prod.outlook.com (2603:10a6:803:137::22) Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: d26cdcf4-0ea1-4f86-645d-08d72d29ba9a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:VI1PR08MB3968; X-MS-TrafficTypeDiagnostic: VI1PR08MB3968:|VI1PR08MB3968:|VE1PR08MB4959: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:4941;OLM:4941; x-forefront-prvs: 0145758B1D X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(396003)(136003)(376002)(39860400002)(346002)(366004)(199004)(189003)(4326008)(66446008)(2616005)(25786009)(476003)(8676002)(2906002)(6436002)(2201001)(66556008)(81156014)(81166006)(64756008)(11346002)(99286004)(14454004)(66476007)(5660300002)(486006)(26005)(76176011)(50226002)(86362001)(7736002)(71200400001)(6636002)(66066001)(1076003)(66946007)(71190400001)(446003)(305945005)(186003)(53936002)(3846002)(14444005)(6512007)(110136005)(6486002)(8936002)(2501003)(102836004)(316002)(54906003)(55236004)(478600001)(386003)(6506007)(52116002)(256004)(6116002)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3968; H:VI1PR08MB5488.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: H2PdfDSjdup/gutTsHBBmHRHR8kawuYE/5qji4XmhRlJsd7/Dx8EUm9JuZ8Wpq5syZmeyuUMBFXX01+qE+gstfOWNQCdY13R+6cn9uWKdXSaYxFRcOUpcCEv5irdgCAzxeBtC7K2Gs/ATsBTx5wfn7tpeZ35+U9EI3vB8UW1swmDTKjqM56QGh665RvQqMtRD/33fd6+LWgt8MkfzWNs/8JFhUAUcfwQUZ4uW4gUTeq/5NhhHKPcgb1f24clWKwMuZj+jKZ1dgqDvoqHdQvoqjvRlOuFQSga2RR9Bs0DEr8G8uY6m4wm6b+I9RcAe00BMTpEd7oUVzQWJkp2llRFAdOSOqrEAEwszvj2mlM+5HHfvaroBM0YMZh1oGsnpNhC6QPKvQtQQTs4tQ7sVF7asrVVUSj6ioQiWryOd20U0LA= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3968 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT015.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(136003)(346002)(376002)(396003)(39860400002)(2980300002)(199004)(189003)(2906002)(478600001)(8746002)(76130400001)(6486002)(26005)(8676002)(2616005)(11346002)(446003)(63350400001)(6636002)(36906005)(14444005)(54906003)(3846002)(50466002)(99286004)(102836004)(76176011)(305945005)(7736002)(25786009)(386003)(6506007)(63370400001)(4326008)(336012)(186003)(14454004)(2501003)(2201001)(1076003)(26826003)(8936002)(70206006)(47776003)(316002)(70586007)(6116002)(50226002)(110136005)(126002)(6512007)(476003)(486006)(5660300002)(356004)(66066001)(36756003)(81156014)(81166006)(22756006)(23756003)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4959; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; A:1; MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 75274041-b547-41ab-da49-08d72d29b312 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(710020)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:VE1PR08MB4959; NoDisclaimer: True X-Forefront-PRVS: 0145758B1D X-Microsoft-Antispam-Message-Info: nGj7pXue01WXZqEm444/ApjNba123fHH3R+T9Htll7S+w7fdmanR2OPZ9L8/pUChBoIEB+MnCYOZa9uwDRc4+JNcs0s6ro1mL2bRjXrWG5+jygp+JcrKwFruCl06uN1CvDFXglZlznDHENfeXn3oQ/ogDJ5C6kpzcMgW0/vm//Guio/ZSd4YrDW5uRakC+kNTk80Heu9HYnNGHEdWIyCOpboac7DY39Pwxf9EA8CjqwNtnFSOmbuX96wluYDozBEUdTJBG9nxrK40+kNJHAwSdFUO4kctzA+ZhcpSnpL6JD2PxqhAO0PkD/y2JoPaLcNp7dIpWjNlGmKAiDDoLRLkreAta4/Keu0iDkHD/ex1oh99+aSViybvEPgIe2VXA4zV6eWITDwuD8+G+rG+GyXL5r1kJsiU/uIofDnhZOjFlI= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2019 09:09:14.3033 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d26cdcf4-0ea1-4f86-645d-08d72d29ba9a X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4959 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bSMc1HqSU+dzendcqlE9OfD9/c0XihGFHJVU3k7trI8=; b=MWfexYje0ICxVEZwVm2Lu/JyrRkKBu6JTwLWMzsBs4cgv5DPPD8lFoPEP611QodrR9wqgMHvVbqWtqIzTuBy4QsoZfQkM4t3FTqcwH9KD+liB2PrhZiX+gHRrZhZE/hhkHfvDvuSVTuzDdlTX16XOD5WN3JAyXre0TmjRseCiGI= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bSMc1HqSU+dzendcqlE9OfD9/c0XihGFHJVU3k7trI8=; b=MWfexYje0ICxVEZwVm2Lu/JyrRkKBu6JTwLWMzsBs4cgv5DPPD8lFoPEP611QodrR9wqgMHvVbqWtqIzTuBy4QsoZfQkM4t3FTqcwH9KD+liB2PrhZiX+gHRrZhZE/hhkHfvDvuSVTuzDdlTX16XOD5WN3JAyXre0TmjRseCiGI= X-Mailman-Original-Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.freedesktop.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.freedesktop.org; dmarc=temperror action=none header.from=arm.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ayan Halder , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , nd Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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) --- .../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 a56dc56a72fb..41b5bfcbd027 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c @@ -401,7 +401,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,