From patchwork Wed Jul 4 15:57:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 10507307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2620D6028F for ; Wed, 4 Jul 2018 15:59:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10DB128BAE for ; Wed, 4 Jul 2018 15:59:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0565328BD5; Wed, 4 Jul 2018 15:59:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CBFC328BAE for ; Wed, 4 Jul 2018 15:59:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A98E6E0E7; Wed, 4 Jul 2018 15:58:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730047.outbound.protection.outlook.com [40.107.73.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id 09B3D6EC22 for ; Wed, 4 Jul 2018 15:58:44 +0000 (UTC) Received: from fedoratest.localdomain (155.4.205.56) by DM6PR05MB4586.namprd05.prod.outlook.com (2603:10b6:5:9f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.13; Wed, 4 Jul 2018 15:58:40 +0000 From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org Subject: [PATCH -next 6/9] drm/vmwgfx: Support for SVGA3dSurfaceAllFlags in vmwgfx Date: Wed, 4 Jul 2018 17:57:47 +0200 Message-Id: <20180704155750.2749-7-thellstrom@vmware.com> X-Mailer: git-send-email 2.18.0.rc1 In-Reply-To: <20180704155750.2749-1-thellstrom@vmware.com> References: <20180704155750.2749-1-thellstrom@vmware.com> MIME-Version: 1.0 X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: PR2P264CA0007.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101::19) To DM6PR05MB4586.namprd05.prod.outlook.com (2603:10b6:5:9f::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4a1a306f-16c3-4ea9-f787-08d5e1c70391 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:DM6PR05MB4586; X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4586; 3:6p4RuBV1Vm2Mgmxyoc9g9Xy6S8aSOhaVwUvqog8HoHowFbgNLY+xS7RFicJh1FRMKde7zqWSskh9SaS37jD7kI3nZCdgshGH2A0wSs9Qd4kWbjar02mcBNBKJeg36lpuaOMMKCV6/SR94sXeJ1QlxZgBvBmXcruZHupmCrBsBHbKTTeyrTkVQoKssSBLPpW3S8DJmJlyu1ookMkIQRm5k8U6UdN1WoV8EQZqKqNmiueHvFEGvrx0i/wnLEjk8Quf; 25:V50CtBeFEswEQLwHKwa4Wc0GBNnqAShMjt9uhELDJvx5gUMijNMadJ+A1PjXg0ywNovv3PzR5+gGjpyDuq+psED02do3oZ6KYrJPu2mS9+tASv2qG3YO8yL8D+i4C5kZwOJBYF4W0wG9zrzzRSHNqBni1Tm1C8PaJRsR25D4mr6qTc2cya6lt8TrVEGr28cd0hWvZFfMUPa+5Gfo/AOu59mofYIP10ixq91zHNiI5a/Tlku3OIUdpqgK6QkFm5givj5ZZFzMMgkFlb/ElOACPKAAwXUoFmtDWwYcjNxhQA30h+q8o/aZXPnCkzlaHUan2d5oqZKIXUbhsQGTyVKtzQ==; 31:o3qyf5amunzLPbXqcnSvjf38d+lPOwNv2CiRb9BDx5WNkzcltExlr6o30NBhXxncn4j24f+63PoGxklpMQBckqKeSDoxs/4+u6RQpqwi+rMYONNeCbOxKUx0qjn+g8UIiFgIr5wkrmXCqq8nFLGXp0blLSUSaucyTuJ+foXLX4PNN5M33teXaoNyCbc7AfB0ANKxT1PVDZgtqJg7tqY16j7lxYWRMVtCMGb0UnlCFAI= X-MS-TrafficTypeDiagnostic: DM6PR05MB4586: X-LD-Processed: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4586; 20:4WhnQMaPwks0YzRpycgb/YQdmuY/HX67dkBeL3+PdBc3lsp3fpBHl648+qghiu53NvHto+r5LqCpeuwoBUbj0BHNsTL4k+dZpIjY5maGdFqAf+JUsPQJYZYKnw3o6sniJ77+ZV9BIMoifG998S2SSip3q8oWjuzqb1gMI/pAwCCom72J6lkXU8LlYB3cjgCoBalhUJgF/TlIdf+ugpbuU1Tv2Wxbm75iOYihgaZIw5LmKRoGJAS+M/taDvXwx1yJ29KBSHv0sJKctq9+DjXSbw100ZwLehYqxU3d58Z1rL18GS8PcnYvlM7A0jhpWoG2C+z4rteMpEyZXUHK79hZXh9uY65FLSRSmSgHn/Fv/cptfLwggOK7Liyg6b8w3jy4WvhL+yv1870elu6sIqJgK6ivgjBuAi4/j82nTH3KtgPHSJom3zo1wmOInqZAQnthsdiRinJ9TaE7JGRtH/1PvPiQiX4tPoBKrLcTwLen0CDPKhlvTi06lzDdtloQx3+p; 4:jaAj3+CJP4ObXKPWFHRcHEaHaP2h68Pp1afcewYZN/LrIfBeMH/xm9j4YXL6+Ldb2UlXAR/uaU7YWpO5cayaA7myb+4uBBbmoOAM62gVQSWMEs1BQyLPf8ugdghNZRYqNkirioaCjI5yBrAwHzFlz/KelScJO0VnR7PlRgLCbHvf6LCQSJVkxUgac+dsjvSUGLOcV3q4xYQOvQtF9RVhZm6nQP6k7yYq+D/Nlp2SCWk5zO1CqMfT8GcPHIe5ZHkaOYngdtLLQjMki172X4oovkY88Vbm0ogXbIB+25XQFaMot0no0CpT+3MV4onMYcAV X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231254)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(149027)(150027)(6041310)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DM6PR05MB4586; BCL:0; PCL:0; RULEID:; SRVR:DM6PR05MB4586; X-Forefront-PRVS: 0723A02764 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(346002)(366004)(376002)(396003)(199004)(189003)(1076002)(48376002)(8676002)(478600001)(16586007)(2906002)(446003)(486006)(11346002)(81156014)(476003)(956004)(316002)(6486002)(2616005)(305945005)(81166006)(51416003)(7736002)(86362001)(6512007)(52116002)(68736007)(107886003)(53936002)(76176011)(2351001)(97736004)(6506007)(2361001)(105586002)(4326008)(25786009)(66066001)(47776003)(36756003)(186003)(50466002)(6916009)(26005)(106356001)(8936002)(386003)(50226002)(16526019)(5660300001)(15760500003)(14444005)(54906003)(3846002)(6116002)(129583001)(17423001)(156123004)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR05MB4586; H:fedoratest.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM6PR05MB4586; 23:HyzoW7NuK86LsJfAQFinBPpg3IjqT9NJQcdSRFOP/?= =?us-ascii?Q?4zk3uWk3jMK+6Q2bqRWjU6wY4Ih0hWoF2M36RF564Jo83gkg6yhCavR9qHC3?= =?us-ascii?Q?tmzK9TgVKMCTZR6SlRM7yo/CqF/5LdWvXyAVuQhjXUaRQvBH9BwTnnyqif2o?= =?us-ascii?Q?Ws6raSL0OMyt8W6Go9sqIKWb984pt752JmojX4mgx1LVbyD3iChbvGaLgUYW?= =?us-ascii?Q?8a2dye3YAUwASlSkZJahTH2v8uaIr4HjCDDoDLlI7QhErrRTLMEJS+mbQYsn?= =?us-ascii?Q?Mlp5y/8yHXvSDoVh/ZlK8lhVyJc0Qfv2Q47qftIdDHm9qwAjx/5mLx+nU5yL?= =?us-ascii?Q?PuY/2lhOIi9DF17AAxYPHhBvKXn76rYDdwimWVbusOHvcEzGuXPTa1diYay2?= =?us-ascii?Q?KxQEpo0dt0SOMAv8+yCFS01HRn9wj2kN7K/r3E8aeGUIPT+85heNe61kTOC+?= =?us-ascii?Q?yuxTwctoEuohXt80/dm30ebWun2rGaxaMwIXi6UxEX8yW5OKCoCh31b+Ryht?= =?us-ascii?Q?5ibkSE+D2vCCjC54sdTr3vQ0/78p5UVKOyjrvZdF1YGj+Fc+9xrHs/5QPyqu?= =?us-ascii?Q?XDE7j4FaFpJgaFduzH9TQkqnbrJ2oFfp87r9iLMc7xLscXUA1T3FR6d/NFah?= =?us-ascii?Q?WN80VRIzgFL5f0HC4l+E+aVEChVForQuW9kT+gtIEDAemDaWeXnE2ygFnFf7?= =?us-ascii?Q?4IwYCdMJeaU3UDG76pLnE8oKpRkIrhXKGzripZVWv2joTCK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wilq1t8Cinb9pDtcz8ZHoVVbfdqVOgepTRRLgybghUeqR4wdty7EobeMufucx5a3hUUnE/c2b4ccVDw95mlmZQX7I2uruCqwmkCTGFZw= X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4586; 6:EZhrIRvyow0JeJYTN0Xr7O5FKa7eLxDCKMKt08WjkN6e7UBnM3kUc1I0Dc0RhX4cixPMpCsW5JAF6nZsduVdmvVZa6qks0v4vdOdr69pdrcraXGqMbJ0b6d5xB8WYTfXlGei0q3Tu8YDv3/rW+p7mN87DDCiLR+GoGUGJlI9mL1KE0lsLy80iwDD+3wnB0eJQv2L4lOHebYpMJF/n9dmL8vQpFIcLY2Wt1BVrutC0vRA7O9kmsG9H/Q+OVGIRyoGDJWg4Fb7xsHTvpIYDVYk5K2WmvJ2RzORpyrX4ZvrNqYY+Ai1JF/azgk2ZvaTnBQmV1anZlD9nOkoBwHt9Nwo+3btje7cazNrg4iOa/ESCb3iN14iA5KiZcmJeODL1wf5oJS4L26BUql1BJ2dRpwWDRDTiU18TjSlrgYAuKcKBeUVNz9aIMA+cA7L/eBnM5aYxUE9BulX6JAiAkSyoB8urg==; 5:8m+zpt3OI6d/smdTl32+u3xmuGvEdvefLBzVXLGWYCUwMH0nfyXQCS6LVSyfXBi4Riaw64yzbELeb4p0y8h63+RlNhvhiA4qFSZm5B63OlwE1q65ko4XvTz47eqDxC/4PfjWEAgY1R+NhYMZCwmX2tLIdLcDWUcrNU6JXJestVg=; 24:2xfP1HPoDrrqXteqfFztugp1+vqH49HzndM7dAFalYTPvYiHZL0V5npqqk/bP6TJdS4bemnAHBiYIqa068wK0mU8eto0EtTSgrqgbYvv1/8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4586; 7:Y2iqUV+lBkErdrs4twnGhGrsVSFQzgsgzeikxA6uwIEszbh81D5zXyZzxb2Ksw56lvdJ/2QPgL+fCZHYJdb+3LDvqpBGxKpspSy2nzEM0w/IX4/0ntpkpHSWX9FoS19QoBSE53R+SpZZuNaLfZrFZgcYGwnY9pbSzdTc0H3C0FYSTq40sWJ+bjxo7XC3yyg4V9I8r0EIV4JoMy0UOr/SH7XE4wAD+QCAsSEpITdKBmsSBJR0POiSkNWkDfLueAz9; 20:3gtoRy8dxvRHm8s479JRTLdyJJw55Xm+zOKs+sqqDWa7P7l6tDtSY5Z6XFuzWLK7ZM/dGhjMLwnWKU0CT9fAAQKHaf7hjMwGwK9z3wkXxy27TkrFEx74OxxagrZfJrfVBLLtD7SRN/+vowVwjsMKEy0g77zzg1U/pPsXcz84qjc= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2018 15:58:40.8776 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4a1a306f-16c3-4ea9-f787-08d5e1c70391 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR05MB4586 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Hellstrom , Deepak Rawat , linux-graphics-maintainer@vmware.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Deepak Rawat Since svga device introduced new 64bit SVGA3dSurfaceAllFlags, vmwgfx now stores the surface flags internally as SVGA3dSurfaceAllFlags. For legacy surface define commands, only lower 32-bit is used. Signed-off-by: Deepak Rawat Reviewed-by: Sinclair Yeh Reviewed-by: Brian Paul Reviewed-by: Thomas Hellstrom Signed-off-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 06cce72b7b9e..7e5c93083036 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h @@ -166,7 +166,7 @@ struct vmw_surface_offset; struct vmw_surface { struct vmw_resource res; - uint32_t flags; + SVGA3dSurfaceAllFlags flags; uint32_t format; uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES]; struct drm_vmw_size base_size; @@ -1080,7 +1080,7 @@ extern int vmw_surface_validate(struct vmw_private *dev_priv, struct vmw_surface *srf); int vmw_surface_gb_priv_define(struct drm_device *dev, uint32_t user_accounting_size, - uint32_t svga3d_flags, + SVGA3dSurfaceAllFlags svga3d_flags, SVGA3dSurfaceFormat format, bool for_scanout, uint32_t num_mip_levels, diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c index 2abf9a895605..a5f93f62c7fa 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c @@ -224,7 +224,12 @@ static void vmw_surface_define_encode(const struct vmw_surface *srf, cmd->header.id = SVGA_3D_CMD_SURFACE_DEFINE; cmd->header.size = cmd_len; cmd->body.sid = srf->res.id; - cmd->body.surfaceFlags = srf->flags; + /* + * Downcast of surfaceFlags, was upcasted when received from user-space, + * since driver internally stores as 64 bit. + * For legacy surface define only 32 bit flag is supported. + */ + cmd->body.surfaceFlags = (SVGA3dSurface1Flags)srf->flags; cmd->body.format = srf->format; for (i = 0; i < DRM_VMW_MAX_SURFACE_FACES; ++i) cmd->body.face[i].numMipLevels = srf->mip_levels[i]; @@ -760,7 +765,8 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, srf = &user_srf->srf; res = &srf->res; - srf->flags = req->flags; + /* Driver internally stores as 64-bit flags */ + srf->flags = (SVGA3dSurfaceAllFlags)req->flags; srf->format = req->format; srf->scanout = req->scanout; @@ -992,7 +998,8 @@ int vmw_surface_reference_ioctl(struct drm_device *dev, void *data, user_srf = container_of(base, struct vmw_user_surface, prime.base); srf = &user_srf->srf; - rep->flags = srf->flags; + /* Downcast of flags when sending back to user space */ + rep->flags = (uint32_t)srf->flags; rep->format = srf->format; memcpy(rep->mip_levels, srf->mip_levels, sizeof(srf->mip_levels)); user_sizes = (struct drm_vmw_size __user *)(unsigned long) @@ -1082,7 +1089,7 @@ static int vmw_gb_surface_create(struct vmw_resource *res) cmd3->header.id = cmd_id; cmd3->header.size = cmd_len; cmd3->body.sid = srf->res.id; - cmd3->body.surfaceFlags = (SVGA3dSurfaceAllFlags)srf->flags; + cmd3->body.surfaceFlags = srf->flags; cmd3->body.format = srf->format; cmd3->body.numMipLevels = srf->mip_levels[0]; cmd3->body.multisampleCount = srf->multisample_count; @@ -1320,7 +1327,7 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, /* Define a surface based on the parameters. */ ret = vmw_surface_gb_priv_define(dev, size, - req->svga3d_flags, + (SVGA3dSurfaceAllFlags)req->svga3d_flags, req->format, req->drm_surface_flags & drm_vmw_surface_flag_scanout, req->mip_levels, @@ -1451,7 +1458,7 @@ int vmw_gb_surface_reference_ioctl(struct drm_device *dev, void *data, goto out_bad_resource; } - rep->creq.svga3d_flags = srf->flags; + rep->creq.svga3d_flags = (uint32_t)srf->flags; rep->creq.format = srf->format; rep->creq.mip_levels = srf->mip_levels[0]; rep->creq.drm_surface_flags = 0; @@ -1495,7 +1502,7 @@ int vmw_gb_surface_reference_ioctl(struct drm_device *dev, void *data, */ int vmw_surface_gb_priv_define(struct drm_device *dev, uint32_t user_accounting_size, - uint32_t svga3d_flags, + SVGA3dSurfaceAllFlags svga3d_flags, SVGA3dSurfaceFormat format, bool for_scanout, uint32_t num_mip_levels,