Re: [PATCH xf86-video-amdgpu 0/13] DRI3/Present support ported from radeon

2015-06-02 Thread Alex Deucher
On Tue, Jun 2, 2015 at 5:21 AM, Michel Dänzer  wrote:
> This series ports the changes for DRI3/Present support from the radeon
> driver, with some followup fixes squashed in.
>
> Patch 11 was ported by Darren Powell, so I added my review tag.
>
> [PATCH xf86-video-amdgpu 01/13] Require at least xserver 1.8
> [PATCH xf86-video-amdgpu 02/13] Move xorg_list backwards
> [PATCH xf86-video-amdgpu 03/13] Add DRM event queue helpers
> [PATCH xf86-video-amdgpu 04/13] DRI2: Simplify blit fallback handling
> [PATCH xf86-video-amdgpu 05/13] DRI2: Remove superfluous assignments
> [PATCH xf86-video-amdgpu 06/13] DRI2: Move
> [PATCH xf86-video-amdgpu 07/13] DRI2: Use helper functions for DRM
> [PATCH xf86-video-amdgpu 08/13] DRI2: Split out helper for getting
> [PATCH xf86-video-amdgpu 09/13] Add support for SYNC extension fences
> [PATCH xf86-video-amdgpu 10/13] Add support for the Present extension
> [PATCH xf86-video-amdgpu 11/13] glamor: Add radeon_pixmap parameter
> [PATCH xf86-video-amdgpu 12/13] amdgpu_set_shared_pixmap_backing: Add
> [PATCH xf86-video-amdgpu 13/13] Add DRI3 support

For the series:
Reviewed-by: Alex Deucher 
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[PATCH xf86-video-amdgpu 06/13] DRI2: Move amdgpu_dri2_flip_event_handler

2015-06-02 Thread Michel Dänzer
From: Michel Dänzer 

In preparation for the next change, which will modify it to a static
function which needs to be in the new place. No functional change.

(Cherry picked from radeon commit c3fa22a479e61d1899fa9d327d9c4e2a7f64b0c1)

Signed-off-by: Michel Dänzer 
---
 src/amdgpu_dri2.c | 120 +++---
 1 file changed, 60 insertions(+), 60 deletions(-)

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index fd98fa7..c139dec 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -497,6 +497,66 @@ xf86CrtcPtr amdgpu_dri2_drawable_crtc(DrawablePtr pDraw, 
Bool consider_disabled)
return NULL;
 }
 
+void amdgpu_dri2_flip_event_handler(unsigned int frame, unsigned int tv_sec,
+   unsigned int tv_usec, void *event_data)
+{
+   DRI2FrameEventPtr flip = event_data;
+   DrawablePtr drawable;
+   ScreenPtr screen;
+   ScrnInfoPtr scrn;
+   int status;
+   PixmapPtr pixmap;
+
+   status = dixLookupDrawable(&drawable, flip->drawable_id, serverClient,
+  M_ANY, DixWriteAccess);
+   if (status != Success) {
+   free(flip);
+   return;
+   }
+   if (!flip->crtc) {
+   free(flip);
+   return;
+   }
+   frame += amdgpu_get_interpolated_vblanks(flip->crtc);
+
+   screen = drawable->pScreen;
+   scrn = xf86ScreenToScrn(screen);
+
+   pixmap = screen->GetScreenPixmap(screen);
+   xf86DrvMsgVerb(scrn->scrnIndex, X_INFO, AMDGPU_LOGLEVEL_DEBUG,
+  "%s:%d fevent[%p] width %d pitch %d (/4 %d)\n",
+  __func__, __LINE__, flip, pixmap->drawable.width,
+  pixmap->devKind, pixmap->devKind / 4);
+
+   /* We assume our flips arrive in order, so we don't check the frame */
+   switch (flip->type) {
+   case DRI2_SWAP:
+   /* Check for too small vblank count of pageflip completion, 
taking wraparound
+* into account. This usually means some defective kms pageflip 
completion,
+* causing wrong (msc, ust) return values and possible visual 
corruption.
+*/
+   if ((frame < flip->frame) && (flip->frame - frame < 5)) {
+   xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+  "%s: Pageflip completion event has 
impossible msc %d < target_msc %d\n",
+  __func__, frame, flip->frame);
+   /* All-Zero values signal failure of (msc, ust) 
timestamping to client. */
+   frame = tv_sec = tv_usec = 0;
+   }
+
+   DRI2SwapComplete(flip->client, drawable, frame, tv_sec, tv_usec,
+DRI2_FLIP_COMPLETE, flip->event_complete,
+flip->event_data);
+   break;
+   default:
+   xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+  "%s: unknown vblank event received\n", __func__);
+   /* Unknown type */
+   break;
+   }
+
+   free(flip);
+}
+
 static Bool
 amdgpu_dri2_schedule_flip(ScrnInfoPtr scrn, ClientPtr client,
  DrawablePtr draw, DRI2BufferPtr front,
@@ -1130,66 +1190,6 @@ out_complete:
return TRUE;
 }
 
-void amdgpu_dri2_flip_event_handler(unsigned int frame, unsigned int tv_sec,
-   unsigned int tv_usec, void *event_data)
-{
-   DRI2FrameEventPtr flip = event_data;
-   DrawablePtr drawable;
-   ScreenPtr screen;
-   ScrnInfoPtr scrn;
-   int status;
-   PixmapPtr pixmap;
-
-   status = dixLookupDrawable(&drawable, flip->drawable_id, serverClient,
-  M_ANY, DixWriteAccess);
-   if (status != Success) {
-   free(flip);
-   return;
-   }
-   if (!flip->crtc) {
-   free(flip);
-   return;
-   }
-   frame += amdgpu_get_interpolated_vblanks(flip->crtc);
-
-   screen = drawable->pScreen;
-   scrn = xf86ScreenToScrn(screen);
-
-   pixmap = screen->GetScreenPixmap(screen);
-   xf86DrvMsgVerb(scrn->scrnIndex, X_INFO, AMDGPU_LOGLEVEL_DEBUG,
-  "%s:%d fevent[%p] width %d pitch %d (/4 %d)\n",
-  __func__, __LINE__, flip, pixmap->drawable.width,
-  pixmap->devKind, pixmap->devKind / 4);
-
-   /* We assume our flips arrive in order, so we don't check the frame */
-   switch (flip->type) {
-   case DRI2_SWAP:
-   /* Check for too small vblank count of pageflip completion, 
taking wraparound
-* into account. This usually means some defective kms pageflip 
completion,
-* causing wrong (msc, ust) return values and possible visual 
corruption.
-*/
-   if ((frame < flip->frame) && (flip

[PATCH xf86-video-amdgpu 0/13] DRI3/Present support ported from radeon

2015-06-02 Thread Michel Dänzer
This series ports the changes for DRI3/Present support from the radeon
driver, with some followup fixes squashed in.

Patch 11 was ported by Darren Powell, so I added my review tag.

[PATCH xf86-video-amdgpu 01/13] Require at least xserver 1.8
[PATCH xf86-video-amdgpu 02/13] Move xorg_list backwards
[PATCH xf86-video-amdgpu 03/13] Add DRM event queue helpers
[PATCH xf86-video-amdgpu 04/13] DRI2: Simplify blit fallback handling
[PATCH xf86-video-amdgpu 05/13] DRI2: Remove superfluous assignments
[PATCH xf86-video-amdgpu 06/13] DRI2: Move
[PATCH xf86-video-amdgpu 07/13] DRI2: Use helper functions for DRM
[PATCH xf86-video-amdgpu 08/13] DRI2: Split out helper for getting
[PATCH xf86-video-amdgpu 09/13] Add support for SYNC extension fences
[PATCH xf86-video-amdgpu 10/13] Add support for the Present extension
[PATCH xf86-video-amdgpu 11/13] glamor: Add radeon_pixmap parameter
[PATCH xf86-video-amdgpu 12/13] amdgpu_set_shared_pixmap_backing: Add
[PATCH xf86-video-amdgpu 13/13] Add DRI3 support
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[PATCH xf86-video-amdgpu 05/13] DRI2: Remove superfluous assignments to *_info->frame

2015-06-02 Thread Michel Dänzer
From: Michel Dänzer 

That field is only used for page flipping.

(Cherry picked from radeon commit 65045112fdc8a9fa36e0e00f46739a6152b775ff)

Signed-off-by: Michel Dänzer 
---
 src/amdgpu_dri2.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index 895abcd..fd98fa7 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -1038,7 +1038,6 @@ static int amdgpu_dri2_schedule_wait_msc(ClientPtr 
client, DrawablePtr draw,
CARD32 delay;
delay = amdgpu_dri2_extrapolate_msc_delay(crtc, &target_msc,
  divisor, remainder);
-   wait_info->frame = target_msc;
amdgpu_dri2_schedule_event(delay, wait_info);
DRI2BlockClient(client, draw);
return TRUE;
@@ -1086,8 +1085,6 @@ static int amdgpu_dri2_schedule_wait_msc(ClientPtr 
client, DrawablePtr draw,
goto out_complete;
}
 
-   wait_info->frame = vbl.reply.sequence;
-   wait_info->frame += amdgpu_get_interpolated_vblanks(crtc);
DRI2BlockClient(client, draw);
return TRUE;
}
@@ -1120,8 +1117,6 @@ static int amdgpu_dri2_schedule_wait_msc(ClientPtr 
client, DrawablePtr draw,
goto out_complete;
}
 
-   wait_info->frame = vbl.reply.sequence;
-   wait_info->frame += amdgpu_get_interpolated_vblanks(crtc);
DRI2BlockClient(client, draw);
 
return TRUE;
@@ -1279,7 +1274,6 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, 
DrawablePtr draw,
CARD32 delay;
delay = amdgpu_dri2_extrapolate_msc_delay(crtc, target_msc,
  divisor, remainder);
-   swap_info->frame = *target_msc;
amdgpu_dri2_schedule_event(delay, swap_info);
return TRUE;
}
-- 
2.1.4

___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[PATCH xf86-video-amdgpu 07/13] DRI2: Use helper functions for DRM event queue management

2015-06-02 Thread Michel Dänzer
From: Michel Dänzer 

This is mostly in preparation for Present support, but it also simplifies
the DRI2 specific code a little.

(Cherry picked from radeon commit 6c3a721cde9317233072b573f9502348dcd21b16)

Signed-off-by: Michel Dänzer 
---
 src/amdgpu_dri2.c | 271 ++
 src/amdgpu_dri2.h |  37 ---
 src/drmmode_display.c |  90 +++--
 src/drmmode_display.h |  13 ++-
 4 files changed, 165 insertions(+), 246 deletions(-)

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index c139dec..95db216 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -49,6 +49,8 @@
 
 #include "amdgpu_list.h"
 
+#include 
+
 #if DRI2INFOREC_VERSION >= 9
 #define USE_DRI2_PRIME
 #endif
@@ -370,65 +372,20 @@ typedef struct _DRI2FrameEvent {
XID drawable_id;
ClientPtr client;
enum DRI2FrameEventType type;
-   int frame;
+   unsigned frame;
xf86CrtcPtr crtc;
+   OsTimerPtr timer;
+   struct amdgpu_drm_queue_entry *drm_queue;
 
/* for swaps & flips only */
DRI2SwapEventPtr event_complete;
void *event_data;
DRI2BufferPtr front;
DRI2BufferPtr back;
-
-   Bool valid;
-
-   struct xorg_list link;
 } DRI2FrameEventRec, *DRI2FrameEventPtr;
 
-typedef struct _DRI2ClientEvents {
-   struct xorg_list reference_list;
-} DRI2ClientEventsRec, *DRI2ClientEventsPtr;
-
-#if HAS_DEVPRIVATEKEYREC
-
 static int DRI2InfoCnt;
 
-static DevPrivateKeyRec DRI2ClientEventsPrivateKeyRec;
-#define DRI2ClientEventsPrivateKey (&DRI2ClientEventsPrivateKeyRec)
-
-#else
-
-static int DRI2ClientEventsPrivateKeyIndex;
-DevPrivateKey DRI2ClientEventsPrivateKey = &DRI2ClientEventsPrivateKeyIndex;
-
-#endif /* HAS_DEVPRIVATEKEYREC */
-
-#define GetDRI2ClientEvents(pClient)   ((DRI2ClientEventsPtr) \
-dixLookupPrivate(&(pClient)->devPrivates, DRI2ClientEventsPrivateKey))
-
-static int ListAddDRI2ClientEvents(ClientPtr client, struct xorg_list *entry)
-{
-   DRI2ClientEventsPtr pClientPriv;
-   pClientPriv = GetDRI2ClientEvents(client);
-
-   if (!pClientPriv) {
-   return BadAlloc;
-   }
-
-   xorg_list_add(entry, &pClientPriv->reference_list);
-   return 0;
-}
-
-static void ListDelDRI2ClientEvents(ClientPtr client, struct xorg_list *entry)
-{
-   DRI2ClientEventsPtr pClientPriv;
-   pClientPriv = GetDRI2ClientEvents(client);
-
-   if (!pClientPriv) {
-   return;
-   }
-   xorg_list_del(entry);
-}
-
 static void amdgpu_dri2_ref_buffer(BufferPtr buffer)
 {
struct dri2_buffer_priv *private = buffer->driverPrivate;
@@ -448,30 +405,13 @@ static void
 amdgpu_dri2_client_state_changed(CallbackListPtr * ClientStateCallback,
 pointer data, pointer calldata)
 {
-   DRI2ClientEventsPtr pClientEventsPriv;
-   DRI2FrameEventPtr ref;
NewClientInfoRec *clientinfo = calldata;
ClientPtr pClient = clientinfo->client;
-   pClientEventsPriv = GetDRI2ClientEvents(pClient);
 
switch (pClient->clientState) {
-   case ClientStateInitial:
-   xorg_list_init(&pClientEventsPriv->reference_list);
-   break;
-   case ClientStateRunning:
-   break;
-
case ClientStateRetained:
case ClientStateGone:
-   if (pClientEventsPriv) {
-   xorg_list_for_each_entry(ref,
-&pClientEventsPriv->
-reference_list, link) {
-   ref->valid = FALSE;
-   amdgpu_dri2_unref_buffer(ref->front);
-   amdgpu_dri2_unref_buffer(ref->back);
-   }
-   }
+   amdgpu_drm_abort_client(pClient);
break;
default:
break;
@@ -497,37 +437,42 @@ xf86CrtcPtr amdgpu_dri2_drawable_crtc(DrawablePtr pDraw, 
Bool consider_disabled)
return NULL;
 }
 
-void amdgpu_dri2_flip_event_handler(unsigned int frame, unsigned int tv_sec,
-   unsigned int tv_usec, void *event_data)
+static void
+amdgpu_dri2_flip_event_abort(ScrnInfoPtr scrn, void *event_data)
+{
+   free(event_data);
+}
+
+static void
+amdgpu_dri2_flip_event_handler(ScrnInfoPtr scrn, uint32_t frame, uint64_t usec,
+  void *event_data)
 {
DRI2FrameEventPtr flip = event_data;
+   unsigned tv_sec, tv_usec;
DrawablePtr drawable;
ScreenPtr screen;
-   ScrnInfoPtr scrn;
int status;
PixmapPtr pixmap;
 
status = dixLookupDrawable(&drawable, flip->drawable_id, serverClient,
   M_ANY, DixWriteAccess);
-   if (status != Success) {
-   free(flip);
-   return;
-   }
-   if (!flip->crtc) {
-   free(flip);
-   return;

[PATCH xf86-video-amdgpu 13/13] Add DRI3 support

2015-06-02 Thread Michel Dänzer
From: Michel Dänzer 

Must be enabled with

Option  "DRI3"

in xorg.conf.

(Cherry picked from radeon commits 64e1e4dbdd3caee6f5d8f6b6c094b4533fa94953,
694e04720b886060fe3eefdce59741f218c8269f,
f940fd741b15f03393037c5bb904cd74f012de9d,
fcd37f65f485291084c174666bd605e215bf1398,
4b0997e56dec0053cb2cb793e0f4ae35055ff7e6,
f68d9b5ba0c91a725b5eec9386c61bea8824c299 and
98fb4199e63fedd4607cddee64bf602d6398df81)

Signed-off-by: Michel Dänzer 
---
 configure.ac  |   4 ++
 man/amdgpu.man|   4 ++
 src/Makefile.am   |   4 +-
 src/amdgpu_dri3.c | 196 ++
 src/amdgpu_drv.h  |   6 +-
 src/amdgpu_kms.c  |  20 +-
 6 files changed, 229 insertions(+), 5 deletions(-)
 create mode 100644 src/amdgpu_dri3.c

diff --git a/configure.ac b/configure.ac
index b91ce17..d9d97ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -168,6 +168,10 @@ AC_CHECK_HEADERS([present.h], [], [],
 #include 
 #include "xorg-server.h"])
 
+AC_CHECK_HEADERS([dri3.h], [], [],
+[#include 
+#include ])
+
 CPPFLAGS="$SAVE_CPPFLAGS"
 
 PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
diff --git a/man/amdgpu.man b/man/amdgpu.man
index 64633b3..bc7bf30 100644
--- a/man/amdgpu.man
+++ b/man/amdgpu.man
@@ -70,6 +70,10 @@ For example:
 Option \*qZaphodHeads\*q \*qLVDS,VGA-0\*q
 will assign xrandr outputs LVDS and VGA-0 to this instance of the driver.
 .TP
+.BI "Option \*qDRI3\*q \*q" boolean \*q
+Enable the DRI3 extension. The default is
+.B off.
+.TP
 .BI "Option \*qEnablePageFlip\*q \*q" boolean \*q
 Enable DRI2 page flipping.  The default is
 .B on.
diff --git a/src/Makefile.am b/src/Makefile.am
index fc8b77a..b953d4c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,8 +28,8 @@
 
 amdgpu_drv_la_LIBADD = $(PCIACCESS_LIBS) $(LIBDRM_AMDGPU_LIBS) $(GBM_LIBS)
 
-AMDGPU_KMS_SRCS=amdgpu_bo_helper.c amdgpu_dri2.c amdgpu_drm_queue.c 
amdgpu_kms.c \
-   amdgpu_present.c amdgpu_sync.c drmmode_display.c
+AMDGPU_KMS_SRCS=amdgpu_bo_helper.c amdgpu_dri2.c amdgpu_dri3.c 
amdgpu_drm_queue.c \
+   amdgpu_kms.c amdgpu_present.c amdgpu_sync.c drmmode_display.c
 
 AM_CFLAGS = \
 @GBM_CFLAGS@ \
diff --git a/src/amdgpu_dri3.c b/src/amdgpu_dri3.c
new file mode 100644
index 000..ce0f8e7
--- /dev/null
+++ b/src/amdgpu_dri3.c
@@ -0,0 +1,196 @@
+/*
+ * Copyright © 2013-2014 Intel Corporation
+ * Copyright © 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "amdgpu_drv.h"
+
+#ifdef HAVE_DRI3_H
+
+#include "amdgpu_glamor.h"
+#include "amdgpu_pixmap.h"
+#include "dri3.h"
+
+#include 
+#include 
+#include 
+#include 
+
+
+static int
+amdgpu_dri3_open(ScreenPtr screen, RRProviderPtr provider, int *out)
+{
+   ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+   AMDGPUInfoPtr info = AMDGPUPTR(scrn);
+   drm_magic_t magic;
+   int fd;
+
+   fd = open(info->dri2.device_name, O_RDWR | O_CLOEXEC);
+   if (fd < 0)
+   return BadAlloc;
+
+   /* Before FD passing in the X protocol with DRI3 (and increased
+* security of rendering with per-process address spaces on the
+* GPU), the kernel had to come up with a way to have the server
+* decide which clients got to access the GPU, which was done by
+* each client getting a unique (magic) number from the kernel,
+* passing it to the server, and the server then telling the
+* kernel which clients were authenticated for using the device.
+*
+* Now that we have FD passing, the server can just set up the
+* authentication on its own and hand the prepared FD off to the
+* client.
+*/
+   if (drmGetMagic(fd, &magic) < 0) {
+   if (errno == EACCES) {
+ 

[PATCH xf86-video-amdgpu 02/13] Move xorg_list backwards compatibility to new amdgpu_list.h header

2015-06-02 Thread Michel Dänzer
From: Michel Dänzer 

(Cherry picked from radeon commits 7c3470f4b659206ed23f761948936ede3a2dba3d
and 4a98f60117c387a228d5cbaadb6e298fb4e865df)

Signed-off-by: Michel Dänzer 
---
 src/Makefile.am   |  1 +
 src/amdgpu_dri2.c |  9 +
 src/amdgpu_list.h | 39 +++
 3 files changed, 41 insertions(+), 8 deletions(-)
 create mode 100644 src/amdgpu_list.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 8715eb3..3fe1cd0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -59,6 +59,7 @@ EXTRA_DIST = \
amdgpu_bo_helper.h \
amdgpu_glamor.h \
amdgpu_drv.h \
+   amdgpu_list.h \
amdgpu_probe.h \
amdgpu_version.h \
amdgpu_video.h \
diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index 32f6171..f05b742 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -47,14 +47,7 @@
 
 #include "amdgpu_version.h"
 
-#include "list.h"
-#if !HAVE_XORG_LIST
-#define xorg_list  list
-#define xorg_list_init list_init
-#define xorg_list_add  list_add
-#define xorg_list_del  list_del
-#define xorg_list_for_each_entry   list_for_each_entry
-#endif
+#include "amdgpu_list.h"
 
 #if DRI2INFOREC_VERSION >= 9
 #define USE_DRI2_PRIME
diff --git a/src/amdgpu_list.h b/src/amdgpu_list.h
new file mode 100644
index 000..c1e3516
--- /dev/null
+++ b/src/amdgpu_list.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright © 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
+ * SOFTWARE.
+ */
+
+#ifndef _AMDGPU_LIST_H_
+#define _AMDGPU_LIST_H_
+
+#include 
+#include 
+
+#if !HAVE_XORG_LIST
+#define xorg_list  list
+#define xorg_list_init list_init
+#define xorg_list_add  list_add
+#define xorg_list_del  list_del
+#define xorg_list_for_each_entry   list_for_each_entry
+#define xorg_list_for_each_entry_safe  list_for_each_entry_safe
+#endif
+
+#endif /* _AMDGPU_LIST_H_ */
-- 
2.1.4

___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[PATCH xf86-video-amdgpu 03/13] Add DRM event queue helpers

2015-06-02 Thread Michel Dänzer
From: Michel Dänzer 

(Cherry picked from radeon commit b4af8a327ed8420f0ff4ea0f113f4a59406ed4d3)

Signed-off-by: Michel Dänzer 
---
 src/Makefile.am|   4 +-
 src/amdgpu_drm_queue.c | 181 +
 src/amdgpu_drm_queue.h |  56 +++
 src/amdgpu_kms.c   |   4 ++
 4 files changed, 244 insertions(+), 1 deletion(-)
 create mode 100644 src/amdgpu_drm_queue.c
 create mode 100644 src/amdgpu_drm_queue.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 3fe1cd0..8e91472 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,7 +28,8 @@
 
 amdgpu_drv_la_LIBADD = $(PCIACCESS_LIBS) $(LIBDRM_AMDGPU_LIBS) $(GBM_LIBS)
 
-AMDGPU_KMS_SRCS=amdgpu_dri2.c amdgpu_kms.c drmmode_display.c amdgpu_bo_helper.c
+AMDGPU_KMS_SRCS=amdgpu_bo_helper.c amdgpu_dri2.c amdgpu_drm_queue.c 
amdgpu_kms.c \
+   drmmode_display.c
 
 AM_CFLAGS = \
 @GBM_CFLAGS@ \
@@ -57,6 +58,7 @@ amdgpu_drv_la_SOURCES += \
 EXTRA_DIST = \
compat-api.h \
amdgpu_bo_helper.h \
+   amdgpu_drm_queue.h \
amdgpu_glamor.h \
amdgpu_drv.h \
amdgpu_list.h \
diff --git a/src/amdgpu_drm_queue.c b/src/amdgpu_drm_queue.c
new file mode 100644
index 000..9bec658
--- /dev/null
+++ b/src/amdgpu_drm_queue.c
@@ -0,0 +1,181 @@
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ * Copyright © 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
+ * SOFTWARE.
+ *
+ * Authors:
+ *Dave Airlie 
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+
+#include "amdgpu_drv.h"
+#include "amdgpu_drm_queue.h"
+#include "amdgpu_list.h"
+
+
+struct amdgpu_drm_queue_entry {
+   struct xorg_list list;
+   uint64_t id;
+   void *data;
+   ClientPtr client;
+   ScrnInfoPtr scrn;
+   amdgpu_drm_handler_proc handler;
+   amdgpu_drm_abort_proc abort;
+};
+
+static int amdgpu_drm_queue_refcnt;
+static struct xorg_list amdgpu_drm_queue;
+
+
+/*
+ * Handle a DRM event
+ */
+void
+amdgpu_drm_queue_handler(int fd, unsigned int frame, unsigned int sec,
+unsigned int usec, void *user_ptr)
+{
+   struct amdgpu_drm_queue_entry *user_data = user_ptr;
+   struct amdgpu_drm_queue_entry *e, *tmp;
+
+   xorg_list_for_each_entry_safe(e, tmp, &amdgpu_drm_queue, list) {
+   if (e == user_data) {
+   xorg_list_del(&e->list);
+   e->handler(e->scrn, frame,
+  (uint64_t)sec * 100 + usec, e->data);
+   free(e);
+   break;
+   }
+   }
+}
+
+/*
+ * Enqueue a potential drm response; when the associated response
+ * appears, we've got data to pass to the handler from here
+ */
+struct amdgpu_drm_queue_entry *
+amdgpu_drm_queue_alloc(ScrnInfoPtr scrn, ClientPtr client,
+  uint64_t id, void *data,
+  amdgpu_drm_handler_proc handler,
+  amdgpu_drm_abort_proc abort)
+{
+   struct amdgpu_drm_queue_entry *e;
+
+   e = calloc(1, sizeof(struct amdgpu_drm_queue_entry));
+   if (!e)
+   return NULL;
+
+   e->client = client;
+   e->scrn = scrn;
+   e->id = id;
+   e->data = data;
+   e->handler = handler;
+   e->abort = abort;
+
+   xorg_list_add(&e->list, &amdgpu_drm_queue);
+
+   return e;
+}
+
+/*
+ * Abort one queued DRM entry, removing it
+ * from the list, calling the abort function and
+ * freeing the memory
+ */
+static void
+amdgpu_drm_abort_one(struct amdgpu_drm_queue_entry *e)
+{
+   xorg_list_del(&e->list);
+   e->abort(e->scrn, e->data);
+   free(e);
+}
+
+/*
+ * Abort drm queue entries for a client
+ */
+void
+amdgpu_drm_abort_client(ClientPtr client)
+{
+   struct amdgpu_drm_queue_entry *e, *tmp;
+
+   xorg_list_for_each_entry_safe(e, tmp, &amdgpu_drm_queue, list) 

[PATCH xf86-video-amdgpu 04/13] DRI2: Simplify blit fallback handling for scheduled swaps

2015-06-02 Thread Michel Dänzer
From: Michel Dänzer 

Also use amdgpu_dri2_schedule_event when possible.

(Cherry picked from radeon commit ad27f16f308079d06a2b1c788b3cb0947531253a)

Signed-off-by: Michel Dänzer 
---
 src/amdgpu_dri2.c | 48 
 1 file changed, 20 insertions(+), 28 deletions(-)

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index f05b742..895abcd 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -1228,7 +1228,6 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, 
DrawablePtr draw,
drmVBlank vbl;
int ret, flip = 0;
DRI2FrameEventPtr swap_info = NULL;
-   enum DRI2FrameEventType swap_type = DRI2_SWAP;
CARD64 current_msc;
BoxRec box;
RegionRec region;
@@ -1254,6 +1253,7 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, 
DrawablePtr draw,
if (!swap_info)
goto blit_fallback;
 
+   swap_info->type = DRI2_SWAP;
swap_info->drawable_id = draw->id;
swap_info->client = client;
swap_info->event_complete = func;
@@ -1293,9 +1293,7 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, 
DrawablePtr draw,
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
   "first get vblank counter failed: %s\n",
   strerror(errno));
-   *target_msc = 0;
-   amdgpu_dri2_schedule_event(FALLBACK_SWAP_DELAY, swap_info);
-   return TRUE;
+   goto blit_fallback;
}
 
current_msc =
@@ -1304,13 +1302,11 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, 
DrawablePtr draw,
 
/* Flips need to be submitted one frame before */
if (can_flip(scrn, draw, front, back)) {
-   swap_type = DRI2_FLIP;
+   swap_info->type = DRI2_FLIP;
flip = 1;
}
 
-   swap_info->type = swap_type;
-
-   /* Correct target_msc by 'flip' if swap_type == DRI2_FLIP.
+   /* Correct target_msc by 'flip' if swap_info->type == DRI2_FLIP.
 * Do it early, so handling of different timing constraints
 * for divisor, remainder and msc vs. target_msc works.
 */
@@ -1347,10 +1343,7 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, 
DrawablePtr draw,
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
   "divisor 0 get vblank counter failed: %s\n",
   strerror(errno));
-   *target_msc = 0;
-   amdgpu_dri2_schedule_event(FALLBACK_SWAP_DELAY,
-  swap_info);
-   return TRUE;
+   goto blit_fallback;
}
 
*target_msc = vbl.reply.sequence + flip;
@@ -1397,9 +1390,7 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, 
DrawablePtr draw,
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
   "final get vblank counter failed: %s\n",
   strerror(errno));
-   *target_msc = 0;
-   amdgpu_dri2_schedule_event(FALLBACK_SWAP_DELAY, swap_info);
-   return TRUE;
+   goto blit_fallback;
}
 
/* Adjust returned value for 1 fame pageflip offset of flip > 0 */
@@ -1410,22 +1401,23 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, 
DrawablePtr draw,
return TRUE;
 
 blit_fallback:
-   box.x1 = 0;
-   box.y1 = 0;
-   box.x2 = draw->width;
-   box.y2 = draw->height;
-   REGION_INIT(pScreen, ®ion, &box, 0);
+   if (swap_info) {
+   swap_info->type = DRI2_SWAP;
+   amdgpu_dri2_schedule_event(FALLBACK_SWAP_DELAY, swap_info);
+   } else {
+   box.x1 = 0;
+   box.y1 = 0;
+   box.x2 = draw->width;
+   box.y2 = draw->height;
+   REGION_INIT(pScreen, ®ion, &box, 0);
 
-   amdgpu_dri2_copy_region(draw, ®ion, front, back);
+   amdgpu_dri2_copy_region(draw, ®ion, front, back);
 
-   DRI2SwapComplete(client, draw, 0, 0, 0, DRI2_BLIT_COMPLETE, func, data);
-   if (swap_info) {
-   ListDelDRI2ClientEvents(swap_info->client, &swap_info->link);
-   free(swap_info);
-   }
+   DRI2SwapComplete(client, draw, 0, 0, 0, DRI2_BLIT_COMPLETE, 
func, data);
 
-   amdgpu_dri2_unref_buffer(front);
-   amdgpu_dri2_unref_buffer(back);
+   amdgpu_dri2_unref_buffer(front);
+   amdgpu_dri2_unref_buffer(back);
+   }
 
*target_msc = 0;/* offscreen, so zero out target vblank count */
return TRUE;
-- 
2.1.4

___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[PATCH xf86-video-amdgpu 10/13] Add support for the Present extension

2015-06-02 Thread Michel Dänzer
From: Michel Dänzer 

(Cherry picked from radeon commits 3c65fb849e1ba9fb6454bcaa55b696548902f3fc,
694e04720b886060fe3eefdce59741f218c8269f,
e3be8b0a8cf484ff16597413a6172788178e80c8,
80eede245d1eda27eaba108b0761a24bfd69aff6 and
5f82a720374c9c1caebb42bfbeea1f0cf8847d28)

Signed-off-by: Michel Dänzer 
---
 configure.ac |   6 +
 src/Makefile.am  |   2 +-
 src/amdgpu_drv.h |   3 +
 src/amdgpu_kms.c |   3 +-
 src/amdgpu_present.c | 394 +++
 5 files changed, 406 insertions(+), 2 deletions(-)
 create mode 100644 src/amdgpu_present.c

diff --git a/configure.ac b/configure.ac
index 2d6d4c7..b91ce17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,6 +162,12 @@ AC_CHECK_HEADERS([misyncshm.h], [], [],
  #include 
  #include ])
 
+AC_CHECK_HEADERS([present.h], [], [],
+[#include 
+#include 
+#include 
+#include "xorg-server.h"])
+
 CPPFLAGS="$SAVE_CPPFLAGS"
 
 PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
diff --git a/src/Makefile.am b/src/Makefile.am
index fa3be5c..fc8b77a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,7 +29,7 @@
 amdgpu_drv_la_LIBADD = $(PCIACCESS_LIBS) $(LIBDRM_AMDGPU_LIBS) $(GBM_LIBS)
 
 AMDGPU_KMS_SRCS=amdgpu_bo_helper.c amdgpu_dri2.c amdgpu_drm_queue.c 
amdgpu_kms.c \
-   amdgpu_sync.c drmmode_display.c
+   amdgpu_present.c amdgpu_sync.c drmmode_display.c
 
 AM_CFLAGS = \
 @GBM_CFLAGS@ \
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index ad51c86..c6c968f 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -233,6 +233,9 @@ typedef struct {
 } AMDGPUInfoRec, *AMDGPUInfoPtr;
 
 
+/* amdgpu_present.c */
+Bool amdgpu_present_screen_init(ScreenPtr screen);
+
 /* amdgpu_sync.c */
 extern Bool amdgpu_sync_init(ScreenPtr screen);
 extern void amdgpu_sync_close(ScreenPtr screen);
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 28d9305..05e9adf 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -827,7 +827,8 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
}
 #endif
 
-   amdgpu_sync_init(pScreen);
+   if (amdgpu_sync_init(pScreen))
+   amdgpu_present_screen_init(pScreen);
 
pScrn->vtSema = TRUE;
xf86SetBackingStore(pScreen);
diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
new file mode 100644
index 000..c0a5a32
--- /dev/null
+++ b/src/amdgpu_present.c
@@ -0,0 +1,394 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ * Copyright © 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "amdgpu_drv.h"
+
+#ifdef HAVE_PRESENT_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "amdgpu_glamor.h"
+#include "amdgpu_pixmap.h"
+#include "amdgpu_video.h"
+
+#include "present.h"
+
+struct amdgpu_present_vblank_event {
+   uint64_t event_id;
+};
+
+static uint32_t crtc_select(int crtc_id)
+{
+   if (crtc_id > 1)
+   return crtc_id << DRM_VBLANK_HIGH_CRTC_SHIFT;
+   else if (crtc_id > 0)
+   return DRM_VBLANK_SECONDARY;
+   else
+   return 0;
+}
+
+static RRCrtcPtr
+amdgpu_present_get_crtc(WindowPtr window)
+{
+   ScreenPtr screen = window->drawable.pScreen;
+   ScrnInfoPtr pScrn = xf86ScreenToScrn(screen);
+   xf86CrtcPtr crtc;
+   RRCrtcPtr randr_crtc = NULL;
+
+   crtc = amdgpu_pick_best_crtc(pScrn, FALSE,
+window->drawable.x,
+window->drawable.x + 
window->drawable.width,
+window->drawable.y,
+window->drawable.y + 
window->drawable.height);

[PATCH xf86-video-amdgpu 08/13] DRI2: Split out helper for getting UST and MSC of a specific CRTC

2015-06-02 Thread Michel Dänzer
From: Michel Dänzer 

(Cherry picked from radeon commits 76c2923ac5c7230a8b2f9f8329c308d28b44d9c0
and d7c82731a8bf3d381bc571b94d80d9bb2dd6e40d)

Signed-off-by: Michel Dänzer 
---
 src/amdgpu_dri2.c | 34 +++---
 src/drmmode_display.c | 27 +++
 src/drmmode_display.h |  1 +
 3 files changed, 39 insertions(+), 23 deletions(-)

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index 95db216..28c56e7 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -851,17 +851,13 @@ CARD32 amdgpu_dri2_extrapolate_msc_delay(xf86CrtcPtr 
crtc, CARD64 * target_msc,
 }
 
 /*
- * Get current frame count and frame count timestamp, based on drawable's
- * crtc.
+ * Get current interpolated frame count and frame count timestamp, based on
+ * drawable's crtc.
  */
 static int amdgpu_dri2_get_msc(DrawablePtr draw, CARD64 * ust, CARD64 * msc)
 {
-   ScreenPtr screen = draw->pScreen;
-   ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
-   AMDGPUInfoPtr info = AMDGPUPTR(scrn);
-   drmVBlank vbl;
-   int ret;
xf86CrtcPtr crtc = amdgpu_dri2_drawable_crtc(draw, TRUE);
+   int ret;
 
/* Drawable not displayed, make up a value */
if (crtc == NULL) {
@@ -869,29 +865,20 @@ static int amdgpu_dri2_get_msc(DrawablePtr draw, CARD64 * 
ust, CARD64 * msc)
*msc = 0;
return TRUE;
}
+
if (amdgpu_crtc_is_enabled(crtc)) {
/* CRTC is running, read vblank counter and timestamp */
-   vbl.request.type = DRM_VBLANK_RELATIVE;
-   vbl.request.type |= amdgpu_populate_vbl_request_type(crtc);
-   vbl.request.sequence = 0;
-
-   ret = drmWaitVBlank(info->dri2.drm_fd, &vbl);
-   if (ret) {
-   xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-  "get vblank counter failed: %s\n",
-  strerror(errno));
+   ret = drmmode_crtc_get_ust_msc(crtc, ust, msc);
+   if (ret != Success)
return FALSE;
-   }
 
-   *ust =
-   ((CARD64) vbl.reply.tval_sec * 100) +
-   vbl.reply.tval_usec;
-   *msc =
-   vbl.reply.sequence + amdgpu_get_interpolated_vblanks(crtc);
+   *msc += amdgpu_get_interpolated_vblanks(crtc);
*msc &= 0x;
} else {
/* CRTC is not running, extrapolate MSC and timestamp */
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+   ScrnInfoPtr scrn = crtc->scrn;
+   AMDGPUInfoPtr info = AMDGPUPTR(scrn);
CARD64 now, delta_t, delta_seq;
 
if (!drmmode_crtc->dpms_last_ust)
@@ -914,7 +901,8 @@ static int amdgpu_dri2_get_msc(DrawablePtr draw, CARD64 * 
ust, CARD64 * msc)
*msc += delta_seq;
*msc &= 0x;
}
-   return TRUE;
+
+   return ret == Success;
 }
 
 static
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index aa7c8c4..01fe860 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -204,6 +204,33 @@ int drmmode_get_current_ust(int drm_fd, CARD64 * ust)
return 0;
 }
 
+/*
+ * Get current frame count and frame count timestamp of the crtc.
+ */
+int drmmode_crtc_get_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc)
+{
+   ScrnInfoPtr scrn = crtc->scrn;
+   AMDGPUInfoPtr info = AMDGPUPTR(scrn);
+   drmVBlank vbl;
+   int ret;
+
+   vbl.request.type = DRM_VBLANK_RELATIVE;
+   vbl.request.type |= amdgpu_populate_vbl_request_type(crtc);
+   vbl.request.sequence = 0;
+
+   ret = drmWaitVBlank(info->dri2.drm_fd, &vbl);
+   if (ret) {
+   xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+  "get vblank counter failed: %s\n", strerror(errno));
+   return ret;
+   }
+
+   *ust = ((CARD64)vbl.reply.tval_sec * 100) + vbl.reply.tval_usec;
+   *msc = vbl.reply.sequence;
+
+   return Success;
+}
+
 static void drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
 {
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 9cf6932..90ab537 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -125,6 +125,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
struct amdgpu_buffer *new_front, uint64_t id, void 
*data,
int ref_crtc_hw_id, amdgpu_drm_handler_proc handler,
amdgpu_drm_abort_proc abort);
+int drmmode_crtc_get_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc);
 int drmmode_get_current_ust(int drm_fd, CARD64 * ust);
 
 #endif
-- 
2.1.4

___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/lis

[PATCH xf86-video-amdgpu 11/13] glamor: Add radeon_pixmap parameter to radeon_glamor_create_textured_pixmap

2015-06-02 Thread Michel Dänzer
From: Michel Dänzer 

(cherry picked from radeon commit 051d46382656ffc3e6cac1aab3aee7efdf5b623a)

Reviewed-by: Michel Dänzer 
Signed-off-by: Darren Powell 
Signed-off-by: Michel Dänzer 
---
 src/amdgpu_glamor.c   | 20 +++-
 src/amdgpu_glamor.h   |  5 -
 src/drmmode_display.c |  3 ++-
 3 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index 36241ce..79b3d01 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -126,28 +126,22 @@ Bool amdgpu_glamor_pre_init(ScrnInfoPtr scrn)
return TRUE;
 }
 
-Bool amdgpu_glamor_create_textured_pixmap(PixmapPtr pixmap)
+Bool
+amdgpu_glamor_create_textured_pixmap(PixmapPtr pixmap, struct amdgpu_pixmap 
*priv)
 {
ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
AMDGPUInfoPtr info = AMDGPUPTR(scrn);
-   struct amdgpu_pixmap *priv;
union gbm_bo_handle bo_handle;
 
if ((info->use_glamor) == 0)
return TRUE;
 
-   priv = amdgpu_get_pixmap_private(pixmap);
-   if (!priv->stride) {
+   if (!priv->stride)
priv->stride = pixmap->devKind;
-   }
 
bo_handle = gbm_bo_get_handle(priv->bo->bo.gbm);
-   if (glamor_egl_create_textured_pixmap(pixmap, bo_handle.u32,
- priv->stride)) {
-   return TRUE;
-   } else {
-   return FALSE;
-   }
+   return glamor_egl_create_textured_pixmap(pixmap, bo_handle.u32,
+priv->stride);
 }
 
 Bool amdgpu_glamor_pixmap_is_offscreen(PixmapPtr pixmap)
@@ -206,7 +200,7 @@ amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, 
int depth,
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, priv->stride,
   NULL);
 
-   if (!amdgpu_glamor_create_textured_pixmap(pixmap))
+   if (!amdgpu_glamor_create_textured_pixmap(pixmap, priv))
goto fallback_glamor;
}
 
@@ -280,7 +274,7 @@ amdgpu_glamor_set_shared_pixmap_backing(PixmapPtr pixmap, 
void *handle)
priv = amdgpu_get_pixmap_private(pixmap);
priv->stride = pixmap->devKind;
 
-   if (!amdgpu_glamor_create_textured_pixmap(pixmap)) {
+   if (!amdgpu_glamor_create_textured_pixmap(pixmap, priv)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
   "Failed to get PRIME drawable for glamor pixmap.\n");
return FALSE;
diff --git a/src/amdgpu_glamor.h b/src/amdgpu_glamor.h
index 01b5ce1..f2414da 100644
--- a/src/amdgpu_glamor.h
+++ b/src/amdgpu_glamor.h
@@ -48,6 +48,8 @@
 #define GLAMOR_USE_PICTURE_SCREEN 0
 #endif
 
+struct amdgpu_pixmap;
+
 Bool amdgpu_glamor_pre_init(ScrnInfoPtr scrn);
 Bool amdgpu_glamor_init(ScreenPtr screen);
 Bool amdgpu_glamor_create_screen_resources(ScreenPtr screen);
@@ -55,7 +57,8 @@ void amdgpu_glamor_free_screen(int scrnIndex, int flags);
 
 void amdgpu_glamor_flush(ScrnInfoPtr pScrn);
 
-Bool amdgpu_glamor_create_textured_pixmap(PixmapPtr pixmap);
+Bool
+amdgpu_glamor_create_textured_pixmap(PixmapPtr pixmap, struct amdgpu_pixmap 
*priv);
 void amdgpu_glamor_exchange_buffers(PixmapPtr src, PixmapPtr dst);
 
 Bool amdgpu_glamor_pixmap_is_offscreen(PixmapPtr pixmap);
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 01fe860..870ced6 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -108,7 +108,8 @@ static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn,
 
amdgpu_set_pixmap_bo(pixmap, bo);
 
-   if (!amdgpu_glamor_create_textured_pixmap(pixmap)) {
+   if (!amdgpu_glamor_create_textured_pixmap(pixmap,
+ 
amdgpu_get_pixmap_private(pixmap))) {
pScreen->DestroyPixmap(pixmap);
return NULL;
}
-- 
2.1.4

___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[PATCH xf86-video-amdgpu 09/13] Add support for SYNC extension fences

2015-06-02 Thread Michel Dänzer
From: Michel Dänzer 

(Cherry picked from radeon commits 8fc9a241ab59ffbcdc178d6415332c88a54e85fe,
af1862a37570fa512a525ab47d72b30400d2e2d6,
aa7825eb29cdf6ac9d7b28ad18186807ff384687,
af6076241c0d322b295a4e898407ae2472bd8eb4 and
d64a13ebe0ecd241ee3260dbffd8f4a01e254183)

Signed-off-by: Michel Dänzer 
---
 configure.ac  |   6 +++
 src/Makefile.am   |   2 +-
 src/amdgpu_drv.h  |   9 
 src/amdgpu_kms.c  |   4 ++
 src/amdgpu_sync.c | 147 ++
 5 files changed, 167 insertions(+), 1 deletion(-)
 create mode 100644 src/amdgpu_sync.c

diff --git a/configure.ac b/configure.ac
index ff0979e..2d6d4c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -156,6 +156,12 @@ AC_CHECK_DECL(GBM_BO_USE_LINEAR,
  [#include 
   #include ])
 
+AC_CHECK_HEADERS([misyncshm.h], [], [],
+ [#include 
+ #include 
+ #include 
+ #include ])
+
 CPPFLAGS="$SAVE_CPPFLAGS"
 
 PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
diff --git a/src/Makefile.am b/src/Makefile.am
index 8e91472..fa3be5c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,7 +29,7 @@
 amdgpu_drv_la_LIBADD = $(PCIACCESS_LIBS) $(LIBDRM_AMDGPU_LIBS) $(GBM_LIBS)
 
 AMDGPU_KMS_SRCS=amdgpu_bo_helper.c amdgpu_dri2.c amdgpu_drm_queue.c 
amdgpu_kms.c \
-   drmmode_display.c
+   amdgpu_sync.c drmmode_display.c
 
 AM_CFLAGS = \
 @GBM_CFLAGS@ \
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 4b87e6e..ad51c86 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -88,6 +88,8 @@
 #include "simple_list.h"
 #include "amdpciids.h"
 
+struct _SyncFence;
+
 #ifndef MAX
 #define MAX(a,b) ((a)>(b)?(a):(b))
 #endif
@@ -185,6 +187,9 @@ typedef struct {
 
void (*BlockHandler) (BLOCKHANDLER_ARGS_DECL);
 
+   void (*CreateFence) (ScreenPtr pScreen, struct _SyncFence *pFence,
+Bool initially_triggered);
+
int pix24bpp;   /* Depth of pixmap for 24bpp fb  */
Bool dac6bits;  /* Use 6 bit DAC?*/
 
@@ -228,6 +233,10 @@ typedef struct {
 } AMDGPUInfoRec, *AMDGPUInfoPtr;
 
 
+/* amdgpu_sync.c */
+extern Bool amdgpu_sync_init(ScreenPtr screen);
+extern void amdgpu_sync_close(ScreenPtr screen);
+
 /* amdgpu_video.c */
 extern void AMDGPUInitVideo(ScreenPtr pScreen);
 extern void AMDGPUResetVideo(ScrnInfoPtr pScrn);
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 71a4aa7..28d9305 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -703,6 +703,8 @@ static Bool AMDGPUCloseScreen_KMS(CLOSE_SCREEN_ARGS_DECL)
 
DeleteCallback(&FlushCallback, amdgpu_flush_callback, pScrn);
 
+   amdgpu_sync_close(pScreen);
+
drmDropMaster(info->dri2.drm_fd);
 
drmmode_fini(pScrn, &info->drmmode);
@@ -825,6 +827,8 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
}
 #endif
 
+   amdgpu_sync_init(pScreen);
+
pScrn->vtSema = TRUE;
xf86SetBackingStore(pScreen);
 
diff --git a/src/amdgpu_sync.c b/src/amdgpu_sync.c
new file mode 100644
index 000..baade0e
--- /dev/null
+++ b/src/amdgpu_sync.c
@@ -0,0 +1,147 @@
+/*
+ * Copyright © 2013-2014 Intel Corporation
+ * Copyright © 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "amdgpu_drv.h"
+
+#ifdef HAVE_MISYNCSHM_H
+
+#include "misync.h"
+#include "misyncshm.h"
+#include "misyncstr.h"
+
+#include "amdgpu_glamor.h"
+
+/*
+ * This whole file exists to wrap a sync fence trigger operation
+ * so that we can flush the batch buffer to provide serialization
+ * between the server and the shm fence client
+ */
+
+static DevPrivateKeyRec amdgpu_sync_fence_private_key;
+
+typedef struct _amdgpu_sync_fence_private {
+SyncFenceSetTriggeredFunc set_triggered;
+} amdgpu_sync_fence_private;
+
+#define SYNC_FE

[PATCH xf86-video-amdgpu 12/13] amdgpu_set_shared_pixmap_backing: Add support for GBM / glamor

2015-06-02 Thread Michel Dänzer
From: Michel Dänzer 

Signed-off-by: Michel Dänzer 
---
 src/amdgpu_bo_helper.c | 101 ++---
 1 file changed, 78 insertions(+), 23 deletions(-)

diff --git a/src/amdgpu_bo_helper.c b/src/amdgpu_bo_helper.c
index 0487b46..08e4048 100644
--- a/src/amdgpu_bo_helper.c
+++ b/src/amdgpu_bo_helper.c
@@ -27,8 +27,32 @@
 #include 
 #include "amdgpu_drv.h"
 #include "amdgpu_bo_helper.h"
+#include "amdgpu_glamor.h"
 #include "amdgpu_pixmap.h"
 
+static uint32_t
+amdgpu_get_gbm_format(int depth, int bitsPerPixel)
+{
+   switch (depth) {
+#ifdef GBM_FORMAT_R8
+   case 8:
+   return GBM_FORMAT_R8;
+#endif
+   case 16:
+   return GBM_FORMAT_RGB565;
+   case 32:
+   return GBM_FORMAT_ARGB;
+   case 24:
+   if (bitsPerPixel == 32)
+   return GBM_FORMAT_XRGB;
+   /* fall through */
+   default:
+   ErrorF("%s: Unsupported depth/bpp %d/%d\n", __func__,
+  depth, bitsPerPixel);
+   return ~0U;
+   }
+}
+
 /* Calculate appropriate pitch for a pixmap and allocate a BO that can hold it.
  */
 struct amdgpu_buffer *amdgpu_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width,
@@ -40,31 +64,10 @@ struct amdgpu_buffer *amdgpu_alloc_pixmap_bo(ScrnInfoPtr 
pScrn, int width,
 
if (info->gbm) {
uint32_t bo_use = GBM_BO_USE_RENDERING;
-   uint32_t gbm_format;
+   uint32_t gbm_format = amdgpu_get_gbm_format(depth, 
bitsPerPixel);
 
-   switch (depth) {
-#ifdef GBM_FORMAT_R8
-   case 8:
-   gbm_format = GBM_FORMAT_R8;
-   break;
-#endif
-   case 16:
-   gbm_format = GBM_FORMAT_RGB565;
-   break;
-   case 32:
-   gbm_format = GBM_FORMAT_ARGB;
-   break;
-   case 24:
-   if (bitsPerPixel == 32) {
-   gbm_format = GBM_FORMAT_XRGB;
-   break;
-   }
-   /* fall through */
-   default:
-   ErrorF("%s: Unsupported depth/bpp %d/%d\n", __func__,
-  depth, bitsPerPixel);
+   if (gbm_format == ~0U)
return NULL;
-   }
 
pixmap_buffer = (struct amdgpu_buffer *)calloc(1, sizeof(struct 
amdgpu_buffer));
if (!pixmap_buffer) {
@@ -310,11 +313,63 @@ Bool amdgpu_share_pixmap_backing(struct amdgpu_buffer 
*bo, void **handle_p)
 Bool amdgpu_set_shared_pixmap_backing(PixmapPtr ppix, void *fd_handle)
 {
ScrnInfoPtr pScrn = xf86ScreenToScrn(ppix->drawable.pScreen);
+   AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
struct amdgpu_buffer *pixmap_buffer = NULL;
int ihandle = (int)(long)fd_handle;
uint32_t size = ppix->devKind * ppix->drawable.height;
 
+   if (info->gbm) {
+   struct amdgpu_pixmap *priv;
+   struct gbm_import_fd_data data;
+   uint32_t bo_use = GBM_BO_USE_RENDERING;
+
+   data.format = amdgpu_get_gbm_format(ppix->drawable.depth,
+   
ppix->drawable.bitsPerPixel);
+   if (data.format == ~0U)
+   return FALSE;
+
+   priv = calloc(1, sizeof(struct amdgpu_pixmap));
+   if (!priv)
+   return FALSE;
+
+   priv->bo = calloc(1, sizeof(struct amdgpu_buffer));
+   if (!priv->bo) {
+   free(priv);
+   return FALSE;
+   }
+
+   data.fd = ihandle;
+   data.width = ppix->drawable.width;
+   data.height = ppix->drawable.height;
+   data.stride = ppix->devKind;
+
+   if (ppix->drawable.bitsPerPixel == pScrn->bitsPerPixel)
+   bo_use |= GBM_BO_USE_SCANOUT;
+
+   priv->bo->bo.gbm = gbm_bo_import(info->gbm, GBM_BO_IMPORT_FD,
+&data, bo_use);
+   if (!priv->bo->bo.gbm) {
+   free(priv->bo);
+   free(priv);
+   return FALSE;
+   }
+
+   priv->bo->flags |= AMDGPU_BO_FLAGS_GBM;
+
+#ifdef USE_GLAMOR
+   if (info->use_glamor &&
+   !amdgpu_glamor_create_textured_pixmap(ppix, priv)) {
+   free(priv->bo);
+   free(priv);
+   return FALSE;
+   }
+#endif
+
+   amdgpu_set_pixmap_private(ppix, priv);
+   return TRUE;
+   }
+
pixmap_buffer = amdgpu_gem_bo_open_prime(pAMDGPUEnt->pDev, ihandle, 
size);
if (

[PATCH xf86-video-amdgpu 01/13] Require at least xserver 1.8

2015-06-02 Thread Michel Dänzer
From: Michel Dänzer 

So we can rely on the list.h header.

xserver 1.8 was released in April 2010.

(Cherry picked from radeon commit 7388d0b6c54b9d536fdb161e3aa61b326627b939)

Signed-off-by: Michel Dänzer 
---
 configure.ac  | 19 ++-
 src/amdgpu_dri2.c | 16 
 2 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/configure.ac b/configure.ac
index b26eebb..ff0979e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,7 +76,7 @@ PKG_CHECK_MODULES(LIBDRM_AMDGPU, [libdrm_amdgpu])
 PKG_CHECK_MODULES(GBM, [gbm])
 
 # Obtain compiler/linker options for the driver dependencies
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.7 xproto fontsproto xf86driproto 
$REQUIRED_MODULES])
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.8 xproto fontsproto xf86driproto 
$REQUIRED_MODULES])
 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
   HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, 
[xextproto 7.1 available]),
   HAVE_XEXTPROTO_71="no")
@@ -145,18 +145,11 @@ else
 fi
 AM_CONDITIONAL(GLAMOR, test x$GLAMOR != xno)
 
-AC_CHECK_HEADERS([list.h],
-[have_list_h="yes"], [have_list_h="no"],
-[#include 
- #include "xorg-server.h"])
-
-if test "x$have_list_h" = xyes; then
-AC_CHECK_DECL(xorg_list_init,
- [AC_DEFINE(HAVE_XORG_LIST, 1, [Have xorg_list API])], [],
- [#include 
-  #include "xorg-server.h"
-  #include "list.h"])
-fi
+AC_CHECK_DECL(xorg_list_init,
+ [AC_DEFINE(HAVE_XORG_LIST, 1, [Have xorg_list API])], [],
+ [#include 
+ #include "xorg-server.h"
+ #include "list.h"])
 
 AC_CHECK_DECL(GBM_BO_USE_LINEAR,
  [AC_DEFINE(HAVE_GBM_BO_USE_LINEAR, 1, [Have GBM_BO_USE_LINEAR])], 
[],
diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index 15bb497..32f6171 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -47,7 +47,6 @@
 
 #include "amdgpu_version.h"
 
-#if HAVE_LIST_H
 #include "list.h"
 #if !HAVE_XORG_LIST
 #define xorg_list  list
@@ -56,11 +55,6 @@
 #define xorg_list_del  list_del
 #define xorg_list_for_each_entry   list_for_each_entry
 #endif
-#endif
-
-#if DRI2INFOREC_VERSION >= 4 && HAVE_LIST_H
-#define USE_DRI2_SCHEDULING
-#endif
 
 #if DRI2INFOREC_VERSION >= 9
 #define USE_DRI2_PRIME
@@ -373,8 +367,6 @@ amdgpu_dri2_copy_region(DrawablePtr pDraw, RegionPtr 
pRegion,
pDstBuffer, pSrcBuffer);
 }
 
-#ifdef USE_DRI2_SCHEDULING
-
 enum DRI2FrameEventType {
DRI2_SWAP,
DRI2_FLIP,
@@ -1446,17 +1438,13 @@ blit_fallback:
return TRUE;
 }
 
-#endif /* USE_DRI2_SCHEDULING */
-
 Bool amdgpu_dri2_screen_init(ScreenPtr pScreen)
 {
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
DRI2InfoRec dri2_info = { 0 };
-#ifdef USE_DRI2_SCHEDULING
const char *driverNames[2];
Bool scheduling_works = TRUE;
-#endif
 
if (!info->dri2.available)
return FALSE;
@@ -1471,7 +1459,6 @@ Bool amdgpu_dri2_screen_init(ScreenPtr pScreen)
dri2_info.DestroyBuffer = amdgpu_dri2_destroy_buffer;
dri2_info.CopyRegion = amdgpu_dri2_copy_region;
 
-#ifdef USE_DRI2_SCHEDULING
if (info->drmmode.mode_res->count_crtcs > 2) {
 #ifdef DRM_CAP_VBLANK_HIGH_CRTC
uint64_t cap_value;
@@ -1532,7 +1519,6 @@ Bool amdgpu_dri2_screen_init(ScreenPtr pScreen)
 
DRI2InfoCnt++;
}
-#endif
 
 #if DRI2INFOREC_VERSION >= 9
dri2_info.version = 9;
@@ -1550,11 +1536,9 @@ void amdgpu_dri2_close_screen(ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
 
-#ifdef USE_DRI2_SCHEDULING
if (--DRI2InfoCnt == 0)
DeleteCallback(&ClientStateCallback,
   amdgpu_dri2_client_state_changed, 0);
-#endif
 
DRI2CloseScreen(pScreen);
drmFree(info->dri2.device_name);
-- 
2.1.4

___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati