From patchwork Fri Mar 5 12:56:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Das, Nirmoy" X-Patchwork-Id: 12118439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33AE8C433E0 for ; Fri, 5 Mar 2021 12:57:15 +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 E63C364F67 for ; Fri, 5 Mar 2021 12:57:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E63C364F67 Authentication-Results: mail.kernel.org; dmarc=fail (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 6A62989DC9; Fri, 5 Mar 2021 12:57:14 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2056.outbound.protection.outlook.com [40.107.237.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id A775089DC9 for ; Fri, 5 Mar 2021 12:57:13 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bLtQSECc1E5i6Z1ZNXoLemJuo5Y0xXUgvlZA+yHc2b/DEukxM2AiJzumrnekQdwshxKgLffzG1m8WxF8K7okFgcmj278vDUo8XDD7B6WjeMjNHqNEvwAs2Kmo95PDgOp861GvCiz/Wj2DySdGpJpM0Hr8dPnT1nmf2wHdfpWCw+ooWLr0vCQmCWAi9ME9uEPhWhTW+u1lQUdFvkhJcEoTOt05CFv048SBYoleDTHXz5Dbc92FWktZE69qnH4zqPSxv14VEtuXjtYjJJvPPWycYO8VRVfbRR4X067YM5/vGfCKmiYl5/jK1wvvhuMVKoB9q1bmfgztudr1LgcvEpHew== 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=tRNm38OXyXD8Vw4A7dPde5m0bpn1eQIpWdBogmUKO8o=; b=bzbTOS0gqUgLeYd+njwXW7iaP9VYECS9ywbHMq9Viqu70EPDc0tA6RFhYyrRW3YPE269MUVcvQTTf/+hcMqio0o2NHWZuy9lyKEFByBi7sN2rKqxI8n2IhHHT2fGNCefO0wMIogLpPN03V4TTDlWB2yU+dz8NRMth08+l/wlxFMakMrROlbqk4JLStlJA6yf28utYrBvGFqhejjjC2ZVFAMnnxOrL1BzySttRUB5frHH+8IzCPZDb0mwr2cIxgA4m/CehRT2yUTgkzqZuwr91EyU3OaCFRiWzLgmfuJaBnC9iplo8LBovJAVmkmtT97DFBibya+Aw0wms6XFJR40Fw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tRNm38OXyXD8Vw4A7dPde5m0bpn1eQIpWdBogmUKO8o=; b=N5uK0NivPeKR3JsEfc8uP7ZzFNqoy83I3MCHpt2fVyuDFkO3WNiStBwU2ZBvDKeAmeiuAjMQMT/EfifbuGSLllpU6dEcZN22onz1aNigiskipXaGXc1NQ74H0akDWzY5+0TV0ZAb152IwKhdDCf64DvgrjZEHvdK2LDu3jDo2HE= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from CY4PR12MB1463.namprd12.prod.outlook.com (2603:10b6:910:e::19) by CY4PR1201MB0232.namprd12.prod.outlook.com (2603:10b6:910:21::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.23; Fri, 5 Mar 2021 12:57:11 +0000 Received: from CY4PR12MB1463.namprd12.prod.outlook.com ([fe80::6504:7fc4:d02f:77f2]) by CY4PR12MB1463.namprd12.prod.outlook.com ([fe80::6504:7fc4:d02f:77f2%3]) with mapi id 15.20.3890.030; Fri, 5 Mar 2021 12:57:10 +0000 From: Nirmoy Das To: Christian.Koenig@amd.com Subject: [PATCH 1/3] drm/amdgpu: introduce struct amdgpu_bo_user Date: Fri, 5 Mar 2021 13:56:57 +0100 Message-Id: <20210305125659.9923-1-nirmoy.das@amd.com> X-Mailer: git-send-email 2.30.1 X-Originating-IP: [217.86.122.77] X-ClientProxiedBy: AM0PR10CA0123.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::40) To CY4PR12MB1463.namprd12.prod.outlook.com (2603:10b6:910:e::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from brihaspati.fritz.box (217.86.122.77) by AM0PR10CA0123.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Fri, 5 Mar 2021 12:57:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 939fa5b5-942b-4f2d-fb45-08d8dfd630c4 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0232: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SIdZTYn7m9FDQsz8s6zKASPl8V4pAVzLuVRbpkjZIH+mCqxA56zK/eDfKUBXTTo00DRA1n8ZeEOPh3nOTGvjpwzJho2qfBIao6J/JMcC3pwiC42jIwdSRVeoIwxGg70Wfql0kZDHcq07Niy7B7UxvPKTERofFtpnzxgfEJsq2q9bLiimucKZkeB8HsJgFb/sFdeiS2ID1aO711GWBXPDe16gfd5PXLQIBjLxVnfiGN6L8gLpZK3cxa/vMxkqittnwHTZ4iG1QVl2SH78CsKXy3q9uN1UkZX9Hjl9kxaMS2Z/bwI3c5sKoVR1E0Z0X9QW2K0X88DVv8Y5BgnYGwLPEzbyviC4nirF0/+MSSHoQYA8x/d5ENRhhf0A6JfuRbA5bvQYIXqAM9vOdo08GFEiG1z8ilR6Fm7Of+RAKziNzRWlkJFYZoUp+qqOpUuNKVO5CTWhoWc8Xqtp+Nae8ZplJVGXhHt5U1R+k1yO4se5cdsJlBR/dbnj6kgtAFz41SdBrIIbEaL1n95cAAe5+SjWhg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR12MB1463.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(136003)(396003)(376002)(39860400002)(16526019)(6486002)(6636002)(26005)(36756003)(2616005)(5660300002)(37006003)(52116002)(66556008)(186003)(66476007)(6506007)(956004)(6666004)(66946007)(34206002)(6512007)(1076003)(478600001)(4326008)(8676002)(316002)(2906002)(86362001)(8936002)(83380400001)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: TKB3Ks3E4lFveNzMDOru7W+p/49DzN1+ewBLi+srV0KqdSomG41LgSP57xAG2nqvG7BUZVUg3KNH850Meri/D/7jEG1FK3EZVdOPoj6lt//xtutiOULeRswje5sYLHkLglACO2T85+YmVt5yjt4cJFn7Ve/t9ZEq2L/xvVMbY69RG5m8yyOGPMAqUPuz5C3jcqPUqIIpSe9febD/AiF0y++IDo09J0/wH2LcgZoUuwHeFg8QWB3ys7KDoUrIIjx7zsFO6ENembwOKHYXMElT0nmg+jh1/kMwsW8MtfXxM3pc5Aw+Es6sDNbwsT5k3VaGDgWVxbPHCgxVTawamX4wwUlTjVONu432gX3HMpsu9gqhxvug4pDCuaeHpximMlnx2zkJu329hn9jU3lwoBU9tAfiqxPBuTCFpB+OeICwxPCUz08MQQsulS5KKjxdCBsqwqxlTgU4PNV3pLkKpjPhORNmRuvyuFvHo8dR1Q1swjsR//ADpHzbgPwyJ0oxbrodI6Ohx+v3VEyEA1sBz7hsHG0ApcEkFSjVfgUFE8Xg/QQVqery27dT+sZ5vXEqNRhk6eC/Ri7RTdhEtoHSsMugByQ7ya1lJC0BXfMiuXvpNq2gPmxPXY0mYzSOF9DpiMLtiD5hPZnN/M5sZg1ed1wHGIPmzNzhUaWjM055rykNRQ5YhWaJXzTK8ybek9KpQiPEG92T9tSUtiXAWrGwGCRvIT8WqH60qbUMy/UMPYtX0uXao3EEbP1KV4PBVnziA2tr7BJTtWzFMSwQfRvhJWj3QafpQ2yffP0m/sc/EHqEoXztAQGdYP5bDvm9HkybiTfEJaJvkTPRlNTZ5pgeud4v3HaNhxVy0jqFEySgtLSof5CO7FvyLWtHOz3BGiyRawMwPw6fKMJ0b84YJow/q4JAWqDTqjVHIDkxQQzPcgyS+W4YawmaJwmixYD/DezvFPsXB3pP+wk5TcLgPXZwVbCcA1mPY8QQL4ku9X7lebQ3I4HawRDjbkj3rhpRgAYP+56KIlGwnM5CFCK8p+OFfC7KeATmb5ex0nr02TwIY7oEdgCWbC8ejbvpxCZnfhwzv3mKhmZxdQMBSF7BTkTkxKkMbRURwURdclFkWNsxWvSTOU4VbHwNbHU7jcgHx45ZYFHh2KfXMpw/Ffb1P4YCNyyH/ZHO/fb2RIywUAgf8YMQm2e9iFx29CFMLQ1lqtT1z/qsaQ2RnRBx1QIhlDYMrMTTOx2RUS5C3cU59JTyCTDh9idNXbA/G97Fz9H9QY+WT73pRe655vz9h1icZNxdibdXRoJNFpXcGwv+myLeqtIQa5cyEWjS2NQ84rp7hiHz/tFC X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 939fa5b5-942b-4f2d-fb45-08d8dfd630c4 X-MS-Exchange-CrossTenant-AuthSource: CY4PR12MB1463.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2021 12:57:10.8755 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: g+2JEY9tHmXnPueSZ3w1xZxnw4qNT7+V64D4kGlUKiGfS7MWMeRKGHpYv0//NVIP3YzF6qq61kJ429b0KMTSXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0232 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: Nirmoy Das , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Implement a new struct amdgpu_bo_user as subclass of struct amdgpu_bo and a function to created amdgpu_bo_user bo with a flag to identify the owner. Signed-off-by: Nirmoy Das --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 44 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 9 +++++ include/uapi/drm/amdgpu_drm.h | 2 + 3 files changed, 55 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 745393472564..f21679f38383 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -699,6 +699,50 @@ int amdgpu_bo_create(struct amdgpu_device *adev, return r; } +/** + * amdgpu_bo_create_user - create an &amdgpu_bo_user buffer object + * @adev: amdgpu device object + * @bp: parameters to be used for the buffer object + * @ubo_ptr: pointer to the buffer object pointer + * + * Create a BO to be used by user application; + * + * Returns: + * 0 for success or a negative error code on failure. + */ + +int amdgpu_bo_create_user(struct amdgpu_device *adev, + struct amdgpu_bo_param *bp, + struct amdgpu_bo_user **ubo_ptr) +{ + struct amdgpu_bo *bo_ptr; + u64 flags = bp->flags; + int r; + + bp->flags = bp->flags & ~AMDGPU_GEM_CREATE_SHADOW; + bp->flags = bp->flags | AMDGPU_GEM_CREATE_USER; + bp->bo_ptr_size = sizeof(struct amdgpu_bo); + r = amdgpu_bo_do_create(adev, bp, &bo_ptr); + if (r) + return r; + + *ubo_ptr = (struct amdgpu_bo_user *)bo_ptr; + if ((flags & AMDGPU_GEM_CREATE_SHADOW) && !(adev->flags & AMD_IS_APU)) { + if (!bp->resv) + WARN_ON(dma_resv_lock((*ubo_ptr)->bo.tbo.base.resv, + NULL)); + + r = amdgpu_bo_create_shadow(adev, bp->size, bo_ptr); + + if (!bp->resv) + dma_resv_unlock((*ubo_ptr)->bo.tbo.base.resv); + + if (r) + ttm_bo_put(&(*ubo_ptr)->bo.tbo); + } + + return r; +} /** * amdgpu_bo_validate - validate an &amdgpu_bo buffer object * @bo: pointer to the buffer object diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index 848dc0a017dd..332e269c3fd1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h @@ -114,6 +114,12 @@ struct amdgpu_bo { struct kgd_mem *kfd_bo; }; +struct amdgpu_bo_user { + struct amdgpu_bo bo; + u64 tiling_flags; + +}; + static inline struct amdgpu_bo *ttm_to_amdgpu_bo(struct ttm_buffer_object *tbo) { return container_of(tbo, struct amdgpu_bo, tbo); @@ -257,6 +263,9 @@ int amdgpu_bo_create_kernel(struct amdgpu_device *adev, int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev, uint64_t offset, uint64_t size, uint32_t domain, struct amdgpu_bo **bo_ptr, void **cpu_addr); +int amdgpu_bo_create_user(struct amdgpu_device *adev, + struct amdgpu_bo_param *bp, + struct amdgpu_bo_user **ubo_ptr); void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 *gpu_addr, void **cpu_addr); int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr); diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 8b832f7458f2..9b9a4ac6f00f 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h @@ -141,6 +141,8 @@ extern "C" { * accessing it with various hw blocks */ #define AMDGPU_GEM_CREATE_ENCRYPTED (1 << 10) +/* Flag that indicates the BO is created for userspace */ +#define AMDGPU_GEM_CREATE_USER (1 << 11) struct drm_amdgpu_gem_create_in { /** the requested memory size */ From patchwork Fri Mar 5 12:56:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Das, Nirmoy" X-Patchwork-Id: 12118443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E36AC433E0 for ; Fri, 5 Mar 2021 12:57:22 +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 0023264F5F for ; Fri, 5 Mar 2021 12:57:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0023264F5F Authentication-Results: mail.kernel.org; dmarc=fail (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 D124A6E201; Fri, 5 Mar 2021 12:57:17 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2056.outbound.protection.outlook.com [40.107.237.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id E60C089DC9 for ; Fri, 5 Mar 2021 12:57:13 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QDxyWBVnHJ9so3VQbruHvWYS3YjjTpU1I3XRn5xfs8uHe0gkmiVs9mssLoxPh0JjSUJDHy+AD+LZNmnhHBEvSMW4QjZLuj0vekRdknrZC8sbIgHIwtWofe3ImMPiMa2ZgSKyMTiUbgzfuYQAs74O53JWbyWDY5ZbcIRAvFa5Pbxc1+5Dq1V5Bqu+qTyk5Fk0nhzPYfNr+VNh1Y6jJWXtWQISYoUhEXfkWgoJkiI4moDDLe452CIsap06pexq31iDeFj6U5LvQTRQVnVBxZzYbe8FoscdvpqiucZZaNFsVMcSgrI7Z9F7ghqVB5aZG/dJtDurhU0FA6z1+bfmODRL4w== 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=90ycKuKEsdwgNFQnQsCNGNZsvc7Yr9HMh2zVdj/59vQ=; b=Exctmw3LVWvuNysjBmau8HuJfSbuUWdRaGYlxZTGSkeBUq4z8ols9kyyienyapHtTEFlFy51WcuUQYdYrDLwPgylUpGnWjFFdOVFET1Y0jLSMSDTG2SxqiPuIYzmUOlyE5ZvlwYyLei0VAOiKAp78Fs7rsAHdJisFXwiI+ziXlzVzlXZ7IijoaKbtBwQ8su4ryznhoOBesaaYPlvdVQdjPqeLKbTe5cyUpkcMzuvKw9BPO0GK6KJFoampR/SA28JwWnCcVxwOt2fEaERzrnZooEpmPcF628BPamqQX4kFM6im6UZXNLWMNizpe1Ww0QABOpddQkpwxRtM21i7uX1+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=90ycKuKEsdwgNFQnQsCNGNZsvc7Yr9HMh2zVdj/59vQ=; b=BZvABXtvqViFtdeR6dH2gXOeGEuUj/9P5pBSkvBdWL99GB+ujaKHt6IPt2uX46lG/nlXN9xBXd0iaAGw+YYihde2RVd6BfjzdoypkhU25dgqa+s5HK+GllDygRDs3fn9nKdmwMyQugCfQ+0ST5yg9ff7shwIWvfzhZeLb55WgL0= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from CY4PR12MB1463.namprd12.prod.outlook.com (2603:10b6:910:e::19) by CY4PR1201MB0232.namprd12.prod.outlook.com (2603:10b6:910:21::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.23; Fri, 5 Mar 2021 12:57:12 +0000 Received: from CY4PR12MB1463.namprd12.prod.outlook.com ([fe80::6504:7fc4:d02f:77f2]) by CY4PR12MB1463.namprd12.prod.outlook.com ([fe80::6504:7fc4:d02f:77f2%3]) with mapi id 15.20.3890.030; Fri, 5 Mar 2021 12:57:12 +0000 From: Nirmoy Das To: Christian.Koenig@amd.com Subject: [PATCH 2/3] drm/amdgpu: use amdgpu_bo_create_user() for gem object Date: Fri, 5 Mar 2021 13:56:58 +0100 Message-Id: <20210305125659.9923-2-nirmoy.das@amd.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305125659.9923-1-nirmoy.das@amd.com> References: <20210305125659.9923-1-nirmoy.das@amd.com> X-Originating-IP: [217.86.122.77] X-ClientProxiedBy: AM0PR10CA0123.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::40) To CY4PR12MB1463.namprd12.prod.outlook.com (2603:10b6:910:e::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from brihaspati.fritz.box (217.86.122.77) by AM0PR10CA0123.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Fri, 5 Mar 2021 12:57:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4175b670-0a54-4b1c-76b2-08d8dfd63197 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0232: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T6CHZ96WRda9eRSU6loeYeg4t9YB+Lgaf48Vu84uT/w54g5LtZo2DPUXmGKCtFumv+CdUP5uY/J2DpIPDF94rw27fHjVAyJzTJOTnMoZSyWbZwGrwCfr5Q7LcvLPv7hbam3PZ89EoN7C42inGqgUrpXb8ZkK9UeDW0pt5OsAwyvS8daL4sbZhfxabUJaaX0rZuOu/ot7Hi12ydocJSsdcTkziuZjozu8vHA0bd5QYbccyhBir7C+WT8+xElsYfWcCLmtbzDdRG8Q2Dn87qu0vnlr6w/8NHKX7lmkeiU8fByHoo4a2t3TI5IWdqyg1jF/4fxt4k/CVd4ON9aoiIBA0OGH3g35RLvN0Sb+5TUfVRqvBE/kSHhcDxy+kcy9XB3IFTUroWO3SbHhCJM/3VnBmZB28lwTumQjNBFDOqWKyU2tWFRqSiuPTQfj0zU017XrPF7M21Sme3qpejvvSj/18fDlbVZaOGMdaP10oZdF8jS47ofc1cKa8GLREmzX6FcN5U3vIkN8aVUnytASFGba8Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR12MB1463.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(136003)(396003)(376002)(39860400002)(16526019)(6486002)(6636002)(26005)(36756003)(2616005)(5660300002)(37006003)(52116002)(66556008)(186003)(66476007)(6506007)(956004)(6666004)(66946007)(34206002)(6512007)(1076003)(478600001)(4326008)(8676002)(316002)(2906002)(86362001)(8936002)(83380400001)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: InmiiM6itAP2AOLesl3NH4vLWTKIYgJznLWiSPa0hihicEUsDc/PpzqW4Elc9Mx4JD8DpdvZ9fPvRXeTv8w16DdM0DeBa04I28moNFdbk0Gb86d95xPdmo0W3iFYxI6DXodNLe6m/yKfItC9C/TohhGU7qrqbZCfSJP9nudxJkFV1JCJ+5PEj1krpux00xB5lRuLS59DjDYK0ykBrFb1boyhpZURh/22EEK1WxFKEC2PIMdJu3OZgaSE0Owk08IrHQW1ghNR2paskyOagIF5wTMeGZf2amGpcJHJR/xXeBmhz2aWcWlXsJwafgunRN8UyS7X5MyKWmPKSsuifQAc5dhsxTC7aarR3dz86t88IfTLu21uCnMVEtQOKy70DP8y+pxKduLXvC13ZVA3eaGGn1Ap3T8NfeVhmGBFrajvfFY8tWgAszVtPT/aRzkAySj+snKWvX1aj4houZnGusnFkb01O9AV6g528N16i9uKqf7/3zmHPDuTwJ7Ccu7IxNAo4vZXF+sCx3Zt/FFe/fJI8T3buNDkna5QzKtAoZTFxHHBiRDQc/Rs6kop6JbR9dZfM3CEyV7ehg9QBy6sA5X12V6TE7fNiZGeP1J+zSslVSJKgk4FOSYySk17pbSjMSqJ+EJeH13Br2Z6HGFrs0bxEQg8CDdjp0sM6H5T8NNTLZTdPHgMcCOibwaaZn0esVgvc4rBLRVIXFobwCJur92ib4aB6WWL/KdGQfb1Z0drZm2o40T/UtBMXoNMj5JD2bdhyaxdr8n7paeQVUezNyDqM121bNzZRaZk8uJW8el0RV71+qYGoBDgHB1xjCCoOH2Gsn3Yk+fMFCr74/4laOcv4X3c0IxgB6eApegmZ44culB26Aa0AA4UZn5Q3PYqJwvLXdZefWbprYQ/F74I3PxzpGrBPNIoUgPCjcvmgMukQoSD+3FWF2InXmqc86q8gnvRwQHpNpT33dxAxhZBIyHtosWeMEIRkepl1qZQUyaRnLhcMNaTQJ/zM3fBQlMX8h7w735ekM8wLIpPj8sr0KuJLqNMh7GJHD049Z71xW7YQB1VcjMH9yxdpPu8tnBeJNvQVDsupeG0nLqEx1t98SJCKH4aMyRBQ1trEfbHwITcyFLa8m/49Fjl/QnY3b3SHXia3u0/RyqmTH7Ksqj0SdCYelsuSpoQaVjmSA1Uh11G8bdXtKg7QLD9qsL4D/zZdwiPaecPS2mm7ZA5VJgHfojuqZHE5nv3bSkPpmTzZP47k3Qd4RIJ3KY9VokIRB0ZSTjxewSQBI70uNf7thfovH9NBhBULD3WiR1vNG3ruBVyP86w0zuLNlHQ0jwztsaWCxyg X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4175b670-0a54-4b1c-76b2-08d8dfd63197 X-MS-Exchange-CrossTenant-AuthSource: CY4PR12MB1463.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2021 12:57:12.4369 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: l82Su43ESGJxPo5rISWn9/mYZzMOX3Qb+qtgdUlp949NSB/KLNtZ8iBoPfFntlBiKR6AmboWcjifqxzE/mlNVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0232 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: Nirmoy Das , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" GEM objects encapsulate amdgpu_bo for userspace applications. Now that we have a new amdgpu_bo_user subclass for that purpose, let's use that instead. Signed-off-by: Nirmoy Das --- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 8e9b8a6e6ef0..9d2b55eb31c2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -54,6 +54,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, struct drm_gem_object **obj) { struct amdgpu_bo *bo; + struct amdgpu_bo_user *ubo; struct amdgpu_bo_param bp; int r; @@ -68,7 +69,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, retry: bp.flags = flags; bp.domain = initial_domain; - r = amdgpu_bo_create(adev, &bp, &bo); + r = amdgpu_bo_create_user(adev, &bp, &ubo); if (r) { if (r != -ERESTARTSYS) { if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) { @@ -85,6 +86,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, } return r; } + bo = &ubo->bo; *obj = &bo->tbo.base; return 0; From patchwork Fri Mar 5 12:56:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Das, Nirmoy" X-Patchwork-Id: 12118441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C543C433DB for ; Fri, 5 Mar 2021 12:57:19 +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 2968360233 for ; Fri, 5 Mar 2021 12:57:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2968360233 Authentication-Results: mail.kernel.org; dmarc=fail (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 C983E89E63; Fri, 5 Mar 2021 12:57:16 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2057.outbound.protection.outlook.com [40.107.237.57]) by gabe.freedesktop.org (Postfix) with ESMTPS id D031A89E63 for ; Fri, 5 Mar 2021 12:57:15 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RZcZRI8OCZnnNEiWIzTV/Vj2AypbhE1B5NozmCmbI/7Z3wVE8ej9rLdWO71DdQHvOsf1EFfIPyw0ezxIpAJd57FxGoL2MRWqsS+n6yR1pEzBAJBOoCBfMd3ZiHuEISj4jGVUZAYJcQQFDBbttSPJuSZWdyPOnOYke+LP4Sl2mUeBqlBFhu1sllaDeMf8mz+Tc2MbVnWHmnmznb/m5miDajyiMdrtzmdQW9w0sFxQbWv5LQlKtWDJEZlHbl1CfXvpPpQdAE7z3JwZjauZgwwzGeJwygjV7mjgD+z/huJvIBbjzO0IMbs8XPNyn5VKhTinc8bHESAnPt7G6N35FkwdqQ== 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=K7HT1DcSfKz6dcM6YVYC5uIYq0aDcZKU/p63O6Q+SkE=; b=NS8IFU2nNrH5BL7qabeEWeBCXCs335SKsAZ9T8+m4w+xagxWKpjNmDEqJFeAUDFHmSEw5TE4kPFpGacEfEqczeI1ccnYAtSvmJKmATqBpTqYVuLqbxYp5lTyHOlSkNtjm4uU/mvW6s8A8Y0j/HjLXfCjLSW7y5AeTbLCzWrXEgsaRCiybM76cd0BGn/NE7HLjFxx2xvGMIezbRq8cQvbqi+6JMP5JKeVtApLhsmG9Dw1zimVHQg77Vq80v5qTugaukCHf7GDl1AuHyOS/jnXMWhghd/jbC1SwFjO5NLLKPCZvdUZ3Sgo+WR4KtO3hvlYChQk/EeneetwRg2LUKMwjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K7HT1DcSfKz6dcM6YVYC5uIYq0aDcZKU/p63O6Q+SkE=; b=BVjSDJiZq6bvebzr90XyZdBfD3AclNwXEFGFOIN3sZLcEP+MeADV0ppi46BbsTojq3sIZ7vAoJd9E4KIMOG0Z1YHpUbR+IlxyrX1Odn3naIqMcwIf15HEaLei7Jl77346jrGd+zUrp1kuZAl5/bywTlMcLJDfKdw1Bha/c737dw= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from CY4PR12MB1463.namprd12.prod.outlook.com (2603:10b6:910:e::19) by CY4PR1201MB0232.namprd12.prod.outlook.com (2603:10b6:910:21::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.23; Fri, 5 Mar 2021 12:57:14 +0000 Received: from CY4PR12MB1463.namprd12.prod.outlook.com ([fe80::6504:7fc4:d02f:77f2]) by CY4PR12MB1463.namprd12.prod.outlook.com ([fe80::6504:7fc4:d02f:77f2%3]) with mapi id 15.20.3890.030; Fri, 5 Mar 2021 12:57:13 +0000 From: Nirmoy Das To: Christian.Koenig@amd.com Subject: [PATCH 3/3] drm/amdgpu: use tiling_flags of struct amdgpu_bo_user Date: Fri, 5 Mar 2021 13:56:59 +0100 Message-Id: <20210305125659.9923-3-nirmoy.das@amd.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305125659.9923-1-nirmoy.das@amd.com> References: <20210305125659.9923-1-nirmoy.das@amd.com> X-Originating-IP: [217.86.122.77] X-ClientProxiedBy: AM0PR10CA0123.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::40) To CY4PR12MB1463.namprd12.prod.outlook.com (2603:10b6:910:e::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from brihaspati.fritz.box (217.86.122.77) by AM0PR10CA0123.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Fri, 5 Mar 2021 12:57:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4a4fbba2-6ed2-44ba-7308-08d8dfd63291 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0232: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wdKqJ+UPU4VSRqtFKET2oFKH5flpLoTo8Ke8/GCoC68Otfaubahs6vQrX6iYnxFzjn9gUCv+Xr67+b2VfzPMI3Y745rckJFfDIbddlZYZL0i28m/X+o/uU+zOQSNplNu/+1dDaVjqF+J5gVRYhPTm3lqIuvNlYIWVO2TpnXjptSu2q0BCJUOLUp1cJ94LpR8QcF6CTCuM+rIZJDf33N/Fm/G4V9+UbujGK7qq6xiccPXKbNshdsbhq4KhG2aiYv6zXXrA5+6amphKN2W1KNDAgX7U6ayEEx/Jgz/w0V3c945qlgq9ePQGEbD/xSWCVekrhnXYCM3nvtFO7xB5jMJbHaYVc/H7VM/UgI6W3+yBsjT1la/OaaK7ddYuz7lPrL7juEthnd/xuv7qlEmLXqhg55yA67U+XZ6rrbOOolEMtCvjg5Nrkn3PE6q9QMNp9oTQAe+HBvWNg0WUFm08DwZO93NKEY9Q1q6pVljvWVJ/NNcTo5DUp+a5Wr49rnUqKrlBsTIzQQ685ITszJu5eEJHg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR12MB1463.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(136003)(396003)(376002)(39860400002)(16526019)(6486002)(6636002)(26005)(36756003)(2616005)(5660300002)(37006003)(52116002)(66556008)(186003)(66476007)(6506007)(956004)(6666004)(66946007)(34206002)(6512007)(1076003)(478600001)(4326008)(8676002)(316002)(2906002)(86362001)(8936002)(83380400001)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: YiP4+xaUoaoAijhdi9ZeZnQaWe92M31zOtkObSY+w4ZENmglmaTKyl/fVjdsx2xFHCyEVlGXIrdwS54EApmiUbsy2oTXm/Lbqe4kGpqcSRozI7hiSJuGXXB9PKXM2ixK1ilZYTZ08864oZWh5yQkZTVe4eHPC9DSmfS9f7q4jeXFJ6iP1n1FNt+WuHxZGN8fPn0gtp825KI4SBID7vyU6Bp4MXiJA5pVp9SK4eoBeKDT3jGWS4rr5aN5Pwr0FslG2uhgOVL4t6TIXVxFNCbH9DoJ7Ibnpwj/133wSsKd+Q34e3g/NIkCfCucL+OOhOlAOg4/QGoW7YpnmHVsjSLIKT35LvJX3wX5jXWUnjK+5xMVrsEYf+7TNvMa1JYez/pto8rov0E/JgltkRf8zt9auQfOLoVyZHRBi05UIdftoF8xbSzH1uwEw4ZmoN2Au6vQ/x3hoE7yCfSGLvsKqlVn22bF5HpoDsffuidf3UTJR3rkKJQE90PdHo+ZpJowsI1lLnDOReRkDLxzb8beG9D6FEUjFNfUoSdx2iohrr+J6SyMJw19BU/mVML+mzGLntifnl2j1iXtUIxVbMMbtR7Phc/Hoaq0HVAhGoH9YAxpVzLc+Gu1ZQLt2SrH6rb+0h7u/RrJeaySnXcfqnB6Ndx3W2qL37b4V3BZs8RRDmQiBMBSD7fCqvOtdR31/HJ0o0jjfYVpVvAKzt361ZNIYiST4kNqE5l1x31wsH3kWT4fbPGqr5WO7oDMbvWqVCvojOcDwi6BjK/oHhYtoNHeH++X+5+ee+a1VfnEu7nRn3o1aV3pPJ7CPmKDhUAkOdXqr94A+1wlz4CAKfHO3fe3Z5G6a1fJO2kP7WgZ1H1IRKambK7H6qLRgXkaMPKfjaXgivCOf0FISJnFJv+hc1ReXnGpuH7oy7ufmkrsHAQraolsWMqMrM7SW12+45PYPCD7zzWKuEg4sqZWLN4VEkuW2lKxz5uGDA69olnWbg/jMMKiFCpxHDTLcBPEMdGl4ffOysn8N9mXkauJ1UiYYMHKcMHy1nXAlEX8tb8+K4ItxHDm+Nvhh6c9HuOdIg/emMi3JpYgP1AQto6w1cmcF+vRHQO+xLswOTw9AGbIcypY1qw2kJZRxLanBs2His0fdMREcgMCipmA/VOQHBANrrvv1ji1aPQI4OhWnTayccFoZfQaO6iw0on+I2395Kb6rtQB4P1mYFink93lE/7eOGeABgKdAw16aaOs3DW6iUlLNeTinYCmYczilvu+gFOsgsYKqs209Xz3HpYxI1heI6+sfe0607ZI0vXo1zse10sIN+VS87gDI1hGcGU+iXy/Qz2l+Hur X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a4fbba2-6ed2-44ba-7308-08d8dfd63291 X-MS-Exchange-CrossTenant-AuthSource: CY4PR12MB1463.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2021 12:57:13.9302 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: //yfPqGGfcOhOex/iaExORpLsIyLukYJK9cE3FijQ7jSD5a6lbDzdZCK+nBrtn6MagZcgC0nSbJ6cauA+CHM6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0232 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: Nirmoy Das , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This flag is only needed for BOs created by amdgpu_gem_object_create(), so we can remove tiling_flags from the base class. Signed-off-by: Nirmoy Das --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 19 +++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 - 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index f21679f38383..c19cb6863966 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -1190,12 +1190,19 @@ int amdgpu_bo_fbdev_mmap(struct amdgpu_bo *bo, int amdgpu_bo_set_tiling_flags(struct amdgpu_bo *bo, u64 tiling_flags) { struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); + struct amdgpu_bo_user *ubo; + + if (!(bo->flags & AMDGPU_GEM_CREATE_USER)) { + DRM_ERROR("can not set tiling_flags for a non-amdgpu_bo_user type BO\n"); + return -EINVAL; + } if (adev->family <= AMDGPU_FAMILY_CZ && AMDGPU_TILING_GET(tiling_flags, TILE_SPLIT) > 6) return -EINVAL; - bo->tiling_flags = tiling_flags; + ubo = container_of((bo), struct amdgpu_bo_user, bo); + ubo->tiling_flags = tiling_flags; return 0; } @@ -1209,10 +1216,18 @@ int amdgpu_bo_set_tiling_flags(struct amdgpu_bo *bo, u64 tiling_flags) */ void amdgpu_bo_get_tiling_flags(struct amdgpu_bo *bo, u64 *tiling_flags) { + struct amdgpu_bo_user *ubo; + + if (!(bo->flags & AMDGPU_GEM_CREATE_USER)) { + DRM_ERROR("can not get tiling_flags for a non-amdgpu_bo_user type BO\n"); + return; + } + dma_resv_assert_held(bo->tbo.base.resv); + ubo = container_of((bo), struct amdgpu_bo_user, bo); if (tiling_flags) - *tiling_flags = bo->tiling_flags; + *tiling_flags = ubo->tiling_flags; } /** diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index 332e269c3fd1..7164c0799534 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h @@ -91,7 +91,6 @@ struct amdgpu_bo { struct ttm_bo_kmap_obj kmap; u64 flags; unsigned pin_count; - u64 tiling_flags; u64 metadata_flags; void *metadata; u32 metadata_size;