From patchwork Thu Jul 30 20:36:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 11693617 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 35185138A for ; Thu, 30 Jul 2020 20:37:36 +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 0DA3E2084D for ; Thu, 30 Jul 2020 20:37:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="Fw0vdVPJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0DA3E2084D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.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 431DA6E0B7; Thu, 30 Jul 2020 20:37:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2073.outbound.protection.outlook.com [40.107.236.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id F39666E972; Thu, 30 Jul 2020 20:37:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=evtH8DCW33p75CWOAdy579GkWhoM5Ry1QY5N+FHOWCZE48KQYU96buXawP+jnoBXixPFn6JpIAX9e3lVbC3ZPAU61w6QTZFU5xtnIXstKFL6e+aNTXoZxPKeb8mBSwVwxNkF2SRVofyOx9P+SUo/zSiUq8reh9npmtC0koLAOZSjiOvoPgwpesQVAA2CkKvBQxBeh265JB8JzlFofpNxw6AYXid+WAo67ZNmbNLH3TTVYD+EZtD7uqRQFP5B9bVt7/TUa6k1bxDVz6ruhYEKy1ERJsRGHAKIZVTGtUD6q9G0sahDZLfSZG8CE8dKy7h0mWb/dhvBqIru2Fh0wOsRMA== 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=2MCKObOLz0diVw0g+cva6UXaKmZDqZ4SKh4d2yOahAo=; b=TotisRDSbvdJvto3+5Azmg271t1co9PDb/5U4OCgp2jZlOKojnKT1vYuAB37JQLy6hfYWETMrAFO1fQxMuoSLBpqhHCaJaMU+0omrwmK2Y22rLuQP21wueOKB/1RTzC7RhPCzFkyG0RkJYak48ZWiTACvOEj9DXeKtGNl8ExwN3nd+pSxiJJNnsS/mQEzmEckRuCjbDuxV0y3CmQ2kAxTgNNo6aoSZjzKaqoGF5UmcGmnIIJpUXT+BYcawX4K3vo+E4OKYZiiLsda1F066l+bLMG8HkzRUuBnT+QLywINESiCG9KT7FGmDtU3n/tYxL4Mb62LXOsbYpzYw9P/Cnj5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2MCKObOLz0diVw0g+cva6UXaKmZDqZ4SKh4d2yOahAo=; b=Fw0vdVPJnqIy0Nd3IUoOSYZHH6TxU5oTcUygw8pOlqqZrMrgzGJde69b38TOk7ltrDdc2Yr59oD/bL+ur7Y4otOpHQj3KQqYwJ7M7onocBX1n8qdLEOgzETdx3iceSJYMA74v+I2Im3nLKqeglK0FBCijn4/WKqIzHNCaLGy4aE= Received: from MWHPR19CA0094.namprd19.prod.outlook.com (2603:10b6:320:1f::32) by BY5PR12MB3953.namprd12.prod.outlook.com (2603:10b6:a03:194::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Thu, 30 Jul 2020 20:37:30 +0000 Received: from CO1NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:320:1f:cafe::17) by MWHPR19CA0094.outlook.office365.com (2603:10b6:320:1f::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.17 via Frontend Transport; Thu, 30 Jul 2020 20:37:30 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by CO1NAM11FT025.mail.protection.outlook.com (10.13.175.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3239.17 via Frontend Transport; Thu, 30 Jul 2020 20:37:29 +0000 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 30 Jul 2020 15:37:28 -0500 Received: from DESKTOP-3JO4JG6.localdomain (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Thu, 30 Jul 2020 15:37:28 -0500 From: Nicholas Kazlauskas To: , Subject: [PATCH 1/7] drm/amd/display: Store tiling_flags and tmz_surface on dm_plane_state Date: Thu, 30 Jul 2020 16:36:36 -0400 Message-ID: <20200730203642.17553-2-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> References: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8259ca65-9314-45bc-7084-08d834c86113 X-MS-TrafficTypeDiagnostic: BY5PR12MB3953: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1227; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hpSriFQ4a1KFuNw1iUr5OWvMtxR7wIcbxIXJiUiyDU+4EcKwX3jQcfSLzK3H4KGEhX7eLZxY8miAL/9G24ML9PiU60FIiRi6gOznt11zdsF8q2vi37iyRUfcpBS330yLsOp0Hx1E9Tc8QS1l3sTaIzZe6EfgsoSEMy3zCSRWMR6DOegDdDu/O6D/UUPIapFzT5hnTsplL+1hoHL4Qa/wv3imzKM+wruqV+WZ5sxryDJXg7cXGr4BOtpMYX5zRv8oRXlkOfY0C3qAoBb8RrbKbdgzbXpD7m72ZMbzkWaSmrglxfamOF0c1kn2GwAAvDrp9E9ezFPY/2wDx2AfGj0BVOM7KZOUNF/efdjsVmfdHUDG3zL/dySidVd93FpxRdkUjtIUsl/mxO4MzR0TkVWEhQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SATLEXMB01.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(136003)(39860400002)(396003)(46966005)(81166007)(70206006)(83380400001)(5660300002)(70586007)(82740400003)(26005)(356005)(82310400002)(316002)(86362001)(1076003)(186003)(6666004)(47076004)(450100002)(4326008)(426003)(478600001)(2616005)(8676002)(110136005)(54906003)(2906002)(336012)(8936002)(44832011)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2020 20:37:29.8073 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8259ca65-9314-45bc-7084-08d834c86113 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3953 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rodrigo Siqueira , Bhawanpreet Lakha , Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [Why] Store these in advance so we can reuse them later in commit_tail without having to reserve the fbo again. These will also be used for checking for tiling changes when deciding to reset the plane or not. [How] This change should mostly be a refactor. Only commit check is affected for now and I'll drop the get_fb_info calls in prepare_planes and commit_tail after. This runs a prepass loop once we think that all planes have been added to the context and replaces the get_fb_info calls with accessing the dm_plane_state instead. Cc: Bhawanpreet Lakha Cc: Rodrigo Siqueira Signed-off-by: Nicholas Kazlauskas Reviewed-by: Rodrigo Siqueira --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 60 +++++++++++-------- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 2 + 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 8d64f5fde7e2..7cc5ab90ce13 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -3700,8 +3700,17 @@ static int fill_dc_scaling_info(const struct drm_plane_state *state, static int get_fb_info(const struct amdgpu_framebuffer *amdgpu_fb, uint64_t *tiling_flags, bool *tmz_surface) { - struct amdgpu_bo *rbo = gem_to_amdgpu_bo(amdgpu_fb->base.obj[0]); - int r = amdgpu_bo_reserve(rbo, false); + struct amdgpu_bo *rbo; + int r; + + if (!amdgpu_fb) { + *tiling_flags = 0; + *tmz_surface = false; + return 0; + } + + rbo = gem_to_amdgpu_bo(amdgpu_fb->base.obj[0]); + r = amdgpu_bo_reserve(rbo, false); if (unlikely(r)) { /* Don't show error message when returning -ERESTARTSYS */ @@ -4124,13 +4133,10 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev, struct drm_crtc_state *crtc_state) { struct dm_crtc_state *dm_crtc_state = to_dm_crtc_state(crtc_state); - const struct amdgpu_framebuffer *amdgpu_fb = - to_amdgpu_framebuffer(plane_state->fb); + struct dm_plane_state *dm_plane_state = to_dm_plane_state(plane_state); struct dc_scaling_info scaling_info; struct dc_plane_info plane_info; - uint64_t tiling_flags; int ret; - bool tmz_surface = false; bool force_disable_dcc = false; ret = fill_dc_scaling_info(plane_state, &scaling_info); @@ -4142,15 +4148,12 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev, dc_plane_state->clip_rect = scaling_info.clip_rect; dc_plane_state->scaling_quality = scaling_info.scaling_quality; - ret = get_fb_info(amdgpu_fb, &tiling_flags, &tmz_surface); - if (ret) - return ret; - force_disable_dcc = adev->asic_type == CHIP_RAVEN && adev->in_suspend; - ret = fill_dc_plane_info_and_addr(adev, plane_state, tiling_flags, + ret = fill_dc_plane_info_and_addr(adev, plane_state, + dm_plane_state->tiling_flags, &plane_info, &dc_plane_state->address, - tmz_surface, + dm_plane_state->tmz_surface, force_disable_dcc); if (ret) return ret; @@ -5753,6 +5756,10 @@ dm_drm_plane_duplicate_state(struct drm_plane *plane) dc_plane_state_retain(dm_plane_state->dc_state); } + /* Framebuffer hasn't been updated yet, so retain old flags. */ + dm_plane_state->tiling_flags = old_dm_plane_state->tiling_flags; + dm_plane_state->tmz_surface = old_dm_plane_state->tmz_surface; + return &dm_plane_state->base; } @@ -8557,13 +8564,9 @@ dm_determine_update_type_for_commit(struct amdgpu_display_manager *dm, continue; for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, j) { - const struct amdgpu_framebuffer *amdgpu_fb = - to_amdgpu_framebuffer(new_plane_state->fb); struct dc_plane_info *plane_info = &bundle->plane_infos[num_plane]; struct dc_flip_addrs *flip_addr = &bundle->flip_addrs[num_plane]; struct dc_scaling_info *scaling_info = &bundle->scaling_infos[num_plane]; - uint64_t tiling_flags; - bool tmz_surface = false; new_plane_crtc = new_plane_state->crtc; new_dm_plane_state = to_dm_plane_state(new_plane_state); @@ -8610,16 +8613,12 @@ dm_determine_update_type_for_commit(struct amdgpu_display_manager *dm, bundle->surface_updates[num_plane].scaling_info = scaling_info; - if (amdgpu_fb) { - ret = get_fb_info(amdgpu_fb, &tiling_flags, &tmz_surface); - if (ret) - goto cleanup; - + if (new_plane_state->fb) { ret = fill_dc_plane_info_and_addr( - dm->adev, new_plane_state, tiling_flags, - plane_info, - &flip_addr->address, tmz_surface, - false); + dm->adev, new_plane_state, + new_dm_plane_state->tiling_flags, + plane_info, &flip_addr->address, + new_dm_plane_state->tmz_surface, false); if (ret) goto cleanup; @@ -8833,6 +8832,17 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, } } + /* Prepass for updating tiling flags on new planes. */ + for_each_new_plane_in_state(state, plane, new_plane_state, i) { + struct dm_plane_state *new_dm_plane_state = to_dm_plane_state(new_plane_state); + struct amdgpu_framebuffer *new_afb = to_amdgpu_framebuffer(new_plane_state->fb); + + ret = get_fb_info(new_afb, &new_dm_plane_state->tiling_flags, + &new_dm_plane_state->tmz_surface); + if (ret) + goto fail; + } + /* Remove exiting planes if they are modified */ for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) { ret = dm_update_plane_state(dc, state, plane, diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h index 5b6f879a108c..ad025f5cfd3e 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -409,6 +409,8 @@ struct dc_plane_state; struct dm_plane_state { struct drm_plane_state base; struct dc_plane_state *dc_state; + uint64_t tiling_flags; + bool tmz_surface; }; struct dm_crtc_state { From patchwork Thu Jul 30 20:36:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 11693629 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 654BB138A for ; Thu, 30 Jul 2020 20:37:54 +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 433852074B for ; Thu, 30 Jul 2020 20:37:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="vA7Mo/pK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 433852074B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.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 E81456E968; Thu, 30 Jul 2020 20:37:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2070.outbound.protection.outlook.com [40.107.93.70]) by gabe.freedesktop.org (Postfix) with ESMTPS id 235196E968; Thu, 30 Jul 2020 20:37:39 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YJqR9kZkhcqCO8JwwwTXelWqyxnmNPBaokxLeJSkxaC0O0DeFbDrPn/9346OeTMjZVb5pGZEMqTzj2XGpX/g/wYMjxfoaq84xl5qUkDX0qoO0bS+IkyWD95oO+fbQt+hkw4TQMCSKB5K52NvqHSVPyDiRTdvFXFyxm/4ej9R1lIts7AKfzJmAyFncRHqpecVGvmOiRmiNyU4ZNF1QDvsTVL6gVPYkczuXJiq/eOtMessBXx+TBic00ZwrbwSK5WoxQx+5Dv3Cp+vrIm/r0sViLsm7G2NfxlwYREjqXmVmiaJ+gbdI+nDF8Wuu0uM4whOUFx+FAUodOpG4cICLVqYqA== 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=U8WVkK0B4fZvLwVomCw7YDgXkP8Ga+76xN2OM96rKOc=; b=EuupxSiYxT9IkicJfRXLL/w+f/AUQ3HrNXoiKYOBDdP8/XTpqH6IhSc4kPelAiRlun+4SlJfuwkc/P8ZB8GWtBQYFO0YLplLiZIMyc83u7PZs50ydsoNSXFuUbObhQujA60etHaVsHhOgHPpOQ13bWlhOo9wz10kSImdFC4OP/ETZ2zqvNzANF/js4y1zUrnUPHcNu64kNrZf13iLNyL0DUpvLlly3s9KGLp1soU1INbon83SwRws4RPdpeoOoWWh5tcY+ssBsV7DW4mZL65qOENa8yG+lyWFWsbyrr/l63aYSsJQuaMtAwkGTNUOLh5bWwRKeTWY4JfUErkLziTkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U8WVkK0B4fZvLwVomCw7YDgXkP8Ga+76xN2OM96rKOc=; b=vA7Mo/pKlcctaPeAyngVAwqw4qxeF9gQKiDYR8VgjOhqLbRCXFMbX7SlZVGPqAfey4gstECQA/TuTejUQrKn44cVvV1IBdUpsA2yt8u8RipoqMlSTJGTLGnRjtUP5quU1SSoZRhF479JxXUll23kCJg92zEYq0ohVU64GRqtz8g= Received: from MWHPR19CA0085.namprd19.prod.outlook.com (2603:10b6:320:1f::23) by DM5PR12MB2408.namprd12.prod.outlook.com (2603:10b6:4:b9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23; Thu, 30 Jul 2020 20:37:33 +0000 Received: from CO1NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:320:1f:cafe::59) by MWHPR19CA0085.outlook.office365.com (2603:10b6:320:1f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.16 via Frontend Transport; Thu, 30 Jul 2020 20:37:33 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by CO1NAM11FT025.mail.protection.outlook.com (10.13.175.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3239.17 via Frontend Transport; Thu, 30 Jul 2020 20:37:33 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 30 Jul 2020 15:37:30 -0500 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 30 Jul 2020 15:37:29 -0500 Received: from DESKTOP-3JO4JG6.localdomain (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Thu, 30 Jul 2020 15:37:29 -0500 From: Nicholas Kazlauskas To: , Subject: [PATCH 2/7] drm/amd/display: Reset plane when tiling flags change Date: Thu, 30 Jul 2020 16:36:37 -0400 Message-ID: <20200730203642.17553-3-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> References: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce1fe0fe-3422-4e0f-01c0-08d834c86324 X-MS-TrafficTypeDiagnostic: DM5PR12MB2408: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qo8xm47dsBOVgYmpJkyOLksMxM0LdCoStUlfZyxaqUcQzch4ixodygxhCErTD2lpQRDJ976ajzN7/UEadJvlJWqHzkVMGnVt3FS6ER5lkSFdnM5msM0IRYq58AftKFhEihdVJT7qsj9l2rsXuWfKtcgm+5/0GQazf4OWh8LOp39e8XEJkzwxgr/8Ig5j1OU188mEmFKBhALN3wPjBRaR7xjWf3pSJa8MoJsvYscQXgh3CfNr39v8xVDxXvaBv/0kJDuhm6C2dw85rbjfp6se7wx0BHPWAEWi8vnl9HsgqJ81AvnHzw+vQzVPyNxsdmcjEC7nBXC4MqPTd84Q+EQD7MKEWWFhCBckvlmAMyNWePjUplk2FEVurf54THbVNZPwJdAwoPHj1ETZA+d3q/xCYw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SATLEXMB01.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFTY:; SFS:(4636009)(376002)(136003)(396003)(39860400002)(346002)(46966005)(356005)(70586007)(83380400001)(82310400002)(86362001)(2616005)(70206006)(426003)(44832011)(6666004)(186003)(1076003)(26005)(336012)(478600001)(4326008)(8936002)(8676002)(450100002)(316002)(54906003)(2906002)(82740400003)(81166007)(36756003)(47076004)(5660300002)(110136005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2020 20:37:33.2713 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce1fe0fe-3422-4e0f-01c0-08d834c86324 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2408 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hersen Wu , Rodrigo Siqueira , Bhawanpreet Lakha , Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [Why] Enabling or disable DCC or switching between tiled and linear formats can require bandwidth updates. They're currently skipping all DC validation by being treated as purely surface updates. [How] Treat tiling_flag changes (which encode DCC state) as a condition for resetting the plane. Cc: Bhawanpreet Lakha Cc: Rodrigo Siqueira Cc: Hersen Wu Signed-off-by: Nicholas Kazlauskas Reviewed-by: Hersen Wu Signed-off-by: Nicholas Kazlauskas Reviewed-by: Rodrigo Siqueira --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 7cc5ab90ce13..bf1881bd492c 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -8332,6 +8332,8 @@ static bool should_reset_plane(struct drm_atomic_state *state, * TODO: Come up with a more elegant solution for this. */ for_each_oldnew_plane_in_state(state, other, old_other_state, new_other_state, i) { + struct dm_plane_state *old_dm_plane_state, *new_dm_plane_state; + if (other->type == DRM_PLANE_TYPE_CURSOR) continue; @@ -8342,9 +8344,20 @@ static bool should_reset_plane(struct drm_atomic_state *state, if (old_other_state->crtc != new_other_state->crtc) return true; - /* TODO: Remove this once we can handle fast format changes. */ - if (old_other_state->fb && new_other_state->fb && - old_other_state->fb->format != new_other_state->fb->format) + /* Framebuffer checks fall at the end. */ + if (!old_other_state->fb || !new_other_state->fb) + continue; + + /* Pixel format changes can require bandwidth updates. */ + if (old_other_state->fb->format != new_other_state->fb->format) + return true; + + old_dm_plane_state = to_dm_plane_state(old_other_state); + new_dm_plane_state = to_dm_plane_state(new_other_state); + + /* Tiling and DCC changes also require bandwidth updates. */ + if (old_dm_plane_state->tiling_flags != + new_dm_plane_state->tiling_flags) return true; } From patchwork Thu Jul 30 20:36:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 11693627 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 CC07D138A for ; Thu, 30 Jul 2020 20:37:52 +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 AA35E2074B for ; Thu, 30 Jul 2020 20:37:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="pV4a26Gu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA35E2074B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.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 1B1266E96F; Thu, 30 Jul 2020 20:37:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-eopbgr700083.outbound.protection.outlook.com [40.107.70.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 10DE56E961; Thu, 30 Jul 2020 20:37:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AQblMz0T2Qlwa6xA0y5XMt5X0Yn1CLS+vkJs128FZ4KDhYLBEyKLyO70lN0se5jLiC6sAhyvZyss21nSNeDNLVExo08K7cHJXj0tQgbIslvk0VCIrvqc6rKsURb6ozR3gJhltXIiBkgvKyA+68QazwGtD5/ZB6Uuqcxhd7F3tfu0xW9ukyzU5U3fc562FApygdfvFYzJlQewPxftmr5196KSrTgv6VuuObsQmp8YYPk7OKaM1XTeZrMqIz59NL4ser4kMvtHnzVJsj6FLYFaDc352t3Bf5wA1h3CBNBwRH1EAbJ9vO223MoIN8Df5pXxr84EUb/kwmy9/D2arHv2yQ== 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=FyjIxa2wCpDw1DlylEWf9b+yyJmLgxVVlQpZqDHridw=; b=Mm7kAkLk0b2MQo2Vp2WLHfkvDe60TisJ/w5xl893HnE41aC4GidNDIe/u4Qzncle4++8uscoh1gLxwv8hSD/aH+esUiCMCHc+TUb3dadAtYvWAvo6eCU2oyAFYKnN5ld5sZ0iQ0ZOIdw+UkdGjEiUubM0AiyxJ1bwwXbWXvd8NpNxJKZXwcuU8Abuzqiw2XJUTLFW3qwQvSHekpsZVvhy0FJ0ip37H4RQROJi6U7CWd11mA/IKUmm1RMsd2FbL+9GakWt/pDwJ6HsYmRVEeN2i8EXOAQITVtKW+kZ13WB+EPIxlgtX8AxANJ3Sqzv2FNt1zseBxLNIV4ivnxXMtJ0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FyjIxa2wCpDw1DlylEWf9b+yyJmLgxVVlQpZqDHridw=; b=pV4a26GuJmmT5vdUizQdQFsGAjGk4CouGVjf367PTBDQaVlKeJ9nIFCd3GT6RgwJ5uazosn0lINAAI51/VWlDOi3/GbfGCjL7CjXx8nXRXr0hBj2bosNEIt5gZITGpUA5W2wTAdhH+i6zRJuqRxWclkOOvY6gAMaguTVO2Wn9Fs= Received: from MWHPR19CA0094.namprd19.prod.outlook.com (2603:10b6:320:1f::32) by MN2PR12MB4341.namprd12.prod.outlook.com (2603:10b6:208:262::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21; Thu, 30 Jul 2020 20:37:34 +0000 Received: from CO1NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:320:1f:cafe::9e) by MWHPR19CA0094.outlook.office365.com (2603:10b6:320:1f::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.17 via Frontend Transport; Thu, 30 Jul 2020 20:37:34 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by CO1NAM11FT025.mail.protection.outlook.com (10.13.175.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3239.17 via Frontend Transport; Thu, 30 Jul 2020 20:37:33 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 30 Jul 2020 15:37:30 -0500 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 30 Jul 2020 15:37:30 -0500 Received: from DESKTOP-3JO4JG6.localdomain (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Thu, 30 Jul 2020 15:37:29 -0500 From: Nicholas Kazlauskas To: , Subject: [PATCH 3/7] drm/amd/display: Avoid using unvalidated tiling_flags and tmz_surface in prepare_planes Date: Thu, 30 Jul 2020 16:36:38 -0400 Message-ID: <20200730203642.17553-4-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> References: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 423c343e-8944-4f4c-a841-08d834c86388 X-MS-TrafficTypeDiagnostic: MN2PR12MB4341: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2733; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Dbk8yN1KvCbjJ+LAR+2o+UWsYUl34txisVtQFXc8vmdH7dSrqFpg3ScSpkqVhquYy4R0gijIFICPm3d5XQXgfYWpu8Gdd1vc0fThtLpAOCzjF9cvKL5j9X9SgbTWuuWfhe/fTokp1eBQ86y/G675rmdzQ0xVvXeyL+RPD4SQn0ZVFlSdtKHvptlX4FXhezRyZrIGAAgsG2f9h64eZfppXzgUEmbSV3gvlzA3F5qytkg3ZsxeQAoFaqQEObXSLOG7ITMgq6fwGrYf8vgRWioyV0N/hjVRxZNI1U+Cud4FVay+1RNet5TpewNj3xavWSxYou/RtWjSpyf1P5rYr917xDHWoHIiiWfZMDsStfTaQ/B58/VSDf4AuRrkDOxA1XuURbAHN3dfFDkxm4sQDV74Sw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SATLEXMB01.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFTY:; SFS:(4636009)(376002)(136003)(39860400002)(396003)(346002)(46966005)(1076003)(186003)(44832011)(316002)(70586007)(81166007)(70206006)(356005)(47076004)(36756003)(82740400003)(5660300002)(8676002)(86362001)(336012)(4326008)(6666004)(54906003)(426003)(26005)(110136005)(83380400001)(450100002)(2906002)(2616005)(82310400002)(478600001)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2020 20:37:33.9320 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 423c343e-8944-4f4c-a841-08d834c86388 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4341 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rodrigo Siqueira , Bhawanpreet Lakha , Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [Why] We're racing with userspace as the flags could potentially change from when we acquired and validated them in commit_check. [How] We unfortunately can't drop this function in its entirety from prepare_planes since we don't know the afb->address at commit_check time yet. So instead of querying new tiling_flags and tmz_surface use the ones from the plane_state directly. While we're at it, also update the force_disable_dcc option based on the state from atomic check. Cc: Bhawanpreet Lakha Cc: Rodrigo Siqueira Signed-off-by: Nicholas Kazlauskas Reviewed-by: Rodrigo Siqueira --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index bf1881bd492c..f78c09c9585e 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -5794,14 +5794,8 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane, struct list_head list; struct ttm_validate_buffer tv; struct ww_acquire_ctx ticket; - uint64_t tiling_flags; uint32_t domain; int r; - bool tmz_surface = false; - bool force_disable_dcc = false; - - dm_plane_state_old = to_dm_plane_state(plane->state); - dm_plane_state_new = to_dm_plane_state(new_state); if (!new_state->fb) { DRM_DEBUG_DRIVER("No FB bound\n"); @@ -5845,27 +5839,35 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane, return r; } - amdgpu_bo_get_tiling_flags(rbo, &tiling_flags); - - tmz_surface = amdgpu_bo_encrypted(rbo); - ttm_eu_backoff_reservation(&ticket, &list); afb->address = amdgpu_bo_gpu_offset(rbo); amdgpu_bo_ref(rbo); + /** + * We don't do surface updates on planes that have been newly created, + * but we also don't have the afb->address during atomic check. + * + * Fill in buffer attributes depending on the address here, but only on + * newly created planes since they're not being used by DC yet and this + * won't modify global state. + */ + dm_plane_state_old = to_dm_plane_state(plane->state); + dm_plane_state_new = to_dm_plane_state(new_state); + if (dm_plane_state_new->dc_state && - dm_plane_state_old->dc_state != dm_plane_state_new->dc_state) { - struct dc_plane_state *plane_state = dm_plane_state_new->dc_state; + dm_plane_state_old->dc_state != dm_plane_state_new->dc_state) { + struct dc_plane_state *plane_state = + dm_plane_state_new->dc_state; + bool force_disable_dcc = !plane_state->dcc.enable; - force_disable_dcc = adev->asic_type == CHIP_RAVEN && adev->in_suspend; fill_plane_buffer_attributes( adev, afb, plane_state->format, plane_state->rotation, - tiling_flags, &plane_state->tiling_info, - &plane_state->plane_size, &plane_state->dcc, - &plane_state->address, tmz_surface, - force_disable_dcc); + dm_plane_state_new->tiling_flags, + &plane_state->tiling_info, &plane_state->plane_size, + &plane_state->dcc, &plane_state->address, + dm_plane_state_new->tmz_surface, force_disable_dcc); } return 0; From patchwork Thu Jul 30 20:36:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 11693621 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 1E6EA138A for ; Thu, 30 Jul 2020 20:37:45 +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 F06FC2074B for ; Thu, 30 Jul 2020 20:37:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="zHuyMIyz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F06FC2074B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.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 6C5E66E964; Thu, 30 Jul 2020 20:37:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2045.outbound.protection.outlook.com [40.107.94.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 106F86E961; Thu, 30 Jul 2020 20:37:35 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l6O1LUBEyLMRdlYKL96fSeBcBwwHkRjFz7CiqiTEn97y2Qb7sKOpHiniGEFqwSdViNl5HxkK5/C3CFsuDEHQftecGs04OTck8k7/d3Qy64gfzem7WQtV1iKtC/py3J1FMB7CCvCGzIzTvZuHmZclaDNog2qfvYiMhFCzIB8si9xNe077PeZwYtNlX0MbLqFd7AZPXKrx9/XNzPUqGSuReky9yAXi+VAKvU6kyDfR0dhkH2C0rYjshSkOH9fDHgwyxN49yFfVg2i6TbqXvI9+F8A2i/xaMxSdgkU0U4quRTAVSrDF/zGcksn5XeVZT3FEGRTbfgEifZkvYMFNIgh8WQ== 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=IZGWHxanRQbCIa8Xr11eHsHLmI/EsV7KHeb/qXNY5qc=; b=HmmgwJX0BM9Q/EinfNIeWNKz5rnIkNHaorEaB658GhP/8H1z0+Nesi/S+vIyTup3hRwEYezWTRz2DnblsJPPrTucCh+T0EXqMTd3hc3GOkmFN5wCc/UNSHrBtKA7WJKY80wKkhSJECebnLrpd0/Hi/8sn+ICm2k1Br5AhjBeWwwibmPB6eq++q7GlFvZL8jNbrWNiGZuzeKZcP+KWwGITSNfsIX4I/WXvNuBXH6W3CgD+n1WOTp9JJyCTsPS9G0iNkyioLpgLSNjl2zAunLQUzX8aVGIThr2FatTwlqeRnnixBw6wglle5KpMEnlZOZv5V6XsojCmKN0EbtvpqQAfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IZGWHxanRQbCIa8Xr11eHsHLmI/EsV7KHeb/qXNY5qc=; b=zHuyMIyzKUhCruvoR2J0mXdj4u3kpm8Sijm+juD2tlLHvITfStQiKUT3uWmE3vUsyLrNyZ8fGDefdf7da0jZDRD/RAfk5WnlfLEk6fR50z7W05P9RGxOxtpTpxfDpc/MB3CdAtygC7xCpgGxEiFXE5wi27E3YEVFgcc43Vszm58= Received: from CO2PR04CA0132.namprd04.prod.outlook.com (2603:10b6:104:7::34) by BN6PR1201MB0116.namprd12.prod.outlook.com (2603:10b6:405:56::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Thu, 30 Jul 2020 20:37:33 +0000 Received: from CO1NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:104:7:cafe::c0) by CO2PR04CA0132.outlook.office365.com (2603:10b6:104:7::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.16 via Frontend Transport; Thu, 30 Jul 2020 20:37:33 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB02.amd.com (165.204.84.17) by CO1NAM11FT067.mail.protection.outlook.com (10.13.174.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3239.20 via Frontend Transport; Thu, 30 Jul 2020 20:37:32 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 30 Jul 2020 15:37:31 -0500 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 30 Jul 2020 15:37:31 -0500 Received: from DESKTOP-3JO4JG6.localdomain (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Thu, 30 Jul 2020 15:37:30 -0500 From: Nicholas Kazlauskas To: , Subject: [PATCH 4/7] drm/amd/display: Use validated tiling_flags and tmz_surface in commit_tail Date: Thu, 30 Jul 2020 16:36:39 -0400 Message-ID: <20200730203642.17553-5-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> References: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7d34c66-204a-4b09-f12d-08d834c8629e X-MS-TrafficTypeDiagnostic: BN6PR1201MB0116: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zbhyhPLIcTrklb7Dv3ggWOHRTb4+tH00Nj8IAmWWtyQFBFrh9GkCqCxEJQre2cD4UCLc66Lmv7HGRAIqZjjXw6AIYp2GPmdptf8LiPcgjLkNz4uaOjz1AwsA8rYTG0/aQhnwRvW0D062QiqdtoVTVEll3FF4zbntkz95cQZygAnvIdmfg2UN8/e36oLJsuGU7D99C6+nCasnA4sOE/NAGlybKF6PXftZu1JCvUB1CO+td99LQpHTjmPjvmWNEemen5fQRLWIcT8kDHbxTof0/haSDBfZpWR/wvEh52BMjwoqTWdkWedQJCfp2CvV7b12zKkB+y6Z2QROJ+MbBnkJ7YMERi4zGsc96iKCWYqS3ivBWFFshemmB4Svy7Gzdy04tJuYahwnAeeFvPhjovUnXQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SATLEXMB02.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(396003)(136003)(346002)(376002)(46966005)(15650500001)(47076004)(81166007)(426003)(82740400003)(82310400002)(316002)(8936002)(8676002)(2616005)(44832011)(336012)(1076003)(186003)(70586007)(83380400001)(26005)(356005)(54906003)(5660300002)(4326008)(36756003)(70206006)(478600001)(86362001)(110136005)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2020 20:37:32.4003 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e7d34c66-204a-4b09-f12d-08d834c8629e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB02.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0116 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Rodrigo Siqueira , Bhawanpreet Lakha , Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [Why] So we're not racing with userspace or deadlocking DM. [How] These flags are now stored on dm_plane_state itself and acquried and validated during commit_check, so just use those instead. Cc: Daniel Vetter Cc: Bhawanpreet Lakha Cc: Rodrigo Siqueira Signed-off-by: Nicholas Kazlauskas Reviewed-by: Rodrigo Siqueira --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index f78c09c9585e..0d5f45742bb5 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -7094,8 +7094,6 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, long r; unsigned long flags; struct amdgpu_bo *abo; - uint64_t tiling_flags; - bool tmz_surface = false; uint32_t target_vblank, last_flip_vblank; bool vrr_active = amdgpu_dm_vrr_active(acrtc_state); bool pflip_present = false; @@ -7179,20 +7177,12 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, if (unlikely(r <= 0)) DRM_ERROR("Waiting for fences timed out!"); - /* - * We cannot reserve buffers here, which means the normal flag - * access functions don't work. Paper over this with READ_ONCE, - * but maybe the flags are invariant enough that not even that - * would be needed. - */ - tiling_flags = READ_ONCE(abo->tiling_flags); - tmz_surface = READ_ONCE(abo->flags) & AMDGPU_GEM_CREATE_ENCRYPTED; - fill_dc_plane_info_and_addr( - dm->adev, new_plane_state, tiling_flags, + dm->adev, new_plane_state, + dm_new_plane_state->tiling_flags, &bundle->plane_infos[planes_count], - &bundle->flip_addrs[planes_count].address, tmz_surface, - false); + &bundle->flip_addrs[planes_count].address, + dm_new_plane_state->tmz_surface, false); DRM_DEBUG_DRIVER("plane: id=%d dcc_en=%d\n", new_plane_state->plane->index, From patchwork Thu Jul 30 20:36:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 11693631 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 E25E613B6 for ; Thu, 30 Jul 2020 20:37:55 +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 C0F352074B for ; Thu, 30 Jul 2020 20:37:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="K5ZapqBv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0F352074B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.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 4BD5F6E970; Thu, 30 Jul 2020 20:37:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2046.outbound.protection.outlook.com [40.107.243.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id 934416E967; Thu, 30 Jul 2020 20:37:40 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Us10SLwZMQQ8zodDG+/f5f7j2tI2kOYNkbBy6IN9WuO/ZeIYEAvbtIU742gvTA8D1z2kqfGJLlm2qzLziPROjvBqMAP+4CLkxKKBqyvYHtVR9SSf1sUt/XH1MxxIwtUo8MhoRGaP8gMvKSfaWsI33TNzELKF6Ssx/e2OWUS3dhMZ+rtpo/FEOXuWPIPzqDzFloSsYywhptNcT3mBa6eQMdWBU3awafaSwatIO0YWXDzRBipxj1592s1c2F1A5VNftvTkoxA4R6TYt57SWKkdC9nTQURK2NF2dvnW49ehvKK0TaU0O6J2lMZoGt+WskZ+6gWW8510p6t4FJS0lBS7Dg== 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=GF0OwY5H9q+6V2tAxWB5b0Pe8xUd77HhnIMjZCsb+7U=; b=QcxGcYNIEzPsd6o8c1kH8Tu1eZ95AOlGpj+l7DoJClHuOqOjvPcQm0wb8aToXxbJgvii9/oSwfQGwFFJTa/lQG1UtK+sLSJ+V+OmfRfbHbXi2RLugg0eFDtr8TvoTlnv5zjk5bzxpKHqUa14F5tKRs3JgEqs9LDFBR2IQS6kcvsSI8fGgfRWcIC8Iw8nFcSxrLkmbxfYgD80awTYUm1jCXDdCFkzXBGSWBm8yJualzghQfWZRZdEO0wzjMR3OFTxDWlXb6YiNllDX1Ms0AV/AKi+WcSvG/+65Y+FDtn2zbZVC1h8TxdPOMlHF6pYqH0lyH4mV23ukqQ4XHVxnqHmDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GF0OwY5H9q+6V2tAxWB5b0Pe8xUd77HhnIMjZCsb+7U=; b=K5ZapqBvz/q/nK7PL1aZOi8dTicxDF6dmxI73JUekYbPKtzClkroDZWTJPWi/60FrJj5X+IvpJvBNislXzFAgfrX5t1wUph7LRn0lFELcXsQjkoCoqemiLRGSzVEiTV4tQp0xCmhrUipzIPBGKXLnKqUM5ebXNmJ/7vcdJa6m+A= Received: from MWHPR19CA0094.namprd19.prod.outlook.com (2603:10b6:320:1f::32) by MW2PR12MB2570.namprd12.prod.outlook.com (2603:10b6:907:a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Thu, 30 Jul 2020 20:37:35 +0000 Received: from CO1NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:320:1f:cafe::17) by MWHPR19CA0094.outlook.office365.com (2603:10b6:320:1f::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.17 via Frontend Transport; Thu, 30 Jul 2020 20:37:34 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by CO1NAM11FT025.mail.protection.outlook.com (10.13.175.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3239.17 via Frontend Transport; Thu, 30 Jul 2020 20:37:34 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 30 Jul 2020 15:37:32 -0500 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 30 Jul 2020 15:37:32 -0500 Received: from DESKTOP-3JO4JG6.localdomain (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Thu, 30 Jul 2020 15:37:31 -0500 From: Nicholas Kazlauskas To: , Subject: [PATCH 5/7] drm/amd/display: Reset plane for anything that's not a FAST update Date: Thu, 30 Jul 2020 16:36:40 -0400 Message-ID: <20200730203642.17553-6-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> References: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c912bef-2eab-4e8b-ff6f-08d834c863fe X-MS-TrafficTypeDiagnostic: MW2PR12MB2570: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lsDqLDZUSLJDGFB6zyRUTAFcEra2UNyYF1IMnH5z7e7xvMgA/Iy7HfTWT/YTLFtLgFkwTYLzj1QNjCOWjHVhWWey3NI9YKuGkZjV2hB1XtAg/fgXFSn/UnhC2H87TRW35ycxB0bJUTWYbVFo/UD64WoA7u6SqKooFNirFQdysXoGb/nw0/or25pu3x0WnT0y2tPM4IGq5Y9hUl3MVfEM89606fWoEDk1BFYg9qEpPt+bICe4ZeXjvApjQbKKnHyL2xiF6cn4wqpIROk76MpV4sm2HQZMkKFZzjCw/MqNDDj8Ed/vmkJ2KMPNx8KBC7VHO6p7iT54BAwTF9j7MDUDXYm+mGC5m4TzxhNMXc7l+xvEbxMrUHRxpQMxj4kwATuT6uvizyMpIgkpN3bLaptYlA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SATLEXMB01.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFTY:; SFS:(4636009)(376002)(39860400002)(346002)(396003)(136003)(46966005)(478600001)(8936002)(36756003)(316002)(86362001)(6666004)(1076003)(450100002)(4326008)(44832011)(83380400001)(2616005)(54906003)(186003)(70206006)(82740400003)(356005)(336012)(81166007)(15650500001)(47076004)(426003)(82310400002)(70586007)(2906002)(110136005)(5660300002)(8676002)(26005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2020 20:37:34.7045 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c912bef-2eab-4e8b-ff6f-08d834c863fe X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2570 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hersen Wu , Bhawanpreet Lakha , Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [Why] MEDIUM or FULL updates can require global validation or affect bandwidth. By treating these all simply as surface updates we aren't actually passing this through DC global validation. [How] There's currently no way to pass surface updates through DC global validation, nor do I think it's a good idea to change the interface to accept these. DC global validation itself is currently stateless, and we can move our update type checking to be stateless as well by duplicating DC surface checks in DM based on DRM properties. We wanted to rely on DC automatically determining this since DC knows best, but DM is ultimately what fills in everything into DC plane state so it does need to know as well. There are basically only three paths that we exercise in DM today: 1) Cursor (async update) 2) Pageflip (fast update) 3) Full pipe programming (medium/full updates) Which means that anything that's more than a pageflip really needs to go down path #3. So this change duplicates all the surface update checks based on DRM state instead inside of should_reset_plane(). Next step is dropping dm_determine_update_type_for_commit and we no longer require the old DC state at all for global validation. Optimization can come later so we don't reset DC planes at all for MEDIUM udpates and avoid validation, but we might require some extra checks in DM to achieve this. Cc: Bhawanpreet Lakha Cc: Hersen Wu Signed-off-by: Nicholas Kazlauskas Reviewed-by: Hersen Wu Signed-off-by: Nicholas Kazlauskas Reviewed-by: Rodrigo Siqueira --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 0d5f45742bb5..2cbb29199e61 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -8336,6 +8336,31 @@ static bool should_reset_plane(struct drm_atomic_state *state, if (old_other_state->crtc != new_other_state->crtc) return true; + /* Src/dst size and scaling updates. */ + if (old_other_state->src_w != new_other_state->src_w || + old_other_state->src_h != new_other_state->src_h || + old_other_state->crtc_w != new_other_state->crtc_w || + old_other_state->crtc_h != new_other_state->crtc_h) + return true; + + /* Rotation / mirroring updates. */ + if (old_other_state->rotation != new_other_state->rotation) + return true; + + /* Blending updates. */ + if (old_other_state->pixel_blend_mode != + new_other_state->pixel_blend_mode) + return true; + + /* Alpha updates. */ + if (old_other_state->alpha != new_other_state->alpha) + return true; + + /* Colorspace changes. */ + if (old_other_state->color_range != new_other_state->color_range || + old_other_state->color_encoding != new_other_state->color_encoding) + return true; + /* Framebuffer checks fall at the end. */ if (!old_other_state->fb || !new_other_state->fb) continue; From patchwork Thu Jul 30 20:36:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 11693623 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 A5180138A for ; Thu, 30 Jul 2020 20:37:47 +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 814B72074B for ; Thu, 30 Jul 2020 20:37:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="D8b/RfdO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 814B72074B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.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 0FBF76E966; Thu, 30 Jul 2020 20:37:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-eopbgr700083.outbound.protection.outlook.com [40.107.70.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3BD896E039; Thu, 30 Jul 2020 20:37:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bNQD4hcFM12L7XRbDftAdtd3Rnt1Ys9w/LJha3j0Yk5dVNya8wglIFwesbPoEKs/R5GmqKMUSMv9wILtt5e365C3A9A7Swtjx1g3vEX68YVk6j2uIhPG3W7Ag3jyUJb15VzX5s+xt1NgTdfea3rw1mVYEcP7SKZ3m5DesgIqZY8lIFEWzLK/Zoxx6cgs29W23Xg8Bbz1sktgiKFbzJo5DnmhD10xb21si6uqvQEKZZQG6AVMCA4IQ52uHR68meS2UXnYgyEjWC6fjO4KvdslhUDaxpkMnhrNZPeBvm5teaL1wBinBgewCwTKlgbvx5dqZ+FxgiA8phJpYVhWZkZhZg== 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=fM7D/lI3LBOCvNhXAYvSxYT6hQQbhBZLgCNMNrZp1vs=; b=kRKCDBCC2mXQtmvUvS0/wJbmDn2NkmV4VhOpsLhqrZS1K7N+37sAxqZjkFMMrtO91cOaSSRIOs1wfgv9FaRFxTU0sNYOxqj0mvcxG5UY4FmSFRdSnBUE4U89ld/hg25UyYeDt7Wad6e+a+bms2CrSprvesosxHJOprtjBES0GbAbu9QvUZtA7Nxp1VPdrdAZs1xoUXilBwgvPJf8/yaQoINcU1DJFaJivyTNow6BfvCOU3L4cHHtryD17H1pO15ciDWPFUqEcKCRyeeb2tPYv5wkN6FU6k0UEAJmNejuSxZgncv1GlnRtYpefVTsz0fiX2hCDI17Rz5qr/9Znzd1zw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fM7D/lI3LBOCvNhXAYvSxYT6hQQbhBZLgCNMNrZp1vs=; b=D8b/RfdO6lrSBfptFx+b2oz1f8zasqUqHlCuQXzg0LDs3odBRxdeveeFczfR5o+RWSG6J5BLvveXPBHRs66mQfCOiwif0rztsmt20HJfNR4C/DoDk1E3zc3AV71XZYUrR6g7IaRsSXaR5F5p4TG0LqOi5+kaL2sP1y4NzkHzLd0= Received: from CO2PR04CA0130.namprd04.prod.outlook.com (2603:10b6:104:7::32) by MN2PR12MB4341.namprd12.prod.outlook.com (2603:10b6:208:262::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21; Thu, 30 Jul 2020 20:37:34 +0000 Received: from CO1NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:104:7:cafe::ae) by CO2PR04CA0130.outlook.office365.com (2603:10b6:104:7::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.16 via Frontend Transport; Thu, 30 Jul 2020 20:37:34 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB02.amd.com (165.204.84.17) by CO1NAM11FT067.mail.protection.outlook.com (10.13.174.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3239.20 via Frontend Transport; Thu, 30 Jul 2020 20:37:34 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 30 Jul 2020 15:37:33 -0500 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 30 Jul 2020 15:37:32 -0500 Received: from DESKTOP-3JO4JG6.localdomain (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Thu, 30 Jul 2020 15:37:32 -0500 From: Nicholas Kazlauskas To: , Subject: [PATCH 6/7] drm/amd/display: Drop dm_determine_update_type_for_commit Date: Thu, 30 Jul 2020 16:36:41 -0400 Message-ID: <20200730203642.17553-7-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> References: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fdf2ddf3-33bf-440a-697c-08d834c863a3 X-MS-TrafficTypeDiagnostic: MN2PR12MB4341: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZG/ysHOpLkWJIEHBr/z9/03Q9vjzqkplPP6PB7jA+vhH+frYxMtrHeJecmMnrc5s4Ug3x/561kU8s7PIq/YFoimpaaNPHrtlKjcgrPqUJMUX32YIpqI7XgSuT2speSS63sId6cJoHnkEsh/s83N9xQcxAAv3rSkfxu19jRCoOCgyRliM9PnuM3BeIX/YBJODqEn9AssNzv3ghvGdMWn2OT+h936IACEjRikc5+KrvzxjDVSifUQCmLabZ2wkk2HJ7p/OsQW8kdmfXrw+0GklQnsKJdebRJCY1X94NibFytyi3xvTcDGbFxdBtN43X9n8pv8vBfZ3wEqXk+0Mn9sFptrEm87JGwRhReq/+P8Z9jYVDnmBPfOQuEiMndVp1++MoKnaWYv3URif7YkknEwSVQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SATLEXMB02.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFTY:; SFS:(4636009)(376002)(136003)(39860400002)(396003)(346002)(46966005)(1076003)(186003)(44832011)(316002)(70586007)(81166007)(70206006)(356005)(47076004)(36756003)(82740400003)(5660300002)(8676002)(86362001)(336012)(4326008)(6666004)(54906003)(426003)(26005)(110136005)(83380400001)(450100002)(2906002)(2616005)(82310400002)(478600001)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2020 20:37:34.1063 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fdf2ddf3-33bf-440a-697c-08d834c863a3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB02.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4341 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bhawanpreet Lakha , Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [Why] This was added in the past to solve the issue of not knowing when to stall for medium and full updates in DM. Since DC is ultimately decides what requires bandwidth changes we wanted to make use of it directly to determine this. The problem is that we can't actually pass any of the stream or surface updates into DC global validation, so we don't actually check if the new configuration is valid - we just validate the old existing config instead and stall for outstanding commits to finish. There's also the problem of grabbing the DRM private object for pageflips which can lead to page faults in the case where commits execute out of order and free a DRM private object state that was still required for commit tail. [How] Now that we reset the plane in DM with the same conditions DC checks we can have planes go through DC validation and we know when we need to check and stall based on whether the stream or planes changed. We mark lock_and_validation_needed whenever we've done this, so just go back to using that instead of dm_determine_update_type_for_commit. Since we'll skip resetting the plane for a pageflip we will no longer grab the DRM private object for pageflips as well, avoiding the page fault issued caused by pageflipping under load with commits executing out of order. Cc: Harry Wentland Cc: Bhawanpreet Lakha Signed-off-by: Nicholas Kazlauskas Reviewed-by: Rodrigo Siqueira --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 199 ++---------------- 1 file changed, 17 insertions(+), 182 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 2cbb29199e61..59829ec81694 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -8542,161 +8542,6 @@ static int dm_update_plane_state(struct dc *dc, return ret; } -static int -dm_determine_update_type_for_commit(struct amdgpu_display_manager *dm, - struct drm_atomic_state *state, - enum surface_update_type *out_type) -{ - struct dc *dc = dm->dc; - struct dm_atomic_state *dm_state = NULL, *old_dm_state = NULL; - int i, j, num_plane, ret = 0; - struct drm_plane_state *old_plane_state, *new_plane_state; - struct dm_plane_state *new_dm_plane_state, *old_dm_plane_state; - struct drm_crtc *new_plane_crtc; - struct drm_plane *plane; - - struct drm_crtc *crtc; - struct drm_crtc_state *new_crtc_state, *old_crtc_state; - struct dm_crtc_state *new_dm_crtc_state, *old_dm_crtc_state; - struct dc_stream_status *status = NULL; - enum surface_update_type update_type = UPDATE_TYPE_FAST; - struct surface_info_bundle { - struct dc_surface_update surface_updates[MAX_SURFACES]; - struct dc_plane_info plane_infos[MAX_SURFACES]; - struct dc_scaling_info scaling_infos[MAX_SURFACES]; - struct dc_flip_addrs flip_addrs[MAX_SURFACES]; - struct dc_stream_update stream_update; - } *bundle; - - bundle = kzalloc(sizeof(*bundle), GFP_KERNEL); - - if (!bundle) { - DRM_ERROR("Failed to allocate update bundle\n"); - /* Set type to FULL to avoid crashing in DC*/ - update_type = UPDATE_TYPE_FULL; - goto cleanup; - } - - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { - - memset(bundle, 0, sizeof(struct surface_info_bundle)); - - new_dm_crtc_state = to_dm_crtc_state(new_crtc_state); - old_dm_crtc_state = to_dm_crtc_state(old_crtc_state); - num_plane = 0; - - if (new_dm_crtc_state->stream != old_dm_crtc_state->stream) { - update_type = UPDATE_TYPE_FULL; - goto cleanup; - } - - if (!new_dm_crtc_state->stream) - continue; - - for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, j) { - struct dc_plane_info *plane_info = &bundle->plane_infos[num_plane]; - struct dc_flip_addrs *flip_addr = &bundle->flip_addrs[num_plane]; - struct dc_scaling_info *scaling_info = &bundle->scaling_infos[num_plane]; - - new_plane_crtc = new_plane_state->crtc; - new_dm_plane_state = to_dm_plane_state(new_plane_state); - old_dm_plane_state = to_dm_plane_state(old_plane_state); - - if (plane->type == DRM_PLANE_TYPE_CURSOR) - continue; - - if (new_dm_plane_state->dc_state != old_dm_plane_state->dc_state) { - update_type = UPDATE_TYPE_FULL; - goto cleanup; - } - - if (crtc != new_plane_crtc) - continue; - - bundle->surface_updates[num_plane].surface = - new_dm_plane_state->dc_state; - - if (new_crtc_state->mode_changed) { - bundle->stream_update.dst = new_dm_crtc_state->stream->dst; - bundle->stream_update.src = new_dm_crtc_state->stream->src; - } - - if (new_crtc_state->color_mgmt_changed) { - bundle->surface_updates[num_plane].gamma = - new_dm_plane_state->dc_state->gamma_correction; - bundle->surface_updates[num_plane].in_transfer_func = - new_dm_plane_state->dc_state->in_transfer_func; - bundle->surface_updates[num_plane].gamut_remap_matrix = - &new_dm_plane_state->dc_state->gamut_remap_matrix; - bundle->stream_update.gamut_remap = - &new_dm_crtc_state->stream->gamut_remap_matrix; - bundle->stream_update.output_csc_transform = - &new_dm_crtc_state->stream->csc_color_matrix; - bundle->stream_update.out_transfer_func = - new_dm_crtc_state->stream->out_transfer_func; - } - - ret = fill_dc_scaling_info(new_plane_state, - scaling_info); - if (ret) - goto cleanup; - - bundle->surface_updates[num_plane].scaling_info = scaling_info; - - if (new_plane_state->fb) { - ret = fill_dc_plane_info_and_addr( - dm->adev, new_plane_state, - new_dm_plane_state->tiling_flags, - plane_info, &flip_addr->address, - new_dm_plane_state->tmz_surface, false); - if (ret) - goto cleanup; - - bundle->surface_updates[num_plane].plane_info = plane_info; - bundle->surface_updates[num_plane].flip_addr = flip_addr; - } - - num_plane++; - } - - if (num_plane == 0) - continue; - - ret = dm_atomic_get_state(state, &dm_state); - if (ret) - goto cleanup; - - old_dm_state = dm_atomic_get_old_state(state); - if (!old_dm_state) { - ret = -EINVAL; - goto cleanup; - } - - status = dc_stream_get_status_from_state(old_dm_state->context, - new_dm_crtc_state->stream); - bundle->stream_update.stream = new_dm_crtc_state->stream; - /* - * TODO: DC modifies the surface during this call so we need - * to lock here - find a way to do this without locking. - */ - mutex_lock(&dm->dc_lock); - update_type = dc_check_update_surfaces_for_stream( - dc, bundle->surface_updates, num_plane, - &bundle->stream_update, status); - mutex_unlock(&dm->dc_lock); - - if (update_type > UPDATE_TYPE_MED) { - update_type = UPDATE_TYPE_FULL; - goto cleanup; - } - } - -cleanup: - kfree(bundle); - - *out_type = update_type; - return ret; -} #if defined(CONFIG_DRM_AMD_DC_DCN) static int add_affected_mst_dsc_crtcs(struct drm_atomic_state *state, struct drm_crtc *crtc) { @@ -8737,8 +8582,7 @@ static int add_affected_mst_dsc_crtcs(struct drm_atomic_state *state, struct drm * acquired. For full updates case which removes/adds/updates streams on one * CRTC while flipping on another CRTC, acquiring global lock will guarantee * that any such full update commit will wait for completion of any outstanding - * flip using DRMs synchronization events. See - * dm_determine_update_type_for_commit() + * flip using DRMs synchronization events. * * Note that DM adds the affected connectors for all CRTCs in state, when that * might not seem necessary. This is because DC stream creation requires the @@ -8759,15 +8603,8 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, struct drm_crtc_state *old_crtc_state, *new_crtc_state; struct drm_plane *plane; struct drm_plane_state *old_plane_state, *new_plane_state; - enum surface_update_type update_type = UPDATE_TYPE_FAST; - enum surface_update_type overall_update_type = UPDATE_TYPE_FAST; enum dc_status status; int ret, i; - - /* - * This bool will be set for true for any modeset/reset - * or plane update which implies non fast surface update. - */ bool lock_and_validation_needed = false; ret = drm_atomic_helper_check_modeset(dev, state); @@ -8961,27 +8798,23 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, if (!is_scaling_state_different(dm_new_con_state, dm_old_con_state)) continue; - overall_update_type = UPDATE_TYPE_FULL; lock_and_validation_needed = true; } - ret = dm_determine_update_type_for_commit(&adev->dm, state, &update_type); - if (ret) - goto fail; - - if (overall_update_type < update_type) - overall_update_type = update_type; - - /* - * lock_and_validation_needed was an old way to determine if we need to set - * the global lock. Leaving it in to check if we broke any corner cases - * lock_and_validation_needed true = UPDATE_TYPE_FULL or UPDATE_TYPE_MED - * lock_and_validation_needed false = UPDATE_TYPE_FAST + /** + * Streams and planes are reset when there are changes that affect + * bandwidth. Anything that affects bandwidth needs to go through + * DC global validation to ensure that the configuration can be applied + * to hardware. + * + * We have to currently stall out here in atomic_check for outstanding + * commits to finish in this case because our IRQ handlers reference + * DRM state directly - we can end up disabling interrupts too early + * if we don't. + * + * TODO: Remove this stall and drop DM state private objects. */ - if (lock_and_validation_needed && overall_update_type <= UPDATE_TYPE_FAST) - WARN(1, "Global lock should be Set, overall_update_type should be UPDATE_TYPE_MED or UPDATE_TYPE_FULL"); - - if (overall_update_type > UPDATE_TYPE_FAST) { + if (lock_and_validation_needed) { ret = dm_atomic_get_state(state, &dm_state); if (ret) goto fail; @@ -9063,7 +8896,9 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, struct dm_crtc_state *dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); - dm_new_crtc_state->update_type = (int)overall_update_type; + dm_new_crtc_state->update_type = lock_and_validation_needed ? + UPDATE_TYPE_FULL : + UPDATE_TYPE_FAST; } /* Must be success */ From patchwork Thu Jul 30 20:36:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kazlauskas, Nicholas" X-Patchwork-Id: 11693625 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 4FC3413B6 for ; Thu, 30 Jul 2020 20:37:51 +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 2E0DD2074B for ; Thu, 30 Jul 2020 20:37:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="pu0bsD1a" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E0DD2074B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.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 AD6126E965; Thu, 30 Jul 2020 20:37:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2079.outbound.protection.outlook.com [40.107.94.79]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0F4C96E0C8; Thu, 30 Jul 2020 20:37:37 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IO/el5Z5UhIAr9XJqwy+qmkjkysOshxOZjJv7kB/5s+0ry8i3m3SQbLvs0e6bOpQOLVjalKTYz5doLunAkWMqBWl4fwsCDbQ4S6AvbfavgDJvLJDe9Z4zW9OGuHxMfTd41aKr/RNXbtF4DisQhGW9zLfFDu+6kVQMkctfSnxsfvKrj4Pg/4gVNi+BmfQ/DxpNfG9u+okC7RuPPCsL8j+A1Yz41L0UE3DeAGkghWW0QGqRfDaYdwt5MjEJX6ZcPeZ5/FwRYwNbzFbMWV1eJ8SbUEQQJXWxfWyuA5aWMF4wNjkDpGkygFPmIsVTeKZRuPGrFM/CborXet4Rs7KpRm/xw== 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=DRcDpzrx1GdvXLid4GswdjbjTWC5q+QSK7RdGIU+gdA=; b=m5n7aZR+lTzaMBuGKmPUhPhKo5sVd0ExazbPo8VeH4YJrevJ1xvzRqN3yPNfCotC1ZoKd2k9GCpI/DJ52+SWUviM2vWS7DFN98Mhn70E5AKtnCidkQb0e7EwOmzrbeqrdv+a003d/uBRymf4BNFlUk9Cwf0BZwpmOmcyfdHgcKQDZstxIwYZPDJZzk6SXsBJcRxPyvXqdqRwAFe1gDyWZMCPbgTF+Iyj/aqVPwXQLd1+tL9msngha0zzTngOrgW6C61xFjU9goTLVC+p6b+a8FXDtSnf9lB2X3lC7m9T9c2DcJuucmVLfg/d8/vud/OZGztZQIMAKGnb8P+qfVUlRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DRcDpzrx1GdvXLid4GswdjbjTWC5q+QSK7RdGIU+gdA=; b=pu0bsD1a4jKBPxxgJhNDKmmpaSs2PgLpZbSmhRYubtcmWcZm5BQYi/U5gYyDqWJ4w2HDlmmCxBxgceoo9C/hGWI59uIYcQnMUa9EtLmZ9RDdyxP25fRPANph12rq4f1GpMa+wZXj1FkXcKiiXtA126+ZaDx90uLW5Cqjwi3LJnQ= Received: from CO2PR04CA0126.namprd04.prod.outlook.com (2603:10b6:104:7::28) by CY4PR12MB1894.namprd12.prod.outlook.com (2603:10b6:903:128::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Thu, 30 Jul 2020 20:37:35 +0000 Received: from CO1NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:104:7:cafe::62) by CO2PR04CA0126.outlook.office365.com (2603:10b6:104:7::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.17 via Frontend Transport; Thu, 30 Jul 2020 20:37:35 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB02.amd.com (165.204.84.17) by CO1NAM11FT067.mail.protection.outlook.com (10.13.174.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3239.20 via Frontend Transport; Thu, 30 Jul 2020 20:37:34 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 30 Jul 2020 15:37:33 -0500 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 30 Jul 2020 15:37:33 -0500 Received: from DESKTOP-3JO4JG6.localdomain (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Thu, 30 Jul 2020 15:37:33 -0500 From: Nicholas Kazlauskas To: , Subject: [PATCH 7/7] drm/amd/display: Replace DRM private objects with subclassed DRM atomic state Date: Thu, 30 Jul 2020 16:36:42 -0400 Message-ID: <20200730203642.17553-8-nicholas.kazlauskas@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> References: <20200730203642.17553-1-nicholas.kazlauskas@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f59ba684-3471-40ba-d1cb-08d834c8641a X-MS-TrafficTypeDiagnostic: CY4PR12MB1894: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VzsVFnJ3Z7wa+f1bC+o8fTfCxIBXCX7FaTCSvC7WLlXD2PQUjHud+g5zMnXm/CtoaKma76j9Hv9zQQbD9clk1Oqa4bNI1wVBVHtVPtu5AcAZS8cqZ971h1Bu+O1spWAC+aZ5oLAhQFx0nqXPfC2bTnxIdJc6LPSaKKINassl3aSAqtpZVoqy0S5ZMeROSWlcBER3P9daZZVMSbehZ/XEfhQTaSiP2xQtBZbJGc6vgBW5gczfaDeIerkUq4mmoVUHnrPloFr7R1O3QTunO9lHoxB0GrnpzAr85ih2i6h8GTM0V0/4PccGNkd/EQP24aX0dOqHnwKYjHwGMm1yXOcrKIoryfBh2WVIO/opGJ1XPUZvka+BhB2H4/qRJgpS6Zj30RGrV6kGXZ5RlIMj0PUYAQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SATLEXMB02.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(396003)(39860400002)(346002)(46966005)(86362001)(70586007)(83380400001)(81166007)(54906003)(26005)(47076004)(316002)(70206006)(6666004)(110136005)(82740400003)(44832011)(8936002)(36756003)(1076003)(356005)(4326008)(186003)(82310400002)(2906002)(426003)(336012)(478600001)(5660300002)(2616005)(30864003)(8676002); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2020 20:37:34.8898 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f59ba684-3471-40ba-d1cb-08d834c8641a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB02.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1894 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leo Li , Bhawanpreet Lakha , Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [Why] DM atomic check was structured in a way that we required old DC state in order to dynamically add and remove planes and streams from the context to build the DC state context for validation. DRM private objects were used to carry over the last DC state and were added to the context on nearly every commit - regardless of fast or full so we could check whether or not the new state could affect bandwidth. The problem with this model is that DRM private objects do not implicitly stall out other commits. So if you have two commits touching separate DRM objects they could run concurrently and potentially execute out of order - leading to a use-after-free. If we want this to be safe we have two options: 1. Stall out concurrent commits since they touch the same private object 2. Refactor DM to not require old DC state and drop private object usage [How] This implements approach #2 since it still allows for judder free updates in multi-display scenarios. I'll list the big changes in order at a high level: 1. Subclass DRM atomic state instead of using DRM private objects. DC relied on the old state to determine which changes cause bandwidth updates but now we have DM perform similar checks based on DRM state instead - dropping the requirement for old state to exist at all. This means that we can now build a new DC context from scratch whenever we have something that DM thinks could affect bandwidth. Whenever we need to rebuild bandwidth we now add all CRTCs and planes to the DRM state in order to get the absolute set of DC streams and DC planes. This introduces a stall on other commits, but this stall already exists because of the lock_and_validation logic and it's necessary since updates may move around pipes and require full reprogramming. 2. Drop workarounds to add planes to maintain z-order early in atomic check. This is no longer needed because of the changes for (1). This also involves fixing up should_plane_reset checks since we can just avoid resetting streams and planes when they haven't actually changed. 3. Rework dm_update_crtc_state and dm_update_plane_state to be single pass instead of two pass. This is necessary since we no longer have the dc_state to add and remove planes to the context in and we want to defer creation to the end of commit_check. It also makes the logic a lot simpler to follow since as an added bonus. Cc: Bhawanpreet Lakha Cc: Harry Wentland Cc: Leo Li Cc: Daniel Vetter Signed-off-by: Nicholas Kazlauskas Tested-by: Rodrigo Siqueira Reviewed-by: Rodrigo Siqueira --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 720 +++++++----------- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 11 +- 2 files changed, 280 insertions(+), 451 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 59829ec81694..97a7dfc620e8 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1839,7 +1839,6 @@ static int dm_resume(void *handle) struct drm_plane *plane; struct drm_plane_state *new_plane_state; struct dm_plane_state *dm_new_plane_state; - struct dm_atomic_state *dm_state = to_dm_atomic_state(dm->atomic_obj.state); enum dc_connection_type new_connection_type = dc_connection_none; struct dc_state *dc_state; int i, r, j; @@ -1879,11 +1878,6 @@ static int dm_resume(void *handle) return 0; } - /* Recreate dc_state - DC invalidates it when setting power state to S3. */ - dc_release_state(dm_state->context); - dm_state->context = dc_create_state(dm->dc); - /* TODO: Remove dc_state->dccg, use dc->dccg directly. */ - dc_resource_state_construct(dm->dc, dm_state->context); /* Before powering on DC we need to re-initialize DMUB. */ r = dm_dmub_hw_init(adev); @@ -2019,11 +2013,51 @@ const struct amdgpu_ip_block_version dm_ip_block = * *WIP* */ +struct drm_atomic_state *dm_atomic_state_alloc(struct drm_device *dev) +{ + struct dm_atomic_state *dm_state; + + dm_state = kzalloc(sizeof(*dm_state), GFP_KERNEL); + + if (!dm_state) + return NULL; + + if (drm_atomic_state_init(dev, &dm_state->base) < 0) { + kfree(dm_state); + return NULL; + } + + return &dm_state->base; +} + +void dm_atomic_state_free(struct drm_atomic_state *state) +{ + struct dm_atomic_state *dm_state = to_dm_atomic_state(state); + + if (dm_state->context) { + dc_release_state(dm_state->context); + dm_state->context = NULL; + } + + drm_atomic_state_default_release(state); + kfree(state); +} + +void dm_atomic_state_clear(struct drm_atomic_state *state) +{ + struct dm_atomic_state *dm_state = to_dm_atomic_state(state); + + drm_atomic_state_default_clear(&dm_state->base); +} + static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = { .fb_create = amdgpu_display_user_framebuffer_create, .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = amdgpu_dm_atomic_check, .atomic_commit = amdgpu_dm_atomic_commit, + .atomic_state_alloc = dm_atomic_state_alloc, + .atomic_state_free = dm_atomic_state_free, + .atomic_state_clear = dm_atomic_state_clear, }; static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = { @@ -2782,108 +2816,6 @@ static int dcn10_register_irq_handlers(struct amdgpu_device *adev) } #endif -/* - * Acquires the lock for the atomic state object and returns - * the new atomic state. - * - * This should only be called during atomic check. - */ -static int dm_atomic_get_state(struct drm_atomic_state *state, - struct dm_atomic_state **dm_state) -{ - struct drm_device *dev = state->dev; - struct amdgpu_device *adev = dev->dev_private; - struct amdgpu_display_manager *dm = &adev->dm; - struct drm_private_state *priv_state; - - if (*dm_state) - return 0; - - priv_state = drm_atomic_get_private_obj_state(state, &dm->atomic_obj); - if (IS_ERR(priv_state)) - return PTR_ERR(priv_state); - - *dm_state = to_dm_atomic_state(priv_state); - - return 0; -} - -static struct dm_atomic_state * -dm_atomic_get_new_state(struct drm_atomic_state *state) -{ - struct drm_device *dev = state->dev; - struct amdgpu_device *adev = dev->dev_private; - struct amdgpu_display_manager *dm = &adev->dm; - struct drm_private_obj *obj; - struct drm_private_state *new_obj_state; - int i; - - for_each_new_private_obj_in_state(state, obj, new_obj_state, i) { - if (obj->funcs == dm->atomic_obj.funcs) - return to_dm_atomic_state(new_obj_state); - } - - return NULL; -} - -static struct dm_atomic_state * -dm_atomic_get_old_state(struct drm_atomic_state *state) -{ - struct drm_device *dev = state->dev; - struct amdgpu_device *adev = dev->dev_private; - struct amdgpu_display_manager *dm = &adev->dm; - struct drm_private_obj *obj; - struct drm_private_state *old_obj_state; - int i; - - for_each_old_private_obj_in_state(state, obj, old_obj_state, i) { - if (obj->funcs == dm->atomic_obj.funcs) - return to_dm_atomic_state(old_obj_state); - } - - return NULL; -} - -static struct drm_private_state * -dm_atomic_duplicate_state(struct drm_private_obj *obj) -{ - struct dm_atomic_state *old_state, *new_state; - - new_state = kzalloc(sizeof(*new_state), GFP_KERNEL); - if (!new_state) - return NULL; - - __drm_atomic_helper_private_obj_duplicate_state(obj, &new_state->base); - - old_state = to_dm_atomic_state(obj->state); - - if (old_state && old_state->context) - new_state->context = dc_copy_state(old_state->context); - - if (!new_state->context) { - kfree(new_state); - return NULL; - } - - return &new_state->base; -} - -static void dm_atomic_destroy_state(struct drm_private_obj *obj, - struct drm_private_state *state) -{ - struct dm_atomic_state *dm_state = to_dm_atomic_state(state); - - if (dm_state && dm_state->context) - dc_release_state(dm_state->context); - - kfree(dm_state); -} - -static struct drm_private_state_funcs dm_atomic_state_funcs = { - .atomic_duplicate_state = dm_atomic_duplicate_state, - .atomic_destroy_state = dm_atomic_destroy_state, -}; - static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev) { struct dm_atomic_state *state; @@ -2916,11 +2848,6 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev) dc_resource_state_copy_construct_current(adev->dm.dc, state->context); - drm_atomic_private_obj_init(adev->ddev, - &adev->dm.atomic_obj, - &state->base, - &dm_atomic_state_funcs); - r = amdgpu_display_modeset_create_props(adev); if (r) return r; @@ -3360,7 +3287,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) static void amdgpu_dm_destroy_drm_device(struct amdgpu_display_manager *dm) { drm_mode_config_cleanup(dm->ddev); - drm_atomic_private_obj_fini(&dm->atomic_obj); return; } @@ -7533,7 +7459,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) struct drm_device *dev = state->dev; struct amdgpu_device *adev = dev->dev_private; struct amdgpu_display_manager *dm = &adev->dm; - struct dm_atomic_state *dm_state; + struct dm_atomic_state *dm_state = to_dm_atomic_state(state); struct dc_state *dc_state = NULL, *dc_state_temp = NULL; uint32_t i, j; struct drm_crtc *crtc; @@ -7547,8 +7473,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) drm_atomic_helper_update_legacy_modeset_state(dev, state); - dm_state = dm_atomic_get_new_state(state); - if (dm_state && dm_state->context) { + if (dm_state->context) { dc_state = dm_state->context; } else { /* No state changes, retain current state. */ @@ -8052,10 +7977,8 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state, struct drm_crtc_state *new_crtc_state, - bool enable, bool *lock_and_validation_needed) { - struct dm_atomic_state *dm_state = NULL; struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state; struct dc_stream_state *new_stream; int ret = 0; @@ -8077,7 +8000,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, aconnector = amdgpu_dm_find_first_crtc_matching_connector(state, crtc); /* TODO This hack should go away */ - if (aconnector && enable) { + if (aconnector) { /* Make sure fake sink is created in plug-in scenario */ drm_new_conn_state = drm_atomic_get_new_connector_state(state, &aconnector->base); @@ -8155,36 +8078,20 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, new_crtc_state->active_changed, new_crtc_state->connectors_changed); - /* Remove stream for any changed/disabled CRTC */ - if (!enable) { - - if (!dm_old_crtc_state->stream) - goto skip_modeset; - - ret = dm_atomic_get_state(state, &dm_state); - if (ret) - goto fail; - - DRM_DEBUG_DRIVER("Disabling DRM crtc: %d\n", - crtc->base.id); + /* Remove stream for changed CRTC - can't reuse it for validation. */ + if (dm_new_crtc_state->stream) { + DRM_DEBUG_DRIVER("Disabling DRM crtc: %d\n", crtc->base.id); - /* i.e. reset mode */ - if (dc_remove_stream_from_ctx( - dm->dc, - dm_state->context, - dm_old_crtc_state->stream) != DC_OK) { - ret = -EINVAL; - goto fail; - } - - dc_stream_release(dm_old_crtc_state->stream); + dc_stream_release(dm_new_crtc_state->stream); dm_new_crtc_state->stream = NULL; reset_freesync_config_for_crtc(dm_new_crtc_state); *lock_and_validation_needed = true; + } - } else {/* Add stream for any updated/enabled CRTC */ + /* Add stream for any updated/enabled CRTC - active implies enabled. */ + if (new_crtc_state->active) { /* * Quick fix to prevent NULL pointer on new_stream when * added MST connectors not found in existing crtc_state in the chained mode @@ -8193,35 +8100,13 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, if (!aconnector || (!aconnector->dc_sink && aconnector->mst_port)) goto skip_modeset; - if (modereset_required(new_crtc_state)) - goto skip_modeset; - - if (modeset_required(new_crtc_state, new_stream, - dm_old_crtc_state->stream)) { - - WARN_ON(dm_new_crtc_state->stream); - - ret = dm_atomic_get_state(state, &dm_state); - if (ret) - goto fail; - - dm_new_crtc_state->stream = new_stream; + WARN_ON(dm_new_crtc_state->stream); + dm_new_crtc_state->stream = new_stream; + dc_stream_retain(new_stream); - dc_stream_retain(new_stream); + DRM_DEBUG_DRIVER("Enabling DRM crtc: %d\n", crtc->base.id); - DRM_DEBUG_DRIVER("Enabling DRM crtc: %d\n", - crtc->base.id); - - if (dc_add_stream_to_ctx( - dm->dc, - dm_state->context, - dm_new_crtc_state->stream) != DC_OK) { - ret = -EINVAL; - goto fail; - } - - *lock_and_validation_needed = true; - } + *lock_and_validation_needed = true; } skip_modeset: @@ -8233,7 +8118,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, * We want to do dc stream updates that do not require a * full modeset below. */ - if (!(enable && aconnector && new_crtc_state->active)) + if (!(aconnector && new_crtc_state->enable && new_crtc_state->active)) return 0; /* * Given above conditions, the dc state cannot be NULL because: @@ -8281,10 +8166,12 @@ static bool should_reset_plane(struct drm_atomic_state *state, struct drm_plane_state *old_plane_state, struct drm_plane_state *new_plane_state) { - struct drm_plane *other; - struct drm_plane_state *old_other_state, *new_other_state; struct drm_crtc_state *new_crtc_state; - int i; + struct dm_plane_state *old_dm_plane_state, *new_dm_plane_state; + + /* Cursor planes don't affect bandwidth. */ + if (plane->type == DRM_PLANE_TYPE_CURSOR) + return false; /* * TODO: Remove this hack once the checks below are sufficient @@ -8312,71 +8199,50 @@ static bool should_reset_plane(struct drm_atomic_state *state, if (new_crtc_state->color_mgmt_changed) return true; + /* Plane scaling can change with a modeset, so reset. */ if (drm_atomic_crtc_needs_modeset(new_crtc_state)) return true; - /* - * If there are any new primary or overlay planes being added or - * removed then the z-order can potentially change. To ensure - * correct z-order and pipe acquisition the current DC architecture - * requires us to remove and recreate all existing planes. - * - * TODO: Come up with a more elegant solution for this. - */ - for_each_oldnew_plane_in_state(state, other, old_other_state, new_other_state, i) { - struct dm_plane_state *old_dm_plane_state, *new_dm_plane_state; - - if (other->type == DRM_PLANE_TYPE_CURSOR) - continue; - - if (old_other_state->crtc != new_plane_state->crtc && - new_other_state->crtc != new_plane_state->crtc) - continue; - - if (old_other_state->crtc != new_other_state->crtc) - return true; - - /* Src/dst size and scaling updates. */ - if (old_other_state->src_w != new_other_state->src_w || - old_other_state->src_h != new_other_state->src_h || - old_other_state->crtc_w != new_other_state->crtc_w || - old_other_state->crtc_h != new_other_state->crtc_h) - return true; + /* Src/dst size and scaling updates. */ + if (old_plane_state->src_w != new_plane_state->src_w || + old_plane_state->src_h != new_plane_state->src_h || + old_plane_state->crtc_w != new_plane_state->crtc_w || + old_plane_state->crtc_h != new_plane_state->crtc_h) + return true; - /* Rotation / mirroring updates. */ - if (old_other_state->rotation != new_other_state->rotation) - return true; + /* Rotation / mirroring updates. */ + if (old_plane_state->rotation != new_plane_state->rotation) + return true; - /* Blending updates. */ - if (old_other_state->pixel_blend_mode != - new_other_state->pixel_blend_mode) - return true; + /* Blending updates. */ + if (old_plane_state->pixel_blend_mode != + new_plane_state->pixel_blend_mode) + return true; - /* Alpha updates. */ - if (old_other_state->alpha != new_other_state->alpha) - return true; + /* Alpha updates. */ + if (old_plane_state->alpha != new_plane_state->alpha) + return true; - /* Colorspace changes. */ - if (old_other_state->color_range != new_other_state->color_range || - old_other_state->color_encoding != new_other_state->color_encoding) - return true; + /* Colorspace changes. */ + if (old_plane_state->color_range != new_plane_state->color_range || + old_plane_state->color_encoding != new_plane_state->color_encoding) + return true; - /* Framebuffer checks fall at the end. */ - if (!old_other_state->fb || !new_other_state->fb) - continue; + /* Framebuffer checks fall at the end. */ + if (!old_plane_state->fb || !new_plane_state->fb) + return false; - /* Pixel format changes can require bandwidth updates. */ - if (old_other_state->fb->format != new_other_state->fb->format) - return true; + /* Pixel format changes can require bandwidth updates. */ + if (old_plane_state->fb->format != new_plane_state->fb->format) + return true; - old_dm_plane_state = to_dm_plane_state(old_other_state); - new_dm_plane_state = to_dm_plane_state(new_other_state); + old_dm_plane_state = to_dm_plane_state(old_plane_state); + new_dm_plane_state = to_dm_plane_state(new_plane_state); - /* Tiling and DCC changes also require bandwidth updates. */ - if (old_dm_plane_state->tiling_flags != - new_dm_plane_state->tiling_flags) - return true; - } + /* Tiling and DCC changes also require bandwidth updates. */ + if (old_dm_plane_state->tiling_flags != + new_dm_plane_state->tiling_flags) + return true; return false; } @@ -8386,15 +8252,12 @@ static int dm_update_plane_state(struct dc *dc, struct drm_plane *plane, struct drm_plane_state *old_plane_state, struct drm_plane_state *new_plane_state, - bool enable, bool *lock_and_validation_needed) { - - struct dm_atomic_state *dm_state = NULL; struct drm_crtc *new_plane_crtc, *old_plane_crtc; - struct drm_crtc_state *old_crtc_state, *new_crtc_state; - struct dm_crtc_state *dm_new_crtc_state, *dm_old_crtc_state; - struct dm_plane_state *dm_new_plane_state, *dm_old_plane_state; + struct drm_crtc_state *new_crtc_state; + struct dm_crtc_state *dm_new_crtc_state; + struct dm_plane_state *dm_new_plane_state; struct amdgpu_crtc *new_acrtc; bool needs_reset; int ret = 0; @@ -8403,12 +8266,12 @@ static int dm_update_plane_state(struct dc *dc, new_plane_crtc = new_plane_state->crtc; old_plane_crtc = old_plane_state->crtc; dm_new_plane_state = to_dm_plane_state(new_plane_state); - dm_old_plane_state = to_dm_plane_state(old_plane_state); /*TODO Implement better atomic check for cursor plane */ if (plane->type == DRM_PLANE_TYPE_CURSOR) { - if (!enable || !new_plane_crtc || - drm_atomic_plane_disabling(plane->state, new_plane_state)) + /* Cursor disabled is always OK. */ + if (!new_plane_crtc || + drm_atomic_plane_disabling(plane->state, new_plane_state)) return 0; new_acrtc = to_amdgpu_crtc(new_plane_crtc); @@ -8423,123 +8286,72 @@ static int dm_update_plane_state(struct dc *dc, return 0; } + /* Check if the plane requires a reset for bandwidth validation. */ needs_reset = should_reset_plane(state, plane, old_plane_state, new_plane_state); - /* Remove any changed/removed planes */ - if (!enable) { - if (!needs_reset) - return 0; - - if (!old_plane_crtc) - return 0; - - old_crtc_state = drm_atomic_get_old_crtc_state( - state, old_plane_crtc); - dm_old_crtc_state = to_dm_crtc_state(old_crtc_state); - - if (!dm_old_crtc_state->stream) - return 0; + /* Exit early if the plane hasn't been trivially modified. */ + if (!needs_reset) + return 0; + /** + * Remove exisiting plane, if any - we can't reuse it for validation + * because we'd be modifying the current state applied to HW. + */ + if (dm_new_plane_state->dc_state) { DRM_DEBUG_ATOMIC("Disabling DRM plane: %d on DRM crtc %d\n", - plane->base.id, old_plane_crtc->base.id); - - ret = dm_atomic_get_state(state, &dm_state); - if (ret) - return ret; + plane->base.id, old_plane_crtc->base.id); - if (!dc_remove_plane_from_context( - dc, - dm_old_crtc_state->stream, - dm_old_plane_state->dc_state, - dm_state->context)) { - - ret = EINVAL; - return ret; - } - - - dc_plane_state_release(dm_old_plane_state->dc_state); + dc_plane_state_release(dm_new_plane_state->dc_state); dm_new_plane_state->dc_state = NULL; *lock_and_validation_needed = true; + } - } else { /* Add new planes */ - struct dc_plane_state *dc_new_plane_state; - - if (drm_atomic_plane_disabling(plane->state, new_plane_state)) - return 0; - - if (!new_plane_crtc) - return 0; - - new_crtc_state = drm_atomic_get_new_crtc_state(state, new_plane_crtc); - dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); - - if (!dm_new_crtc_state->stream) - return 0; - - if (!needs_reset) - return 0; - - ret = dm_plane_helper_check_state(new_plane_state, new_crtc_state); - if (ret) - return ret; - - WARN_ON(dm_new_plane_state->dc_state); - - dc_new_plane_state = dc_create_plane_state(dc); - if (!dc_new_plane_state) - return -ENOMEM; - - DRM_DEBUG_DRIVER("Enabling DRM plane: %d on DRM crtc %d\n", - plane->base.id, new_plane_crtc->base.id); + /** + * If the plane is disabling exit early. Also serves as a guarantee + * that we have a framebuffer below if we do have a CRTC. + */ + if (drm_atomic_plane_disabling(plane->state, new_plane_state)) + return 0; - ret = fill_dc_plane_attributes( - new_plane_crtc->dev->dev_private, - dc_new_plane_state, - new_plane_state, - new_crtc_state); - if (ret) { - dc_plane_state_release(dc_new_plane_state); - return ret; - } + /* If we don't have a CRTC then the plane is disabled. */ + if (!new_plane_crtc) + return 0; - ret = dm_atomic_get_state(state, &dm_state); - if (ret) { - dc_plane_state_release(dc_new_plane_state); - return ret; - } + new_crtc_state = drm_atomic_get_new_crtc_state(state, new_plane_crtc); + dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); - /* - * Any atomic check errors that occur after this will - * not need a release. The plane state will be attached - * to the stream, and therefore part of the atomic - * state. It'll be released when the atomic state is - * cleaned. - */ - if (!dc_add_plane_to_context( - dc, - dm_new_crtc_state->stream, - dc_new_plane_state, - dm_state->context)) { + /* Don't enable the plane if there's no stream for output. */ + if (!dm_new_crtc_state->stream) + return 0; - dc_plane_state_release(dc_new_plane_state); - return -EINVAL; - } + /** + * Freeing the plane will take care of freeing the dc_state + * on failure, so we don't need to explicitly release below. + */ + dm_new_plane_state->dc_state = dc_create_plane_state(dc); + if (!dm_new_plane_state->dc_state) + return -ENOMEM; - dm_new_plane_state->dc_state = dc_new_plane_state; + DRM_DEBUG_DRIVER("Enabling DRM plane: %d on DRM crtc %d\n", + plane->base.id, new_plane_crtc->base.id); - /* Tell DC to do a full surface update every time there - * is a plane change. Inefficient, but works for now. - */ - dm_new_plane_state->dc_state->update_flags.bits.full_update = 1; + ret = fill_dc_plane_attributes(new_plane_crtc->dev->dev_private, + dm_new_plane_state->dc_state, + new_plane_state, new_crtc_state); + if (ret) + return ret; - *lock_and_validation_needed = true; - } + /** + * Tell DC to do a full surface update every time there + * is a plane change. Inefficient, but works for now. + */ + dm_new_plane_state->dc_state->update_flags.bits.full_update = 1; + *lock_and_validation_needed = true; - return ret; + return 0; } #if defined(CONFIG_DRM_AMD_DC_DCN) @@ -8567,6 +8379,113 @@ static int add_affected_mst_dsc_crtcs(struct drm_atomic_state *state, struct drm } #endif +static int dm_atomic_state_init_context(struct drm_device *dev, + struct drm_atomic_state *state) +{ + struct dm_atomic_state *dm_state = to_dm_atomic_state(state); + struct amdgpu_device *adev = dev->dev_private; + struct drm_crtc *crtc; + struct drm_crtc_state *new_crtc_state; + struct dm_crtc_state *new_dm_crtc_state; + struct drm_plane *plane; + struct drm_plane_state *new_plane_state, *old_plane_state; + struct dm_plane_state *new_dm_plane_state; + int ret, i; + + dm_state->context = dc_create_state(adev->dm.dc); + if (!dm_state->context) + return -ENOMEM; + + /** + * DC validation requires an absolute set of streams and planes to work + * with so add all planes and CRTCs to the state to make this work. + * Pipe allocation can change so there's no easy way to work around + * this constraint. + * + * Unfortunately this also means that whenever userspace requests a + * change that only needs to modify one CRTC's planes we still have to + * stall out fast updates affecting other CRTCs - introducing judder + * in multi-monitor scenarios. + * + * Userspace should avoid frequent updates to properties that can + * require bandwidth changes. + */ + drm_for_each_crtc(crtc, dev) { + new_crtc_state = drm_atomic_get_crtc_state(state, crtc); + if (IS_ERR(new_crtc_state)) + return PTR_ERR(new_crtc_state); + + /** + * Cursor planes may not strictly be necessary here + * but it's probably safer to add them. + */ + ret = drm_atomic_add_affected_planes(state, crtc); + if (ret) + return ret; + } + + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { + new_dm_crtc_state = to_dm_crtc_state(new_crtc_state); + + if (!new_dm_crtc_state->stream) + continue; + + if (dc_add_stream_to_ctx(adev->dm.dc, dm_state->context, + new_dm_crtc_state->stream) != DC_OK) + return -EINVAL; + } + + /** + * Planes are added in reverse order to ensure correct blending order + * in DC - planes with higher priority go first, and the cursor and + * MPO planes are at the very end of the list. + */ + for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) { + /* Cursors aren't real hardware planes. */ + if (plane->type == DRM_PLANE_TYPE_CURSOR) + continue; + + if (!new_plane_state->crtc) + continue; + + new_crtc_state = drm_atomic_get_new_crtc_state( + state, new_plane_state->crtc); + + if (!new_crtc_state) { + DRM_WARN("No CRTC state found: plane=%d crtc=%d\n", + plane->base.id, + new_plane_state->crtc->base.id); + return -EINVAL; + } + + new_dm_crtc_state = to_dm_crtc_state(new_crtc_state); + + /* Skip planes for disabled streams. */ + if (!new_dm_crtc_state->stream) + continue; + + new_dm_plane_state = to_dm_plane_state(new_plane_state); + + if (!new_dm_plane_state->dc_state) { + DRM_WARN("No DC state found: plane=%d crtc=%d\n", + plane->base.id, + new_plane_state->crtc->base.id); + return -EINVAL; + } + + if (!dc_add_plane_to_context( + adev->dm.dc, new_dm_crtc_state->stream, + new_dm_plane_state->dc_state, dm_state->context)) { + DRM_DEBUG_KMS( + "Couldn't add plane to context: plane=%d\n", + plane->base.id); + return -EINVAL; + } + } + + return 0; +} + /** * amdgpu_dm_atomic_check() - Atomic check implementation for AMDgpu DM. * @dev: The DRM device @@ -8595,7 +8514,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, struct drm_atomic_state *state) { struct amdgpu_device *adev = dev->dev_private; - struct dm_atomic_state *dm_state = NULL; + struct dm_atomic_state *dm_state = to_dm_atomic_state(state); struct dc *dc = adev->dm.dc; struct drm_connector *connector; struct drm_connector_state *old_con_state, *new_con_state; @@ -8607,6 +8526,11 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, int ret, i; bool lock_and_validation_needed = false; + /** + * Check for modesets on CRTCs in the new state. DRM internally checks + * that the mode has actually changed for us as well in here, so we can + * avoid modesets. + */ ret = drm_atomic_helper_check_modeset(dev, state); if (ret) goto fail; @@ -8634,6 +8558,18 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, new_crtc_state->connectors_changed = true; } + /** + * Add all required objects for performing the commit and stalling out + * other commits that may be touching the same resources. + */ + + /** + * Pass one: Add all affected CRTCs on a MST DSC topology that has a + * CRTC undergoing a modeset and mark mode_changed = true for each one. + * + * Optimization: DSC can only be supported on DCN2 onwards, so we can + * skip on earlier ASIC. + */ #if defined(CONFIG_DRM_AMD_DC_DCN) if (adev->asic_type >= CHIP_NAVI10) { for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { @@ -8645,6 +8581,8 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, } } #endif + + /* Pass two: Add connectors and planes for CRTCs as needed. */ for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { if (!drm_atomic_crtc_needs_modeset(new_crtc_state) && !new_crtc_state->color_mgmt_changed && @@ -8663,42 +8601,6 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, goto fail; } - /* - * Add all primary and overlay planes on the CRTC to the state - * whenever a plane is enabled to maintain correct z-ordering - * and to enable fast surface updates. - */ - drm_for_each_crtc(crtc, dev) { - bool modified = false; - - for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { - if (plane->type == DRM_PLANE_TYPE_CURSOR) - continue; - - if (new_plane_state->crtc == crtc || - old_plane_state->crtc == crtc) { - modified = true; - break; - } - } - - if (!modified) - continue; - - drm_for_each_plane_mask(plane, state->dev, crtc->state->plane_mask) { - if (plane->type == DRM_PLANE_TYPE_CURSOR) - continue; - - new_plane_state = - drm_atomic_get_plane_state(state, plane); - - if (IS_ERR(new_plane_state)) { - ret = PTR_ERR(new_plane_state); - goto fail; - } - } - } - /* Prepass for updating tiling flags on new planes. */ for_each_new_plane_in_state(state, plane, new_plane_state, i) { struct dm_plane_state *new_dm_plane_state = to_dm_plane_state(new_plane_state); @@ -8710,45 +8612,21 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, goto fail; } - /* Remove exiting planes if they are modified */ - for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) { - ret = dm_update_plane_state(dc, state, plane, - old_plane_state, - new_plane_state, - false, - &lock_and_validation_needed); - if (ret) - goto fail; - } - - /* Disable all crtcs which require disable */ + /* Update modified CRTCs. */ for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { ret = dm_update_crtc_state(&adev->dm, state, crtc, old_crtc_state, new_crtc_state, - false, &lock_and_validation_needed); if (ret) goto fail; } - /* Enable all crtcs which require enable */ - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { - ret = dm_update_crtc_state(&adev->dm, state, crtc, - old_crtc_state, - new_crtc_state, - true, - &lock_and_validation_needed); - if (ret) - goto fail; - } - - /* Add new/modified planes */ + /* Update modified planes. */ for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) { ret = dm_update_plane_state(dc, state, plane, old_plane_state, new_plane_state, - true, &lock_and_validation_needed); if (ret) goto fail; @@ -8812,10 +8690,11 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, * DRM state directly - we can end up disabling interrupts too early * if we don't. * - * TODO: Remove this stall and drop DM state private objects. + * TODO: Remove this stall. */ if (lock_and_validation_needed) { - ret = dm_atomic_get_state(state, &dm_state); + /* Create a new DC context to validate. */ + ret = dm_atomic_state_init_context(dev, state); if (ret) goto fail; @@ -8848,47 +8727,6 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ret = -EINVAL; goto fail; } - } else { - /* - * The commit is a fast update. Fast updates shouldn't change - * the DC context, affect global validation, and can have their - * commit work done in parallel with other commits not touching - * the same resource. If we have a new DC context as part of - * the DM atomic state from validation we need to free it and - * retain the existing one instead. - * - * Furthermore, since the DM atomic state only contains the DC - * context and can safely be annulled, we can free the state - * and clear the associated private object now to free - * some memory and avoid a possible use-after-free later. - */ - - for (i = 0; i < state->num_private_objs; i++) { - struct drm_private_obj *obj = state->private_objs[i].ptr; - - if (obj->funcs == adev->dm.atomic_obj.funcs) { - int j = state->num_private_objs-1; - - dm_atomic_destroy_state(obj, - state->private_objs[i].state); - - /* If i is not at the end of the array then the - * last element needs to be moved to where i was - * before the array can safely be truncated. - */ - if (i != j) - state->private_objs[i] = - state->private_objs[j]; - - state->private_objs[j].ptr = NULL; - state->private_objs[j].state = NULL; - state->private_objs[j].old_state = NULL; - state->private_objs[j].new_state = NULL; - - state->num_private_objs = j; - break; - } - } } /* Store the overall update type for use later in atomic check. */ diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h index ad025f5cfd3e..1c3aa7cb83b9 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -217,15 +217,6 @@ struct amdgpu_display_manager { struct drm_device *ddev; u16 display_indexes_num; - /** - * @atomic_obj: - * - * In combination with &dm_atomic_state it helps manage - * global atomic state that doesn't map cleanly into existing - * drm resources, like &dc_context. - */ - struct drm_private_obj atomic_obj; - /** * @dc_lock: * @@ -440,7 +431,7 @@ struct dm_crtc_state { #define to_dm_crtc_state(x) container_of(x, struct dm_crtc_state, base) struct dm_atomic_state { - struct drm_private_state base; + struct drm_atomic_state base; struct dc_state *context; };