[PATCH xf86-video-amdgpu 2/6] Set freesync capability when client has fullscreen size drawable

Nicholas Kazlauskas nicholas.kazlauskas at amd.com
Tue Sep 11 16:18:38 UTC 2018


From: Hawking Zhang <Hawking.Zhang at amd.com>

OGL send freesync request to ddx driver when it makes a drawable as current
DDX driver only set the client to be freesync capable when it is a fullscreen
size one.

Change-Id: Ie25ff11f58104546c52a253d6a5f85aa62532d4d
Signed-off-by: Hawking Zhang <Hawking.Zhang at amd.com>
Reviewed-by: Flora Cui <Flora.Cui at amd.com>
---
 src/amdgpu_extension.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/amdgpu_extension.c b/src/amdgpu_extension.c
index 1c984df..eadb742 100644
--- a/src/amdgpu_extension.c
+++ b/src/amdgpu_extension.c
@@ -32,6 +32,8 @@
 #include "extnsionst.h"
 #include "resource.h"
 #include "scrnintstr.h"
+#include "dixaccess.h"
+#include "pixmap.h"
 
 #include "amdgpu_drm.h"
 #include "amdgpu_extension.h"
@@ -53,8 +55,16 @@ static int ProcAMDGPUFreesyncCapability(ClientPtr client)
 	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
 	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
 	XID cliResId;
+	DrawablePtr pDrawable = NULL;
+	if (dixLookupDrawable(&pDrawable, (Drawable)stuff->drawable,
+			      client, 0, DixReadAccess))
+		return BadValue;
 
-	if (info->freesync_capable_client == NULL) {
+	if (info->freesync_capable_client == NULL &&
+	    pDrawable->x == pDrawable->pScreen->x &&
+	    pDrawable->y == pDrawable->pScreen->y &&
+	    pDrawable->width == pDrawable->pScreen->width &&
+	    pDrawable->height == pDrawable->pScreen->height) {
 		info->freesync_capable_client = client;
 		cliResId = FakeClientID(client->index);
 		if (AddResource(cliResId, RT_AMDGPUCLIENT, (void *)pScrn))
-- 
2.18.0



More information about the amd-gfx mailing list