From patchwork Wed Jul 4 15:57:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 10507305 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 0F499601D7 for ; Wed, 4 Jul 2018 15:59:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE0BA28BAE for ; Wed, 4 Jul 2018 15:59:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E29E828BD5; Wed, 4 Jul 2018 15:59:17 +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 848AA28BAE for ; Wed, 4 Jul 2018 15:59:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 133C16EC20; 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 NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0074.outbound.protection.outlook.com [104.47.34.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id 422F66EC2B for ; Wed, 4 Jul 2018 15:58:46 +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:43 +0000 From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org Subject: [PATCH -next 8/9] drm/vmwgfx: Add support for multisampling Date: Wed, 4 Jul 2018 17:57:49 +0200 Message-Id: <20180704155750.2749-9-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: 60d83eac-79c1-4f7c-dcf4-08d5e1c70523 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:9IvussLISXuRaojqIF90ZYUilBKms2YldE8Rr/R4bb4cA+T25aYD5jmEdORjuIGB5id8LHy1Z+IZ+exmHcK479HTXRmaiHRnRWoIaLVFymwRkvDgBTdyeYsTXia+BSrqWmJ1vVKji/uf/Kej+YDKmkooecXNS2pycY0wzHheYYLzODo/Tnji0EWkMxReOEsCqdni/CbG0/9yk6UixyVn5VTSTgVUQIhvL76m6U7F41y9p6pim+cyrZgB2h85KUU6; 25:ZEH4KD1fQLPMRPHQbCeL3MEHaUo00OlRHAK2sxdCoZivB37psnrxD1sNG7ysAcsubiJ63jcd9CDjHCjxNqIIDryxBNKjqXxe0d35NnaAoVZ8BeDOudXIwRNGp8Rll/W+CPkDeVpmQmEjd02vv1iQEPCNHLowY45I2uv6DyGqn0/JGmYwirG98BtGFZLoZo01+dV7yiST8Up83He+Nk6LZd6LpL+Qct41oa0aZk+SE36dK7goaSl15VzS9hPlzPEAsObNHqht0d0cYmKcLnelw+ROCJWJj1imGtmVfXGZORmkrOUg/WGxIqQGFWi/x1zbrrjB3K4tiHLWW+1KojjKdQ==; 31:uIzw2WNGNTgSaAMZNXPjio/6HY4Z9wd7szS3eIWVOiDhW0xBW1NGpvy4am2/wdqo7+md+RQ7bZfCCb+Q+uZn0SB2XEd+uiYgfEz6mhSIGziVAI3buWDn0bP1nzXed6gfH5Inyy3vaE7i4OkPLDQqKzecww/bk7uZu2FMkVSUFhM6IW+XCnys+0wYVi632wt4cmLGF7v3BPHShR0Z9yRahUwJbJbPVj+FhKv1Yg6L7j0= X-MS-TrafficTypeDiagnostic: DM6PR05MB4586: X-LD-Processed: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4586; 20:7QULaS4TDktaprJzjQOz2W94eMJVA2jgWRovN6M9/CcFKg8hbLyVdAS2FJsM+RldLb/phuZ4SRndnXmsLE1x9FudsHj4/uNURk62e1yTJxoc3VgBf7xJKDIYFwCapPfr9nNLTGAfH1Rur2PPciOyDuebBVvvCBJaPAWc5vCTLGPeat6QhoLvc282EmlopC669iFfpvJraJKPVLCbq0PTJ+J8RgYFIqn3Iw/pefZjjk2TRx6fmTLZ6cEi6gCDgjoy9o+3ZVbdchZU6lryfIL1Y2qbmjkarI73vKHWJkPP/VLwrhTGwF5l41vhklwm4qWrzjXYJRtMNkhnIjcmkyNIqsU4JksxSlXvZuzUOwrPzgQpuZ77PPBE+3CRpbGmUDtxE8BabDyKyuAY/2n/0QC8yBVWnJdU01B9IQDAFw4a57JeesFA2aV5XaXk+pDGaW5YxSRLIiZFqORxfxnqorlqTXi6Ln4rzkhKD2y570LWqUdvthA2crhICFGwHtF/RqNr; 4:PADVzstoEJJN0Xg6o31WLGm99rnEv8IWI1RBykoAcLV+0Q3zwidW7UunkbOQckuFBphB6NcABfrycIx0caHMXC7xnqMkc8J9CZEJNRE5IK3Ef8r4hTp4Nk0OopVSiYbgcfIFhQTDgc/IgReUI5OfL8NgR8Znv0JX0g0L5kMGywTMdVU94xs3D/rZGhWWB89hCsSWKO5WeIqoWBWUhlrC3Q21pZ064AGat654MkqugH9PhEbMnd7dn4R5Yxwzr6rVKkz6U4HI8pznTbI9Dr/DxBWOSg6zg2bqLVNySd3FTzCCguXmYCrVt0ug8d/xdC/y 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)(575784001)(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)(14444005)(54906003)(3846002)(6116002); 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:goR8Znb/aKIZ/twheFJiV70w0Tsz3KaXOMUAveQZO?= =?us-ascii?Q?BBs1haVni4i+Om8Zey1IbchxctYgiNnXqGlnhlMl2EPbHpeMbABAkJ+mujMO?= =?us-ascii?Q?h83UyHDj3aa0h9GloZa8vH6i2gXS6N+ZwD/DQrjXf2mOhiSZ24/VoW8uiM+8?= =?us-ascii?Q?fy3ziFnd5HE31hjGajhKgyoY/a+niqlghDmLfEPe5EbTlNYz0Spuqyl+yjh8?= =?us-ascii?Q?O/sYFrxDwGePyScBiil4uzg7nJMaG2D9pFk7Z9yG9hszTn+o7+VkpObF16xq?= =?us-ascii?Q?lAcqk1pp7O7+KOfJsfw7K1ASixVyGFVsY2lpc/Wu2UEaPjp1TLbn5uCxD7R1?= =?us-ascii?Q?RI7MBfZl1CPL3PDDdoGggzZ6O6qs/572BdjFiCBxgCiD+WG0VTomYZ5aK60x?= =?us-ascii?Q?U+zfRK5kTWhKN3p1J6Al4e4jggTcCLx/50OFcu9DDE0B+9IX0UUfWJkSGqV5?= =?us-ascii?Q?UejBZ7LMtYPY9Hmlzd/MQTuUr2A7PkExVbv0kaRGrLpW1bBmm6J/yDAmmEqA?= =?us-ascii?Q?+bGy69pQELasRYLGcDARl/2MHJwt343216NCstKTc10mOXICd4Yxjlud5vbC?= =?us-ascii?Q?fl5q7ZePjZ8bfMjAgwyzWXODI/14PaAT0IzIxiQt3sOxam3kyvhrpwfe9qM8?= =?us-ascii?Q?lo1n2vDSd48g+nHN4pVBP/fj3o+V32lqtl1bjMdGfuAlNRbFPVKQftsYP2cY?= =?us-ascii?Q?pR19qYwLoAiUs8ujXcp5XZ1n+J7RXnfEeMoSwp+i0FovKApVs/hFmhRkfcLc?= =?us-ascii?Q?f7Gslh5FBN8ClqMlRtVoQows3fiE4rI1Tz/U4/F3+IjEMjjVtmMgbb9o6M7d?= =?us-ascii?Q?/z0w7GXaxVK+N2bC1+o+zJyzVooc4JNdxahF1WRRQQOROIVbWsCXB0GfNlfU?= =?us-ascii?Q?zpqJyhi03JKIUe0KjOWdfXCuHBa+dKLVZvLEA9CR0DleWdi0m/ZMNo06PQ+w?= =?us-ascii?Q?ZbGV0inAWwB0FafIg5YuOjDksBakQy4upPF/nUxzDsYX1mKqrs3Vyog3jQPs?= =?us-ascii?Q?CxJ1axxlYXb7sM5qYLPNgKOnbHFr9jlEorITLwmB2/WnBte6OHfG1ibYCtof?= =?us-ascii?Q?CqGjFYI8sv4Wxe1KIRwGdGVd/ffskDCxWNNiRggX865fXoTLLOFBu7Wnsl5s?= =?us-ascii?Q?g34syG/zm5JdwAd6dZpH5hHW2WvzFPqkpGMo1PqnlhEU1gohsURjAP0YB6aa?= =?us-ascii?Q?JQ4ftsykxPLtEtf6xDVJTcIhzPtfiNySOxq9c+dNXCThC1YazAADwWbR5gm8?= =?us-ascii?Q?DsosUU4Rd8LMwGS7pF1c66RV2EC+1jYdxHePXzL3haGRrV6ZViSeAfnxlMpY?= =?us-ascii?B?QT09?= X-Microsoft-Antispam-Message-Info: 3pFcN6yjffDPpduCrQdgNVjnsdLc2AN/eBNdJMXfM+empUttVbIwkrP09JXk3p9WSeml8xsl/egOr6B3GNjl2cPIRfUEKn60/5lIt6qt9a4Gl34dgQKel6i6eiqHJSI3sN/q5t99UlETNNewRv0qQjfBNylPGP+zlMAqVXk3TMg090AB2SwvMuAI7ZkG/OVdlFG4U+J7yG5D4dK7rY0KYkWDpDRDuhx4g35sjTn8AttBlhvDkiat+g8t9PL+iRYKWyDuS/fHyeazZaAuQPDUww5WZgye0xOlCpVqC3BI88q3V62VnWwt0OH50qa/0HDdNsz1PR8m7f3QOJYfs+FLucDFDE28F+tUtfwJckpSsfw= X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4586; 6:BdD9pJqcp0yoWS9KfETDm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ZsOWTo+Wh27OOSNneSBtQcK9U6h9UkFytNOtrQ2CqgL2ncDBgFAmMHTFkGoIh3sKWix0UvY9ykAKdcVAcjSArZBgPru4DPg2zS8gXnWY3Fqgqjx1xKoEFhDRqpnnSeYdV/O+OnhR63yk8PD8LOUIabMtE69kOuXec= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2018 15:58:43.5104 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 60d83eac-79c1-4f7c-dcf4-08d5e1c70523 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 Support for SVGA3D_SURFACE_MULTISAMPLE and surface mob size according to sample count. Signed-off-by: Deepak Rawat Reviewed-by: Sinclair Yeh Reviewed-by: Brian Paul Reviewed-by: Thomas Hellstrom Reviewed-by: Charmaine Lee Signed-off-by: Thomas Hellstrom --- .../device_include/svga3d_surfacedefs.h | 20 +++++++++++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 17 ++++++++++++---- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/device_include/svga3d_surfacedefs.h b/drivers/gpu/drm/vmwgfx/device_include/svga3d_surfacedefs.h index 6422e3899cdf..809a4ec68e89 100644 --- a/drivers/gpu/drm/vmwgfx/device_include/svga3d_surfacedefs.h +++ b/drivers/gpu/drm/vmwgfx/device_include/svga3d_surfacedefs.h @@ -1235,6 +1235,26 @@ svga3dsurface_get_serialized_size(SVGA3dSurfaceFormat format, return total_size * num_layers; } +/** + * svga3dsurface_get_serialized_size_extended - Returns the number of bytes + * required for a surface with given parameters. Support for sample count. + */ +static inline u32 +svga3dsurface_get_serialized_size_extended(SVGA3dSurfaceFormat format, + surf_size_struct base_level_size, + u32 num_mip_levels, + u32 num_layers, + u32 num_samples) +{ + uint64_t total_size = + svga3dsurface_get_serialized_size(format, + base_level_size, + num_mip_levels, + num_layers); + total_size *= max_t(u32, 1, num_samples); + + return min_t(uint64_t, total_size, (uint64_t)U32_MAX); +} /** * svga3dsurface_get_pixel_offset - Compute the offset (in bytes) to a pixel diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 59af14714797..a67b54e4fd50 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h @@ -83,7 +83,7 @@ struct vmw_fpriv { struct drm_master *locked_master; struct ttm_object_file *tfile; - bool gb_aware; + bool gb_aware; /* user-space is guest-backed aware */ }; struct vmw_buffer_object { diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c index 1d4c010a0e48..7636bf2db17e 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c @@ -1399,6 +1399,7 @@ int vmw_surface_gb_priv_define(struct drm_device *dev, struct vmw_surface *srf; int ret; u32 num_layers = 1; + u32 sample_count = 1; *srf_out = NULL; @@ -1481,11 +1482,15 @@ int vmw_surface_gb_priv_define(struct drm_device *dev, else if (svga3d_flags & SVGA3D_SURFACE_CUBEMAP) num_layers = SVGA3D_MAX_SURFACE_FACES; + if (srf->flags & SVGA3D_SURFACE_MULTISAMPLE) + sample_count = srf->multisample_count; + srf->res.backup_size = - svga3dsurface_get_serialized_size(srf->format, - srf->base_size, - srf->mip_levels[0], - num_layers); + svga3dsurface_get_serialized_size_extended(srf->format, + srf->base_size, + srf->mip_levels[0], + num_layers, + sample_count); if (srf->flags & SVGA3D_SURFACE_BIND_STREAM_OUTPUT) srf->res.backup_size += sizeof(SVGA3dDXSOState); @@ -1595,6 +1600,10 @@ vmw_gb_surface_define_internal(struct drm_device *dev, return -EINVAL; } + if ((svga3d_flags_64 & SVGA3D_SURFACE_MULTISAMPLE) && + req->base.multisample_count == 0) + return -EINVAL; + if (req->base.mip_levels > DRM_VMW_MAX_MIP_LEVELS) return -EINVAL;