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

libdrm: Changes to 'upstream-unstable'



 configure.ac                     |    2 -
 libdrm/Makefile.am               |    1 
 libdrm/intel/intel_bufmgr.c      |   16 ++++++++++
 libdrm/intel/intel_bufmgr.h      |    4 ++
 libdrm/intel/intel_bufmgr_fake.c |    2 +
 libdrm/intel/intel_bufmgr_gem.c  |   58 +++++++++++++++++++++++++++++++++++----
 libdrm/intel/intel_bufmgr_priv.h |   23 +++++++++++++++
 libdrm/nouveau/nouveau_bo.c      |    3 +-
 libdrm/nouveau/nouveau_dma.c     |    1 
 libdrm/xf86drmMode.c             |    3 +-
 linux-core/nouveau_backlight.c   |    2 -
 shared-core/drm.h                |    6 ++++
 shared-core/i915_drm.h           |   10 ++++++
 shared-core/nouveau_state.c      |    2 -
 14 files changed, 122 insertions(+), 11 deletions(-)

New commits:
commit f355ad89431c49355e626613e6fc29ef2e183dab
Author: Eric Anholt <eric@anholt.net>
Date:   Tue May 19 10:07:16 2009 -0700

    intel: quiet a warning.

diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c
index ef046f4..c25fc4c 100644
--- a/libdrm/intel/intel_bufmgr_gem.c
+++ b/libdrm/intel/intel_bufmgr_gem.c
@@ -747,7 +747,6 @@ drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo)
 {
     drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr;
     drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo;
-    struct drm_i915_gem_sw_finish sw_finish;
     int ret = 0;
 
     if (bo == NULL)

commit 469655fab7a56eb32ff8cdefb33992813342353a
Author: Eric Anholt <eric@anholt.net>
Date:   Mon May 18 16:07:45 2009 -0700

    intel: Only do BO caching up to 64MB objects.
    
    This avoids making objects significantly bigger than they would be
    otherwise, which would result in some failing at binding to the GTT.
    Found from firefox hanging on:
    http://upload.wikimedia.org/wikipedia/commons/b/b7/Singapore_port_panorama.jpg
    due to a software fallback trying to do a GTT-mapped copy between two 73MB
    BOs that were instead each 128MB, and failing because both couldn't fit
    simultaneously.
    
    The cost here is that we get no opportunity to cache these objects and
    avoid the mapping.  But since the objects are a significant percentage
    of the aperture size, each mapped access is likely having to fault and rebind
    the object most of the time anyway.
    
    Bug #20152 (2/3)

diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c
index 61943f0..ef046f4 100644
--- a/libdrm/intel/intel_bufmgr_gem.c
+++ b/libdrm/intel/intel_bufmgr_gem.c
@@ -80,10 +80,10 @@ struct drm_intel_gem_bo_bucket {
    int num_entries;
 };
 
-/* Arbitrarily chosen, 16 means that the maximum size we'll cache for reuse
- * is 1 << 16 pages, or 256MB.
+/* Only cache objects up to 64MB.  Bigger than that, and the rounding of the
+ * size makes many operations fail that wouldn't otherwise.
  */
-#define DRM_INTEL_GEM_BO_BUCKETS	16
+#define DRM_INTEL_GEM_BO_BUCKETS	14
 typedef struct _drm_intel_bufmgr_gem {
     drm_intel_bufmgr bufmgr;
 

commit f57d7f4b0b14972f92a83f155ae8033478aa7729
Author: Keith Packard <keithp@keithp.com>
Date:   Thu May 14 16:58:14 2009 -0700

    libdrm/intel: Make get_pipe_from_crtc_id per-bufmgr. Return -1 on failure.
    
    The convention is that all APIs are per-bufmgr, so make this one the same.
    Then, have it return -1 on failure so that the application can know what's
    going on and do something sensible.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/configure.ac b/configure.ac
index e8cce3b..9d1a8ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@
 #  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 AC_PREREQ(2.57)
-AC_INIT([libdrm], 2.4.10, [dri-devel@lists.sourceforge.net], libdrm)
+AC_INIT([libdrm], 2.4.11, [dri-devel@lists.sourceforge.net], libdrm)
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2])
 
diff --git a/libdrm/intel/intel_bufmgr.c b/libdrm/intel/intel_bufmgr.c
index 5057fe6..f170e7f 100644
--- a/libdrm/intel/intel_bufmgr.c
+++ b/libdrm/intel/intel_bufmgr.c
@@ -219,3 +219,12 @@ int drm_intel_bo_disable_reuse(drm_intel_bo *bo)
 		return bo->bufmgr->bo_disable_reuse(bo);
 	return 0;
 }
+
+int
+drm_intel_get_pipe_from_crtc_id (drm_intel_bufmgr *bufmgr, int crtc_id)
+{
+	if (bufmgr->get_pipe_from_crtc_id)
+		return bufmgr->get_pipe_from_crtc_id(bufmgr, crtc_id);
+	return -1;
+}
+
diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c
index 3f792da..61943f0 100644
--- a/libdrm/intel/intel_bufmgr_gem.c
+++ b/libdrm/intel/intel_bufmgr_gem.c
@@ -815,8 +815,8 @@ drm_intel_gem_bo_subdata (drm_intel_bo *bo, unsigned long offset,
     return 0;
 }
 
-int
-drm_intel_get_pipe_from_crtc_id (drm_intel_bufmgr *bufmgr, int crtc_id)
+static int
+drm_intel_gem_get_pipe_from_crtc_id (drm_intel_bufmgr *bufmgr, int crtc_id)
 {
     drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bufmgr;
     struct drm_i915_get_pipe_from_crtc_id get_pipe_from_crtc_id;
@@ -826,13 +826,13 @@ drm_intel_get_pipe_from_crtc_id (drm_intel_bufmgr *bufmgr, int crtc_id)
     ret = ioctl (bufmgr_gem->fd, DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID,
 		 &get_pipe_from_crtc_id);
     if (ret != 0) {
-	/* We're intentionally silent here so that there is no
-	 * complaint when simply running with an older kernel that
-	 * doesn't have the GET_PIPE_FROM_CRTC_ID ioctly. In that
-	 * case, we just punt and try to sync on pipe 0, which is
-	 * hopefully the right pipe in some cases at least.
+	/* We return -1 here to signal that we don't
+	 * know which pipe is associated with this crtc.
+	 * This lets the caller know that this information
+	 * isn't available; using the wrong pipe for
+	 * vblank waiting can cause the chipset to lock up
 	 */
-	return 0;
+	return -1;
     }
 
     return get_pipe_from_crtc_id.pipe;
@@ -1482,6 +1482,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
     bufmgr_gem->bufmgr.debug = 0;
     bufmgr_gem->bufmgr.check_aperture_space = drm_intel_gem_check_aperture_space;
     bufmgr_gem->bufmgr.bo_disable_reuse = drm_intel_gem_bo_disable_reuse;
+    bufmgr_gem->bufmgr.get_pipe_from_crtc_id = drm_intel_gem_get_pipe_from_crtc_id;
     /* Initialize the linked lists for BO reuse cache. */
     for (i = 0; i < DRM_INTEL_GEM_BO_BUCKETS; i++)
 	DRMINITLISTHEAD(&bufmgr_gem->cache_bucket[i].head);
diff --git a/libdrm/intel/intel_bufmgr_priv.h b/libdrm/intel/intel_bufmgr_priv.h
index 3484dee..0098076 100644
--- a/libdrm/intel/intel_bufmgr_priv.h
+++ b/libdrm/intel/intel_bufmgr_priv.h
@@ -188,6 +188,19 @@ struct _drm_intel_bufmgr {
      */
     int (*bo_disable_reuse)(drm_intel_bo *bo);
 
+    /**
+     *
+     * Return the pipe associated with a crtc_id so that vblank
+     * synchronization can use the correct data in the request.
+     * This is only supported for KMS and gem at this point, when
+     * unsupported, this function returns -1 and leaves the decision
+     * of what to do in that case to the caller
+     *
+     * \param bufmgr the associated buffer manager
+     * \param crtc_id the crtc identifier
+     */
+    int (*get_pipe_from_crtc_id)(drm_intel_bufmgr *bufmgr, int crtc_id);
+    
     int debug; /**< Enables verbose debugging printouts */
 };
 

commit afd245dd7fd85cf3ffd3e6d5fe9711252aa2ed7f
Author: Carl Worth <cworth@cworth.org>
Date:   Wed Apr 29 14:43:55 2009 -0700

    Add new drm_intel_get_pipe_from_crtc_id function.
    
    This wraps the new DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID ioctl,
    allowing applications to discover the pipe number corresponding
    to a given CRTC ID. This is necessary for doing pipe-specific
    operations such as waiting for vblank on a given CRTC.

diff --git a/libdrm/intel/intel_bufmgr.h b/libdrm/intel/intel_bufmgr.h
index 75d06ca..758558d 100644
--- a/libdrm/intel/intel_bufmgr.h
+++ b/libdrm/intel/intel_bufmgr.h
@@ -120,6 +120,8 @@ int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo);
 int drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo);
 void drm_intel_gem_bo_start_gtt_access(drm_intel_bo *bo, int write_enable);
 
+int drm_intel_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id);
+
 /* drm_intel_bufmgr_fake.c */
 drm_intel_bufmgr *drm_intel_bufmgr_fake_init(int fd,
 					     unsigned long low_offset,
diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c
index 5ae4d66..3f792da 100644
--- a/libdrm/intel/intel_bufmgr_gem.c
+++ b/libdrm/intel/intel_bufmgr_gem.c
@@ -815,6 +815,29 @@ drm_intel_gem_bo_subdata (drm_intel_bo *bo, unsigned long offset,
     return 0;
 }
 
+int
+drm_intel_get_pipe_from_crtc_id (drm_intel_bufmgr *bufmgr, int crtc_id)
+{
+    drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bufmgr;
+    struct drm_i915_get_pipe_from_crtc_id get_pipe_from_crtc_id;
+    int ret;
+
+    get_pipe_from_crtc_id.crtc_id = crtc_id;
+    ret = ioctl (bufmgr_gem->fd, DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID,
+		 &get_pipe_from_crtc_id);
+    if (ret != 0) {
+	/* We're intentionally silent here so that there is no
+	 * complaint when simply running with an older kernel that
+	 * doesn't have the GET_PIPE_FROM_CRTC_ID ioctly. In that
+	 * case, we just punt and try to sync on pipe 0, which is
+	 * hopefully the right pipe in some cases at least.
+	 */
+	return 0;
+    }
+
+    return get_pipe_from_crtc_id.pipe;
+}
+
 static int
 drm_intel_gem_bo_get_subdata (drm_intel_bo *bo, unsigned long offset,
 			      unsigned long size, void *data)
diff --git a/shared-core/i915_drm.h b/shared-core/i915_drm.h
index 5456e91..c8fec5f 100644
--- a/shared-core/i915_drm.h
+++ b/shared-core/i915_drm.h
@@ -205,6 +205,7 @@ typedef struct drm_i915_sarea {
 #define DRM_I915_GEM_GET_TILING	0x22
 #define DRM_I915_GEM_GET_APERTURE 0x23
 #define DRM_I915_GEM_MMAP_GTT	0x24
+#define DRM_I915_GET_PIPE_FROM_CRTC_ID	0x25
 
 #define DRM_IOCTL_I915_INIT		DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
 #define DRM_IOCTL_I915_FLUSH		DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -242,6 +243,7 @@ typedef struct drm_i915_sarea {
 #define DRM_IOCTL_I915_GEM_SET_TILING	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
 #define DRM_IOCTL_I915_GEM_GET_TILING	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
 #define DRM_IOCTL_I915_GEM_GET_APERTURE	DRM_IOR  (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
+#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id)
 
 /* Asynchronous page flipping:
  */
@@ -769,4 +771,12 @@ struct drm_i915_gem_get_aperture {
 	uint64_t aper_available_size;
 };
 
+struct drm_i915_get_pipe_from_crtc_id {
+	/** ID of CRTC being requested **/
+	uint32_t crtc_id;
+
+	/** pipe of requested CRTC **/
+	uint32_t pipe;
+};
+
 #endif				/* _I915_DRM_H_ */

commit 8b8e20e0f9900fae23baee55a91533a739c1a3ec
Author: Keith Packard <keithp@keithp.com>
Date:   Tue May 12 15:33:28 2009 -0700

    Bump to version 2.4.10 to mark addition of drm_intel_bo_disable_reuse
    
    New API, new version.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>

diff --git a/configure.ac b/configure.ac
index 19d9c9c..e8cce3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@
 #  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 AC_PREREQ(2.57)
-AC_INIT([libdrm], 2.4.9, [dri-devel@lists.sourceforge.net], libdrm)
+AC_INIT([libdrm], 2.4.10, [dri-devel@lists.sourceforge.net], libdrm)
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2])
 

commit 5b5ce301287fb8ef74b45fad3c10b2d4ac3a9cc6
Author: Keith Packard <keithp@keithp.com>
Date:   Mon May 11 13:42:12 2009 -0700

    libdrm/intel: add drm_intel_bo_disable_reuse api
    
    Scanout buffers need to be freed through the kernel as it holds a reference
    to them; exposing this API allows applications allocating scanout buffers to
    flag them as not reusable.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>

diff --git a/libdrm/intel/intel_bufmgr.c b/libdrm/intel/intel_bufmgr.c
index 25a6828..5057fe6 100644
--- a/libdrm/intel/intel_bufmgr.c
+++ b/libdrm/intel/intel_bufmgr.c
@@ -212,3 +212,10 @@ int drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
     *swizzle_mode = I915_BIT_6_SWIZZLE_NONE;
     return 0;
 }
+
+int drm_intel_bo_disable_reuse(drm_intel_bo *bo)
+{
+	if (bo->bufmgr->bo_disable_reuse)
+		return bo->bufmgr->bo_disable_reuse(bo);
+	return 0;
+}
diff --git a/libdrm/intel/intel_bufmgr.h b/libdrm/intel/intel_bufmgr.h
index 542dc06..75d06ca 100644
--- a/libdrm/intel/intel_bufmgr.h
+++ b/libdrm/intel/intel_bufmgr.h
@@ -108,6 +108,8 @@ int drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
 			uint32_t *swizzle_mode);
 int drm_intel_bo_flink(drm_intel_bo *bo, uint32_t *name);
 
+int drm_intel_bo_disable_reuse(drm_intel_bo *bo);
+
 /* drm_intel_bufmgr_gem.c */
 drm_intel_bufmgr *drm_intel_bufmgr_gem_init(int fd, int batch_size);
 drm_intel_bo *drm_intel_bo_gem_create_from_name(drm_intel_bufmgr *bufmgr,
diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c
index 89931d8..5ae4d66 100644
--- a/libdrm/intel/intel_bufmgr_gem.c
+++ b/libdrm/intel/intel_bufmgr_gem.c
@@ -166,6 +166,11 @@ struct _drm_intel_bo_gem {
      char used_as_reloc_target;
 
     /**
+     * Boolean of whether this buffer can be re-used
+     */
+    char reusable;
+
+    /**
      * Size in bytes of this buffer and its relocation descendents.
      *
      * Used to avoid costly tree walking in drm_intel_bufmgr_check_aperture in
@@ -420,6 +425,7 @@ drm_intel_gem_bo_alloc_internal(drm_intel_bufmgr *bufmgr, const char *name,
     bo_gem->used_as_reloc_target = 0;
     bo_gem->tiling_mode = I915_TILING_NONE;
     bo_gem->swizzle_mode = I915_BIT_6_SWIZZLE_NONE;
+    bo_gem->reusable = 1;
 
     DBG("bo_create: buf %d (%s) %ldb\n",
 	bo_gem->gem_handle, bo_gem->name, size);
@@ -479,6 +485,7 @@ drm_intel_bo_gem_create_from_name(drm_intel_bufmgr *bufmgr, const char *name,
     bo_gem->validate_index = -1;
     bo_gem->gem_handle = open_arg.handle;
     bo_gem->global_name = handle;
+    bo_gem->reusable = 0;
 
     memset(&get_tiling, 0, sizeof(get_tiling));
     get_tiling.handle = bo_gem->gem_handle;
@@ -572,7 +579,7 @@ drm_intel_gem_bo_unreference_locked(drm_intel_bo *bo)
 	bucket = drm_intel_gem_bo_bucket_for_size(bufmgr_gem, bo->size);
 	/* Put the buffer into our internal cache for reuse if we can. */
 	tiling_mode = I915_TILING_NONE;
-	if (bo_gem->global_name == 0 &&
+	if (bo_gem->reusable &&
 	    bucket != NULL &&
 	    (bucket->max_entries == -1 ||
 	     (bucket->max_entries > 0 &&
@@ -1168,6 +1175,7 @@ drm_intel_gem_bo_flink(drm_intel_bo *bo, uint32_t *name)
 	if (ret != 0)
 	    return -errno;
 	bo_gem->global_name = flink.name;
+	bo_gem->reusable = 0;
     }
     
     *name = bo_gem->global_name;
@@ -1356,6 +1364,19 @@ drm_intel_gem_check_aperture_space(drm_intel_bo **bo_array, int count)
     }
 }
 
+/*
+ * Disable buffer reuse for objects which are shared with the kernel
+ * as scanout buffers
+ */
+static int
+drm_intel_gem_bo_disable_reuse(drm_intel_bo *bo)
+{
+    drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo;
+
+    bo_gem->reusable = 0;
+    return 0;
+}
+
 /**
  * Initializes the GEM buffer manager, which uses the kernel to allocate, map,
  * and manage map buffer objections.
@@ -1437,6 +1458,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
     bufmgr_gem->bufmgr.destroy = drm_intel_bufmgr_gem_destroy;
     bufmgr_gem->bufmgr.debug = 0;
     bufmgr_gem->bufmgr.check_aperture_space = drm_intel_gem_check_aperture_space;
+    bufmgr_gem->bufmgr.bo_disable_reuse = drm_intel_gem_bo_disable_reuse;
     /* Initialize the linked lists for BO reuse cache. */
     for (i = 0; i < DRM_INTEL_GEM_BO_BUCKETS; i++)
 	DRMINITLISTHEAD(&bufmgr_gem->cache_bucket[i].head);
diff --git a/libdrm/intel/intel_bufmgr_priv.h b/libdrm/intel/intel_bufmgr_priv.h
index 82d87b4..3484dee 100644
--- a/libdrm/intel/intel_bufmgr_priv.h
+++ b/libdrm/intel/intel_bufmgr_priv.h
@@ -178,6 +178,16 @@ struct _drm_intel_bufmgr {
     int (*bo_flink)(drm_intel_bo *bo, uint32_t *name);
 
     int (*check_aperture_space)(drm_intel_bo **bo_array, int count);
+
+    /**
+     * Disable buffer reuse for buffers which will be shared in some way,
+     * as with scanout buffers. When the buffer reference count goes to zero,
+     * it will be freed and not placed in the reuse list.
+     *
+     * \param bo Buffer to disable reuse for
+     */
+    int (*bo_disable_reuse)(drm_intel_bo *bo);
+
     int debug; /**< Enables verbose debugging printouts */
 };
 

commit 628dc48a16ec6796ec5a81428e695837c51463d0
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date:   Mon Jun 9 17:03:28 2008 -0700

    Use C99 versions of __FUNCTION__ & __volatile__ when not building with gcc

diff --git a/shared-core/drm.h b/shared-core/drm.h
index b97ba09..97fab9a 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -69,6 +69,12 @@
 # define DEPRECATED  __attribute__ ((deprecated))
 #else
 # define DEPRECATED
+# ifndef __FUNCTION__
+#  define __FUNCTION__ __func__ /* C99 */
+# endif
+# ifndef __volatile__
+#  define __volatile__ volatile
+# endif
 #endif
 
 #if defined(__linux__)

commit 1bae8844cafd70f6196116f6e84b0f36c069e976
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date:   Sat May 9 17:21:29 2009 -0700

    Delete extra libdrm_lists.h line after libdrm_la_SOURCES in libdrm/Makefile.am
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>

diff --git a/libdrm/Makefile.am b/libdrm/Makefile.am
index 4c066e0..458420a 100644
--- a/libdrm/Makefile.am
+++ b/libdrm/Makefile.am
@@ -32,7 +32,6 @@ libdrm_la_LIBADD = @CLOCK_LIB@
 AM_CFLAGS = -I$(top_srcdir)/shared-core
 libdrm_la_SOURCES = xf86drm.c xf86drmHash.c xf86drmRandom.c xf86drmSL.c \
 	xf86drmMode.c libdrm_lists.h
-	libdrm_lists.h
 
 libdrmincludedir = ${includedir}
 libdrminclude_HEADERS = xf86drm.h xf86drmMode.h

commit 94d48d038502097ebfa2e33e4a75b9e0e675231d
Author: Stuart Bennett <stuart@freedesktop.org>
Date:   Wed May 6 23:56:51 2009 +0100

    nouveau: backlight compat fix
    
    Avoid failure to build on old kernels with CONFIG_BACKLIGHT_CLASS_DEVICE set

diff --git a/linux-core/nouveau_backlight.c b/linux-core/nouveau_backlight.c
index 51c747a..1b36f3c 100644
--- a/linux-core/nouveau_backlight.c
+++ b/linux-core/nouveau_backlight.c
@@ -37,7 +37,7 @@
 #include "nouveau_drm.h"
 #include "nouveau_reg.h"
 
-#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
+#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
 
 static int nv40_get_intensity(struct backlight_device *bd)
 {

commit e2b5fde7f6ff412cadd9cad35ad051a028cf7fae
Author: Danny Tholen <moondrake@gmail.com>
Date:   Wed May 6 23:41:09 2009 +0100

    nouveau: fix ppc for swab changes in Linux 2.6.29

diff --git a/shared-core/nouveau_state.c b/shared-core/nouveau_state.c
index c9f4329..b2ad747 100644
--- a/shared-core/nouveau_state.c
+++ b/shared-core/nouveau_state.c
@@ -496,7 +496,7 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
 	reg1 = readl(regs+NV03_PMC_BOOT_1);
 #if defined(__powerpc__)
 	if (reg1)
-		reg0=___swab32(reg0);
+		reg0=__swab32(reg0);
 #endif
 
 	/* We're dealing with >=NV10 */

commit 68103b2758029b3c1fbfcf995baa758bfd2676de
Author: Keith Packard <keithp@keithp.com>
Date:   Fri May 1 18:47:04 2009 -0700

    libdrm/intel: assert that clients are using bo refcounting correctly
    
    Add assertions to drm_intel_gem_bo_reference,
    drm_intel_gem_bo_reference_locked and drm_intel_gem_bo_unreference_locked
    that the object has not been freed (refcount > 0). Mistakes in refcounting
    lead to attempts to insert a bo into a free list more than once which causes
    application failure as empty free lists are dereferenced as buffer objects.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c
index e48778c..89931d8 100644
--- a/libdrm/intel/intel_bufmgr_gem.c
+++ b/libdrm/intel/intel_bufmgr_gem.c
@@ -505,6 +505,7 @@ drm_intel_gem_bo_reference(drm_intel_bo *bo)
     drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr;
     drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo;
 
+    assert(bo_gem->refcount > 0);
     pthread_mutex_lock(&bufmgr_gem->lock);
     bo_gem->refcount++;
     pthread_mutex_unlock(&bufmgr_gem->lock);
@@ -515,6 +516,7 @@ drm_intel_gem_bo_reference_locked(drm_intel_bo *bo)
 {
     drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo;
 
+    assert(bo_gem->refcount > 0);
     bo_gem->refcount++;
 }
 
@@ -549,6 +551,7 @@ drm_intel_gem_bo_unreference_locked(drm_intel_bo *bo)
     drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr;
     drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo;
 
+    assert(bo_gem->refcount > 0);
     if (--bo_gem->refcount == 0) {
 	struct drm_intel_gem_bo_bucket *bucket;
 	uint32_t tiling_mode;

commit 11b60973bca1bc9bbda44be4c695e22d28d8ca4a
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date:   Tue Apr 21 17:13:16 2009 -0700

    intel: NULL fake bo block when freeing in evict_all
    
    Fixes assertion failures on later use of the object.

diff --git a/libdrm/intel/intel_bufmgr_fake.c b/libdrm/intel/intel_bufmgr_fake.c
index e1f98d6..969c03d 100644
--- a/libdrm/intel/intel_bufmgr_fake.c
+++ b/libdrm/intel/intel_bufmgr_fake.c
@@ -1467,8 +1467,10 @@ drm_intel_bufmgr_fake_evict_all(drm_intel_bufmgr *bufmgr)
    assert(DRMLISTEMPTY(&bufmgr_fake->on_hardware));
 
    DRMLISTFOREACHSAFE(block, tmp, &bufmgr_fake->lru) {
+      drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *)block->bo;
       /* Releases the memory, and memcpys dirty contents out if necessary. */
       free_block(bufmgr_fake, block, 0);
+      bo_fake->block = NULL;
    }
 
    pthread_mutex_unlock(&bufmgr_fake->lock);

commit 412d370b9ae4b2882691863a1c5e13a507574e92
Author: Dave Airlie <airlied@linux.ie>
Date:   Wed Apr 22 20:25:40 2009 +1000

    libdrm/mode: align subpixel results

diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c
index 872604f..ea11207 100644
--- a/libdrm/xf86drmMode.c
+++ b/libdrm/xf86drmMode.c
@@ -395,7 +395,8 @@ drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id)
 	r->connection   = conn.connection;
 	r->mmWidth      = conn.mm_width;
 	r->mmHeight     = conn.mm_height;
-	r->subpixel     = conn.subpixel;
+	/* convert subpixel from kernel to userspace */
+	r->subpixel     = conn.subpixel + 1;
 	r->count_modes  = conn.count_modes;
 	/* TODO we should test if these alloc & cpy fails. */
 	r->count_props  = conn.count_props;

commit a1e3ab9e55047c08a4006ec389c1a99b72bc672c
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Fri Apr 17 09:29:19 2009 +1000

    nouveau: write posting got lost somewhere, bring it back

diff --git a/libdrm/nouveau/nouveau_dma.c b/libdrm/nouveau/nouveau_dma.c
index 23da64b..b084f70 100644
--- a/libdrm/nouveau/nouveau_dma.c
+++ b/libdrm/nouveau/nouveau_dma.c
@@ -41,6 +41,7 @@ WRITE_PUT(struct nouveau_channel_priv *nvchan, uint32_t val)
 	volatile int dum;
 
 	NOUVEAU_DMA_BARRIER;
+	dum = nvchan->pushbuf[0];
 	dum = READ_GET(nvchan);
 
 	*nvchan->put = put;

commit 78e753d03314e3aa92af8ec601e9dbb869a938d5
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Wed Apr 15 12:44:21 2009 +1000

    nouveau: store bo handle in public struct in bo_ref_handle

diff --git a/libdrm/nouveau/nouveau_bo.c b/libdrm/nouveau/nouveau_bo.c
index 023c6be..66466e3 100644
--- a/libdrm/nouveau/nouveau_bo.c
+++ b/libdrm/nouveau/nouveau_bo.c
@@ -404,7 +404,8 @@ nouveau_bo_handle_ref(struct nouveau_device *dev, uint32_t handle,
 		nvbo->size = req.size;
 		nvbo->handle = req.handle;
 	}
- 
+
+	nvbo->base.handle = nvbo->handle;
 	return 0;
 } 
 


Reply to: