Merge branch 'drm-intel-next' of git://anongit.freedesktop.org/drm-intel into drm...
[cascardo/linux.git] / include / drm / drmP.h
index 3c8422c..c5d2950 100644 (file)
@@ -52,6 +52,7 @@
 #include <linux/poll.h>
 #include <linux/ratelimit.h>
 #include <linux/sched.h>
+#include <linux/seqlock.h>
 #include <linux/slab.h>
 #include <linux/types.h>
 #include <linux/vmalloc.h>
@@ -90,7 +91,7 @@ struct reservation_object;
 struct dma_buf_attachment;
 
 /*
- * 4 debug categories are defined:
+ * The following categories are defined:
  *
  * CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, drm_memory.c, ...
  *      This is the category used by the DRM_DEBUG() macro.
@@ -392,11 +393,6 @@ struct drm_master {
        void *driver_priv;
 };
 
-/* Size of ringbuffer for vblank timestamps. Just double-buffer
- * in initial implementation.
- */
-#define DRM_VBLANKTIME_RBSIZE 2
-
 /* Flags and return codes for get_vblank_timestamp() driver function. */
 #define DRM_CALLED_FROM_VBLIRQ 1
 #define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0)
@@ -580,12 +576,21 @@ struct drm_driver {
        void (*debugfs_cleanup)(struct drm_minor *minor);
 
        /**
-        * Driver-specific constructor for drm_gem_objects, to set up
-        * obj->driver_private.
+        * @gem_free_object: deconstructor for drm_gem_objects
         *
-        * Returns 0 on success.
+        * This is deprecated and should not be used by new drivers. Use
+        * @gem_free_object_unlocked instead.
         */
        void (*gem_free_object) (struct drm_gem_object *obj);
+
+       /**
+        * @gem_free_object_unlocked: deconstructor for drm_gem_objects
+        *
+        * This is for drivers which are not encumbered with dev->struct_mutex
+        * legacy locking schemes. Use this hook instead of @gem_free_object.
+        */
+       void (*gem_free_object_unlocked) (struct drm_gem_object *obj);
+
        int (*gem_open_object) (struct drm_gem_object *, struct drm_file *);
        void (*gem_close_object) (struct drm_gem_object *, struct drm_file *);
 
@@ -716,10 +721,10 @@ struct drm_vblank_crtc {
        wait_queue_head_t queue;        /**< VBLANK wait queue */
        struct timer_list disable_timer;                /* delayed disable timer */
 
-       /* vblank counter, protected by dev->vblank_time_lock for writes */
-       u32 count;
-       /* vblank timestamps, protected by dev->vblank_time_lock for writes */
-       struct timeval time[DRM_VBLANKTIME_RBSIZE];
+       seqlock_t seqlock;              /* protects vblank count and time */
+
+       u32 count;                      /* vblank counter */
+       struct timeval time;            /* vblank timestamp */
 
        atomic_t refcount;              /* number of users of vblank interruptsper crtc */
        u32 last;                       /* protected by dev->vbl_lock, used */
@@ -769,6 +774,7 @@ struct drm_device {
        atomic_t buf_alloc;             /**< Buffer allocation in progress */
        /*@} */
 
+       struct mutex filelist_mutex;
        struct list_head filelist;
 
        /** \name Memory management */
@@ -804,14 +810,6 @@ struct drm_device {
        bool irq_enabled;
        int irq;
 
-       /*
-        * At load time, disabling the vblank interrupt won't be allowed since
-        * old clients may not call the modeset ioctl and therefore misbehave.
-        * Once the modeset ioctl *has* been called though, we can safely
-        * disable them when unused.
-        */
-       bool vblank_disable_allowed;
-
        /*
         * If true, vblank interrupt will be disabled immediately when the
         * refcount drops to zero, as opposed to via the vblank disable
@@ -992,6 +990,7 @@ extern void drm_crtc_vblank_off(struct drm_crtc *crtc);
 extern void drm_crtc_vblank_reset(struct drm_crtc *crtc);
 extern void drm_crtc_vblank_on(struct drm_crtc *crtc);
 extern void drm_vblank_cleanup(struct drm_device *dev);
+extern u32 drm_accurate_vblank_count(struct drm_crtc *crtc);
 extern u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe);
 
 extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,