aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_irq.c
diff options
context:
space:
mode:
authorIlija Hadzic <ihadzic@research.bell-labs.com>2011-03-18 17:58:04 -0400
committerDave Airlie <airlied@redhat.com>2011-03-20 19:25:54 -0400
commit19b01b5fbf0b78930b3b06ee6080539c17b5d1fd (patch)
treeb2cfeb6aeae49bc4061ce8923a63b6b8bd4d6e1d /drivers/gpu/drm/drm_irq.c
parentb74ad5ae14def5e81ad0be3dddb96e485b861b1b (diff)
drm/kernel: vblank wait on crtc > 1
Below is a patch against drm-next branch of 2.6.38-rc8+ kernel that adds the capability to wait on vblank events for CRTCs that are greater than 1 and thus cannot be represented with primary/secondary flags in the legacy interface. It was discussed on the dri-devel list in these two threads: http://lists.freedesktop.org/archives/dri-devel/2011-March/009009.html http://lists.freedesktop.org/archives/dri-devel/2011-March/009025.html This patch extends the interface to drm_wait_vblank ioctl so that crtc>1 can be represented. It also adds a new capability to drm_getcap ioctl so that the user space can check whether the new interface to drm_wait_vblank is supported (and fall back to the legacy interface if not) Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Mario Kleiner <mario.kleiner at tuebingen.mpg.de> Acked-by: Mario Kleiner <mario.kleiner at tuebingen.mpg.de> Reviewed-by: Alex Deucher <alexdeucher@gmail.com> Tested-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_irq.c')
-rw-r--r--drivers/gpu/drm/drm_irq.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index a34ef97d3c81..741457bd1c46 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1125,7 +1125,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
1125{ 1125{
1126 union drm_wait_vblank *vblwait = data; 1126 union drm_wait_vblank *vblwait = data;
1127 int ret = 0; 1127 int ret = 0;
1128 unsigned int flags, seq, crtc; 1128 unsigned int flags, seq, crtc, high_crtc;
1129 1129
1130 if ((!drm_dev_to_irq(dev)) || (!dev->irq_enabled)) 1130 if ((!drm_dev_to_irq(dev)) || (!dev->irq_enabled))
1131 return -EINVAL; 1131 return -EINVAL;
@@ -1134,16 +1134,21 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
1134 return -EINVAL; 1134 return -EINVAL;
1135 1135
1136 if (vblwait->request.type & 1136 if (vblwait->request.type &
1137 ~(_DRM_VBLANK_TYPES_MASK | _DRM_VBLANK_FLAGS_MASK)) { 1137 ~(_DRM_VBLANK_TYPES_MASK | _DRM_VBLANK_FLAGS_MASK |
1138 _DRM_VBLANK_HIGH_CRTC_MASK)) {
1138 DRM_ERROR("Unsupported type value 0x%x, supported mask 0x%x\n", 1139 DRM_ERROR("Unsupported type value 0x%x, supported mask 0x%x\n",
1139 vblwait->request.type, 1140 vblwait->request.type,
1140 (_DRM_VBLANK_TYPES_MASK | _DRM_VBLANK_FLAGS_MASK)); 1141 (_DRM_VBLANK_TYPES_MASK | _DRM_VBLANK_FLAGS_MASK |
1142 _DRM_VBLANK_HIGH_CRTC_MASK));
1141 return -EINVAL; 1143 return -EINVAL;
1142 } 1144 }
1143 1145
1144 flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK; 1146 flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK;
1145 crtc = flags & _DRM_VBLANK_SECONDARY ? 1 : 0; 1147 high_crtc = (vblwait->request.type & _DRM_VBLANK_HIGH_CRTC_MASK);
1146 1148 if (high_crtc)
1149 crtc = high_crtc >> _DRM_VBLANK_HIGH_CRTC_SHIFT;
1150 else
1151 crtc = flags & _DRM_VBLANK_SECONDARY ? 1 : 0;
1147 if (crtc >= dev->num_crtcs) 1152 if (crtc >= dev->num_crtcs)
1148 return -EINVAL; 1153 return -EINVAL;
1149 1154