From: "Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH xf86-video-ati 2/2] Keep track of damage event related flushes per-client
Date: Mon, 1 Aug 2016 18:59:20 +0900 [thread overview]
Message-ID: <1470045560-7220-2-git-send-email-michel@daenzer.net> (raw)
In-Reply-To: <1470045560-7220-1-git-send-email-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
From: Michel Dänzer <michel.daenzer@amd.com>
This further reduces the compositing slowdown due to flushing overhead,
by only flushing when the X server actually sends XDamageNotify events
to a client, and there hasn't been a flush yet in the meantime.
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
This patch can't have an effect without a corresponding xserver patch
which passes the ClientPtr to the FlushCallback, so I'll only push this
one once the xserver patch has landed.
src/radeon.h | 5 ++++-
src/radeon_kms.c | 34 ++++++++++++++++++++++++++++------
2 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/src/radeon.h b/src/radeon.h
index 25ff61c..b119241 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -448,6 +448,10 @@ struct radeon_accel_state {
Bool force;
};
+struct radeon_client_priv {
+ uint_fast32_t needs_flush[0];
+};
+
typedef struct {
EntityInfoPtr pEnt;
pciVideoPtr PciInfo;
@@ -474,7 +478,6 @@ typedef struct {
Bool allowColorTiling;
Bool allowColorTiling2D;
int callback_event_type;
- uint_fast32_t callback_needs_flush;
uint_fast32_t gpu_flushed;
uint_fast32_t gpu_synced;
struct radeon_accel_state *accel_state;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index da11358..7ede3a1 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -40,6 +40,7 @@
#include "radeon_version.h"
#include "shadow.h"
+#include <xf86Priv.h>
#include "atipciids.h"
@@ -59,6 +60,8 @@
#include "radeon_cs_gem.h"
#include "radeon_vbo.h"
+static DevPrivateKeyRec radeon_client_private_key;
+
extern SymTabRec RADEONChipsets[];
static Bool radeon_setup_kernel_mem(ScreenPtr pScreen);
@@ -241,9 +244,9 @@ radeonUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
}
static Bool
-callback_needs_flush(RADEONInfoPtr info)
+callback_needs_flush(RADEONInfoPtr info, uint_fast32_t needs_flush)
{
- return (int)(info->callback_needs_flush - info->gpu_flushed) > 0;
+ return (int)(needs_flush - info->gpu_flushed) > 0;
}
static void
@@ -251,21 +254,28 @@ radeon_event_callback(CallbackListPtr *list,
pointer user_data, pointer call_data)
{
EventInfoRec *eventinfo = call_data;
+ struct radeon_client_priv *client_priv =
+ dixLookupPrivate(&eventinfo->client->devPrivates, &radeon_client_private_key);
+ struct radeon_client_priv *server_priv =
+ dixLookupPrivate(&serverClient->devPrivates, &radeon_client_private_key);
ScrnInfoPtr pScrn = user_data;
RADEONInfoPtr info = RADEONPTR(pScrn);
int i;
- if (callback_needs_flush(info))
+ if (callback_needs_flush(info, client_priv->needs_flush[pScrn->scrnIndex]) ||
+ callback_needs_flush(info, server_priv->needs_flush[pScrn->scrnIndex]))
return;
/* Don't let gpu_flushed get too far ahead of callback_needs_flush,
* in order to prevent false positives in callback_needs_flush()
*/
- info->callback_needs_flush = info->gpu_flushed;
+ client_priv->needs_flush[pScrn->scrnIndex] = info->gpu_flushed;
+ server_priv->needs_flush[pScrn->scrnIndex] = info->gpu_flushed;
for (i = 0; i < eventinfo->count; i++) {
if (eventinfo->events[i].u.u.type == info->callback_event_type) {
- info->callback_needs_flush++;
+ client_priv->needs_flush[pScrn->scrnIndex]++;
+ server_priv->needs_flush[pScrn->scrnIndex]++;
return;
}
}
@@ -276,9 +286,13 @@ radeon_flush_callback(CallbackListPtr *list,
pointer user_data, pointer call_data)
{
ScrnInfoPtr pScrn = user_data;
+ ClientPtr client = call_data ? call_data : serverClient;
+ struct radeon_client_priv *client_priv =
+ dixLookupPrivate(&client->devPrivates, &radeon_client_private_key);
RADEONInfoPtr info = RADEONPTR(pScrn);
- if (pScrn->vtSema && callback_needs_flush(info))
+ if (pScrn->vtSema &&
+ callback_needs_flush(info, client_priv->needs_flush[pScrn->scrnIndex]))
radeon_cs_flush_indirect(pScrn);
}
@@ -351,6 +365,14 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen)
DeleteCallback(&FlushCallback, radeon_flush_callback, pScrn);
return FALSE;
}
+
+ if (!dixPrivateKeyRegistered(&radeon_client_private_key) &&
+ !dixRegisterPrivateKey(&radeon_client_private_key, PRIVATE_CLIENT,
+ xf86NumScreens * sizeof(uint_fast32_t))) {
+ DeleteCallback(&FlushCallback, radeon_flush_callback, pScrn);
+ DeleteCallback(&EventCallback, radeon_event_callback, pScrn);
+ return FALSE;
+ }
}
return TRUE;
--
2.8.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2016-08-01 9:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-01 9:59 [PATCH xf86-video-ati 1/2] Use EventCallback to avoid flushing every time in the FlushCallback Michel Dänzer
[not found] ` <1470045560-7220-1-git-send-email-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-08-01 9:59 ` Michel Dänzer [this message]
[not found] ` <1470045560-7220-2-git-send-email-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-08-01 15:56 ` [PATCH xf86-video-ati 2/2] Keep track of damage event related flushes per-client Deucher, Alexander
2016-08-02 8:48 ` [PATCH xf86-video-ati] Keep track of damage event related flushes per-client v2 Michel Dänzer
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=1470045560-7220-2-git-send-email-michel@daenzer.net \
--to=michel-otuistvhuppr7s880joybq@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.