diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-05-15 10:21:48 -0700 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-05-15 10:21:48 -0700 |
commit | bd6f8f31cc94e2d9dcb1d4ee014893682868b834 (patch) | |
tree | 3c2ead853a4abe8e6f0bbefd3f63b44b9bcac3ed | |
parent | e98581da95db3173a07ac0afdf155e65a2c5fc5d (diff) | |
parent | f57d7f4b0b14972f92a83f155ae8033478aa7729 (diff) |
Merge branch 'master' into kms-pageflip
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | libdrm/Makefile.am | 1 | ||||
-rw-r--r-- | libdrm/intel/intel_bufmgr.c | 16 | ||||
-rw-r--r-- | libdrm/intel/intel_bufmgr.h | 4 | ||||
-rw-r--r-- | libdrm/intel/intel_bufmgr_gem.c | 51 | ||||
-rw-r--r-- | libdrm/intel/intel_bufmgr_priv.h | 23 | ||||
-rw-r--r-- | linux-core/nouveau_backlight.c | 2 | ||||
-rw-r--r-- | shared-core/drm.h | 6 | ||||
-rw-r--r-- | shared-core/i915_drm.h | 10 | ||||
-rw-r--r-- | shared-core/nouveau_state.c | 2 |
10 files changed, 112 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 19d9c9ce..9d1a8ef3 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.11, [dri-devel@lists.sourceforge.net], libdrm) AC_CONFIG_SRCDIR([Makefile.am]) AM_INIT_AUTOMAKE([dist-bzip2]) diff --git a/libdrm/Makefile.am b/libdrm/Makefile.am index 4c066e0e..458420ab 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 diff --git a/libdrm/intel/intel_bufmgr.c b/libdrm/intel/intel_bufmgr.c index 25a6828c..f170e7fc 100644 --- a/libdrm/intel/intel_bufmgr.c +++ b/libdrm/intel/intel_bufmgr.c @@ -212,3 +212,19 @@ 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; +} + +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.h b/libdrm/intel/intel_bufmgr.h index 542dc06f..758558df 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, @@ -118,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 e48778c3..61943f0d 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; @@ -505,6 +512,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 +523,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 +558,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; @@ -569,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 && @@ -806,6 +816,29 @@ drm_intel_gem_bo_subdata (drm_intel_bo *bo, unsigned long offset, } 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; + 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 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 -1; + } + + 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) { @@ -1165,6 +1198,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; @@ -1353,6 +1387,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. @@ -1434,6 +1481,8 @@ 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; + 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 82d87b4c..0098076e 100644 --- a/libdrm/intel/intel_bufmgr_priv.h +++ b/libdrm/intel/intel_bufmgr_priv.h @@ -178,6 +178,29 @@ 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); + + /** + * + * 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 */ }; diff --git a/linux-core/nouveau_backlight.c b/linux-core/nouveau_backlight.c index 51c747a3..1b36f3cf 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) { diff --git a/shared-core/drm.h b/shared-core/drm.h index 2353ac42..a677db89 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__) diff --git a/shared-core/i915_drm.h b/shared-core/i915_drm.h index 5456e917..c8fec5fa 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_ */ diff --git a/shared-core/nouveau_state.c b/shared-core/nouveau_state.c index c9f43295..b2ad747a 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 */ |