| 1 |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
|
| 2 |
index ba728ad..4b7e748 100644
|
| 3 |
--- a/drivers/gpu/drm/drm_crtc.c
|
| 4 |
+++ b/drivers/gpu/drm/drm_crtc.c
|
| 5 |
@@ -34,6 +34,8 @@
|
| 6 |
#include "drmP.h"
|
| 7 |
#include "drm_crtc.h"
|
| 8 |
|
| 9 |
+#undef set_base
|
| 10 |
+
|
| 11 |
struct drm_prop_enum_list {
|
| 12 |
int type;
|
| 13 |
char *name;
|
| 14 |
@@ -330,6 +332,34 @@ void drm_framebuffer_cleanup(struct drm_framebuffer *fb)
|
| 15 |
EXPORT_SYMBOL(drm_framebuffer_cleanup);
|
| 16 |
|
| 17 |
/**
|
| 18 |
+ * drm_crtc_async_flip - do a set_base call from a work queue
|
| 19 |
+ * @work: work struct
|
| 20 |
+ *
|
| 21 |
+ * Called when a set_base call is queued by the page flip code. This
|
| 22 |
+ * allows the flip ioctl itself to return immediately and allow userspace
|
| 23 |
+ * to continue working.
|
| 24 |
+ */
|
| 25 |
+static void drm_crtc_async_flip(struct work_struct *work)
|
| 26 |
+{
|
| 27 |
+ struct drm_crtc *crtc = container_of(work, struct drm_crtc, async_flip);
|
| 28 |
+ struct drm_device *dev = crtc->dev;
|
| 29 |
+ struct drm_pending_flip *pending;
|
| 30 |
+
|
| 31 |
+ BUG_ON(crtc->pending_flip == NULL);
|
| 32 |
+
|
| 33 |
+ mutex_lock(&dev->struct_mutex);
|
| 34 |
+ crtc->funcs->set_base(crtc, crtc->x, crtc->y, NULL);
|
| 35 |
+
|
| 36 |
+ pending = crtc->pending_flip;
|
| 37 |
+ crtc->pending_flip = NULL;
|
| 38 |
+
|
| 39 |
+ pending->frame = drm_vblank_count(dev, crtc->pipe);
|
| 40 |
+ list_add_tail(&pending->link, &dev->flip_list);
|
| 41 |
+
|
| 42 |
+ mutex_unlock(&dev->struct_mutex);
|
| 43 |
+}
|
| 44 |
+
|
| 45 |
+/**
|
| 46 |
* drm_crtc_init - Initialise a new CRTC object
|
| 47 |
* @dev: DRM device
|
| 48 |
* @crtc: CRTC object to init
|
| 49 |
@@ -340,17 +370,19 @@ EXPORT_SYMBOL(drm_framebuffer_cleanup);
|
| 50 |
*
|
| 51 |
* Inits a new object created as base part of an driver crtc object.
|
| 52 |
*/
|
| 53 |
-void drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
|
| 54 |
+void drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, int pipe,
|
| 55 |
const struct drm_crtc_funcs *funcs)
|
| 56 |
{
|
| 57 |
crtc->dev = dev;
|
| 58 |
crtc->funcs = funcs;
|
| 59 |
+ crtc->pipe = pipe;
|
| 60 |
|
| 61 |
mutex_lock(&dev->mode_config.mutex);
|
| 62 |
drm_mode_object_get(dev, &crtc->base, DRM_MODE_OBJECT_CRTC);
|
| 63 |
|
| 64 |
list_add_tail(&crtc->head, &dev->mode_config.crtc_list);
|
| 65 |
dev->mode_config.num_crtc++;
|
| 66 |
+ INIT_WORK(&crtc->async_flip, drm_crtc_async_flip);
|
| 67 |
mutex_unlock(&dev->mode_config.mutex);
|
| 68 |
}
|
| 69 |
EXPORT_SYMBOL(drm_crtc_init);
|
| 70 |
@@ -369,6 +401,9 @@ void drm_crtc_cleanup(struct drm_crtc *crtc)
|
| 71 |
{
|
| 72 |
struct drm_device *dev = crtc->dev;
|
| 73 |
|
| 74 |
+ mutex_lock(&dev->mode_config.mutex);
|
| 75 |
+ flush_work(&crtc->async_flip);
|
| 76 |
+
|
| 77 |
if (crtc->gamma_store) {
|
| 78 |
kfree(crtc->gamma_store);
|
| 79 |
crtc->gamma_store = NULL;
|
| 80 |
@@ -376,6 +411,7 @@ void drm_crtc_cleanup(struct drm_crtc *crtc)
|
| 81 |
|
| 82 |
drm_mode_object_put(dev, &crtc->base);
|
| 83 |
list_del(&crtc->head);
|
| 84 |
+ mutex_unlock(&dev->mode_config.mutex);
|
| 85 |
dev->mode_config.num_crtc--;
|
| 86 |
}
|
| 87 |
EXPORT_SYMBOL(drm_crtc_cleanup);
|
| 88 |
@@ -2479,3 +2515,134 @@ out:
|
| 89 |
mutex_unlock(&dev->mode_config.mutex);
|
| 90 |
return ret;
|
| 91 |
}
|
| 92 |
+
|
| 93 |
+/**
|
| 94 |
+ * drm_mode_page_flip_ioctl - page flip ioctl
|
| 95 |
+ * @dev: DRM device
|
| 96 |
+ * @data: ioctl args
|
| 97 |
+ * @file_priv: file private data
|
| 98 |
+ *
|
| 99 |
+ * The page flip ioctl replaces the current front buffer with a new
|
| 100 |
+ * one, using the CRTC's set_base function, which should just update
|
| 101 |
+ * the front buffer base pointer. It's up to set_base to make
|
| 102 |
+ * sure the update doesn't result in tearing (on some hardware the
|
| 103 |
+ * base register is double buffered, so this is easy).
|
| 104 |
+ *
|
| 105 |
+ * Note that this covers just the simple case of flipping the front
|
| 106 |
+ * buffer immediately. Interval handling and interlaced modes have to
|
| 107 |
+ * be handled by userspace, or with new ioctls.
|
| 108 |
+ */
|
| 109 |
+int drm_mode_page_flip_ioctl(struct drm_device *dev, void *data,
|
| 110 |
+ struct drm_file *file_priv)
|
| 111 |
+{
|
| 112 |
+ struct drm_pending_flip *pending;
|
| 113 |
+ struct drm_mode_page_flip *flip_data = data;
|
| 114 |
+ struct drm_mode_object *drm_obj, *fb_obj;
|
| 115 |
+ struct drm_crtc *crtc;
|
| 116 |
+ int ret = 0;
|
| 117 |
+
|
| 118 |
+ if (!(drm_core_check_feature(dev, DRIVER_MODESET)))
|
| 119 |
+ return -ENODEV;
|
| 120 |
+
|
| 121 |
+ /*
|
| 122 |
+ * Reject unknown flags so future userspace knows what we (don't)
|
| 123 |
+ * support
|
| 124 |
+ */
|
| 125 |
+ if (flip_data->flags & (~DRM_MODE_PAGE_FLIP_FLAGS_MASK)) {
|
| 126 |
+ DRM_DEBUG("bad page flip flags\n");
|
| 127 |
+ return -EINVAL;
|
| 128 |
+ }
|
| 129 |
+
|
| 130 |
+ pending = kzalloc(sizeof *pending, GFP_KERNEL);
|
| 131 |
+ if (pending == NULL)
|
| 132 |
+ return -ENOMEM;
|
| 133 |
+
|
| 134 |
+ mutex_lock(&dev->struct_mutex);
|
| 135 |
+
|
| 136 |
+ fb_obj = drm_mode_object_find(dev, flip_data->fb_id,
|
| 137 |
+ DRM_MODE_OBJECT_FB);
|
| 138 |
+ if (!fb_obj) {
|
| 139 |
+ DRM_DEBUG("unknown fb %d\n", flip_data->fb_id);
|
| 140 |
+ ret = -ENOENT;
|
| 141 |
+ goto out_unlock;
|
| 142 |
+ }
|
| 143 |
+
|
| 144 |
+ drm_obj = drm_mode_object_find(dev, flip_data->crtc_id,
|
| 145 |
+ DRM_MODE_OBJECT_CRTC);
|
| 146 |
+ if (!drm_obj) {
|
| 147 |
+ DRM_DEBUG("unknown crtc %d\n", flip_data->crtc_id);
|
| 148 |
+ ret = -ENOENT;
|
| 149 |
+ goto out_unlock;
|
| 150 |
+ }
|
| 151 |
+ crtc = obj_to_crtc(drm_obj);
|
| 152 |
+ if (!crtc->enabled) {
|
| 153 |
+ DRM_DEBUG("crtc %d not enabled\n", flip_data->crtc_id);
|
| 154 |
+ ret = -EINVAL;
|
| 155 |
+ goto out_unlock;
|
| 156 |
+ }
|
| 157 |
+
|
| 158 |
+ if (crtc->fb->funcs->unpin == NULL) {
|
| 159 |
+ DRM_DEBUG("fb for crtc %d does not support delayed unpin\n",
|
| 160 |
+ flip_data->crtc_id);
|
| 161 |
+ ret = -ENODEV;
|
| 162 |
+ goto out_unlock;
|
| 163 |
+ }
|
| 164 |
+
|
| 165 |
+ pending->crtc = crtc;
|
| 166 |
+ pending->old_fb = crtc->fb;
|
| 167 |
+ pending->pipe = crtc->pipe;
|
| 168 |
+ pending->event.base.type = DRM_EVENT_MODE_PAGE_FLIP;
|
| 169 |
+ pending->event.base.length = sizeof pending->event;
|
| 170 |
+ pending->event.user_data = flip_data->user_data;
|
| 171 |
+ pending->pending_event.event = &pending->event.base;
|
| 172 |
+ pending->pending_event.file_priv = file_priv;
|
| 173 |
+ pending->pending_event.destroy =
|
| 174 |
+ (void (*) (struct drm_pending_event *)) kfree;
|
| 175 |
+
|
| 176 |
+ /* Get vblank ref for completion handling */
|
| 177 |
+ ret = drm_vblank_get(dev, crtc->pipe);
|
| 178 |
+ if (ret) {
|
| 179 |
+ DRM_DEBUG("failed to take vblank ref\n");
|
| 180 |
+ goto out_unlock;
|
| 181 |
+ }
|
| 182 |
+
|
| 183 |
+ /*
|
| 184 |
+ * The set_base call will change the domain on the new fb,
|
| 185 |
+ * which will force the rendering to finish and block the
|
| 186 |
+ * ioctl. We need to do this last part from a work queue, to
|
| 187 |
+ * avoid blocking userspace here.
|
| 188 |
+ */
|
| 189 |
+ crtc->fb = obj_to_fb(fb_obj);
|
| 190 |
+
|
| 191 |
+ if (crtc->pending_flip != NULL) {
|
| 192 |
+ struct drm_pending_flip *old_flip;
|
| 193 |
+
|
| 194 |
+ /* We have an outstanding flip request for this crtc/pipe.
|
| 195 |
+ * In order to satisfy the user we can either queue the requests
|
| 196 |
+ * and apply them on sequential vblanks, or we can drop old
|
| 197 |
+ * requests.
|
| 198 |
+ *
|
| 199 |
+ * Here we choose to discard the previous request for
|
| 200 |
+ * simplicity. Note that since we have not yet applied the
|
| 201 |
+ * previous flip, we need to preserve the original (i.e. still
|
| 202 |
+ * current) fb.
|
| 203 |
+ */
|
| 204 |
+
|
| 205 |
+ old_flip = crtc->pending_flip;
|
| 206 |
+ pending->old_fb = old_flip->old_fb;
|
| 207 |
+ old_flip->old_fb = NULL;
|
| 208 |
+ drm_finish_pending_flip (dev, old_flip, 0);
|
| 209 |
+ } else
|
| 210 |
+ schedule_work(&crtc->async_flip);
|
| 211 |
+ crtc->pending_flip = pending;
|
| 212 |
+
|
| 213 |
+ mutex_unlock(&dev->struct_mutex);
|
| 214 |
+
|
| 215 |
+ return 0;
|
| 216 |
+
|
| 217 |
+out_unlock:
|
| 218 |
+ mutex_unlock(&dev->struct_mutex);
|
| 219 |
+ kfree(pending);
|
| 220 |
+
|
| 221 |
+ return ret;
|
| 222 |
+}
|
| 223 |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
|
| 224 |
index ff447f1..fec66f9 100644
|
| 225 |
--- a/drivers/gpu/drm/drm_crtc_helper.c
|
| 226 |
+++ b/drivers/gpu/drm/drm_crtc_helper.c
|
| 227 |
@@ -872,8 +872,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
|
| 228 |
old_fb = set->crtc->fb;
|
| 229 |
if (set->crtc->fb != set->fb)
|
| 230 |
set->crtc->fb = set->fb;
|
| 231 |
+ mutex_lock(&dev->struct_mutex);
|
| 232 |
ret = crtc_funcs->mode_set_base(set->crtc,
|
| 233 |
set->x, set->y, old_fb);
|
| 234 |
+ mutex_unlock(&dev->struct_mutex);
|
| 235 |
if (ret != 0)
|
| 236 |
goto fail;
|
| 237 |
}
|
| 238 |
@@ -1095,3 +1097,13 @@ int drm_helper_resume_force_mode(struct drm_device *dev)
|
| 239 |
return 0;
|
| 240 |
}
|
| 241 |
EXPORT_SYMBOL(drm_helper_resume_force_mode);
|
| 242 |
+
|
| 243 |
+int
|
| 244 |
+drm_crtc_helper_set_base(struct drm_crtc *crtc, int x, int y,
|
| 245 |
+ struct drm_framebuffer *old_fb)
|
| 246 |
+{
|
| 247 |
+ struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
|
| 248 |
+
|
| 249 |
+ return crtc_funcs->mode_set_base(crtc, x, y, old_fb);
|
| 250 |
+}
|
| 251 |
+EXPORT_SYMBOL(drm_crtc_helper_set_base);
|
| 252 |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
|
| 253 |
index a75ca63..672f473 100644
|
| 254 |
--- a/drivers/gpu/drm/drm_drv.c
|
| 255 |
+++ b/drivers/gpu/drm/drm_drv.c
|
| 256 |
@@ -145,6 +145,7 @@ static struct drm_ioctl_desc drm_ioctls[] = {
|
| 257 |
DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, DRM_MASTER|DRM_CONTROL_ALLOW),
|
| 258 |
DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb, DRM_MASTER|DRM_CONTROL_ALLOW),
|
| 259 |
DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb, DRM_MASTER|DRM_CONTROL_ALLOW),
|
| 260 |
+ DRM_IOCTL_DEF(DRM_IOCTL_MODE_PAGE_FLIP, drm_mode_page_flip_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW),
|
| 261 |
};
|
| 262 |
|
| 263 |
#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )
|
| 264 |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
|
| 265 |
index 251bc0e..dcd9c66 100644
|
| 266 |
--- a/drivers/gpu/drm/drm_fops.c
|
| 267 |
+++ b/drivers/gpu/drm/drm_fops.c
|
| 268 |
@@ -257,6 +257,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
|
| 269 |
|
| 270 |
INIT_LIST_HEAD(&priv->lhead);
|
| 271 |
INIT_LIST_HEAD(&priv->fbs);
|
| 272 |
+ INIT_LIST_HEAD(&priv->event_list);
|
| 273 |
+ init_waitqueue_head(&priv->event_wait);
|
| 274 |
|
| 275 |
if (dev->driver->driver_features & DRIVER_GEM)
|
| 276 |
drm_gem_open(dev, priv);
|
| 277 |
@@ -429,6 +431,9 @@ int drm_release(struct inode *inode, struct file *filp)
|
| 278 |
{
|
| 279 |
struct drm_file *file_priv = filp->private_data;
|
| 280 |
struct drm_device *dev = file_priv->minor->dev;
|
| 281 |
+ struct drm_pending_flip *f, *ft;
|
| 282 |
+ struct drm_pending_event *e, *et;
|
| 283 |
+
|
| 284 |
int retcode = 0;
|
| 285 |
|
| 286 |
lock_kernel();
|
| 287 |
@@ -451,6 +456,19 @@ int drm_release(struct inode *inode, struct file *filp)
|
| 288 |
if (file_priv->minor->master)
|
| 289 |
drm_master_release(dev, filp);
|
| 290 |
|
| 291 |
+ mutex_lock(&dev->struct_mutex);
|
| 292 |
+
|
| 293 |
+ /* Remove pending flips */
|
| 294 |
+ list_for_each_entry_safe(f, ft, &dev->flip_list, link)
|
| 295 |
+ if (f->pending_event.file_priv == file_priv)
|
| 296 |
+ drm_finish_pending_flip(dev, f, 0);
|
| 297 |
+
|
| 298 |
+ /* Remove unconsumed events */
|
| 299 |
+ list_for_each_entry_safe(e, et, &file_priv->event_list, link)
|
| 300 |
+ e->destroy(e);
|
| 301 |
+
|
| 302 |
+ mutex_unlock(&dev->struct_mutex);
|
| 303 |
+
|
| 304 |
if (dev->driver->driver_features & DRIVER_GEM)
|
| 305 |
drm_gem_release(dev, file_priv);
|
| 306 |
|
| 307 |
@@ -544,9 +562,55 @@ int drm_release(struct inode *inode, struct file *filp)
|
| 308 |
}
|
| 309 |
EXPORT_SYMBOL(drm_release);
|
| 310 |
|
| 311 |
-/** No-op. */
|
| 312 |
+ssize_t drm_read(struct file *filp, char __user *buffer,
|
| 313 |
+ size_t count, loff_t *offset)
|
| 314 |
+{
|
| 315 |
+ struct drm_file *file_priv = filp->private_data;
|
| 316 |
+ struct drm_device *dev = file_priv->minor->dev;
|
| 317 |
+ struct drm_pending_event *event;
|
| 318 |
+ ssize_t total, ret;
|
| 319 |
+
|
| 320 |
+ ret = wait_event_interruptible(file_priv->event_wait,
|
| 321 |
+ !list_empty(&file_priv->event_list));
|
| 322 |
+ if (ret < 0)
|
| 323 |
+ return ret;
|
| 324 |
+
|
| 325 |
+ total = 0;
|
| 326 |
+ while (!list_empty(&file_priv->event_list)) {
|
| 327 |
+ mutex_lock(&dev->struct_mutex);
|
| 328 |
+ event = list_first_entry(&file_priv->event_list,
|
| 329 |
+ struct drm_pending_event, link);
|
| 330 |
+ if (total + event->event->length > count) {
|
| 331 |
+ mutex_unlock(&dev->struct_mutex);
|
| 332 |
+ break;
|
| 333 |
+ }
|
| 334 |
+ list_del(&event->link);
|
| 335 |
+ mutex_unlock(&dev->struct_mutex);
|
| 336 |
+
|
| 337 |
+ if (copy_to_user(buffer + total,
|
| 338 |
+ event->event, event->event->length)) {
|
| 339 |
+ total = -EFAULT;
|
| 340 |
+ break;
|
| 341 |
+ }
|
| 342 |
+
|
| 343 |
+ total += event->event->length;
|
| 344 |
+ event->destroy(event);
|
| 345 |
+ }
|
| 346 |
+
|
| 347 |
+ return total;
|
| 348 |
+}
|
| 349 |
+EXPORT_SYMBOL(drm_read);
|
| 350 |
+
|
| 351 |
unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait)
|
| 352 |
{
|
| 353 |
- return 0;
|
| 354 |
+ struct drm_file *file_priv = filp->private_data;
|
| 355 |
+ unsigned int mask = 0;
|
| 356 |
+
|
| 357 |
+ poll_wait(filp, &file_priv->event_wait, wait);
|
| 358 |
+
|
| 359 |
+ if (!list_empty(&file_priv->event_list))
|
| 360 |
+ mask |= POLLIN | POLLRDNORM;
|
| 361 |
+
|
| 362 |
+ return mask;
|
| 363 |
}
|
| 364 |
EXPORT_SYMBOL(drm_poll);
|
| 365 |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
|
| 366 |
index f85aaf2..102d19d 100644
|
| 367 |
--- a/drivers/gpu/drm/drm_irq.c
|
| 368 |
+++ b/drivers/gpu/drm/drm_irq.c
|
| 369 |
@@ -34,6 +34,7 @@
|
| 370 |
*/
|
| 371 |
|
| 372 |
#include "drmP.h"
|
| 373 |
+#include "drm_crtc_helper.h"
|
| 374 |
|
| 375 |
#include <linux/interrupt.h> /* For task queue support */
|
| 376 |
|
| 377 |
@@ -71,6 +72,44 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
|
| 378 |
return 0;
|
| 379 |
}
|
| 380 |
|
| 381 |
+#define vblank_passed(a,b) ((long)(a - b) > 0)
|
| 382 |
+
|
| 383 |
+void drm_finish_pending_flip(struct drm_device *dev,
|
| 384 |
+ struct drm_pending_flip *f, u32 frame)
|
| 385 |
+{
|
| 386 |
+ struct timeval now;
|
| 387 |
+
|
| 388 |
+ f->event.frame = frame;
|
| 389 |
+ do_gettimeofday(&now);
|
| 390 |
+ f->event.tv_sec = now.tv_sec;
|
| 391 |
+ f->event.tv_usec = now.tv_usec;
|
| 392 |
+ drm_vblank_put(dev, f->pipe);
|
| 393 |
+ list_del_init(&f->link);
|
| 394 |
+ list_add_tail(&f->pending_event.link,
|
| 395 |
+ &f->pending_event.file_priv->event_list);
|
| 396 |
+ if (f->old_fb)
|
| 397 |
+ f->old_fb->funcs->unpin(f->old_fb);
|
| 398 |
+ wake_up_interruptible(&f->pending_event.file_priv->event_wait);
|
| 399 |
+}
|
| 400 |
+
|
| 401 |
+static void drm_flip_work_func(struct work_struct *work)
|
| 402 |
+{
|
| 403 |
+ struct drm_device *dev =
|
| 404 |
+ container_of(work, struct drm_device, flip_work);
|
| 405 |
+ struct drm_pending_flip *f, *t;
|
| 406 |
+ u32 frame;
|
| 407 |
+
|
| 408 |
+ mutex_lock(&dev->struct_mutex);
|
| 409 |
+
|
| 410 |
+ list_for_each_entry_safe(f, t, &dev->flip_list, link) {
|
| 411 |
+ frame = drm_vblank_count(dev, f->pipe);
|
| 412 |
+ if (vblank_passed(frame, f->frame))
|
| 413 |
+ drm_finish_pending_flip(dev, f, frame);
|
| 414 |
+ }
|
| 415 |
+
|
| 416 |
+ mutex_unlock(&dev->struct_mutex);
|
| 417 |
+}
|
| 418 |
+
|
| 419 |
static void vblank_disable_fn(unsigned long arg)
|
| 420 |
{
|
| 421 |
struct drm_device *dev = (struct drm_device *)arg;
|
| 422 |
@@ -161,6 +200,8 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs)
|
| 423 |
atomic_set(&dev->vblank_refcount[i], 0);
|
| 424 |
}
|
| 425 |
|
| 426 |
+ INIT_WORK(&dev->flip_work, drm_flip_work_func);
|
| 427 |
+
|
| 428 |
dev->vblank_disable_allowed = 0;
|
| 429 |
|
| 430 |
return 0;
|
| 431 |
@@ -626,5 +667,7 @@ void drm_handle_vblank(struct drm_device *dev, int crtc)
|
| 432 |
{
|
| 433 |
atomic_inc(&dev->_vblank_count[crtc]);
|
| 434 |
DRM_WAKEUP(&dev->vbl_queue[crtc]);
|
| 435 |
+ schedule_work(&dev->flip_work);
|
| 436 |
}
|
| 437 |
EXPORT_SYMBOL(drm_handle_vblank);
|
| 438 |
+
|
| 439 |
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
|
| 440 |
index 55bb8a8..65c8662 100644
|
| 441 |
--- a/drivers/gpu/drm/drm_stub.c
|
| 442 |
+++ b/drivers/gpu/drm/drm_stub.c
|
| 443 |
@@ -220,6 +220,7 @@ static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev,
|
| 444 |
INIT_LIST_HEAD(&dev->ctxlist);
|
| 445 |
INIT_LIST_HEAD(&dev->vmalist);
|
| 446 |
INIT_LIST_HEAD(&dev->maplist);
|
| 447 |
+ INIT_LIST_HEAD(&dev->flip_list);
|
| 448 |
|
| 449 |
spin_lock_init(&dev->count_lock);
|
| 450 |
spin_lock_init(&dev->drw_lock);
|
| 451 |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
|
| 452 |
index dbe568c..b81305e 100644
|
| 453 |
--- a/drivers/gpu/drm/i915/i915_drv.c
|
| 454 |
+++ b/drivers/gpu/drm/i915/i915_drv.c
|
| 455 |
@@ -206,6 +206,7 @@ static struct drm_driver driver = {
|
| 456 |
.mmap = drm_gem_mmap,
|
| 457 |
.poll = drm_poll,
|
| 458 |
.fasync = drm_fasync,
|
| 459 |
+ .read = drm_read,
|
| 460 |
#ifdef CONFIG_COMPAT
|
| 461 |
.compat_ioctl = i915_compat_ioctl,
|
| 462 |
#endif
|
| 463 |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
|
| 464 |
index 155719f..0d6e677 100644
|
| 465 |
--- a/drivers/gpu/drm/i915/intel_display.c
|
| 466 |
+++ b/drivers/gpu/drm/i915/intel_display.c
|
| 467 |
@@ -973,6 +973,8 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
|
| 468 |
u32 dspcntr, alignment;
|
| 469 |
int ret;
|
| 470 |
|
| 471 |
+ BUG_ON(!mutex_is_locked(&dev->struct_mutex));
|
| 472 |
+
|
| 473 |
/* no fb bound */
|
| 474 |
if (!crtc->fb) {
|
| 475 |
DRM_DEBUG("No FB bound\n");
|
| 476 |
@@ -1008,17 +1010,14 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
|
| 477 |
BUG();
|
| 478 |
}
|
| 479 |
|
| 480 |
- mutex_lock(&dev->struct_mutex);
|
| 481 |
ret = i915_gem_object_pin(obj, alignment);
|
| 482 |
if (ret != 0) {
|
| 483 |
- mutex_unlock(&dev->struct_mutex);
|
| 484 |
return ret;
|
| 485 |
}
|
| 486 |
|
| 487 |
ret = i915_gem_object_set_to_gtt_domain(obj, 1);
|
| 488 |
if (ret != 0) {
|
| 489 |
i915_gem_object_unpin(obj);
|
| 490 |
- mutex_unlock(&dev->struct_mutex);
|
| 491 |
return ret;
|
| 492 |
}
|
| 493 |
|
| 494 |
@@ -1029,7 +1028,6 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
|
| 495 |
ret = i915_gem_object_get_fence_reg(obj);
|
| 496 |
if (ret != 0) {
|
| 497 |
i915_gem_object_unpin(obj);
|
| 498 |
- mutex_unlock(&dev->struct_mutex);
|
| 499 |
return ret;
|
| 500 |
}
|
| 501 |
}
|
| 502 |
@@ -1054,7 +1052,6 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
|
| 503 |
default:
|
| 504 |
DRM_ERROR("Unknown color depth\n");
|
| 505 |
i915_gem_object_unpin(obj);
|
| 506 |
- mutex_unlock(&dev->struct_mutex);
|
| 507 |
return -EINVAL;
|
| 508 |
}
|
| 509 |
if (IS_I965G(dev)) {
|
| 510 |
@@ -1086,17 +1083,14 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
|
| 511 |
I915_READ(dspbase);
|
| 512 |
}
|
| 513 |
|
| 514 |
- intel_wait_for_vblank(dev);
|
| 515 |
-
|
| 516 |
if (old_fb) {
|
| 517 |
intel_fb = to_intel_framebuffer(old_fb);
|
| 518 |
obj_priv = intel_fb->obj->driver_private;
|
| 519 |
+ intel_wait_for_vblank(dev);
|
| 520 |
i915_gem_object_unpin(intel_fb->obj);
|
| 521 |
}
|
| 522 |
intel_increase_pllclock(crtc, true);
|
| 523 |
|
| 524 |
- mutex_unlock(&dev->struct_mutex);
|
| 525 |
-
|
| 526 |
if (!dev->primary->master)
|
| 527 |
return 0;
|
| 528 |
|
| 529 |
@@ -2732,7 +2726,9 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
|
| 530 |
I915_WRITE(dspcntr_reg, dspcntr);
|
| 531 |
|
| 532 |
/* Flush the plane changes */
|
| 533 |
+ mutex_lock(&dev->struct_mutex);
|
| 534 |
ret = intel_pipe_set_base(crtc, x, y, old_fb);
|
| 535 |
+ mutex_unlock(&dev->struct_mutex);
|
| 536 |
|
| 537 |
intel_update_watermarks(dev);
|
| 538 |
|
| 539 |
@@ -3521,6 +3517,7 @@ static const struct drm_crtc_funcs intel_crtc_funcs = {
|
| 540 |
.gamma_set = intel_crtc_gamma_set,
|
| 541 |
.set_config = drm_crtc_helper_set_config,
|
| 542 |
.destroy = intel_crtc_destroy,
|
| 543 |
+ .set_base = drm_crtc_helper_set_base,
|
| 544 |
};
|
| 545 |
|
| 546 |
|
| 547 |
@@ -3533,7 +3530,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
|
| 548 |
if (intel_crtc == NULL)
|
| 549 |
return;
|
| 550 |
|
| 551 |
- drm_crtc_init(dev, &intel_crtc->base, &intel_crtc_funcs);
|
| 552 |
+ drm_crtc_init(dev, &intel_crtc->base, pipe, &intel_crtc_funcs);
|
| 553 |
|
| 554 |
drm_mode_crtc_set_gamma_size(&intel_crtc->base, 256);
|
| 555 |
intel_crtc->pipe = pipe;
|
| 556 |
@@ -3717,9 +3714,18 @@ static int intel_user_framebuffer_create_handle(struct drm_framebuffer *fb,
|
| 557 |
return drm_gem_handle_create(file_priv, object, handle);
|
| 558 |
}
|
| 559 |
|
| 560 |
+static void intel_user_framebuffer_unpin(struct drm_framebuffer *fb)
|
| 561 |
+{
|
| 562 |
+ struct intel_framebuffer *intel_fb;
|
| 563 |
+
|
| 564 |
+ intel_fb = to_intel_framebuffer(fb);
|
| 565 |
+ i915_gem_object_unpin(intel_fb->obj);
|
| 566 |
+}
|
| 567 |
+
|
| 568 |
static const struct drm_framebuffer_funcs intel_fb_funcs = {
|
| 569 |
.destroy = intel_user_framebuffer_destroy,
|
| 570 |
.create_handle = intel_user_framebuffer_create_handle,
|
| 571 |
+ .unpin = intel_user_framebuffer_unpin
|
| 572 |
};
|
| 573 |
|
| 574 |
int intel_framebuffer_create(struct drm_device *dev,
|
| 575 |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
|
| 576 |
index f5739e2..0ec45bc 100644
|
| 577 |
--- a/drivers/gpu/drm/radeon/radeon_display.c
|
| 578 |
+++ b/drivers/gpu/drm/radeon/radeon_display.c
|
| 579 |
@@ -168,6 +168,7 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = {
|
| 580 |
.gamma_set = radeon_crtc_gamma_set,
|
| 581 |
.set_config = drm_crtc_helper_set_config,
|
| 582 |
.destroy = radeon_crtc_destroy,
|
| 583 |
+ .set_base = drm_crtc_helper_set_base,
|
| 584 |
};
|
| 585 |
|
| 586 |
static void radeon_crtc_init(struct drm_device *dev, int index)
|
| 587 |
@@ -180,7 +181,7 @@ static void radeon_crtc_init(struct drm_device *dev, int index)
|
| 588 |
if (radeon_crtc == NULL)
|
| 589 |
return;
|
| 590 |
|
| 591 |
- drm_crtc_init(dev, &radeon_crtc->base, &radeon_crtc_funcs);
|
| 592 |
+ drm_crtc_init(dev, &radeon_crtc->base, index, &radeon_crtc_funcs);
|
| 593 |
|
| 594 |
drm_mode_crtc_set_gamma_size(&radeon_crtc->base, 256);
|
| 595 |
radeon_crtc->crtc_id = index;
|
| 596 |
diff --git a/include/drm/drm.h b/include/drm/drm.h
|
| 597 |
index 7cb50bd..1920323 100644
|
| 598 |
--- a/include/drm/drm.h
|
| 599 |
+++ b/include/drm/drm.h
|
| 600 |
@@ -686,6 +686,7 @@ struct drm_gem_open {
|
| 601 |
#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd)
|
| 602 |
#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd)
|
| 603 |
#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int)
|
| 604 |
+#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOW( 0xB0, struct drm_mode_page_flip)
|
| 605 |
|
| 606 |
/**
|
| 607 |
* Device specific ioctls should only be in their respective headers
|
| 608 |
@@ -698,6 +699,30 @@ struct drm_gem_open {
|
| 609 |
#define DRM_COMMAND_BASE 0x40
|
| 610 |
#define DRM_COMMAND_END 0xA0
|
| 611 |
|
| 612 |
+/**
|
| 613 |
+ * Header for events written back to userspace on the drm fd. The
|
| 614 |
+ * type defines the type of event, the length specifies the total
|
| 615 |
+ * length of the event (including the header), and user_data is
|
| 616 |
+ * typically a 64 bit value passed with the ioctl that triggered the
|
| 617 |
+ * event. A read on the drm fd will always only return complete
|
| 618 |
+ * events, that is, if for example the read buffer is 100 bytes, and
|
| 619 |
+ * there are two 64 byte events pending, only one will be returned.
|
| 620 |
+ */
|
| 621 |
+struct drm_event {
|
| 622 |
+ __u32 type;
|
| 623 |
+ __u32 length;
|
| 624 |
+};
|
| 625 |
+
|
| 626 |
+#define DRM_EVENT_MODE_PAGE_FLIP 0x01
|
| 627 |
+
|
| 628 |
+struct drm_event_page_flip {
|
| 629 |
+ struct drm_event base;
|
| 630 |
+ __u64 user_data;
|
| 631 |
+ __u32 tv_sec;
|
| 632 |
+ __u32 tv_usec;
|
| 633 |
+ __u32 frame;
|
| 634 |
+};
|
| 635 |
+
|
| 636 |
/* typedef area */
|
| 637 |
#ifndef __KERNEL__
|
| 638 |
typedef struct drm_clip_rect drm_clip_rect_t;
|
| 639 |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
|
| 640 |
index eeefb63..5431888 100644
|
| 641 |
--- a/include/drm/drmP.h
|
| 642 |
+++ b/include/drm/drmP.h
|
| 643 |
@@ -426,6 +426,14 @@ struct drm_buf_entry {
|
| 644 |
struct drm_freelist freelist;
|
| 645 |
};
|
| 646 |
|
| 647 |
+/* Event queued up for userspace to read */
|
| 648 |
+struct drm_pending_event {
|
| 649 |
+ struct drm_event *event;
|
| 650 |
+ struct list_head link;
|
| 651 |
+ struct drm_file *file_priv;
|
| 652 |
+ void (*destroy) (struct drm_pending_event *event);
|
| 653 |
+};
|
| 654 |
+
|
| 655 |
/** File private data */
|
| 656 |
struct drm_file {
|
| 657 |
int authenticated;
|
| 658 |
@@ -449,6 +457,9 @@ struct drm_file {
|
| 659 |
struct drm_master *master; /* master this node is currently associated with
|
| 660 |
N.B. not always minor->master */
|
| 661 |
struct list_head fbs;
|
| 662 |
+
|
| 663 |
+ wait_queue_head_t event_wait;
|
| 664 |
+ struct list_head event_list;
|
| 665 |
};
|
| 666 |
|
| 667 |
/** Wait queue */
|
| 668 |
@@ -897,6 +908,16 @@ struct drm_minor {
|
| 669 |
struct drm_mode_group mode_group;
|
| 670 |
};
|
| 671 |
|
| 672 |
+struct drm_pending_flip {
|
| 673 |
+ struct drm_pending_event pending_event;
|
| 674 |
+ struct drm_framebuffer *old_fb;
|
| 675 |
+ struct drm_crtc *crtc;
|
| 676 |
+ u32 frame;
|
| 677 |
+ int pipe;
|
| 678 |
+ struct list_head link;
|
| 679 |
+ struct drm_event_page_flip event;
|
| 680 |
+};
|
| 681 |
+
|
| 682 |
/**
|
| 683 |
* DRM device structure. This structure represent a complete card that
|
| 684 |
* may contain multiple heads.
|
| 685 |
@@ -996,6 +1017,13 @@ struct drm_device {
|
| 686 |
|
| 687 |
u32 max_vblank_count; /**< size of vblank counter register */
|
| 688 |
|
| 689 |
+ struct work_struct flip_work;
|
| 690 |
+
|
| 691 |
+ /**
|
| 692 |
+ * List of objects waiting on flip completion
|
| 693 |
+ */
|
| 694 |
+ struct list_head flip_list;
|
| 695 |
+
|
| 696 |
/*@} */
|
| 697 |
cycles_t ctx_start;
|
| 698 |
cycles_t lck_start;
|
| 699 |
@@ -1132,6 +1160,8 @@ extern int drm_lastclose(struct drm_device *dev);
|
| 700 |
extern int drm_open(struct inode *inode, struct file *filp);
|
| 701 |
extern int drm_stub_open(struct inode *inode, struct file *filp);
|
| 702 |
extern int drm_fasync(int fd, struct file *filp, int on);
|
| 703 |
+extern ssize_t drm_read(struct file *filp, char __user *buffer,
|
| 704 |
+ size_t count, loff_t *offset);
|
| 705 |
extern int drm_release(struct inode *inode, struct file *filp);
|
| 706 |
|
| 707 |
/* Mapping support (drm_vm.h) */
|
| 708 |
@@ -1298,6 +1328,8 @@ extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
|
| 709 |
extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc);
|
| 710 |
extern int drm_modeset_ctl(struct drm_device *dev, void *data,
|
| 711 |
struct drm_file *file_priv);
|
| 712 |
+extern void drm_finish_pending_flip(struct drm_device *dev,
|
| 713 |
+ struct drm_pending_flip *f, u32 frame);
|
| 714 |
|
| 715 |
/* AGP/GART support (drm_agpsupport.h) */
|
| 716 |
extern struct drm_agp_head *drm_agp_init(struct drm_device *dev);
|
| 717 |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
|
| 718 |
index ae1e9e1..525f770 100644
|
| 719 |
--- a/include/drm/drm_crtc.h
|
| 720 |
+++ b/include/drm/drm_crtc.h
|
| 721 |
@@ -238,6 +238,12 @@ struct drm_display_info {
|
| 722 |
};
|
| 723 |
|
| 724 |
struct drm_framebuffer_funcs {
|
| 725 |
+ /*
|
| 726 |
+ * Unpin the old fb after setting a mode. Must be called
|
| 727 |
+ * after the old framebuffer is no longer visible, ie, after
|
| 728 |
+ * the next vblank, typically.
|
| 729 |
+ */
|
| 730 |
+ void (*unpin)(struct drm_framebuffer *fb);
|
| 731 |
void (*destroy)(struct drm_framebuffer *framebuffer);
|
| 732 |
int (*create_handle)(struct drm_framebuffer *fb,
|
| 733 |
struct drm_file *file_priv,
|
| 734 |
@@ -290,6 +296,7 @@ struct drm_property {
|
| 735 |
struct drm_crtc;
|
| 736 |
struct drm_connector;
|
| 737 |
struct drm_encoder;
|
| 738 |
+struct drm_pending_flip;
|
| 739 |
|
| 740 |
/**
|
| 741 |
* drm_crtc_funcs - control CRTCs for a given device
|
| 742 |
@@ -333,17 +340,29 @@ struct drm_crtc_funcs {
|
| 743 |
void (*destroy)(struct drm_crtc *crtc);
|
| 744 |
|
| 745 |
int (*set_config)(struct drm_mode_set *set);
|
| 746 |
+
|
| 747 |
+ /*
|
| 748 |
+ * Move the crtc on the current fb to the given position.
|
| 749 |
+ * This function is optional. If old_fb is provided, the
|
| 750 |
+ * function will wait for vblank and unpin it. If old_fb is
|
| 751 |
+ * NULL, nothing is unpinned and the caller must call
|
| 752 |
+ * mode_unpin_fb to release the old framebuffer.
|
| 753 |
+ */
|
| 754 |
+ int (*set_base)(struct drm_crtc *crtc, int x, int y,
|
| 755 |
+ struct drm_framebuffer *old_fb);
|
| 756 |
};
|
| 757 |
|
| 758 |
/**
|
| 759 |
* drm_crtc - central CRTC control structure
|
| 760 |
* @enabled: is this CRTC enabled?
|
| 761 |
+ * @pipe: pipe number (as seen by DRM vblank functions)
|
| 762 |
* @x: x position on screen
|
| 763 |
* @y: y position on screen
|
| 764 |
* @desired_mode: new desired mode
|
| 765 |
* @desired_x: desired x for desired_mode
|
| 766 |
* @desired_y: desired y for desired_mode
|
| 767 |
* @funcs: CRTC control functions
|
| 768 |
+ * @async_work: work queue for async set base calls
|
| 769 |
*
|
| 770 |
* Each CRTC may have one or more connectors associated with it. This structure
|
| 771 |
* allows the CRTC to be controlled.
|
| 772 |
@@ -361,6 +380,7 @@ struct drm_crtc {
|
| 773 |
|
| 774 |
struct drm_display_mode mode;
|
| 775 |
|
| 776 |
+ int pipe;
|
| 777 |
int x, y;
|
| 778 |
struct drm_display_mode *desired_mode;
|
| 779 |
int desired_x, desired_y;
|
| 780 |
@@ -370,6 +390,10 @@ struct drm_crtc {
|
| 781 |
uint32_t gamma_size;
|
| 782 |
uint16_t *gamma_store;
|
| 783 |
|
| 784 |
+ /* Allow async set_pipe_base calls for flipping */
|
| 785 |
+ struct work_struct async_flip;
|
| 786 |
+ struct drm_pending_flip *pending_flip;
|
| 787 |
+
|
| 788 |
/* if you are using the helper */
|
| 789 |
void *helper_private;
|
| 790 |
};
|
| 791 |
@@ -597,6 +621,7 @@ struct drm_mode_config {
|
| 792 |
|
| 793 |
extern void drm_crtc_init(struct drm_device *dev,
|
| 794 |
struct drm_crtc *crtc,
|
| 795 |
+ int pipe,
|
| 796 |
const struct drm_crtc_funcs *funcs);
|
| 797 |
extern void drm_crtc_cleanup(struct drm_crtc *crtc);
|
| 798 |
|
| 799 |
@@ -744,6 +769,8 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
|
| 800 |
extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
|
| 801 |
void *data, struct drm_file *file_priv);
|
| 802 |
extern bool drm_detect_hdmi_monitor(struct edid *edid);
|
| 803 |
+extern int drm_mode_page_flip_ioctl(struct drm_device *dev, void *data,
|
| 804 |
+ struct drm_file *file_priv);
|
| 805 |
extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
|
| 806 |
int hdisplay, int vdisplay, int vrefresh,
|
| 807 |
bool reduced, bool interlaced);
|
| 808 |
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
|
| 809 |
index 4c8daca..b5bd0b8 100644
|
| 810 |
--- a/include/drm/drm_crtc_helper.h
|
| 811 |
+++ b/include/drm/drm_crtc_helper.h
|
| 812 |
@@ -126,4 +126,8 @@ static inline void drm_connector_helper_add(struct drm_connector *connector,
|
| 813 |
}
|
| 814 |
|
| 815 |
extern int drm_helper_resume_force_mode(struct drm_device *dev);
|
| 816 |
+
|
| 817 |
+extern int drm_crtc_helper_set_base(struct drm_crtc *crtc, int x, int y,
|
| 818 |
+ struct drm_framebuffer *old_fb);
|
| 819 |
+
|
| 820 |
#endif
|
| 821 |
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
|
| 822 |
index 1f90841..6f08a77 100644
|
| 823 |
--- a/include/drm/drm_mode.h
|
| 824 |
+++ b/include/drm/drm_mode.h
|
| 825 |
@@ -268,4 +268,20 @@ struct drm_mode_crtc_lut {
|
| 826 |
__u64 blue;
|
| 827 |
};
|
| 828 |
|
| 829 |
+#define DRM_MODE_PAGE_FLIP_WAIT (1<<0) /* block on previous page flip */
|
| 830 |
+#define DRM_MODE_PAGE_FLIP_FLAGS_MASK (DRM_MODE_PAGE_FLIP_WAIT)
|
| 831 |
+
|
| 832 |
+struct drm_mode_page_flip {
|
| 833 |
+ /** Handle of new front buffer */
|
| 834 |
+ __u32 fb_id;
|
| 835 |
+ __u32 crtc_id;
|
| 836 |
+
|
| 837 |
+ /* 64 bit cookie returned to userspace in the page flip event. */
|
| 838 |
+ __u64 user_data;
|
| 839 |
+ /**
|
| 840 |
+ * page flip flags (wait on flip only for now)
|
| 841 |
+ */
|
| 842 |
+ __u32 flags;
|
| 843 |
+};
|
| 844 |
+
|
| 845 |
#endif
|
| 846 |
diff -up linux-2.6.30.noarch/drivers/gpu/drm/nouveau/nv04_crtc.c.da linux-2.6.30.noarch/drivers/gpu/drm/nouveau/nv04_crtc.c
|
| 847 |
--- linux-2.6.30.noarch/drivers/gpu/drm/nouveau/nv04_crtc.c.da 2009-09-08 16:07:49.000000000 +1000
|
| 848 |
+++ linux-2.6.30.noarch/drivers/gpu/drm/nouveau/nv04_crtc.c 2009-09-08 16:08:09.000000000 +1000
|
| 849 |
@@ -993,7 +993,7 @@ nv04_crtc_create(struct drm_device *dev,
|
| 850 |
nv_crtc->index = crtc_num;
|
| 851 |
nv_crtc->last_dpms = NV_DPMS_CLEARED;
|
| 852 |
|
| 853 |
- drm_crtc_init(dev, &nv_crtc->base, &nv04_crtc_funcs);
|
| 854 |
+ drm_crtc_init(dev, &nv_crtc->base, crtc_num, &nv04_crtc_funcs);
|
| 855 |
drm_crtc_helper_add(&nv_crtc->base, &nv04_crtc_helper_funcs);
|
| 856 |
drm_mode_crtc_set_gamma_size(&nv_crtc->base, 256);
|
| 857 |
|
| 858 |
diff -up linux-2.6.30.noarch/drivers/gpu/drm/nouveau/nv50_crtc.c.da linux-2.6.30.noarch/drivers/gpu/drm/nouveau/nv50_crtc.c
|
| 859 |
--- linux-2.6.30.noarch/drivers/gpu/drm/nouveau/nv50_crtc.c.da 2009-09-08 16:07:49.000000000 +1000
|
| 860 |
+++ linux-2.6.30.noarch/drivers/gpu/drm/nouveau/nv50_crtc.c 2009-09-08 16:08:09.000000000 +1000
|
| 861 |
@@ -777,7 +777,7 @@ nv50_crtc_create(struct drm_device *dev,
|
| 862 |
crtc->set_dither = nv50_crtc_set_dither;
|
| 863 |
crtc->set_scale = nv50_crtc_set_scale;
|
| 864 |
|
| 865 |
- drm_crtc_init(dev, &crtc->base, &nv50_crtc_funcs);
|
| 866 |
+ drm_crtc_init(dev, &crtc->base, index, &nv50_crtc_funcs);
|
| 867 |
drm_crtc_helper_add(&crtc->base, &nv50_crtc_helper_funcs);
|
| 868 |
drm_mode_crtc_set_gamma_size(&crtc->base, 256);
|
| 869 |
|