diff options
author | Keith Packard <keithp@keithp.com> | 2009-05-14 16:58:14 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-05-14 16:58:14 -0700 |
commit | f57d7f4b0b14972f92a83f155ae8033478aa7729 (patch) | |
tree | 4235d7067d5438c4fbdefdfb4757ffeeee26862f | |
parent | afd245dd7fd85cf3ffd3e6d5fe9711252aa2ed7f (diff) |
libdrm/intel: Make get_pipe_from_crtc_id per-bufmgr. Return -1 on failure.libdrm-2.4.11
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>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | libdrm/intel/intel_bufmgr.c | 9 | ||||
-rw-r--r-- | libdrm/intel/intel_bufmgr_gem.c | 17 | ||||
-rw-r--r-- | libdrm/intel/intel_bufmgr_priv.h | 13 |
4 files changed, 32 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac index e8cce3bf..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.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 5057fe69..f170e7fc 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 3f792da1..61943f0d 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 3484dee8..0098076e 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 */ }; |