[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-ati: Changes to 'debian-experimental'



 ChangeLog                         |  193 ++++++++++++++++++++++++++++++++++++++
 configure.ac                      |   15 ++
 debian/changelog                  |    2 
 debian/control                    |    2 
 src/ati.c                         |   26 +++++
 src/ati_pciids_gen.h              |    3 
 src/drmmode_display.c             |    4 
 src/evergreen_exa.c               |   15 ++
 src/evergreen_state.h             |    2 
 src/pcidb/ati_pciids.csv          |    3 
 src/r600_exa.c                    |   14 ++
 src/r600_state.h                  |    4 
 src/radeon.h                      |   24 ++++
 src/radeon_bo_helper.c            |   10 +
 src/radeon_chipinfo_gen.h         |    3 
 src/radeon_chipset_gen.h          |    3 
 src/radeon_dri2.c                 |  154 +++++++++++++++++++++++-------
 src/radeon_driver.c               |    1 
 src/radeon_exa.c                  |   75 ++++++++++++++
 src/radeon_exa_funcs.c            |   13 +-
 src/radeon_glamor.c               |    8 +
 src/radeon_glamor_wrappers.h      |    1 
 src/radeon_kms.c                  |   79 ++++++++++++++-
 src/radeon_pci_chipset_gen.h      |    3 
 src/radeon_pci_device_match_gen.h |    3 
 src/radeon_probe.c                |   98 ++++++++++++++++++-
 26 files changed, 691 insertions(+), 67 deletions(-)

New commits:
commit 281064b23ad57685717076da240975e37d9af6fd
Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Wed Oct 3 11:13:59 2012 +0200

    Bump changelog and require libdrm 2.4.39 for prime

diff --git a/ChangeLog b/ChangeLog
index c9af4a3..68ee8b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,196 @@
+commit e8cb0b721e6ea251f85c799ca0563bfa59a2d37c
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Wed Sep 26 09:27:54 2012 -0400
+
+    Remove mibstore.h
+    
+    Signed-off-by: Adam Jackson <ajax@redhat.com>
+
+commit 8637f772347c958fa3beea6c0dc9c22255db70e5
+Author: Michel Dänzer <michel.daenzer@amd.com>
+Date:   Thu Sep 13 19:50:35 2012 +0200
+
+    glamor: Force acceleration for DRI2 copies.
+    
+    Improves performance of non-pageflipped 3D apps on SI.
+    
+    Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
+
+commit 40b87f0e9db2642ca8a70e994fb4d3742e199640
+Author: Michel Dänzer <michel.daenzer@amd.com>
+Date:   Wed Sep 12 18:44:10 2012 +0200
+
+    glamor: Fix DRI2 crash introduced by PRIME changes.
+    
+    Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
+
+commit 646ffd49d2cf0d3130301e8ad2f49f620bd9ef1b
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Mon Sep 10 15:31:06 2012 +1000
+
+    radeon: fix build against old servers
+    
+    Fixes https://bugs.freedesktop.org/show_bug.cgi?id=54711
+    
+    Reported-by: wolput@onsneteindhoven.nl
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit 7c7f2775604da61537c24c249884aaa220e06e13
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Mon Sep 10 11:27:45 2012 +1000
+
+    radeon: don't fail to load if we have no modes and gpu driver.
+    
+    This ensures radeon loads on output less GPUs as a GPU driver.
+    
+    There are server bugs that also need to be fixed.
+    
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit 7fe16dd037ac688726869816888bd77fe4356f8e
+Author: Dave Airlie <airlied@gmail.com>
+Date:   Wed Sep 5 10:41:51 2012 +1000
+
+    radeon: fix typo in glamor paths
+    
+    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54519
+    
+    Reported-By: scaty@dcinformatique.com
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit cdc985e9190ce54dc6274ebc0e87ab954b15bb0d
+Author: Dave Airlie <airlied@gmail.com>
+Date:   Tue Sep 4 18:18:50 2012 +1000
+
+    radeon: fix build against older servers
+    
+    Another silly one.
+    
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit bd0e9c51407cb99f1fe4f0acfedc37ee0c354040
+Author: Dave Airlie <airlied@gmail.com>
+Date:   Tue Sep 4 18:17:06 2012 +1000
+
+    radeon/dri2: fix build against older servers.
+    
+    Older servers won't have DRI2UpdatePrime, so fix build.
+    
+    bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54433
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit 75c1f62f44d7b3709c1fa103d59733866967b841
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Mon Sep 3 13:09:02 2012 +1000
+
+    radeon: add capability and provider support
+    
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit ca8b61e916998458203dfa4b9d0c997fa7d90ba9
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Mon Sep 3 13:08:37 2012 +1000
+
+    radeon: allocated shared pixmaps as untiled gtt.
+    
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit 8c1bf9d8fe3948b72795984e625ef46b2f0bf654
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Mon Sep 3 13:08:05 2012 +1000
+
+    radeon: add pixmap sharing hooks.
+    
+    This hooks into EXA and the dirty tracking to add sharing and output
+    offload support.
+    
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit 3add8df8122697acfe126d4857f3946ce44b8305
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Mon Sep 3 13:07:07 2012 +1000
+
+    radeon: add dri2 offload support.
+    
+    This adds the new dri2 interfaces required for radeon to be offloaded to.
+    
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit f7502a11c8ef9c453ceb40d26109977116df88c2
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Mon Sep 3 12:56:56 2012 +1000
+
+    radeon: add shared support to pixmaps.
+    
+    this just adds the interface and shared support to the pixmap.
+    
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit f71139a2afe8fffb628331402bf829a6d67c9fff
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Mon Sep 3 12:37:22 2012 +1000
+
+    radeon: add platform bus loading support.
+    
+    This allows the radeon driver to be loaded via the platform bus mechanism.
+    
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit 9911e72ea79e000ee0492d19a434aa98b83b5066
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Fri Aug 17 17:02:51 2012 +1000
+
+    radeon: damage full screen after pageflip
+    
+    in order for offload to work we need to cause a full
+    screen damage to be registered after pageflip.
+    
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit 0873b8cef21abf1e7286731758f0db1e7f2e7c97
+Author: Dave Airlie <airlied@redhat.com>
+Date:   Fri Aug 3 16:45:50 2012 +1000
+
+    ati: fix stub driver loader to load all drivers properly
+    
+    Signed-off-by: Dave Airlie <airlied@redhat.com>
+
+commit cdf522f5992adf7b76f9153c777e6dddcf7758a6
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Wed Aug 15 13:38:28 2012 -0400
+
+    Implement ->driverFunc
+    
+    Copied from fbdev, makes it so we can run without iopl.
+    
+    Signed-off-by: Adam Jackson <ajax@redhat.com>
+
+commit 763f387ccac2399f1d58ec112c8bed45196bea5e
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Wed Aug 15 12:49:10 2012 -0400
+
+    Don't bother to include vbe.h
+    
+    The only VBE code here went away when we dropped UMS.
+    
+    Signed-off-by: Adam Jackson <ajax@redhat.com>
+
+commit aabcf5ea30195274c79ae94c0fe6edc965f5c123
+Author: Tomas Chvatal <tchvatal@suse.cz>
+Date:   Mon Aug 13 22:58:18 2012 +0200
+
+    Add switch for udev to disable automagic detection.
+    
+    Signed-off-by: Tomas Chvatal <tchvatal@suse.cz>
+
+commit aef90993621331f01d17b95a751d4924d77eed0c
+Author: Alex Deucher <alexdeucher@gmail.com>
+Date:   Mon Aug 6 11:00:45 2012 -0400
+
+    radeon: add some new SI pci ids
+    
+    Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
+
 commit 6ef1ad6a46348d3aecd8d1f5e94431ca2298853c
 Author: Michel Dänzer <michel.daenzer@amd.com>
 Date:   Fri Jul 13 11:15:25 2012 +0200
diff --git a/debian/changelog b/debian/changelog
index cd3cc18..c788497 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ xserver-xorg-video-ati (1:6.99.99-1) UNRELEASED; urgency=low
 
   * KMS-only release, only works with linux-any now.
   * Bump to build against xserver 1.13rc1
-  * Require libdrm 2.6.36
+  * Require libdrm 2.4.39
 
  -- Maarten Lankhorst <maarten.lankhorst@canonical.com>  Mon, 16 Jul 2012 14:29:26 +0200
 
diff --git a/debian/control b/debian/control
index fb51a82..9834960 100644
--- a/debian/control
+++ b/debian/control
@@ -17,7 +17,7 @@ Build-Depends:
  x11proto-fonts-dev,
  x11proto-randr-dev (>= 1.2),
  x11proto-render-dev,
- libdrm-dev (>= 2.4.36) [!hurd-i386],
+ libdrm-dev (>= 2.4.39) [!hurd-i386],
  x11proto-dri2-dev,
  x11proto-xf86dri-dev,
  libudev-dev [linux-any],

commit e8cb0b721e6ea251f85c799ca0563bfa59a2d37c
Author: Adam Jackson <ajax@redhat.com>
Date:   Wed Sep 26 09:27:54 2012 -0400

    Remove mibstore.h
    
    Signed-off-by: Adam Jackson <ajax@redhat.com>

diff --git a/src/radeon_glamor_wrappers.h b/src/radeon_glamor_wrappers.h
index 9abbd22..53ce969 100644
--- a/src/radeon_glamor_wrappers.h
+++ b/src/radeon_glamor_wrappers.h
@@ -42,7 +42,6 @@
 #include "pixmapstr.h"
 #include "windowstr.h"
 #include "servermd.h"
-#include "mibstore.h"
 #include "colormapst.h"
 #include "gcstruct.h"
 #include "input.h"
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 2842a23..0a10bee 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1215,13 +1215,8 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 #endif
 
     pScrn->vtSema = TRUE;
-    /* Backing store setup */
-    xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
-		   "Initializing backing store\n");
-    miInitializeBackingStore(pScreen);
     xf86SetBackingStore(pScreen);
 
-
     if (info->directRenderingEnabled) {
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering enabled\n");
     } else {

commit 8637f772347c958fa3beea6c0dc9c22255db70e5
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Sep 13 19:50:35 2012 +0200

    glamor: Force acceleration for DRI2 copies.
    
    Improves performance of non-pageflipped 3D apps on SI.
    
    Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

diff --git a/src/radeon.h b/src/radeon.h
index eb46db2..9c2073f 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -402,6 +402,7 @@ struct radeon_accel_state {
     int               vline_y1;
     int               vline_y2;
 
+    Bool              force;
 };
 
 typedef struct {
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 7c5898c..1e04b85 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -633,10 +633,12 @@ radeon_dri2_copy_region2(ScreenPtr pScreen,
 
     /* Driver option "SwapbuffersWait" defines if we vsync DRI2 copy-swaps. */ 
     info->accel_state->vsync = info->swapBuffersWait;
+    info->accel_state->force = TRUE;
 
     (*gc->ops->CopyArea)(src_drawable, dst_drawable, gc,
                          0, 0, drawable->width, drawable->height, off_x, off_y);
 
+    info->accel_state->force = FALSE;
     info->accel_state->vsync = vsync;
 
     FreeScratchGC(gc);
diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index 12dfd38..99bc666 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -151,8 +151,12 @@ Bool radeon_glamor_prepare_access(PixmapPtr pixmap, glamor_access_t access)
 	struct radeon_bo *bo;
 	int ret;
 
-	if (access == GLAMOR_GPU_ACCESS_RW || access == GLAMOR_GPU_ACCESS_RO)
-		return info->ChipFamily < CHIP_FAMILY_TAHITI;
+	if (access == GLAMOR_GPU_ACCESS_RW || access == GLAMOR_GPU_ACCESS_RO) {
+		if (info->ChipFamily < CHIP_FAMILY_TAHITI)
+			return TRUE;
+
+		return info->accel_state->force;
+	}
 
 	bo = radeon_get_pixmap_bo(pixmap);
 	if (bo) {

commit 40b87f0e9db2642ca8a70e994fb4d3742e199640
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Sep 12 18:44:10 2012 +0200

    glamor: Fix DRI2 crash introduced by PRIME changes.
    
    Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 02fe66d..7c5898c 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -358,7 +358,7 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
         pixmap->refcnt++;
     }
 
-    if (!pixmap && attachment != DRI2BufferFrontLeft) {
+    if (!pixmap && (is_glamor_pixmap || attachment != DRI2BufferFrontLeft)) {
 	/* tile the back buffer */
 	switch(attachment) {
 	case DRI2BufferDepth:

commit 646ffd49d2cf0d3130301e8ad2f49f620bd9ef1b
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon Sep 10 15:31:06 2012 +1000

    radeon: fix build against old servers
    
    Fixes https://bugs.freedesktop.org/show_bug.cgi?id=54711
    
    Reported-by: wolput@onsneteindhoven.nl
    Signed-off-by: Dave Airlie <airlied@redhat.com>

diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 94aa19c..2842a23 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -954,7 +954,11 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE;
     }
 
-    if (!pScrn->is_gpu && pScrn->modes == NULL) {
+    if (pScrn->modes == NULL
+#ifdef XSERVER_PLATFORM_BUS
+        && !pScrn->is_gpu
+#endif
+        ) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
       goto fail;
    }

commit 7c7f2775604da61537c24c249884aaa220e06e13
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon Sep 10 11:27:45 2012 +1000

    radeon: don't fail to load if we have no modes and gpu driver.
    
    This ensures radeon loads on output less GPUs as a GPU driver.
    
    There are server bugs that also need to be fixed.
    
    Signed-off-by: Dave Airlie <airlied@redhat.com>

diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index e953082..94aa19c 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -954,7 +954,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE;
     }
 
-    if (pScrn->modes == NULL) {
+    if (!pScrn->is_gpu && pScrn->modes == NULL) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
       goto fail;
    }

commit 7fe16dd037ac688726869816888bd77fe4356f8e
Author: Dave Airlie <airlied@gmail.com>
Date:   Wed Sep 5 10:41:51 2012 +1000

    radeon: fix typo in glamor paths
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54519
    
    Reported-By: scaty@dcinformatique.com
    Signed-off-by: Dave Airlie <airlied@redhat.com>

diff --git a/src/radeon.h b/src/radeon.h
index b0676d4..eb46db2 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -637,7 +637,7 @@ static inline Bool radeon_get_pixmap_shared(PixmapPtr pPix)
 
     if (info->use_glamor) {
         ErrorF("glamor sharing todo\n");
-	return FALSE:
+	return FALSE;
     } else
 #endif
     {

commit cdc985e9190ce54dc6274ebc0e87ab954b15bb0d
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Sep 4 18:18:50 2012 +1000

    radeon: fix build against older servers
    
    Another silly one.
    
    Signed-off-by: Dave Airlie <airlied@redhat.com>

diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 81cb5ba..e953082 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -289,7 +289,9 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 	radeon_glamor_flush(pScrn);
 
     radeon_cs_flush_indirect(pScrn);
+#ifdef RADEON_PIXMAP_SHARING
     radeon_dirty_update(pScreen);
+#endif
 }
 
 static void

commit bd0e9c51407cb99f1fe4f0acfedc37ee0c354040
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Sep 4 18:17:06 2012 +1000

    radeon/dri2: fix build against older servers.
    
    Older servers won't have DRI2UpdatePrime, so fix build.
    
    bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54433
    Signed-off-by: Dave Airlie <airlied@redhat.com>

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index f6f5fd5..02fe66d 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -63,6 +63,10 @@
 #define USE_DRI2_SCHEDULING
 #endif
 
+#if DRI2INFOREC_VERSION >= 9
+#define USE_DRI2_PRIME
+#endif
+
 #if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,0, 0)
 typedef DRI2BufferPtr BufferPtr;
 #else
@@ -578,6 +582,7 @@ radeon_dri2_copy_region2(ScreenPtr pScreen,
         src_drawable = drawable;
     }
     if (dst_private->attachment == DRI2BufferFrontLeft) {
+#ifdef USE_DRI2_PRIME
 	if (drawable->pScreen != pScreen) {
 	    dst_drawable = DRI2UpdatePrime(drawable, dest_buffer);
 	    if (!dst_drawable)
@@ -586,6 +591,7 @@ radeon_dri2_copy_region2(ScreenPtr pScreen,
 	    if (dst_drawable != drawable)
 		translate = TRUE;
 	} else
+#endif
 	    dst_drawable = drawable;
     }
 

commit 75c1f62f44d7b3709c1fa103d59733866967b841
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon Sep 3 13:09:02 2012 +1000

    radeon: add capability and provider support
    
    Signed-off-by: Dave Airlie <airlied@redhat.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 6a35728..9b9fc83 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1549,6 +1549,10 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 	/* workout clones */
 	drmmode_clones_init(pScrn, drmmode);
 
+#ifdef RADEON_PIXMAP_SHARING
+	xf86ProviderSetup(pScrn, NULL, "radeon");
+#endif
+
 	xf86InitialConfiguration(pScrn, TRUE);
 
 	drmmode->event_context.version = DRM_EVENT_CONTEXT_VERSION;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 09aea7e..81cb5ba 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -715,6 +715,24 @@ static Bool r600_get_tile_config(ScrnInfoPtr pScrn)
 
 #endif /* EXA_MIXED_PIXMAPS */
 
+static void RADEONSetupCapabilities(ScrnInfoPtr pScrn)
+{
+#ifdef RADEON_PIXMAP_SHARING
+    RADEONInfoPtr  info = RADEONPTR(pScrn);
+    uint64_t value;
+    int ret;
+
+    pScrn->capabilities = 0;
+    ret = drmGetCap(info->dri2.drm_fd, DRM_CAP_PRIME, &value);
+    if (ret == 0) {
+	if (value & DRM_PRIME_CAP_EXPORT)
+	    pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SinkOffload;
+	if (value & DRM_PRIME_CAP_IMPORT)
+	    pScrn->capabilities |= RR_Capability_SourceOffload;
+    }
+#endif
+}
+
 Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 {
     RADEONInfoPtr     info;
@@ -797,6 +815,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 
     info->allowColorTiling2D = FALSE;
 
+    RADEONSetupCapabilities(pScrn);
 #ifdef EXA_MIXED_PIXMAPS
     /* don't enable tiling if accel is not enabled */
     if (!info->r600_shadow_fb) {

commit ca8b61e916998458203dfa4b9d0c997fa7d90ba9
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon Sep 3 13:08:37 2012 +1000

    radeon: allocated shared pixmaps as untiled gtt.
    
    Signed-off-by: Dave Airlie <airlied@redhat.com>

diff --git a/src/radeon_bo_helper.c b/src/radeon_bo_helper.c
index ccdf7eb..593c690 100644
--- a/src/radeon_bo_helper.c
+++ b/src/radeon_bo_helper.c
@@ -73,7 +73,7 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width, int height, int depth,
     uint32_t tiling = 0;
     struct radeon_surface surface;
     struct radeon_bo *bo;
-
+    int domain = RADEON_GEM_DOMAIN_VRAM;
     if (usage_hint) {
 	if (info->allowColorTiling) {
 	    if (usage_hint & RADEON_CREATE_PIXMAP_TILING_MACRO)
@@ -84,6 +84,12 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width, int height, int depth,
 	if (usage_hint & RADEON_CREATE_PIXMAP_DEPTH)
 		tiling |= RADEON_TILING_MACRO | RADEON_TILING_MICRO;
 
+#ifdef CREATE_PIXMAP_USAGE_SHARED
+	if ((usage_hint & 0xffff) == CREATE_PIXMAP_USAGE_SHARED) {
+		tiling = 0;
+		domain = RADEON_GEM_DOMAIN_GTT;
+	}
+#endif
     }
 
     /* Small pixmaps must not be macrotiled on R300, hw cannot sample them
@@ -166,7 +172,7 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width, int height, int depth,
 	}
 
     bo = radeon_bo_open(info->bufmgr, 0, size, base_align,
-			RADEON_GEM_DOMAIN_VRAM, 0);
+			domain, 0);
 
     if (bo && tiling && radeon_bo_set_tiling(bo, tiling, pitch) == 0)
 	*new_tiling = tiling;

commit 8c1bf9d8fe3948b72795984e625ef46b2f0bf654
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon Sep 3 13:08:05 2012 +1000

    radeon: add pixmap sharing hooks.
    
    This hooks into EXA and the dirty tracking to add sharing and output
    offload support.
    
    Signed-off-by: Dave Airlie <airlied@redhat.com>

diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c
index 40e2e96..883fa5c 100644
--- a/src/evergreen_exa.c
+++ b/src/evergreen_exa.c
@@ -1908,7 +1908,10 @@ EVERGREENDrawInit(ScreenPtr pScreen)
 #if (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR >= 5)
     info->accel_state->exa->CreatePixmap2 = RADEONEXACreatePixmap2;
 #endif
-
+#if (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR >= 6) 
+    info->accel_state->exa->SharePixmapBacking = RADEONEXASharePixmapBacking; 
+    info->accel_state->exa->SetSharedPixmapBacking = RADEONEXASetSharedPixmapBacking;
+#endif
     info->accel_state->exa->flags = EXA_OFFSCREEN_PIXMAPS;
 #ifdef EXA_SUPPORTS_PREPARE_AUX
     info->accel_state->exa->flags |= EXA_SUPPORTS_PREPARE_AUX;
diff --git a/src/evergreen_state.h b/src/evergreen_state.h
index c92393e..3ce2bf2 100644
--- a/src/evergreen_state.h
+++ b/src/evergreen_state.h
@@ -350,5 +350,7 @@ extern void *RADEONEXACreatePixmap2(ScreenPtr pScreen, int width, int height,
 extern void RADEONEXADestroyPixmap(ScreenPtr pScreen, void *driverPriv);
 extern struct radeon_bo *radeon_get_pixmap_bo(PixmapPtr pPix);
 extern Bool RADEONEXAPixmapIsOffscreen(PixmapPtr pPix);
+extern Bool RADEONEXASharePixmapBacking(PixmapPtr ppix, ScreenPtr slave, void **handle_p);
+extern Bool RADEONEXASetSharedPixmapBacking(PixmapPtr ppix, void *handle);
 
 #endif
diff --git a/src/r600_exa.c b/src/r600_exa.c
index be0a9fa..21df084 100644
--- a/src/r600_exa.c
+++ b/src/r600_exa.c
@@ -1888,6 +1888,10 @@ R600DrawInit(ScreenPtr pScreen)
     info->accel_state->exa->DownloadFromScreen = R600DownloadFromScreenCS;
 #if (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR >= 5)
     info->accel_state->exa->CreatePixmap2 = RADEONEXACreatePixmap2;
+#if (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR >= 6) 
+    info->accel_state->exa->SharePixmapBacking = RADEONEXASharePixmapBacking; 
+    info->accel_state->exa->SetSharedPixmapBacking = RADEONEXASetSharedPixmapBacking;
+#endif
 #endif
 #endif
 
diff --git a/src/r600_state.h b/src/r600_state.h
index 74b481c..fa777e8 100644
--- a/src/r600_state.h
+++ b/src/r600_state.h
@@ -321,6 +321,6 @@ extern void *RADEONEXACreatePixmap2(ScreenPtr pScreen, int width, int height,
 extern void RADEONEXADestroyPixmap(ScreenPtr pScreen, void *driverPriv);
 extern struct radeon_bo *radeon_get_pixmap_bo(PixmapPtr pPix);
 extern Bool RADEONEXAPixmapIsOffscreen(PixmapPtr pPix);
-
-
+extern Bool RADEONEXASharePixmapBacking(PixmapPtr ppix, ScreenPtr slave, void **handle_p);
+extern Bool RADEONEXASetSharedPixmapBacking(PixmapPtr ppix, void *handle);
 #endif
diff --git a/src/radeon.h b/src/radeon.h
index 2eac38e..b0676d4 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -527,6 +527,10 @@ extern void radeon_ddx_cs_start(ScrnInfoPtr pScrn,
 				const char *func, int line);
 void radeon_kms_update_vram_limit(ScrnInfoPtr pScrn, int new_fb_size);
 
+#if XF86_CRTC_VERSION >= 5
+#define RADEON_PIXMAP_SHARING 1
+#endif
+
 static inline struct radeon_surface *radeon_get_pixmap_surface(PixmapPtr pPix)
 {
 #ifdef USE_GLAMOR
diff --git a/src/radeon_exa.c b/src/radeon_exa.c
index 5c5d997..0c42735 100644
--- a/src/radeon_exa.c
+++ b/src/radeon_exa.c
@@ -41,7 +41,7 @@
 #include "radeon_probe.h"
 #include "radeon_version.h"
 #include "radeon_exa_shared.h"
-
+#include "radeon_bo_gem.h"
 #include "xf86.h"
 
 
@@ -325,6 +325,79 @@ void RADEONEXADestroyPixmap(ScreenPtr pScreen, void *driverPriv)
     free(driverPriv);
 }
 
+#ifdef RADEON_PIXMAP_SHARING
+Bool RADEONEXASharePixmapBacking(PixmapPtr ppix, ScreenPtr slave, void **fd_handle)
+{
+    struct radeon_exa_pixmap_priv *driver_priv;
+    int ret;
+    int handle;
+
+    driver_priv = exaGetPixmapDriverPrivate(ppix);
+
+    ret = radeon_gem_prime_share_bo(driver_priv->bo, &handle);
+    if (ret)
+	return FALSE;
+
+    driver_priv->shared = TRUE;
+    *fd_handle = (void *)(long)handle;
+    return TRUE;
+}
+
+Bool RADEONEXASetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle)
+{
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(ppix->drawable.pScreen);
+    RADEONInfoPtr info = RADEONPTR(pScrn);
+    struct radeon_exa_pixmap_priv *driver_priv;
+    struct radeon_bo *bo;
+    int ihandle = (int)(long)fd_handle;
+    uint32_t size = ppix->devKind * ppix->drawable.height;
+    struct radeon_surface surface;
+
+    driver_priv = exaGetPixmapDriverPrivate(ppix);
+
+    bo = radeon_gem_bo_open_prime(info->bufmgr, ihandle, size);
+    if (!bo)
+        return FALSE;
+
+    memset(&surface, 0, sizeof(struct radeon_surface));
+	
+    if (info->ChipFamily >= CHIP_FAMILY_R600 && info->surf_man) {
+
+	surface.npix_x = ppix->drawable.width;
+	surface.npix_y = ppix->drawable.height;
+	surface.npix_z = 1;
+	surface.blk_w = 1;
+	surface.blk_h = 1;
+	surface.blk_d = 1;
+	surface.array_size = 1;
+	surface.bpe = ppix->drawable.bitsPerPixel / 8;
+	surface.nsamples = 1;
+	surface.flags |= RADEON_SURF_SET(RADEON_SURF_TYPE_2D, TYPE);
+	surface.flags |= RADEON_SURF_SET(RADEON_SURF_MODE_LINEAR, MODE);
+	if (radeon_surface_best(info->surf_man, &surface)) {
+	    return FALSE;
+	}
+	if (radeon_surface_init(info->surf_man, &surface)) {
+	    return FALSE;
+	}
+	/* we have to post hack the surface to reflect the actual size
+	   of the shared pixmap */
+	surface.level[0].pitch_bytes = ppix->devKind;
+	surface.level[0].nblk_x = ppix->devKind / surface.bpe;
+    }
+    driver_priv->surface = surface;
+    driver_priv->shared = TRUE;
+    driver_priv->tiling_flags = 0;
+    radeon_set_pixmap_bo(ppix, bo);
+
+    close(ihandle);
+    /* we have a reference from the alloc and one from set pixmap bo,
+       drop one */
+    radeon_bo_unref(bo);
+    return TRUE;
+}
+#endif
+
 uint32_t radeon_get_pixmap_tiling(PixmapPtr pPix)
 {
     struct radeon_exa_pixmap_priv *driver_priv;
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index db44d94..2533d78 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -655,6 +655,10 @@ Bool RADEONDrawInit(ScreenPtr pScreen)
     info->accel_state->exa->FinishAccess = RADEONFinishAccess_CS;
 #if (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR >= 5)
     info->accel_state->exa->CreatePixmap2 = RADEONEXACreatePixmap2;
+#if (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR >= 6) 
+    info->accel_state->exa->SharePixmapBacking = RADEONEXASharePixmapBacking; 
+    info->accel_state->exa->SetSharedPixmapBacking = RADEONEXASetSharedPixmapBacking;
+#endif
 #endif
 #endif
 
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 2107640..09aea7e 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -241,6 +241,40 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen)
     return TRUE;
 }
 
+#ifdef RADEON_PIXMAP_SHARING
+static void
+redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
+{
+	ScrnInfoPtr pScrn = xf86ScreenToScrn(screen);
+	RegionRec pixregion;
+
+	PixmapRegionInit(&pixregion, dirty->slave_dst->master_pixmap);
+	PixmapSyncDirtyHelper(dirty, &pixregion);
+
+	radeon_cs_flush_indirect(pScrn);
+	DamageRegionAppend(&dirty->slave_dst->drawable, &pixregion);
+	RegionUninit(&pixregion);
+}
+
+static void
+radeon_dirty_update(ScreenPtr screen)
+{
+	RegionPtr region;
+	PixmapDirtyUpdatePtr ent;
+
+	if (xorg_list_is_empty(&screen->pixmap_dirty_list))
+		return;
+
+	xorg_list_for_each_entry(ent, &screen->pixmap_dirty_list, ent) {
+		region = DamageRegion(ent->damage);
+		if (RegionNotEmpty(region)) {
+			redisplay_dirty(screen, ent);
+			DamageEmpty(ent->damage);
+		}
+	}
+}
+#endif
+
 static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 {
     SCREEN_PTR(arg);
@@ -255,6 +289,7 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 	radeon_glamor_flush(pScrn);
 
     radeon_cs_flush_indirect(pScrn);
+    radeon_dirty_update(pScreen);
 }
 
 static void
@@ -1242,6 +1277,11 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
     info->CreateScreenResources = pScreen->CreateScreenResources;
     pScreen->CreateScreenResources = RADEONCreateScreenResources_KMS;
 
+#ifdef RADEON_PIXMAP_SHARING
+    pScreen->StartPixmapTracking = PixmapStartDirtyTracking;
+    pScreen->StopPixmapTracking = PixmapStopDirtyTracking;
+#endif
+
    if (!xf86CrtcScreenInit (pScreen))
        return FALSE;
 

commit 3add8df8122697acfe126d4857f3946ce44b8305
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon Sep 3 13:07:07 2012 +1000

    radeon: add dri2 offload support.
    
    This adds the new dri2 interfaces required for radeon to be offloaded to.
    
    Signed-off-by: Dave Airlie <airlied@redhat.com>

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 496c669..f6f5fd5 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -315,11 +315,11 @@ radeon_dri2_create_buffers(DrawablePtr drawable,
 }
 #else
 static BufferPtr
-radeon_dri2_create_buffer(DrawablePtr drawable,
-                          unsigned int attachment,
-                          unsigned int format)
+radeon_dri2_create_buffer2(ScreenPtr pScreen,
+			   DrawablePtr drawable,
+			   unsigned int attachment,
+			   unsigned int format)
 {
-    ScreenPtr pScreen = drawable->pScreen;
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     BufferPtr buffers;
@@ -340,7 +340,9 @@ radeon_dri2_create_buffer(DrawablePtr drawable,
 
     if (attachment == DRI2BufferFrontLeft) {
         pixmap = get_drawable_pixmap(drawable);
-	if (info->use_glamor && !radeon_get_pixmap_bo(pixmap)) {
+	if (pScreen != pixmap->drawable.pScreen)
+	    pixmap = NULL;
+	else if (info->use_glamor && !radeon_get_pixmap_bo(pixmap)) {
 	    is_glamor_pixmap = TRUE;
 	    aligned_width = pixmap->drawable.width;
 	    height = pixmap->drawable.height;
@@ -352,7 +354,7 @@ radeon_dri2_create_buffer(DrawablePtr drawable,
         pixmap->refcnt++;
     }
 
-    if (!pixmap) {
+    if (!pixmap && attachment != DRI2BufferFrontLeft) {
 	/* tile the back buffer */
 	switch(attachment) {
 	case DRI2BufferDepth:
@@ -425,9 +427,6 @@ radeon_dri2_create_buffer(DrawablePtr drawable,
 					      flags | RADEON_CREATE_PIXMAP_DRI2);
     }
 
-    if (!pixmap)
-        return NULL;
-
     buffers = calloc(1, sizeof *buffers);
     if (buffers == NULL)
         goto error;
@@ -435,24 +434,30 @@ radeon_dri2_create_buffer(DrawablePtr drawable,
     if (attachment == DRI2BufferDepth) {
         depth_pixmap = pixmap;
     }
-    if (!info->use_glamor) {
-	info->exa_force_create = TRUE;
-	exaMoveInPixmap(pixmap);
-	info->exa_force_create = FALSE;
+
+    if (pixmap) {
+	if (!info->use_glamor) {
+	    info->exa_force_create = TRUE;
+	    exaMoveInPixmap(pixmap);
+	    info->exa_force_create = FALSE;
+	}
+
+	if (is_glamor_pixmap)
+	    pixmap = fixup_glamor(drawable, pixmap);
+	bo = radeon_get_pixmap_bo(pixmap);
+	if (!bo || radeon_gem_get_kernel_name(bo, &buffers->name) != 0)
+	    goto error;
     }
-    if (is_glamor_pixmap)
-	pixmap = fixup_glamor(drawable, pixmap);
-    bo = radeon_get_pixmap_bo(pixmap);
-    if (!bo || radeon_gem_get_kernel_name(bo, &buffers->name) != 0)
-        goto error;
 
     privates = calloc(1, sizeof(struct dri2_buffer_priv));
     if (privates == NULL)
         goto error;
 
     buffers->attachment = attachment;
-    buffers->pitch = pixmap->devKind;
-    buffers->cpp = pixmap->drawable.bitsPerPixel / 8;
+    if (pixmap) {
+	buffers->pitch = pixmap->devKind;
+	buffers->cpp = pixmap->drawable.bitsPerPixel / 8;
+    }
     buffers->driverPrivate = privates;
     buffers->format = format;
     buffers->flags = 0; /* not tiled */
@@ -468,6 +473,14 @@ error:
         (*pScreen->DestroyPixmap)(pixmap);
     return NULL;
 }
+
+DRI2BufferPtr


Reply to: