From patchwork Fri Oct 5 09:26:54 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: 10627699 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 09AA71515 for ; Fri, 5 Oct 2018 09:27:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F369D29236 for ; Fri, 5 Oct 2018 09:27:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E75412923D; Fri, 5 Oct 2018 09:27:00 +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=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 656EC29236 for ; Fri, 5 Oct 2018 09:27:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 470A26E777; Fri, 5 Oct 2018 09:26:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80083.outbound.protection.outlook.com [40.107.8.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0D32B6E777 for ; Fri, 5 Oct 2018 09:26:57 +0000 (UTC) Received: from DB6PR0802MB2551.eurprd08.prod.outlook.com (10.172.251.149) by DB6PR0802MB2197.eurprd08.prod.outlook.com (10.172.227.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.22; Fri, 5 Oct 2018 09:26:54 +0000 Received: from DB6PR0802MB2551.eurprd08.prod.outlook.com ([fe80::647d:f29a:a6d3:c8f2]) by DB6PR0802MB2551.eurprd08.prod.outlook.com ([fe80::647d:f29a:a6d3:c8f2%12]) with mapi id 15.20.1207.022; Fri, 5 Oct 2018 09:26:54 +0000 From: Alexandru-Cosmin Gheorghe To: "seanpaul@chromium.org" , "airlied@linux.ie" , "dri-devel@lists.freedesktop.org" , Liviu Dudau , Brian Starkey , "malidp@foss.arm.com" , "gustavo@padovan.org" , "maarten.lankhorst@linux.intel.com" , Ayan Halder , "daniel.vetter@ffwll.ch" , Raymond Smith , David Garbett , Lisa Wu , Matt Szczesiak , Charles Xu , "james qian wang (Arm Technology China)" Subject: [PATCH v3 3/6] drm: mali-dp: Enable Mali-DP tiled buffer formats Thread-Topic: [PATCH v3 3/6] drm: mali-dp: Enable Mali-DP tiled buffer formats Thread-Index: AQHUXI2OKf1B+36S9k6i+rzQwKLmLg== Date: Fri, 5 Oct 2018 09:26:54 +0000 Message-ID: <20181005092606.21100-4-alexandru-cosmin.gheorghe@arm.com> References: <20181005092606.21100-1-alexandru-cosmin.gheorghe@arm.com> In-Reply-To: <20181005092606.21100-1-alexandru-cosmin.gheorghe@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1P195CA0039.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:5a::28) To DB6PR0802MB2551.eurprd08.prod.outlook.com (2603:10a6:4:a1::21) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [217.140.106.51] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0802MB2197; 6:/+kIm/q9BEIt6cLE6xXYnUaEK3c+KxW5oBRmhu8NB6mpqyWvpLp5T1KkwfFc2UY7tb1+feUYNAb75qxaiiQUOM+mf+TY4peH8Udsmfqe5Ze6xnMm30HKbvajwKWtrNs0M/hMpg6J0UdGdxBa/vGsE2VAN3HKt+oJ3624hjdQfGcTyA+ewyHspNpnj00YlQLEKI4iJJFTO/L0cCEmNA+XXC+tCqMdlkMNcPYyUJH4tqVXpptJA9dBZtqFnnRnprEBfQICh7qhxJzJlm1f09st3QJzqhy0T0gwQjrnutI2abPXMV/t+h7da79xt8g/965oZczJ3D5wo/DPNFFwCfXgxyXMrvAUw5/eJXPStzn95UaP8n/MVBbhaB4Mlk6qEydU3ZE0P0/CLvB5MBYQDSjNvGc+HaqQs8GMvQKVeLo6vHTQ9BNJVZYBw2Fe4MM16CdRRWvdNZ4kJweRmVVKWoLTsw==; 5:oL7ZogCcfiWP9JOAVmSP4LUHAkzSDEIwejslUi7azujDKqaIigOfsclInlGZhg3+i/YW79HS7S0dP/hP+h2NrwgF8lSWKfKiqvtn4cDM4REPrNkmqoEkhHejPCUxkDP3oFKKh3foLVFxxA68Ae9MqlujugiJ5OisGTg1PqXUy9c=; 7:BUy0czj5Gj3VU7ZGaxPwnULnSn+M1Ls7quRGd4coY8JTgzoIyWx2c1KcLk0GJ34Az/nShkUbi8LlbWfRYlJ16H1aWV3ccge/399c4rT8VoNl7pLzImt9kVt0C1guGSVMu8dWrWUY1OQMZukUv6kPzXCYlHleZAHACYcKXFqPElZstm4bU3utaULHfl+tiW+wcwR9ZiyAzU3i+UrQ9nyeXBI9XGZ/nve6zZPX6UpN8R3hba7O9HHyDvFZ2FB10RzP x-ms-office365-filtering-correlation-id: 40fbbb9c-8716-4539-c983-08d62aa4b062 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0802MB2197; x-ms-traffictypediagnostic: DB6PR0802MB2197: nodisclaimer: True 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)(3002001)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(201708071742011)(7699051); SRVR:DB6PR0802MB2197; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0802MB2197; x-forefront-prvs: 0816F1D86E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(366004)(346002)(396003)(39860400002)(376002)(189003)(199004)(72206003)(68736007)(8676002)(26005)(36756003)(14454004)(256004)(186003)(11346002)(71190400001)(486006)(71200400001)(5660300001)(2616005)(6636002)(2900100001)(105586002)(106356001)(446003)(66066001)(305945005)(6506007)(7736002)(102836004)(8936002)(52116002)(76176011)(81166006)(476003)(99286004)(386003)(110136005)(316002)(54906003)(2201001)(4326008)(5250100002)(6436002)(81156014)(6486002)(2906002)(575784001)(25786009)(86362001)(1076002)(53936002)(2501003)(6116002)(3846002)(97736004)(45080400002)(478600001)(6512007)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0802MB2197; H:DB6PR0802MB2551.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: TprkLOZuWV0Z9DeMvmxoLk7NxD38dOMgmp4QH6GmeQLqzBnZkQZ1HfO8dZBILJltj5Vx5QhbE+AThQuAEAjAuI16jm03ND6guL3GehEKmM4AtAVqeHNJgnKcFUhUW6wTPb8K0+4OeBprHd6Vd+DnzCukx9NQQAsoXSM2FbLxPhMwYnU6Kd4qpPw2uNAlEStwNWRkNjvokRZJT7x7foSVtg0FHvAa18fHiWYexD8nrEnUmz0DkjUBeFy1ZSxaswKW3yHRFU8pDyK1P6wWXGdEd9KS1HB6WoLSeEhXttvYhABTEcnIzSBBbChIDQXClkKCS2JX4DSaXwMio/tzIbQ+aEtMy1yjsnQ8q3q8MDMCSz8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40fbbb9c-8716-4539-c983-08d62aa4b062 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Oct 2018 09:26:54.5464 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2197 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 , Alexandru-Cosmin 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 Reviewed-by: Liviu Dudau --- 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); }