Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 1 | /************************************************************************** |
| 2 | * |
Sinclair Yeh | 54fbde8 | 2015-07-29 12:38:02 -0700 | [diff] [blame] | 3 | * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 4 | * All Rights Reserved. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the |
| 8 | * "Software"), to deal in the Software without restriction, including |
| 9 | * without limitation the rights to use, copy, modify, merge, publish, |
| 10 | * distribute, sub license, and/or sell copies of the Software, and to |
| 11 | * permit persons to whom the Software is furnished to do so, subject to |
| 12 | * the following conditions: |
| 13 | * |
| 14 | * The above copyright notice and this permission notice (including the |
| 15 | * next paragraph) shall be included in all copies or substantial portions |
| 16 | * of the Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, |
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 25 | * |
| 26 | **************************************************************************/ |
| 27 | |
| 28 | #ifndef VMWGFX_KMS_H_ |
| 29 | #define VMWGFX_KMS_H_ |
| 30 | |
David Howells | 760285e | 2012-10-02 18:01:07 +0100 | [diff] [blame] | 31 | #include <drm/drmP.h> |
| 32 | #include <drm/drm_crtc_helper.h> |
Laurent Pinchart | 9338203 | 2016-11-28 20:51:09 +0200 | [diff] [blame] | 33 | #include <drm/drm_encoder.h> |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 34 | #include "vmwgfx_drv.h" |
| 35 | |
Sinclair Yeh | 36cc79b | 2017-03-23 11:28:11 -0700 | [diff] [blame] | 36 | |
| 37 | |
Thomas Hellstrom | 1a4b172 | 2015-06-26 02:03:53 -0700 | [diff] [blame] | 38 | /** |
| 39 | * struct vmw_kms_dirty - closure structure for the vmw_kms_helper_dirty |
| 40 | * function. |
| 41 | * |
| 42 | * @fifo_commit: Callback that is called once for each display unit after |
| 43 | * all clip rects. This function must commit the fifo space reserved by the |
| 44 | * helper. Set up by the caller. |
| 45 | * @clip: Callback that is called for each cliprect on each display unit. |
| 46 | * Set up by the caller. |
| 47 | * @fifo_reserve_size: Fifo size that the helper should try to allocat for |
| 48 | * each display unit. Set up by the caller. |
| 49 | * @dev_priv: Pointer to the device private. Set up by the helper. |
| 50 | * @unit: The current display unit. Set up by the helper before a call to @clip. |
| 51 | * @cmd: The allocated fifo space. Set up by the helper before the first @clip |
| 52 | * call. |
| 53 | * @num_hits: Number of clip rect commands for this display unit. |
| 54 | * Cleared by the helper before the first @clip call. Updated by the @clip |
| 55 | * callback. |
| 56 | * @fb_x: Clip rect left side in framebuffer coordinates. |
| 57 | * @fb_y: Clip rect right side in framebuffer coordinates. |
| 58 | * @unit_x1: Clip rect left side in crtc coordinates. |
| 59 | * @unit_y1: Clip rect top side in crtc coordinates. |
| 60 | * @unit_x2: Clip rect right side in crtc coordinates. |
| 61 | * @unit_y2: Clip rect bottom side in crtc coordinates. |
| 62 | * |
| 63 | * The clip rect coordinates are updated by the helper for each @clip call. |
| 64 | * Note that this may be derived from if more info needs to be passed between |
| 65 | * helper caller and helper callbacks. |
| 66 | */ |
| 67 | struct vmw_kms_dirty { |
| 68 | void (*fifo_commit)(struct vmw_kms_dirty *); |
| 69 | void (*clip)(struct vmw_kms_dirty *); |
| 70 | size_t fifo_reserve_size; |
| 71 | struct vmw_private *dev_priv; |
| 72 | struct vmw_display_unit *unit; |
| 73 | void *cmd; |
| 74 | u32 num_hits; |
| 75 | s32 fb_x; |
| 76 | s32 fb_y; |
| 77 | s32 unit_x1; |
| 78 | s32 unit_y1; |
| 79 | s32 unit_x2; |
| 80 | s32 unit_y2; |
| 81 | }; |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 82 | |
Jakob Bornecrantz | 56d1c78 | 2011-10-04 20:13:22 +0200 | [diff] [blame] | 83 | #define VMWGFX_NUM_DISPLAY_UNITS 8 |
| 84 | |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 85 | |
| 86 | #define vmw_framebuffer_to_vfb(x) \ |
| 87 | container_of(x, struct vmw_framebuffer, base) |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 88 | #define vmw_framebuffer_to_vfbs(x) \ |
| 89 | container_of(x, struct vmw_framebuffer_surface, base.base) |
| 90 | #define vmw_framebuffer_to_vfbd(x) \ |
| 91 | container_of(x, struct vmw_framebuffer_dmabuf, base.base) |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 92 | |
| 93 | /** |
| 94 | * Base class for framebuffers |
| 95 | * |
| 96 | * @pin is called the when ever a crtc uses this framebuffer |
| 97 | * @unpin is called |
| 98 | */ |
| 99 | struct vmw_framebuffer { |
| 100 | struct drm_framebuffer base; |
| 101 | int (*pin)(struct vmw_framebuffer *fb); |
| 102 | int (*unpin)(struct vmw_framebuffer *fb); |
Jakob Bornecrantz | 2fcd5a7 | 2011-10-04 20:13:26 +0200 | [diff] [blame] | 103 | bool dmabuf; |
Thomas Hellstrom | 90ff18b | 2011-10-04 20:13:32 +0200 | [diff] [blame] | 104 | struct ttm_base_object *user_obj; |
| 105 | uint32_t user_handle; |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 106 | }; |
| 107 | |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 108 | /* |
| 109 | * Clip rectangle |
| 110 | */ |
| 111 | struct vmw_clip_rect { |
| 112 | int x1, x2, y1, y2; |
| 113 | }; |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 114 | |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 115 | struct vmw_framebuffer_surface { |
| 116 | struct vmw_framebuffer base; |
| 117 | struct vmw_surface *surface; |
| 118 | struct vmw_dma_buffer *buffer; |
| 119 | struct list_head head; |
Sinclair Yeh | f89c6c3 | 2015-06-26 01:54:28 -0700 | [diff] [blame] | 120 | bool is_dmabuf_proxy; /* true if this is proxy surface for DMA buf */ |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 121 | }; |
| 122 | |
| 123 | |
| 124 | struct vmw_framebuffer_dmabuf { |
| 125 | struct vmw_framebuffer base; |
| 126 | struct vmw_dma_buffer *buffer; |
| 127 | }; |
| 128 | |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 129 | |
Sinclair Yeh | 36cc79b | 2017-03-23 11:28:11 -0700 | [diff] [blame] | 130 | static const uint32_t vmw_primary_plane_formats[] = { |
| 131 | DRM_FORMAT_XRGB1555, |
| 132 | DRM_FORMAT_RGB565, |
| 133 | DRM_FORMAT_RGB888, |
| 134 | DRM_FORMAT_XRGB8888, |
| 135 | DRM_FORMAT_ARGB8888, |
| 136 | }; |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 137 | |
Sinclair Yeh | 36cc79b | 2017-03-23 11:28:11 -0700 | [diff] [blame] | 138 | static const uint32_t vmw_cursor_plane_formats[] = { |
| 139 | DRM_FORMAT_ARGB8888, |
| 140 | }; |
Jakob Bornecrantz | bfc2638 | 2011-11-28 13:19:14 +0100 | [diff] [blame] | 141 | |
Sinclair Yeh | 9c2542a | 2017-03-23 11:33:39 -0700 | [diff] [blame] | 142 | |
| 143 | #define vmw_crtc_state_to_vcs(x) container_of(x, struct vmw_crtc_state, base) |
Sinclair Yeh | cc5ec45 | 2017-03-23 11:36:05 -0700 | [diff] [blame] | 144 | #define vmw_plane_state_to_vps(x) container_of(x, struct vmw_plane_state, base) |
Sinclair Yeh | d7721ca | 2017-03-23 11:48:44 -0700 | [diff] [blame] | 145 | #define vmw_connector_state_to_vcs(x) \ |
| 146 | container_of(x, struct vmw_connector_state, base) |
Sinclair Yeh | 9c2542a | 2017-03-23 11:33:39 -0700 | [diff] [blame] | 147 | |
| 148 | /** |
| 149 | * Derived class for crtc state object |
| 150 | * |
| 151 | * @base DRM crtc object |
| 152 | */ |
| 153 | struct vmw_crtc_state { |
| 154 | struct drm_crtc_state base; |
| 155 | }; |
| 156 | |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 157 | /** |
Sinclair Yeh | cc5ec45 | 2017-03-23 11:36:05 -0700 | [diff] [blame] | 158 | * Derived class for plane state object |
| 159 | * |
| 160 | * @base DRM plane object |
| 161 | * @surf Display surface for STDU |
| 162 | * @dmabuf display dmabuf for SOU |
| 163 | * @content_fb_type Used by STDU. |
Sinclair Yeh | 06ec419 | 2017-03-23 13:14:54 -0700 | [diff] [blame] | 164 | * @dmabuf_size Size of the dmabuf, used by Screen Object Display Unit |
Sinclair Yeh | cc5ec45 | 2017-03-23 11:36:05 -0700 | [diff] [blame] | 165 | * @pinned pin count for STDU display surface |
| 166 | */ |
| 167 | struct vmw_plane_state { |
| 168 | struct drm_plane_state base; |
| 169 | struct vmw_surface *surf; |
| 170 | struct vmw_dma_buffer *dmabuf; |
| 171 | |
| 172 | int content_fb_type; |
Sinclair Yeh | 06ec419 | 2017-03-23 13:14:54 -0700 | [diff] [blame] | 173 | unsigned long dmabuf_size; |
Sinclair Yeh | cc5ec45 | 2017-03-23 11:36:05 -0700 | [diff] [blame] | 174 | |
| 175 | int pinned; |
Sinclair Yeh | 810b3e16 | 2017-03-23 15:39:16 -0700 | [diff] [blame] | 176 | |
| 177 | /* For CPU Blit */ |
| 178 | struct ttm_bo_kmap_obj host_map, guest_map; |
| 179 | unsigned int cpp; |
Sinclair Yeh | cc5ec45 | 2017-03-23 11:36:05 -0700 | [diff] [blame] | 180 | }; |
| 181 | |
Sinclair Yeh | d7721ca | 2017-03-23 11:48:44 -0700 | [diff] [blame] | 182 | |
| 183 | /** |
| 184 | * Derived class for connector state object |
| 185 | * |
| 186 | * @base DRM connector object |
| 187 | * @is_implicit connector property |
| 188 | * |
| 189 | */ |
| 190 | struct vmw_connector_state { |
| 191 | struct drm_connector_state base; |
| 192 | |
| 193 | bool is_implicit; |
| 194 | }; |
| 195 | |
Sinclair Yeh | cc5ec45 | 2017-03-23 11:36:05 -0700 | [diff] [blame] | 196 | /** |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 197 | * Base class display unit. |
| 198 | * |
| 199 | * Since the SVGA hw doesn't have a concept of a crtc, encoder or connector |
| 200 | * so the display unit is all of them at the same time. This is true for both |
| 201 | * legacy multimon and screen objects. |
| 202 | */ |
| 203 | struct vmw_display_unit { |
| 204 | struct drm_crtc crtc; |
| 205 | struct drm_encoder encoder; |
| 206 | struct drm_connector connector; |
Sinclair Yeh | 36cc79b | 2017-03-23 11:28:11 -0700 | [diff] [blame] | 207 | struct drm_plane primary; |
| 208 | struct drm_plane cursor; |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 209 | |
| 210 | struct vmw_surface *cursor_surface; |
| 211 | struct vmw_dma_buffer *cursor_dmabuf; |
| 212 | size_t cursor_age; |
| 213 | |
| 214 | int cursor_x; |
| 215 | int cursor_y; |
| 216 | |
| 217 | int hotspot_x; |
| 218 | int hotspot_y; |
Thomas Hellstrom | 8fbf9d9 | 2015-11-26 19:45:16 +0100 | [diff] [blame] | 219 | s32 core_hotspot_x; |
| 220 | s32 core_hotspot_y; |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 221 | |
| 222 | unsigned unit; |
Jakob Bornecrantz | 626ab77 | 2011-10-04 20:13:20 +0200 | [diff] [blame] | 223 | |
| 224 | /* |
| 225 | * Prefered mode tracking. |
| 226 | */ |
| 227 | unsigned pref_width; |
| 228 | unsigned pref_height; |
| 229 | bool pref_active; |
| 230 | struct drm_display_mode *pref_mode; |
Thomas Hellstrom | cd2b89e | 2011-10-25 23:35:53 +0200 | [diff] [blame] | 231 | |
| 232 | /* |
| 233 | * Gui positioning |
| 234 | */ |
| 235 | int gui_x; |
| 236 | int gui_y; |
Thomas Hellstrom | 6987427 | 2011-11-02 09:43:11 +0100 | [diff] [blame] | 237 | bool is_implicit; |
Thomas Hellstrom | 75c0685 | 2016-02-12 09:00:26 +0100 | [diff] [blame] | 238 | bool active_implicit; |
Thomas Hellstrom | 6dd687b | 2016-02-12 09:57:15 +0100 | [diff] [blame] | 239 | int set_gui_x; |
| 240 | int set_gui_y; |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 241 | }; |
| 242 | |
Jakob Bornecrantz | 2fcd5a7 | 2011-10-04 20:13:26 +0200 | [diff] [blame] | 243 | #define vmw_crtc_to_du(x) \ |
| 244 | container_of(x, struct vmw_display_unit, crtc) |
Jakob Bornecrantz | 626ab77 | 2011-10-04 20:13:20 +0200 | [diff] [blame] | 245 | #define vmw_connector_to_du(x) \ |
| 246 | container_of(x, struct vmw_display_unit, connector) |
| 247 | |
| 248 | |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 249 | /* |
| 250 | * Shared display unit functions - vmwgfx_kms.c |
| 251 | */ |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 252 | void vmw_du_cleanup(struct vmw_display_unit *du); |
Jakob Bornecrantz | 626ab77 | 2011-10-04 20:13:20 +0200 | [diff] [blame] | 253 | void vmw_du_crtc_save(struct drm_crtc *crtc); |
| 254 | void vmw_du_crtc_restore(struct drm_crtc *crtc); |
Maarten Lankhorst | 7ea7728 | 2016-06-07 12:49:30 +0200 | [diff] [blame] | 255 | int vmw_du_crtc_gamma_set(struct drm_crtc *crtc, |
Jakob Bornecrantz | 626ab77 | 2011-10-04 20:13:20 +0200 | [diff] [blame] | 256 | u16 *r, u16 *g, u16 *b, |
Daniel Vetter | 6d124ff | 2017-04-03 10:33:01 +0200 | [diff] [blame] | 257 | uint32_t size, |
| 258 | struct drm_modeset_acquire_ctx *ctx); |
Sinclair Yeh | 9c2542a | 2017-03-23 11:33:39 -0700 | [diff] [blame] | 259 | int vmw_du_connector_set_property(struct drm_connector *connector, |
| 260 | struct drm_property *property, |
| 261 | uint64_t val); |
Sinclair Yeh | d7721ca | 2017-03-23 11:48:44 -0700 | [diff] [blame] | 262 | int vmw_du_connector_atomic_set_property(struct drm_connector *connector, |
| 263 | struct drm_connector_state *state, |
| 264 | struct drm_property *property, |
| 265 | uint64_t val); |
| 266 | int |
| 267 | vmw_du_connector_atomic_get_property(struct drm_connector *connector, |
| 268 | const struct drm_connector_state *state, |
| 269 | struct drm_property *property, |
| 270 | uint64_t *val); |
Maarten Lankhorst | 9a69a9a | 2015-07-21 11:34:55 +0200 | [diff] [blame] | 271 | int vmw_du_connector_dpms(struct drm_connector *connector, int mode); |
Jakob Bornecrantz | 626ab77 | 2011-10-04 20:13:20 +0200 | [diff] [blame] | 272 | void vmw_du_connector_save(struct drm_connector *connector); |
| 273 | void vmw_du_connector_restore(struct drm_connector *connector); |
| 274 | enum drm_connector_status |
| 275 | vmw_du_connector_detect(struct drm_connector *connector, bool force); |
| 276 | int vmw_du_connector_fill_modes(struct drm_connector *connector, |
| 277 | uint32_t max_width, uint32_t max_height); |
Thomas Hellstrom | 1a4b172 | 2015-06-26 02:03:53 -0700 | [diff] [blame] | 278 | int vmw_kms_helper_dirty(struct vmw_private *dev_priv, |
| 279 | struct vmw_framebuffer *framebuffer, |
| 280 | const struct drm_clip_rect *clips, |
| 281 | const struct drm_vmw_rect *vclips, |
| 282 | s32 dest_x, s32 dest_y, |
| 283 | int num_clips, |
| 284 | int increment, |
| 285 | struct vmw_kms_dirty *dirty); |
Thomas Hellstrom | cd2b89e | 2011-10-25 23:35:53 +0200 | [diff] [blame] | 286 | |
Thomas Hellstrom | 1a4b172 | 2015-06-26 02:03:53 -0700 | [diff] [blame] | 287 | int vmw_kms_helper_buffer_prepare(struct vmw_private *dev_priv, |
| 288 | struct vmw_dma_buffer *buf, |
| 289 | bool interruptible, |
| 290 | bool validate_as_mob); |
| 291 | void vmw_kms_helper_buffer_revert(struct vmw_dma_buffer *buf); |
| 292 | void vmw_kms_helper_buffer_finish(struct vmw_private *dev_priv, |
| 293 | struct drm_file *file_priv, |
| 294 | struct vmw_dma_buffer *buf, |
| 295 | struct vmw_fence_obj **out_fence, |
| 296 | struct drm_vmw_fence_rep __user * |
| 297 | user_fence_rep); |
| 298 | int vmw_kms_helper_resource_prepare(struct vmw_resource *res, |
| 299 | bool interruptible); |
| 300 | void vmw_kms_helper_resource_revert(struct vmw_resource *res); |
| 301 | void vmw_kms_helper_resource_finish(struct vmw_resource *res, |
| 302 | struct vmw_fence_obj **out_fence); |
Thomas Hellstrom | 10b1e0c | 2015-06-26 02:14:27 -0700 | [diff] [blame] | 303 | int vmw_kms_readback(struct vmw_private *dev_priv, |
| 304 | struct drm_file *file_priv, |
| 305 | struct vmw_framebuffer *vfb, |
| 306 | struct drm_vmw_fence_rep __user *user_fence_rep, |
| 307 | struct drm_vmw_rect *vclips, |
| 308 | uint32_t num_clips); |
Thomas Hellstrom | fd006a4 | 2015-06-28 02:50:56 -0700 | [diff] [blame] | 309 | struct vmw_framebuffer * |
| 310 | vmw_kms_new_framebuffer(struct vmw_private *dev_priv, |
| 311 | struct vmw_dma_buffer *dmabuf, |
| 312 | struct vmw_surface *surface, |
| 313 | bool only_2d, |
Daniel Vetter | dabdcdc | 2016-12-02 08:07:40 +0100 | [diff] [blame] | 314 | const struct drm_mode_fb_cmd2 *mode_cmd); |
Thomas Hellstrom | a278724 | 2015-06-29 12:55:07 -0700 | [diff] [blame] | 315 | int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv, |
| 316 | unsigned unit, |
| 317 | u32 max_width, |
| 318 | u32 max_height, |
| 319 | struct drm_connector **p_con, |
| 320 | struct drm_crtc **p_crtc, |
| 321 | struct drm_display_mode **p_mode); |
| 322 | void vmw_guess_mode_timing(struct drm_display_mode *mode); |
Thomas Hellstrom | 75c0685 | 2016-02-12 09:00:26 +0100 | [diff] [blame] | 323 | void vmw_kms_del_active(struct vmw_private *dev_priv, |
| 324 | struct vmw_display_unit *du); |
| 325 | void vmw_kms_add_active(struct vmw_private *dev_priv, |
| 326 | struct vmw_display_unit *du, |
| 327 | struct vmw_framebuffer *vfb); |
| 328 | bool vmw_kms_crtc_flippable(struct vmw_private *dev_priv, |
| 329 | struct drm_crtc *crtc); |
| 330 | void vmw_kms_update_implicit_fb(struct vmw_private *dev_priv, |
| 331 | struct drm_crtc *crtc); |
Thomas Hellstrom | 76404ac | 2016-02-12 09:55:45 +0100 | [diff] [blame] | 332 | void vmw_kms_create_implicit_placement_property(struct vmw_private *dev_priv, |
| 333 | bool immutable); |
Thomas Hellstrom | 75c0685 | 2016-02-12 09:00:26 +0100 | [diff] [blame] | 334 | |
Sinclair Yeh | 36cc79b | 2017-03-23 11:28:11 -0700 | [diff] [blame] | 335 | /* Universal Plane Helpers */ |
| 336 | void vmw_du_primary_plane_destroy(struct drm_plane *plane); |
| 337 | void vmw_du_cursor_plane_destroy(struct drm_plane *plane); |
Sinclair Yeh | 36cc79b | 2017-03-23 11:28:11 -0700 | [diff] [blame] | 338 | |
Sinclair Yeh | 06ec419 | 2017-03-23 13:14:54 -0700 | [diff] [blame] | 339 | /* Atomic Helpers */ |
Sinclair Yeh | 060e2ad | 2017-03-23 14:18:32 -0700 | [diff] [blame] | 340 | int vmw_du_primary_plane_atomic_check(struct drm_plane *plane, |
| 341 | struct drm_plane_state *state); |
| 342 | int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane, |
| 343 | struct drm_plane_state *state); |
| 344 | void vmw_du_cursor_plane_atomic_update(struct drm_plane *plane, |
| 345 | struct drm_plane_state *old_state); |
Sinclair Yeh | 060e2ad | 2017-03-23 14:18:32 -0700 | [diff] [blame] | 346 | int vmw_du_cursor_plane_prepare_fb(struct drm_plane *plane, |
| 347 | struct drm_plane_state *new_state); |
| 348 | void vmw_du_plane_cleanup_fb(struct drm_plane *plane, |
| 349 | struct drm_plane_state *old_state); |
Sinclair Yeh | cc5ec45 | 2017-03-23 11:36:05 -0700 | [diff] [blame] | 350 | void vmw_du_plane_reset(struct drm_plane *plane); |
| 351 | struct drm_plane_state *vmw_du_plane_duplicate_state(struct drm_plane *plane); |
| 352 | void vmw_du_plane_destroy_state(struct drm_plane *plane, |
| 353 | struct drm_plane_state *state); |
Sinclair Yeh | 060e2ad | 2017-03-23 14:18:32 -0700 | [diff] [blame] | 354 | void vmw_du_plane_unpin_surf(struct vmw_plane_state *vps, |
| 355 | bool unreference); |
| 356 | |
Sinclair Yeh | 06ec419 | 2017-03-23 13:14:54 -0700 | [diff] [blame] | 357 | int vmw_du_crtc_atomic_check(struct drm_crtc *crtc, |
| 358 | struct drm_crtc_state *state); |
| 359 | void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc, |
| 360 | struct drm_crtc_state *old_crtc_state); |
| 361 | void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc, |
| 362 | struct drm_crtc_state *old_crtc_state); |
Sinclair Yeh | 9c2542a | 2017-03-23 11:33:39 -0700 | [diff] [blame] | 363 | void vmw_du_crtc_reset(struct drm_crtc *crtc); |
| 364 | struct drm_crtc_state *vmw_du_crtc_duplicate_state(struct drm_crtc *crtc); |
| 365 | void vmw_du_crtc_destroy_state(struct drm_crtc *crtc, |
| 366 | struct drm_crtc_state *state); |
Sinclair Yeh | d7721ca | 2017-03-23 11:48:44 -0700 | [diff] [blame] | 367 | void vmw_du_connector_reset(struct drm_connector *connector); |
| 368 | struct drm_connector_state * |
| 369 | vmw_du_connector_duplicate_state(struct drm_connector *connector); |
| 370 | |
| 371 | void vmw_du_connector_destroy_state(struct drm_connector *connector, |
| 372 | struct drm_connector_state *state); |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 373 | |
| 374 | /* |
Jakob Bornecrantz | d8bd19d | 2010-06-01 11:54:20 +0200 | [diff] [blame] | 375 | * Legacy display unit functions - vmwgfx_ldu.c |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 376 | */ |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 377 | int vmw_kms_ldu_init_display(struct vmw_private *dev_priv); |
| 378 | int vmw_kms_ldu_close_display(struct vmw_private *dev_priv); |
| 379 | int vmw_kms_ldu_do_dmabuf_dirty(struct vmw_private *dev_priv, |
| 380 | struct vmw_framebuffer *framebuffer, |
| 381 | unsigned flags, unsigned color, |
| 382 | struct drm_clip_rect *clips, |
| 383 | unsigned num_clips, int increment); |
Thomas Hellstrom | 6bf6bf0 | 2015-06-26 02:22:40 -0700 | [diff] [blame] | 384 | int vmw_kms_update_proxy(struct vmw_resource *res, |
| 385 | const struct drm_clip_rect *clips, |
| 386 | unsigned num_clips, |
| 387 | int increment); |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 388 | |
Jakob Bornecrantz | 56d1c78 | 2011-10-04 20:13:22 +0200 | [diff] [blame] | 389 | /* |
| 390 | * Screen Objects display functions - vmwgfx_scrn.c |
| 391 | */ |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 392 | int vmw_kms_sou_init_display(struct vmw_private *dev_priv); |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 393 | int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv, |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 394 | struct vmw_framebuffer *framebuffer, |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 395 | struct drm_clip_rect *clips, |
Thomas Hellstrom | 10b1e0c | 2015-06-26 02:14:27 -0700 | [diff] [blame] | 396 | struct drm_vmw_rect *vclips, |
| 397 | struct vmw_resource *srf, |
| 398 | s32 dest_x, |
| 399 | s32 dest_y, |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 400 | unsigned num_clips, int inc, |
| 401 | struct vmw_fence_obj **out_fence); |
Thomas Hellstrom | 10b1e0c | 2015-06-26 02:14:27 -0700 | [diff] [blame] | 402 | int vmw_kms_sou_do_dmabuf_dirty(struct vmw_private *dev_priv, |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 403 | struct vmw_framebuffer *framebuffer, |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 404 | struct drm_clip_rect *clips, |
Thomas Hellstrom | 897b818 | 2016-02-12 08:32:08 +0100 | [diff] [blame] | 405 | struct drm_vmw_rect *vclips, |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 406 | unsigned num_clips, int increment, |
Thomas Hellstrom | 10b1e0c | 2015-06-26 02:14:27 -0700 | [diff] [blame] | 407 | bool interruptible, |
Sinclair Yeh | c8261a9 | 2015-06-26 01:23:42 -0700 | [diff] [blame] | 408 | struct vmw_fence_obj **out_fence); |
Thomas Hellstrom | 10b1e0c | 2015-06-26 02:14:27 -0700 | [diff] [blame] | 409 | int vmw_kms_sou_readback(struct vmw_private *dev_priv, |
| 410 | struct drm_file *file_priv, |
| 411 | struct vmw_framebuffer *vfb, |
| 412 | struct drm_vmw_fence_rep __user *user_fence_rep, |
| 413 | struct drm_vmw_rect *vclips, |
| 414 | uint32_t num_clips); |
Sinclair Yeh | 35c0512 | 2015-06-26 01:42:06 -0700 | [diff] [blame] | 415 | |
| 416 | /* |
| 417 | * Screen Target Display Unit functions - vmwgfx_stdu.c |
| 418 | */ |
| 419 | int vmw_kms_stdu_init_display(struct vmw_private *dev_priv); |
Thomas Hellstrom | 6bf6bf0 | 2015-06-26 02:22:40 -0700 | [diff] [blame] | 420 | int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv, |
| 421 | struct vmw_framebuffer *framebuffer, |
| 422 | struct drm_clip_rect *clips, |
| 423 | struct drm_vmw_rect *vclips, |
| 424 | struct vmw_resource *srf, |
| 425 | s32 dest_x, |
| 426 | s32 dest_y, |
| 427 | unsigned num_clips, int inc, |
| 428 | struct vmw_fence_obj **out_fence); |
| 429 | int vmw_kms_stdu_dma(struct vmw_private *dev_priv, |
| 430 | struct drm_file *file_priv, |
| 431 | struct vmw_framebuffer *vfb, |
| 432 | struct drm_vmw_fence_rep __user *user_fence_rep, |
| 433 | struct drm_clip_rect *clips, |
| 434 | struct drm_vmw_rect *vclips, |
| 435 | uint32_t num_clips, |
| 436 | int increment, |
| 437 | bool to_surface, |
| 438 | bool interruptible); |
Jakob Bornecrantz | b5ec427 | 2012-02-09 16:56:45 +0100 | [diff] [blame] | 439 | |
Dave Airlie | 320d8c3 | 2017-04-03 16:30:24 +1000 | [diff] [blame] | 440 | int vmw_kms_set_config(struct drm_mode_set *set, |
| 441 | struct drm_modeset_acquire_ctx *ctx); |
Jakob Bornecrantz | 56d1c78 | 2011-10-04 20:13:22 +0200 | [diff] [blame] | 442 | |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 443 | #endif |