diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/drm/drmP.h | 35 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 30 | ||||
-rw-r--r-- | include/drm/drm_fb_helper.h | 14 | ||||
-rw-r--r-- | include/drm/drm_mm.h | 12 | ||||
-rw-r--r-- | include/drm/drm_plane_helper.h | 5 | ||||
-rw-r--r-- | include/drm/drm_vma_manager.h | 2 | ||||
-rw-r--r-- | include/linux/fence-array.h | 10 | ||||
-rw-r--r-- | include/linux/fence.h | 4 | ||||
-rw-r--r-- | include/linux/sync_file.h | 20 |
9 files changed, 105 insertions, 27 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index d3778652e462..f8e87fde611b 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -146,6 +146,7 @@ void drm_err(const char *format, ...); /* driver capabilities and requirements mask */ #define DRIVER_USE_AGP 0x1 +#define DRIVER_LEGACY 0x2 #define DRIVER_PCI_DMA 0x8 #define DRIVER_SG 0x10 #define DRIVER_HAVE_DMA 0x20 @@ -231,6 +232,36 @@ void drm_err(const char *format, ...); drm_ut_debug_printk(__func__, fmt, ##args); \ } while (0) +#define _DRM_DEFINE_DEBUG_RATELIMITED(level, fmt, args...) \ + do { \ + if (unlikely(drm_debug & DRM_UT_ ## level)) { \ + static DEFINE_RATELIMIT_STATE( \ + _rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + \ + if (__ratelimit(&_rs)) { \ + drm_ut_debug_printk(__func__, fmt, \ + ##args); \ + } \ + } \ + } while (0) + +/** + * Rate limited debug output. Like DRM_DEBUG() but won't flood the log. + * + * \param fmt printf() like format string. + * \param arg arguments + */ +#define DRM_DEBUG_RATELIMITED(fmt, args...) \ + _DRM_DEFINE_DEBUG_RATELIMITED(CORE, fmt, ##args) +#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...) \ + _DRM_DEFINE_DEBUG_RATELIMITED(DRIVER, fmt, ##args) +#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...) \ + _DRM_DEFINE_DEBUG_RATELIMITED(KMS, fmt, ##args) +#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \ + _DRM_DEFINE_DEBUG_RATELIMITED(PRIME, fmt, ##args) + /*@}*/ /***********************************************************************/ @@ -642,7 +673,7 @@ struct drm_driver { }; enum drm_minor_type { - DRM_MINOR_LEGACY, + DRM_MINOR_PRIMARY, DRM_MINOR_CONTROL, DRM_MINOR_RENDER, DRM_MINOR_CNT, @@ -856,7 +887,7 @@ static inline bool drm_is_control_client(const struct drm_file *file_priv) static inline bool drm_is_primary_client(const struct drm_file *file_priv) { - return file_priv->minor->type == DRM_MINOR_LEGACY; + return file_priv->minor->type == DRM_MINOR_PRIMARY; } /******************************************************************/ diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 44e070800b6d..b618b506b04d 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -35,6 +35,7 @@ #include <uapi/drm/drm_mode.h> #include <uapi/drm/drm_fourcc.h> #include <drm/drm_modeset_lock.h> +#include <drm/drm_rect.h> struct drm_device; struct drm_mode_set; @@ -83,14 +84,15 @@ static inline uint64_t I642U64(int64_t val) * specified amount in degrees in counter clockwise direction. DRM_REFLECT_X and * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation */ -#define DRM_ROTATE_MASK 0x0f -#define DRM_ROTATE_0 0 -#define DRM_ROTATE_90 1 -#define DRM_ROTATE_180 2 -#define DRM_ROTATE_270 3 -#define DRM_REFLECT_MASK (~DRM_ROTATE_MASK) -#define DRM_REFLECT_X 4 -#define DRM_REFLECT_Y 5 +#define DRM_ROTATE_0 BIT(0) +#define DRM_ROTATE_90 BIT(1) +#define DRM_ROTATE_180 BIT(2) +#define DRM_ROTATE_270 BIT(3) +#define DRM_ROTATE_MASK (DRM_ROTATE_0 | DRM_ROTATE_90 | \ + DRM_ROTATE_180 | DRM_ROTATE_270) +#define DRM_REFLECT_X BIT(4) +#define DRM_REFLECT_Y BIT(5) +#define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y) enum drm_connector_force { DRM_FORCE_UNSPECIFIED, @@ -1414,6 +1416,9 @@ struct drm_connector { * @zpos: priority of the given plane on crtc (optional) * @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1 * where N is the number of active planes for given crtc + * @src: clipped source coordinates of the plane (in 16.16) + * @dst: clipped destination coordinates of the plane + * @visible: visibility of the plane * @state: backpointer to global drm_atomic_state */ struct drm_plane_state { @@ -1438,6 +1443,15 @@ struct drm_plane_state { unsigned int zpos; unsigned int normalized_zpos; + /* Clipped coordinates */ + struct drm_rect src, dst; + + /* + * Is the plane actually visible? Can be false even + * if fb!=NULL and crtc!=NULL, due to clipping. + */ + bool visible; + struct drm_atomic_state *state; }; diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index db8d4780eaa2..130c324f1aee 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h @@ -32,6 +32,7 @@ struct drm_fb_helper; +#include <drm/drm_crtc.h> #include <linux/kgdb.h> enum mode_set_atomic { @@ -282,6 +283,12 @@ drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn, int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector); int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector); +static inline int +drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a, + const char *name, bool primary) +{ + return remove_conflicting_framebuffers(a, name, primary); +} #else static inline int drm_fb_helper_modinit(void) { @@ -475,5 +482,12 @@ drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, { return 0; } + +static inline int +drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a, + const char *name, bool primary) +{ + return 0; +} #endif #endif diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index fc65118e5077..205ddcf6d55d 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h @@ -37,6 +37,7 @@ * Generic range manager structs */ #include <linux/bug.h> +#include <linux/rbtree.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/spinlock.h> @@ -61,6 +62,7 @@ enum drm_mm_allocator_flags { struct drm_mm_node { struct list_head node_list; struct list_head hole_stack; + struct rb_node rb; unsigned hole_follows : 1; unsigned scanned_block : 1; unsigned scanned_prev_free : 1; @@ -70,6 +72,7 @@ struct drm_mm_node { unsigned long color; u64 start; u64 size; + u64 __subtree_last; struct drm_mm *mm; }; @@ -79,6 +82,9 @@ struct drm_mm { /* head_node.node_list is the list of all memory nodes, ordered * according to the (increasing) start address of the memory node. */ struct drm_mm_node head_node; + /* Keep an interval_tree for fast lookup of drm_mm_nodes by address. */ + struct rb_root interval_tree; + unsigned int scan_check_range : 1; unsigned scan_alignment; unsigned long scan_color; @@ -295,6 +301,12 @@ void drm_mm_init(struct drm_mm *mm, void drm_mm_takedown(struct drm_mm *mm); bool drm_mm_clean(struct drm_mm *mm); +struct drm_mm_node * +drm_mm_interval_first(struct drm_mm *mm, u64 start, u64 last); + +struct drm_mm_node * +drm_mm_interval_next(struct drm_mm_node *node, u64 start, u64 last); + void drm_mm_init_scan(struct drm_mm *mm, u64 size, unsigned alignment, diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h index 0e0c3573cce0..fbc8ecb3e5e8 100644 --- a/include/drm/drm_plane_helper.h +++ b/include/drm/drm_plane_helper.h @@ -40,6 +40,11 @@ int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, const struct drm_crtc_funcs *funcs); +int drm_plane_helper_check_state(struct drm_plane_state *state, + const struct drm_rect *clip, + int min_scale, int max_scale, + bool can_position, + bool can_update_disabled); int drm_plane_helper_check_update(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb, diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h index 06ea8e077ec2..afba6fcac853 100644 --- a/include/drm/drm_vma_manager.h +++ b/include/drm/drm_vma_manager.h @@ -40,13 +40,11 @@ struct drm_vma_offset_file { struct drm_vma_offset_node { rwlock_t vm_lock; struct drm_mm_node vm_node; - struct rb_node vm_rb; struct rb_root vm_files; }; struct drm_vma_offset_manager { rwlock_t vm_lock; - struct rb_root vm_addr_space_rb; struct drm_mm vm_addr_space_mm; }; diff --git a/include/linux/fence-array.h b/include/linux/fence-array.h index 86baaa45567c..a44794e508df 100644 --- a/include/linux/fence-array.h +++ b/include/linux/fence-array.h @@ -52,6 +52,16 @@ struct fence_array { extern const struct fence_ops fence_array_ops; /** + * fence_is_array - check if a fence is from the array subsclass + * + * Return true if it is a fence_array and false otherwise. + */ +static inline bool fence_is_array(struct fence *fence) +{ + return fence->ops == &fence_array_ops; +} + +/** * to_fence_array - cast a fence to a fence_array * @fence: fence to cast to a fence_array * diff --git a/include/linux/fence.h b/include/linux/fence.h index 8cc719a63728..0d763053f97a 100644 --- a/include/linux/fence.h +++ b/include/linux/fence.h @@ -49,8 +49,6 @@ struct fence_cb; * @timestamp: Timestamp when the fence was signaled. * @status: Optional, only valid if < 0, must be set before calling * fence_signal, indicates that the fence has completed with an error. - * @child_list: list of children fences - * @active_list: list of active fences * * the flags member must be manipulated and read using the appropriate * atomic ops (bit_*), so taking the spinlock will not be needed most @@ -62,7 +60,7 @@ struct fence_cb; * implementer of the fence for its own purposes. Can be used in different * ways by different fence implementers, so do not rely on this. * - * *) Since atomic bitops are used, this is not guaranteed to be the case. + * Since atomic bitops are used, this is not guaranteed to be the case. * Particularly, if the bit was set, but fence_signal was called right * before this bit was set, it would have been able to set the * FENCE_FLAG_SIGNALED_BIT, before enable_signaling was called. diff --git a/include/linux/sync_file.h b/include/linux/sync_file.h index c6ffe8b0725c..aa17ccfc2f57 100644 --- a/include/linux/sync_file.h +++ b/include/linux/sync_file.h @@ -19,12 +19,7 @@ #include <linux/list.h> #include <linux/spinlock.h> #include <linux/fence.h> - -struct sync_file_cb { - struct fence_cb cb; - struct fence *fence; - struct sync_file *sync_file; -}; +#include <linux/fence-array.h> /** * struct sync_file - sync file to export to the userspace @@ -32,10 +27,9 @@ struct sync_file_cb { * @kref: reference count on fence. * @name: name of sync_file. Useful for debugging * @sync_file_list: membership in global file list - * @num_fences: number of sync_pts in the fence * @wq: wait queue for fence signaling - * @status: 0: signaled, >0:active, <0: error - * @cbs: sync_pts callback information + * @fence: fence with the fences in the sync_file + * @cb: fence callback information */ struct sync_file { struct file *file; @@ -44,14 +38,16 @@ struct sync_file { #ifdef CONFIG_DEBUG_FS struct list_head sync_file_list; #endif - int num_fences; wait_queue_head_t wq; - atomic_t status; - struct sync_file_cb cbs[]; + struct fence *fence; + struct fence_cb cb; }; +#define POLL_ENABLED FENCE_FLAG_USER_BITS + struct sync_file *sync_file_create(struct fence *fence); +struct fence *sync_file_get_fence(int fd); #endif /* _LINUX_SYNC_H */ |