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>main
parent
afd245dd7f
commit
f57d7f4b0b
|
@ -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])
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue