dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zack Rusin <zack@kde.org>
To: dri-devel@lists.freedesktop.org
Cc: krastevm@vmware.com, banackm@vmware.com, mombasawalam@vmware.com
Subject: [PATCH v2 16/16] drm/vmwgfx: Optimize initial sizes of cotables
Date: Wed, 19 Oct 2022 23:41:31 -0400	[thread overview]
Message-ID: <20221020034131.491973-17-zack@kde.org> (raw)
In-Reply-To: <20221020034131.491973-1-zack@kde.org>

From: Zack Rusin <zackr@vmware.com>

It's important to get the initial size of cotables right because
otherwise every app needs to start with a synchronous cotable resize.

This has an measurable impact on system wide performance but is not
relevant for long running single full screen apps for which the cotable
resizes will happen early in the lifecycle and will continue running
just fine.

To eliminate the initial cotable resizes match the initial sizes to what
the userspace expects. The actual result of the patch is simply setting
the initial size of two of the cotables to a size that will align them
to two pages instead of one.

For a piglit run, before:
name               |  total |  per frame | per sec
vmw_cotable_resize |   1405 |       0.12 |    1.58
vmw_execbuf_ioctl  | 290805 |      25.43 |  326.05

After:
name               |  total |  per frame | per sec
vmw_cotable_resize |      4 |       0.00 |    0.00
vmw_execbuf_ioctl  | 281673 |      25.10 |  274.68

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Michael Banack <banackm@vmware.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
index a4c30f950d7c..0422b6b89cc1 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
@@ -73,12 +73,24 @@ struct vmw_cotable_info {
 			    bool);
 };
 
+
+/*
+ * Getting the initial size right is difficult because it all depends
+ * on what the userspace is doing. The sizes will be aligned up to
+ * a PAGE_SIZE so we just want to make sure that for majority of apps
+ * the initial number of entries doesn't require an immediate resize.
+ * For all cotables except SVGACOTableDXElementLayoutEntry and
+ * SVGACOTableDXBlendStateEntry the initial number of entries fits
+ * within the PAGE_SIZE. For SVGACOTableDXElementLayoutEntry and
+ * SVGACOTableDXBlendStateEntry we want to reserve two pages,
+ * because that's what all apps will require initially.
+ */
 static const struct vmw_cotable_info co_info[] = {
 	{1, sizeof(SVGACOTableDXRTViewEntry), &vmw_view_cotable_list_destroy},
 	{1, sizeof(SVGACOTableDXDSViewEntry), &vmw_view_cotable_list_destroy},
 	{1, sizeof(SVGACOTableDXSRViewEntry), &vmw_view_cotable_list_destroy},
-	{1, sizeof(SVGACOTableDXElementLayoutEntry), NULL},
-	{1, sizeof(SVGACOTableDXBlendStateEntry), NULL},
+	{PAGE_SIZE/sizeof(SVGACOTableDXElementLayoutEntry) + 1, sizeof(SVGACOTableDXElementLayoutEntry), NULL},
+	{PAGE_SIZE/sizeof(SVGACOTableDXBlendStateEntry) + 1, sizeof(SVGACOTableDXBlendStateEntry), NULL},
 	{1, sizeof(SVGACOTableDXDepthStencilEntry), NULL},
 	{1, sizeof(SVGACOTableDXRasterizerStateEntry), NULL},
 	{1, sizeof(SVGACOTableDXSamplerEntry), NULL},
-- 
2.34.1


      parent reply	other threads:[~2022-10-20  3:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20  3:41 [PATCH v2 00/16] drm/vmwgfx: fb, cursors and hashtable refactor Zack Rusin
2022-10-20  3:41 ` [PATCH v2 01/16] drm/vmwgfx: Write the driver id registers Zack Rusin
2022-10-20  3:41 ` [PATCH v2 02/16] drm/vmwgfx: Fix frame-size warning in vmw_mksstat_add_ioctl Zack Rusin
2022-10-20  3:41 ` [PATCH v2 03/16] drm/vmwgfx: Refactor resource manager's hashtable to use linux/hashtable implementation Zack Rusin
2022-10-20  3:41 ` [PATCH v2 04/16] drm/vmwgfx: Remove ttm object hashtable Zack Rusin
2022-10-20  3:41 ` [PATCH v2 05/16] drm/vmwgfx: Refactor resource validation hashtable to use linux/hashtable implementation Zack Rusin
2022-10-20  3:41 ` [PATCH v2 06/16] drm/vmwgfx: Clean up cursor mobs Zack Rusin
2022-10-20  3:41 ` [PATCH v2 07/16] drm/vmwgfx: Start diffing new mob cursors against old ones Zack Rusin
2022-10-20  3:41 ` [PATCH v2 08/16] drm/vmwgfx: Support cursor surfaces with mob cursor Zack Rusin
2022-10-20  3:41 ` [PATCH v2 09/16] drm/vmwgfx: Diff cursors when using cmds Zack Rusin
2022-10-20  3:41 ` [PATCH v2 10/16] drm/vmwgfx: Refactor ttm reference object hashtable to use linux/hashtable Zack Rusin
2022-10-20  3:41 ` [PATCH v2 11/16] drm/vmwgfx: Remove vmwgfx_hashtab Zack Rusin
2022-10-20  3:41 ` [PATCH v2 12/16] drm/vmwgfx: Do not allow invalid bpp's for dumb buffers Zack Rusin
2022-10-20  3:41 ` [PATCH v2 13/16] drm/vmwgfx: Port the framebuffer code to drm fb helpers Zack Rusin
2022-10-20  9:06   ` Thomas Zimmermann
2022-10-20 18:37     ` Zack Rusin
2022-10-21  7:06       ` Thomas Zimmermann
2022-10-20  3:41 ` [PATCH v2 14/16] drm/vmwgfx: Remove explicit and broken vblank handling Zack Rusin
2022-10-20  3:41 ` [PATCH v2 15/16] drm/vmwgfx: Add a mksstat counter for cotable resizes Zack Rusin
2022-10-20  3:41 ` Zack Rusin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221020034131.491973-17-zack@kde.org \
    --to=zack@kde.org \
    --cc=banackm@vmware.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=krastevm@vmware.com \
    --cc=mombasawalam@vmware.com \
    --cc=zackr@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox