From patchwork Fri Oct 19 10:57:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10649015 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E237D112B for ; Fri, 19 Oct 2018 10:59:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0F8B28A68 for ; Fri, 19 Oct 2018 10:59:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C497628A7F; Fri, 19 Oct 2018 10:59:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5830428A68 for ; Fri, 19 Oct 2018 10:59:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E38546E35D; Fri, 19 Oct 2018 10:58:43 +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-he1eur04on0626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::626]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F59E6E343 for ; Fri, 19 Oct 2018 10:58:37 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Fri, 19 Oct 2018 10:58:35 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, maxime.ripard@bootlin.com, maarten.lankhorst@linux.intel.com, ayan.halder@arm.com, daniel.vetter@ffwll.ch, raymond.smith@arm.com, david.garbett@arm.com, lisa.wu@arm.com, matt.szczesiak@arm.com, charles.xu@arm.com, james.qian.wang@arm.com Subject: [PATCH v5 4/9] drm: mali-dp: Enable Mali-DP tiled buffer formats Date: Fri, 19 Oct 2018 11:57:47 +0100 Message-Id: <20181019105752.17741-5-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> References: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO2P265CA0387.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::15) To AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 909329d7-fd92-4a16-9b43-08d635b1d132 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2546; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2546; 3:mCBIi0Hlp0g0BsAvnpzZ6Wq7a8yNLHNY/4pRqr9Pq8mX2YszQwenOYHYwwZUV/ffTFOPPHt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ix6SPftNo4gMVgMw7VBG/8H9g7QpVjqsStaVzHSzSUBNcrdKVsTUb9n2jm9Sm1Gq+GBQsjER/0z/WjCnZDDBtZ3q1IGt9L6XzzqLJ78LHarWnDAi+qmO1yyBZlidEaSfztPn855SWxjaELYsdCAKOyeWons8zJT1M3fjKPgSIE/IFko3HnF1c++ooV7c3yYYTTU/BFIejKJ+2jms5E4HYy7VVw7PcQ=; 4:F/qXNUzfnJe9MTxViTxdF1S5votSK9si6UrFMy/+Ah5lw6+Xt8WZrdwTwgQDMXd4y0gxgKvpdVtnubGmC6X6hgNkE0ZlJEn4k1WqHGN4D87hbJKWrqJzVFADlWAJw//70rAgjKshpKYyrrewdUX6OnZx1Y+ufeVoZHMWDpBorsBgb9QHaqfhfAzRInTXACc5McuCBKS5FVKGAkyGjqtWkPlicwMNmHXqrhedbwEJt7ri6MfDn2Pp/F/70p5in+wLZ8STg2ppgJ9ckrD2YWImj7XXzibK61W8iztpWxJIsiPhGw8grrQ5pICbI8okB2hv X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM5PR0802MB2546; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2546; X-Forefront-PRVS: 0830866D19 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(136003)(346002)(396003)(199004)(189003)(6636002)(11346002)(105586002)(81156014)(81166006)(50226002)(106356001)(4326008)(97736004)(3846002)(476003)(25786009)(6116002)(16586007)(8676002)(53936002)(50466002)(486006)(1076002)(8936002)(316002)(2616005)(956004)(16526019)(48376002)(36756003)(26005)(478600001)(45080400002)(6486002)(386003)(7696005)(186003)(52116002)(51416003)(68736007)(446003)(5660300001)(305945005)(72206003)(76176011)(7736002)(2906002)(86362001)(575784001)(66066001)(47776003)(6666004)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2546; H:e114479-lin.cambridge.arm.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-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2546; 23:cMTiN/+i+b2PdFCcLC5jMdsy0l0RTr33hSfQ0qs?= Vj39aaX3TrgU6mOUPzHBqZMCtmQweB1xMEDmlh9Hdhi5FRYrG8LmQl8t2bQmzd/TaIw5Pux9Lv7OhUlCW6kI1KM4WpZyiF0kAHJqtJmR5ljlg4f88caD1DmZrT06pDMoTStax7A0FJInxw8BsZL/oHJgBZv/AWs4iebCnFUs9UgrP/rk5fYB2uyjZSzNt+YcJjDccF5LQxWbLIUS5RT1hGhyQckgIQocK6G+OSC4rPQz8evFQhcy0zVIrQ9yMa7wsi3QINeXSD0NfzJbP2+JDdHFctPzRPHBxY/9iCFcht9Bqe1/DLoOaYYzTTj7xrVCZDqDnjzShTX0rp4fKP+Ukq3V8L6kWZKdoolUt5v7aCaVRCBieg13dNmS0Lip33wV8L5OvuvH1cyfRmVmXGacY3M2OgcZF5gDNx6uf870jhTi+YNnbkyTXCQaO7xOP4r1wyBBPCvZQNrfhbu7mKFHVZanbyCxvaefppNz71SM9E2h3uZAZHISNNzTV1vnpuaRm2bxS6J7sIEz9Gl3nZG4JmjDsiDE7b0rRZ+gzEZWBNaevj1TaedhHBIuYka+D0FOPR2T8pTpMwzw2H9v2qCVouyDvvB1YKblrfL/FD/xad9O8GVLdNNsRjW1v49ZMqA7rKOPDPMhcTBskV+R8Bg7uObUHPV2tjRY05vwvPUsgLRqx1LrFI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3o9eXlSQ484kP+pijFFmF5GULSQI0yT9Zs78Kx0ryQF6kfIBopPwJO1Tw2gS1z7uFlEM5stt3D5HrIjhu11qEEG3EDWUwBqKrGK8k0+U9Pm5x74EW15K1G+Z8l+j0fxu/sngxsNwnYD36+Ot0AZ8EhSxVv8mSKoeQk0VMCc8AIKCTZHP3GKGIvJk4ahNzsKJJU81mc8nXozQZCM497uwN6XmCD5vkQ90N7BTnEABWGcv4DZ+C/iPz7sbpV1qFqFoK6HOGgl+xzrHrQz5xZw9g+2R/HDd2GKriYYsIF2aNoKmxAYs2yP2ah//wkyK7aPtvGF2kcAyhKo/b6ebBB66CLbbdFOUPOyPIQpaQpwyTnQA==; 5:5yp5f90GHZ0awq2KrIDR5TnnnMyPOf6SV7RjQ1x6CG3ACZ0XmLLVYrKS0AtfXZJWJ5VwGFjr6VrGQosyKrLekpMiWID7kkWDMyyzW9x4Ee8wnSvcg49voXph89K4b/lJcyKdvQC51EA9QomTOR5uxuxvW1RuUuhcvnZlqovRmZo=; 7:SlkhM/jK6ZKxNNx0Jq+PKWrYXibGBLJ2NXOaIR16oA6WMpHI8hbvVD4JxIOT/R6NDvbk5/OVeJ5Thx7J7n3y69FSHIzq3WAdZLkobbiZZtdFG+x4TromQdxRqyrOJKe957vN6oEDkuLb/a/j2V/DbiKu4EavrYaSOzK1b96v2lWdbQzntrDi1eL22w3dYLhQ7xqUKKub+bmBfP5dZ5r2el0wzahkJ+bDlHL7UOUs8fRh7UF73ylb4s7mePkEy4pz SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 10:58:35.2398 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 909329d7-fd92-4a16-9b43-08d635b1d132 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2546 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: nd@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Enable the following formats - DRM_FORMAT_X0L0: DP650 - DRM_FORMAT_X0L2: DP550, DP650 Signed-off-by: Alexandru Gheorghe --- drivers/gpu/drm/arm/malidp_hw.c | 14 +++++++++++--- drivers/gpu/drm/arm/malidp_planes.c | 23 +++++++++++++++++++++-- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c index c94a4422e0e9..e01fc0e5b503 100644 --- a/drivers/gpu/drm/arm/malidp_hw.c +++ b/drivers/gpu/drm/arm/malidp_hw.c @@ -77,12 +77,18 @@ static const struct malidp_format_id malidp500_de_formats[] = { { DRM_FORMAT_YUYV, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 2) }, \ { DRM_FORMAT_UYVY, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 3) }, \ { DRM_FORMAT_NV12, DE_VIDEO1 | DE_VIDEO2 | SE_MEMWRITE, MALIDP_ID(5, 6) }, \ - { DRM_FORMAT_YUV420, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 7) } + { DRM_FORMAT_YUV420, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 7) }, \ + { DRM_FORMAT_X0L2, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(6, 6)} static const struct malidp_format_id malidp550_de_formats[] = { MALIDP_COMMON_FORMATS, }; +static const struct malidp_format_id malidp650_de_formats[] = { + MALIDP_COMMON_FORMATS, + { DRM_FORMAT_X0L0, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 4)}, +}; + static const struct malidp_layer malidp500_layers[] = { { DE_VIDEO1, MALIDP500_DE_LV_BASE, MALIDP500_DE_LV_PTR_BASE, MALIDP_DE_LV_STRIDE0, MALIDP500_LV_YUV2RGB }, { DE_GRAPHICS1, MALIDP500_DE_LG1_BASE, MALIDP500_DE_LG1_PTR_BASE, MALIDP_DE_LG_STRIDE, 0 }, @@ -595,6 +601,8 @@ static int malidp550_rotmem_required(struct malidp_hw_device *hwdev, u16 w, u16 case DRM_FORMAT_BGR565: case DRM_FORMAT_UYVY: case DRM_FORMAT_YUYV: + case DRM_FORMAT_X0L0: + case DRM_FORMAT_X0L2: bytes_per_col = 32; break; /* 16 lines at 1.5 bytes per pixel */ @@ -860,8 +868,8 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { MALIDP550_DC_IRQ_SE, .vsync_irq = MALIDP550_DC_IRQ_CONF_VALID, }, - .pixel_formats = malidp550_de_formats, - .n_pixel_formats = ARRAY_SIZE(malidp550_de_formats), + .pixel_formats = malidp650_de_formats, + .n_pixel_formats = ARRAY_SIZE(malidp650_de_formats), .bus_align_bytes = 16, }, .query_hw = malidp650_query_hw, diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 49c37f6dd63e..33bbc29da774 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -196,13 +196,26 @@ static int malidp_de_plane_check(struct drm_plane *plane, ms->n_planes = fb->format->num_planes; for (i = 0; i < ms->n_planes; i++) { u8 alignment = malidp_hw_get_pitch_align(mp->hwdev, rotated); - if (fb->pitches[i] & (alignment - 1)) { + + if ((fb->pitches[i] * drm_format_info_block_height(fb->format, i)) + & (alignment - 1)) { DRM_DEBUG_KMS("Invalid pitch %u for plane %d\n", fb->pitches[i], i); return -EINVAL; } } + if (fb->width % drm_format_info_block_width(fb->format, 0) || + fb->height % drm_format_info_block_height(fb->format, 0)) { + DRM_DEBUG_KMS("Buffer width/height needs to be a multiple of tile sizes"); + return -EINVAL; + } + if ((state->src_x >> 16) % drm_format_info_block_width(fb->format, 0) || + (state->src_y >> 16) % drm_format_info_block_height(fb->format, 0)) { + DRM_DEBUG_KMS("Plane src_x/src_y needs to be a multiple of tile sizes"); + return -EINVAL; + } + if ((state->crtc_w > mp->hwdev->max_line_size) || (state->crtc_h > mp->hwdev->max_line_size) || (state->crtc_w < mp->hwdev->min_line_size) || @@ -258,8 +271,14 @@ static void malidp_de_set_plane_pitches(struct malidp_plane *mp, num_strides = (mp->hwdev->hw->features & MALIDP_DEVICE_LV_HAS_3_STRIDES) ? 3 : 2; + /* + * The drm convention for pitch is that it needs to cover width * cpp, + * but our hardware wants the pitch/stride to cover all rows included + * in a tile. + */ for (i = 0; i < num_strides; ++i) - malidp_hw_write(mp->hwdev, pitches[i], + malidp_hw_write(mp->hwdev, pitches[i] * + drm_format_info_block_height(mp->base.state->fb->format, i), mp->layer->base + mp->layer->stride_offset + i * 4); }