diff options
author | Carl Worth <cworth@cworth.org> | 2009-04-29 17:43:54 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-05-14 19:00:32 -0400 |
commit | 08d7b3d1edff84bd673d9e9ab36b5aa62e1ba903 (patch) | |
tree | 0dcbb40ceb39aafab750bb06e2cd165dd906f8d3 /drivers/gpu/drm/i915/intel_display.c | |
parent | 9d2949a4cdb77b9b5c243c79be6489d34d770c7c (diff) |
drm/i915: Add new GET_PIPE_FROM_CRTC_ID ioctl.
This allows userlevel code 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. Failure to use
the right pipe mapping can result in GPU hangs, or at least failure
to actually sync to vblank.
Signed-off-by: Carl Worth <cworth@cworth.org>
[anholt: Style touchups from review]
Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index bdcda36953b0..3387cf32f385 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1804,6 +1804,37 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
1804 | } | 1804 | } |
1805 | } | 1805 | } |
1806 | 1806 | ||
1807 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, | ||
1808 | struct drm_file *file_priv) | ||
1809 | { | ||
1810 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
1811 | struct drm_i915_get_pipe_from_crtc_id *pipe_from_crtc_id = data; | ||
1812 | struct drm_crtc *crtc = NULL; | ||
1813 | int pipe = -1; | ||
1814 | |||
1815 | if (!dev_priv) { | ||
1816 | DRM_ERROR("called with no initialization\n"); | ||
1817 | return -EINVAL; | ||
1818 | } | ||
1819 | |||
1820 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
1821 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
1822 | if (crtc->base.id == pipe_from_crtc_id->crtc_id) { | ||
1823 | pipe = intel_crtc->pipe; | ||
1824 | break; | ||
1825 | } | ||
1826 | } | ||
1827 | |||
1828 | if (pipe == -1) { | ||
1829 | DRM_ERROR("no such CRTC id\n"); | ||
1830 | return -EINVAL; | ||
1831 | } | ||
1832 | |||
1833 | pipe_from_crtc_id->pipe = pipe; | ||
1834 | |||
1835 | return 0; | ||
1836 | } | ||
1837 | |||
1807 | struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe) | 1838 | struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe) |
1808 | { | 1839 | { |
1809 | struct drm_crtc *crtc = NULL; | 1840 | struct drm_crtc *crtc = NULL; |