Home | History | Annotate | Line # | Download | only in vmwgfx
      1  1.2  riastrad /*	$NetBSD: vmwgfx_kms.h,v 1.3 2021/12/18 23:45:45 riastradh Exp $	*/
      2  1.2  riastrad 
      3  1.3  riastrad /* SPDX-License-Identifier: GPL-2.0 OR MIT */
      4  1.1  riastrad /**************************************************************************
      5  1.1  riastrad  *
      6  1.3  riastrad  * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
      7  1.1  riastrad  *
      8  1.1  riastrad  * Permission is hereby granted, free of charge, to any person obtaining a
      9  1.1  riastrad  * copy of this software and associated documentation files (the
     10  1.1  riastrad  * "Software"), to deal in the Software without restriction, including
     11  1.1  riastrad  * without limitation the rights to use, copy, modify, merge, publish,
     12  1.1  riastrad  * distribute, sub license, and/or sell copies of the Software, and to
     13  1.1  riastrad  * permit persons to whom the Software is furnished to do so, subject to
     14  1.1  riastrad  * the following conditions:
     15  1.1  riastrad  *
     16  1.1  riastrad  * The above copyright notice and this permission notice (including the
     17  1.1  riastrad  * next paragraph) shall be included in all copies or substantial portions
     18  1.1  riastrad  * of the Software.
     19  1.1  riastrad  *
     20  1.1  riastrad  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     21  1.1  riastrad  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     22  1.1  riastrad  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
     23  1.1  riastrad  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
     24  1.1  riastrad  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
     25  1.1  riastrad  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
     26  1.1  riastrad  * USE OR OTHER DEALINGS IN THE SOFTWARE.
     27  1.1  riastrad  *
     28  1.1  riastrad  **************************************************************************/
     29  1.1  riastrad 
     30  1.1  riastrad #ifndef VMWGFX_KMS_H_
     31  1.1  riastrad #define VMWGFX_KMS_H_
     32  1.1  riastrad 
     33  1.3  riastrad #include <drm/drm_encoder.h>
     34  1.3  riastrad #include <drm/drm_probe_helper.h>
     35  1.3  riastrad 
     36  1.1  riastrad #include "vmwgfx_drv.h"
     37  1.1  riastrad 
     38  1.2  riastrad /**
     39  1.3  riastrad  * struct vmw_du_update_plane - Closure structure for vmw_du_helper_plane_update
     40  1.3  riastrad  * @plane: Plane which is being updated.
     41  1.3  riastrad  * @old_state: Old state of plane.
     42  1.3  riastrad  * @dev_priv: Device private.
     43  1.3  riastrad  * @du: Display unit on which to update the plane.
     44  1.3  riastrad  * @vfb: Framebuffer which is blitted to display unit.
     45  1.3  riastrad  * @out_fence: Out fence for resource finish.
     46  1.3  riastrad  * @mutex: The mutex used to protect resource reservation.
     47  1.3  riastrad  * @cpu_blit: True if need cpu blit.
     48  1.3  riastrad  * @intr: Whether to perform waits interruptible if possible.
     49  1.3  riastrad  *
     50  1.3  riastrad  * This structure loosely represent the set of operations needed to perform a
     51  1.3  riastrad  * plane update on a display unit. Implementer will define that functionality
     52  1.3  riastrad  * according to the function callbacks for this structure. In brief it involves
     53  1.3  riastrad  * surface/buffer object validation, populate FIFO commands and command
     54  1.3  riastrad  * submission to the device.
     55  1.3  riastrad  */
     56  1.3  riastrad struct vmw_du_update_plane {
     57  1.3  riastrad 	/**
     58  1.3  riastrad 	 * @calc_fifo_size: Calculate fifo size.
     59  1.3  riastrad 	 *
     60  1.3  riastrad 	 * Determine fifo size for the commands needed for update. The number of
     61  1.3  riastrad 	 * damage clips on display unit @num_hits will be passed to allocate
     62  1.3  riastrad 	 * sufficient fifo space.
     63  1.3  riastrad 	 *
     64  1.3  riastrad 	 * Return: Fifo size needed
     65  1.3  riastrad 	 */
     66  1.3  riastrad 	uint32_t (*calc_fifo_size)(struct vmw_du_update_plane *update,
     67  1.3  riastrad 				   uint32_t num_hits);
     68  1.3  riastrad 
     69  1.3  riastrad 	/**
     70  1.3  riastrad 	 * @post_prepare: Populate fifo for resource preparation.
     71  1.3  riastrad 	 *
     72  1.3  riastrad 	 * Some surface resource or buffer object need some extra cmd submission
     73  1.3  riastrad 	 * like update GB image for proxy surface and define a GMRFB for screen
     74  1.3  riastrad 	 * object. That should should be done here as this callback will be
     75  1.3  riastrad 	 * called after FIFO allocation with the address of command buufer.
     76  1.3  riastrad 	 *
     77  1.3  riastrad 	 * This callback is optional.
     78  1.3  riastrad 	 *
     79  1.3  riastrad 	 * Return: Size of commands populated to command buffer.
     80  1.3  riastrad 	 */
     81  1.3  riastrad 	uint32_t (*post_prepare)(struct vmw_du_update_plane *update, void *cmd);
     82  1.3  riastrad 
     83  1.3  riastrad 	/**
     84  1.3  riastrad 	 * @pre_clip: Populate fifo before clip.
     85  1.3  riastrad 	 *
     86  1.3  riastrad 	 * This is where pre clip related command should be populated like
     87  1.3  riastrad 	 * surface copy/DMA, etc.
     88  1.3  riastrad 	 *
     89  1.3  riastrad 	 * This callback is optional.
     90  1.3  riastrad 	 *
     91  1.3  riastrad 	 * Return: Size of commands populated to command buffer.
     92  1.3  riastrad 	 */
     93  1.3  riastrad 	uint32_t (*pre_clip)(struct vmw_du_update_plane *update, void *cmd,
     94  1.3  riastrad 			     uint32_t num_hits);
     95  1.3  riastrad 
     96  1.3  riastrad 	/**
     97  1.3  riastrad 	 * @clip: Populate fifo for clip.
     98  1.3  riastrad 	 *
     99  1.3  riastrad 	 * This is where to populate clips for surface copy/dma or blit commands
    100  1.3  riastrad 	 * if needed. This will be called times have damage in display unit,
    101  1.3  riastrad 	 * which is one if doing full update. @clip is the damage in destination
    102  1.3  riastrad 	 * coordinates which is crtc/DU and @src_x, @src_y is damage clip src in
    103  1.3  riastrad 	 * framebuffer coordinate.
    104  1.3  riastrad 	 *
    105  1.3  riastrad 	 * This callback is optional.
    106  1.3  riastrad 	 *
    107  1.3  riastrad 	 * Return: Size of commands populated to command buffer.
    108  1.3  riastrad 	 */
    109  1.3  riastrad 	uint32_t (*clip)(struct vmw_du_update_plane *update, void *cmd,
    110  1.3  riastrad 			 struct drm_rect *clip, uint32_t src_x, uint32_t src_y);
    111  1.3  riastrad 
    112  1.3  riastrad 	/**
    113  1.3  riastrad 	 * @post_clip: Populate fifo after clip.
    114  1.3  riastrad 	 *
    115  1.3  riastrad 	 * This is where to populate display unit update commands or blit
    116  1.3  riastrad 	 * commands.
    117  1.3  riastrad 	 *
    118  1.3  riastrad 	 * Return: Size of commands populated to command buffer.
    119  1.3  riastrad 	 */
    120  1.3  riastrad 	uint32_t (*post_clip)(struct vmw_du_update_plane *update, void *cmd,
    121  1.3  riastrad 				    struct drm_rect *bb);
    122  1.3  riastrad 
    123  1.3  riastrad 	struct drm_plane *plane;
    124  1.3  riastrad 	struct drm_plane_state *old_state;
    125  1.3  riastrad 	struct vmw_private *dev_priv;
    126  1.3  riastrad 	struct vmw_display_unit *du;
    127  1.3  riastrad 	struct vmw_framebuffer *vfb;
    128  1.3  riastrad 	struct vmw_fence_obj **out_fence;
    129  1.3  riastrad 	struct mutex *mutex;
    130  1.3  riastrad 	bool cpu_blit;
    131  1.3  riastrad 	bool intr;
    132  1.3  riastrad };
    133  1.3  riastrad 
    134  1.3  riastrad /**
    135  1.3  riastrad  * struct vmw_du_update_plane_surface - closure structure for surface
    136  1.3  riastrad  * @base: base closure structure.
    137  1.3  riastrad  * @cmd_start: FIFO command start address (used by SOU only).
    138  1.3  riastrad  */
    139  1.3  riastrad struct vmw_du_update_plane_surface {
    140  1.3  riastrad 	struct vmw_du_update_plane base;
    141  1.3  riastrad 	/* This member is to handle special case SOU surface update */
    142  1.3  riastrad 	void *cmd_start;
    143  1.3  riastrad };
    144  1.3  riastrad 
    145  1.3  riastrad /**
    146  1.3  riastrad  * struct vmw_du_update_plane_buffer - Closure structure for buffer object
    147  1.3  riastrad  * @base: Base closure structure.
    148  1.3  riastrad  * @fb_left: x1 for fb damage bounding box.
    149  1.3  riastrad  * @fb_top: y1 for fb damage bounding box.
    150  1.3  riastrad  */
    151  1.3  riastrad struct vmw_du_update_plane_buffer {
    152  1.3  riastrad 	struct vmw_du_update_plane base;
    153  1.3  riastrad 	int fb_left, fb_top;
    154  1.3  riastrad };
    155  1.3  riastrad 
    156  1.3  riastrad /**
    157  1.2  riastrad  * struct vmw_kms_dirty - closure structure for the vmw_kms_helper_dirty
    158  1.2  riastrad  * function.
    159  1.2  riastrad  *
    160  1.2  riastrad  * @fifo_commit: Callback that is called once for each display unit after
    161  1.2  riastrad  * all clip rects. This function must commit the fifo space reserved by the
    162  1.2  riastrad  * helper. Set up by the caller.
    163  1.2  riastrad  * @clip: Callback that is called for each cliprect on each display unit.
    164  1.2  riastrad  * Set up by the caller.
    165  1.2  riastrad  * @fifo_reserve_size: Fifo size that the helper should try to allocat for
    166  1.2  riastrad  * each display unit. Set up by the caller.
    167  1.2  riastrad  * @dev_priv: Pointer to the device private. Set up by the helper.
    168  1.2  riastrad  * @unit: The current display unit. Set up by the helper before a call to @clip.
    169  1.2  riastrad  * @cmd: The allocated fifo space. Set up by the helper before the first @clip
    170  1.2  riastrad  * call.
    171  1.3  riastrad  * @crtc: The crtc for which to build dirty commands.
    172  1.2  riastrad  * @num_hits: Number of clip rect commands for this display unit.
    173  1.2  riastrad  * Cleared by the helper before the first @clip call. Updated by the @clip
    174  1.2  riastrad  * callback.
    175  1.2  riastrad  * @fb_x: Clip rect left side in framebuffer coordinates.
    176  1.2  riastrad  * @fb_y: Clip rect right side in framebuffer coordinates.
    177  1.2  riastrad  * @unit_x1: Clip rect left side in crtc coordinates.
    178  1.2  riastrad  * @unit_y1: Clip rect top side in crtc coordinates.
    179  1.2  riastrad  * @unit_x2: Clip rect right side in crtc coordinates.
    180  1.2  riastrad  * @unit_y2: Clip rect bottom side in crtc coordinates.
    181  1.2  riastrad  *
    182  1.2  riastrad  * The clip rect coordinates are updated by the helper for each @clip call.
    183  1.2  riastrad  * Note that this may be derived from if more info needs to be passed between
    184  1.2  riastrad  * helper caller and helper callbacks.
    185  1.2  riastrad  */
    186  1.2  riastrad struct vmw_kms_dirty {
    187  1.2  riastrad 	void (*fifo_commit)(struct vmw_kms_dirty *);
    188  1.2  riastrad 	void (*clip)(struct vmw_kms_dirty *);
    189  1.2  riastrad 	size_t fifo_reserve_size;
    190  1.2  riastrad 	struct vmw_private *dev_priv;
    191  1.2  riastrad 	struct vmw_display_unit *unit;
    192  1.2  riastrad 	void *cmd;
    193  1.3  riastrad 	struct drm_crtc *crtc;
    194  1.2  riastrad 	u32 num_hits;
    195  1.2  riastrad 	s32 fb_x;
    196  1.2  riastrad 	s32 fb_y;
    197  1.2  riastrad 	s32 unit_x1;
    198  1.2  riastrad 	s32 unit_y1;
    199  1.2  riastrad 	s32 unit_x2;
    200  1.2  riastrad 	s32 unit_y2;
    201  1.2  riastrad };
    202  1.2  riastrad 
    203  1.1  riastrad #define VMWGFX_NUM_DISPLAY_UNITS 8
    204  1.1  riastrad 
    205  1.1  riastrad 
    206  1.1  riastrad #define vmw_framebuffer_to_vfb(x) \
    207  1.1  riastrad 	container_of(x, struct vmw_framebuffer, base)
    208  1.2  riastrad #define vmw_framebuffer_to_vfbs(x) \
    209  1.2  riastrad 	container_of(x, struct vmw_framebuffer_surface, base.base)
    210  1.2  riastrad #define vmw_framebuffer_to_vfbd(x) \
    211  1.3  riastrad 	container_of(x, struct vmw_framebuffer_bo, base.base)
    212  1.1  riastrad 
    213  1.1  riastrad /**
    214  1.1  riastrad  * Base class for framebuffers
    215  1.1  riastrad  *
    216  1.1  riastrad  * @pin is called the when ever a crtc uses this framebuffer
    217  1.1  riastrad  * @unpin is called
    218  1.1  riastrad  */
    219  1.1  riastrad struct vmw_framebuffer {
    220  1.1  riastrad 	struct drm_framebuffer base;
    221  1.1  riastrad 	int (*pin)(struct vmw_framebuffer *fb);
    222  1.1  riastrad 	int (*unpin)(struct vmw_framebuffer *fb);
    223  1.3  riastrad 	bool bo;
    224  1.1  riastrad 	struct ttm_base_object *user_obj;
    225  1.1  riastrad 	uint32_t user_handle;
    226  1.1  riastrad };
    227  1.1  riastrad 
    228  1.2  riastrad /*
    229  1.2  riastrad  * Clip rectangle
    230  1.2  riastrad  */
    231  1.2  riastrad struct vmw_clip_rect {
    232  1.2  riastrad 	int x1, x2, y1, y2;
    233  1.2  riastrad };
    234  1.2  riastrad 
    235  1.2  riastrad struct vmw_framebuffer_surface {
    236  1.2  riastrad 	struct vmw_framebuffer base;
    237  1.2  riastrad 	struct vmw_surface *surface;
    238  1.3  riastrad 	struct vmw_buffer_object *buffer;
    239  1.2  riastrad 	struct list_head head;
    240  1.3  riastrad 	bool is_bo_proxy;  /* true if this is proxy surface for DMA buf */
    241  1.2  riastrad };
    242  1.2  riastrad 
    243  1.2  riastrad 
    244  1.3  riastrad struct vmw_framebuffer_bo {
    245  1.2  riastrad 	struct vmw_framebuffer base;
    246  1.3  riastrad 	struct vmw_buffer_object *buffer;
    247  1.2  riastrad };
    248  1.1  riastrad 
    249  1.1  riastrad 
    250  1.3  riastrad static const uint32_t vmw_primary_plane_formats[] = {
    251  1.3  riastrad 	DRM_FORMAT_XRGB1555,
    252  1.3  riastrad 	DRM_FORMAT_RGB565,
    253  1.3  riastrad 	DRM_FORMAT_RGB888,
    254  1.3  riastrad 	DRM_FORMAT_XRGB8888,
    255  1.3  riastrad 	DRM_FORMAT_ARGB8888,
    256  1.3  riastrad };
    257  1.3  riastrad 
    258  1.3  riastrad static const uint32_t vmw_cursor_plane_formats[] = {
    259  1.3  riastrad 	DRM_FORMAT_ARGB8888,
    260  1.3  riastrad };
    261  1.3  riastrad 
    262  1.3  riastrad 
    263  1.3  riastrad #define vmw_crtc_state_to_vcs(x) container_of(x, struct vmw_crtc_state, base)
    264  1.3  riastrad #define vmw_plane_state_to_vps(x) container_of(x, struct vmw_plane_state, base)
    265  1.3  riastrad #define vmw_connector_state_to_vcs(x) \
    266  1.3  riastrad 		container_of(x, struct vmw_connector_state, base)
    267  1.3  riastrad 
    268  1.3  riastrad /**
    269  1.3  riastrad  * Derived class for crtc state object
    270  1.3  riastrad  *
    271  1.3  riastrad  * @base DRM crtc object
    272  1.3  riastrad  */
    273  1.3  riastrad struct vmw_crtc_state {
    274  1.3  riastrad 	struct drm_crtc_state base;
    275  1.3  riastrad };
    276  1.3  riastrad 
    277  1.3  riastrad /**
    278  1.3  riastrad  * Derived class for plane state object
    279  1.3  riastrad  *
    280  1.3  riastrad  * @base DRM plane object
    281  1.3  riastrad  * @surf Display surface for STDU
    282  1.3  riastrad  * @bo display bo for SOU
    283  1.3  riastrad  * @content_fb_type Used by STDU.
    284  1.3  riastrad  * @bo_size Size of the bo, used by Screen Object Display Unit
    285  1.3  riastrad  * @pinned pin count for STDU display surface
    286  1.1  riastrad  */
    287  1.3  riastrad struct vmw_plane_state {
    288  1.3  riastrad 	struct drm_plane_state base;
    289  1.3  riastrad 	struct vmw_surface *surf;
    290  1.3  riastrad 	struct vmw_buffer_object *bo;
    291  1.3  riastrad 
    292  1.3  riastrad 	int content_fb_type;
    293  1.3  riastrad 	unsigned long bo_size;
    294  1.3  riastrad 
    295  1.3  riastrad 	int pinned;
    296  1.3  riastrad 
    297  1.3  riastrad 	/* For CPU Blit */
    298  1.3  riastrad 	unsigned int cpp;
    299  1.3  riastrad };
    300  1.1  riastrad 
    301  1.1  riastrad 
    302  1.1  riastrad /**
    303  1.3  riastrad  * Derived class for connector state object
    304  1.3  riastrad  *
    305  1.3  riastrad  * @base DRM connector object
    306  1.3  riastrad  * @is_implicit connector property
    307  1.3  riastrad  *
    308  1.3  riastrad  */
    309  1.3  riastrad struct vmw_connector_state {
    310  1.3  riastrad 	struct drm_connector_state base;
    311  1.3  riastrad 
    312  1.3  riastrad 	/**
    313  1.3  riastrad 	 * @gui_x:
    314  1.3  riastrad 	 *
    315  1.3  riastrad 	 * vmwgfx connector property representing the x position of this display
    316  1.3  riastrad 	 * unit (connector is synonymous to display unit) in overall topology.
    317  1.3  riastrad 	 * This is what the device expect as xRoot while creating screen.
    318  1.3  riastrad 	 */
    319  1.3  riastrad 	int gui_x;
    320  1.3  riastrad 
    321  1.3  riastrad 	/**
    322  1.3  riastrad 	 * @gui_y:
    323  1.3  riastrad 	 *
    324  1.3  riastrad 	 * vmwgfx connector property representing the y position of this display
    325  1.3  riastrad 	 * unit (connector is synonymous to display unit) in overall topology.
    326  1.3  riastrad 	 * This is what the device expect as yRoot while creating screen.
    327  1.3  riastrad 	 */
    328  1.3  riastrad 	int gui_y;
    329  1.3  riastrad };
    330  1.3  riastrad 
    331  1.3  riastrad /**
    332  1.1  riastrad  * Base class display unit.
    333  1.1  riastrad  *
    334  1.1  riastrad  * Since the SVGA hw doesn't have a concept of a crtc, encoder or connector
    335  1.1  riastrad  * so the display unit is all of them at the same time. This is true for both
    336  1.1  riastrad  * legacy multimon and screen objects.
    337  1.1  riastrad  */
    338  1.1  riastrad struct vmw_display_unit {
    339  1.1  riastrad 	struct drm_crtc crtc;
    340  1.1  riastrad 	struct drm_encoder encoder;
    341  1.1  riastrad 	struct drm_connector connector;
    342  1.3  riastrad 	struct drm_plane primary;
    343  1.3  riastrad 	struct drm_plane cursor;
    344  1.1  riastrad 
    345  1.1  riastrad 	struct vmw_surface *cursor_surface;
    346  1.3  riastrad 	struct vmw_buffer_object *cursor_bo;
    347  1.1  riastrad 	size_t cursor_age;
    348  1.1  riastrad 
    349  1.1  riastrad 	int cursor_x;
    350  1.1  riastrad 	int cursor_y;
    351  1.1  riastrad 
    352  1.1  riastrad 	int hotspot_x;
    353  1.1  riastrad 	int hotspot_y;
    354  1.2  riastrad 	s32 core_hotspot_x;
    355  1.2  riastrad 	s32 core_hotspot_y;
    356  1.1  riastrad 
    357  1.1  riastrad 	unsigned unit;
    358  1.1  riastrad 
    359  1.1  riastrad 	/*
    360  1.1  riastrad 	 * Prefered mode tracking.
    361  1.1  riastrad 	 */
    362  1.1  riastrad 	unsigned pref_width;
    363  1.1  riastrad 	unsigned pref_height;
    364  1.1  riastrad 	bool pref_active;
    365  1.1  riastrad 	struct drm_display_mode *pref_mode;
    366  1.1  riastrad 
    367  1.1  riastrad 	/*
    368  1.1  riastrad 	 * Gui positioning
    369  1.1  riastrad 	 */
    370  1.1  riastrad 	int gui_x;
    371  1.1  riastrad 	int gui_y;
    372  1.1  riastrad 	bool is_implicit;
    373  1.3  riastrad 	int set_gui_x;
    374  1.3  riastrad 	int set_gui_y;
    375  1.1  riastrad };
    376  1.1  riastrad 
    377  1.2  riastrad struct vmw_validation_ctx {
    378  1.2  riastrad 	struct vmw_resource *res;
    379  1.3  riastrad 	struct vmw_buffer_object *buf;
    380  1.2  riastrad };
    381  1.2  riastrad 
    382  1.1  riastrad #define vmw_crtc_to_du(x) \
    383  1.1  riastrad 	container_of(x, struct vmw_display_unit, crtc)
    384  1.1  riastrad #define vmw_connector_to_du(x) \
    385  1.1  riastrad 	container_of(x, struct vmw_display_unit, connector)
    386  1.1  riastrad 
    387  1.1  riastrad 
    388  1.1  riastrad /*
    389  1.1  riastrad  * Shared display unit functions - vmwgfx_kms.c
    390  1.1  riastrad  */
    391  1.2  riastrad void vmw_du_cleanup(struct vmw_display_unit *du);
    392  1.1  riastrad void vmw_du_crtc_save(struct drm_crtc *crtc);
    393  1.1  riastrad void vmw_du_crtc_restore(struct drm_crtc *crtc);
    394  1.3  riastrad int vmw_du_crtc_gamma_set(struct drm_crtc *crtc,
    395  1.1  riastrad 			   u16 *r, u16 *g, u16 *b,
    396  1.3  riastrad 			   uint32_t size,
    397  1.3  riastrad 			   struct drm_modeset_acquire_ctx *ctx);
    398  1.3  riastrad int vmw_du_connector_set_property(struct drm_connector *connector,
    399  1.3  riastrad 				  struct drm_property *property,
    400  1.3  riastrad 				  uint64_t val);
    401  1.3  riastrad int vmw_du_connector_atomic_set_property(struct drm_connector *connector,
    402  1.3  riastrad 					 struct drm_connector_state *state,
    403  1.3  riastrad 					 struct drm_property *property,
    404  1.3  riastrad 					 uint64_t val);
    405  1.3  riastrad int
    406  1.3  riastrad vmw_du_connector_atomic_get_property(struct drm_connector *connector,
    407  1.3  riastrad 				     const struct drm_connector_state *state,
    408  1.3  riastrad 				     struct drm_property *property,
    409  1.3  riastrad 				     uint64_t *val);
    410  1.2  riastrad int vmw_du_connector_dpms(struct drm_connector *connector, int mode);
    411  1.1  riastrad void vmw_du_connector_save(struct drm_connector *connector);
    412  1.1  riastrad void vmw_du_connector_restore(struct drm_connector *connector);
    413  1.1  riastrad enum drm_connector_status
    414  1.1  riastrad vmw_du_connector_detect(struct drm_connector *connector, bool force);
    415  1.1  riastrad int vmw_du_connector_fill_modes(struct drm_connector *connector,
    416  1.1  riastrad 				uint32_t max_width, uint32_t max_height);
    417  1.2  riastrad int vmw_kms_helper_dirty(struct vmw_private *dev_priv,
    418  1.2  riastrad 			 struct vmw_framebuffer *framebuffer,
    419  1.2  riastrad 			 const struct drm_clip_rect *clips,
    420  1.2  riastrad 			 const struct drm_vmw_rect *vclips,
    421  1.2  riastrad 			 s32 dest_x, s32 dest_y,
    422  1.2  riastrad 			 int num_clips,
    423  1.2  riastrad 			 int increment,
    424  1.2  riastrad 			 struct vmw_kms_dirty *dirty);
    425  1.2  riastrad 
    426  1.3  riastrad void vmw_kms_helper_validation_finish(struct vmw_private *dev_priv,
    427  1.3  riastrad 				      struct drm_file *file_priv,
    428  1.3  riastrad 				      struct vmw_validation_context *ctx,
    429  1.3  riastrad 				      struct vmw_fence_obj **out_fence,
    430  1.3  riastrad 				      struct drm_vmw_fence_rep __user *
    431  1.3  riastrad 				      user_fence_rep);
    432  1.2  riastrad int vmw_kms_readback(struct vmw_private *dev_priv,
    433  1.2  riastrad 		     struct drm_file *file_priv,
    434  1.2  riastrad 		     struct vmw_framebuffer *vfb,
    435  1.2  riastrad 		     struct drm_vmw_fence_rep __user *user_fence_rep,
    436  1.2  riastrad 		     struct drm_vmw_rect *vclips,
    437  1.2  riastrad 		     uint32_t num_clips);
    438  1.2  riastrad struct vmw_framebuffer *
    439  1.2  riastrad vmw_kms_new_framebuffer(struct vmw_private *dev_priv,
    440  1.3  riastrad 			struct vmw_buffer_object *bo,
    441  1.2  riastrad 			struct vmw_surface *surface,
    442  1.2  riastrad 			bool only_2d,
    443  1.3  riastrad 			const struct drm_mode_fb_cmd2 *mode_cmd);
    444  1.2  riastrad int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv,
    445  1.2  riastrad 			    unsigned unit,
    446  1.2  riastrad 			    u32 max_width,
    447  1.2  riastrad 			    u32 max_height,
    448  1.2  riastrad 			    struct drm_connector **p_con,
    449  1.2  riastrad 			    struct drm_crtc **p_crtc,
    450  1.2  riastrad 			    struct drm_display_mode **p_mode);
    451  1.2  riastrad void vmw_guess_mode_timing(struct drm_display_mode *mode);
    452  1.3  riastrad void vmw_kms_update_implicit_fb(struct vmw_private *dev_priv);
    453  1.3  riastrad void vmw_kms_create_implicit_placement_property(struct vmw_private *dev_priv);
    454  1.3  riastrad 
    455  1.3  riastrad /* Universal Plane Helpers */
    456  1.3  riastrad void vmw_du_primary_plane_destroy(struct drm_plane *plane);
    457  1.3  riastrad void vmw_du_cursor_plane_destroy(struct drm_plane *plane);
    458  1.3  riastrad 
    459  1.3  riastrad /* Atomic Helpers */
    460  1.3  riastrad int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
    461  1.3  riastrad 				      struct drm_plane_state *state);
    462  1.3  riastrad int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane,
    463  1.3  riastrad 				     struct drm_plane_state *state);
    464  1.3  riastrad void vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
    465  1.3  riastrad 				       struct drm_plane_state *old_state);
    466  1.3  riastrad int vmw_du_cursor_plane_prepare_fb(struct drm_plane *plane,
    467  1.3  riastrad 				   struct drm_plane_state *new_state);
    468  1.3  riastrad void vmw_du_plane_cleanup_fb(struct drm_plane *plane,
    469  1.3  riastrad 			     struct drm_plane_state *old_state);
    470  1.3  riastrad void vmw_du_plane_reset(struct drm_plane *plane);
    471  1.3  riastrad struct drm_plane_state *vmw_du_plane_duplicate_state(struct drm_plane *plane);
    472  1.3  riastrad void vmw_du_plane_destroy_state(struct drm_plane *plane,
    473  1.3  riastrad 				struct drm_plane_state *state);
    474  1.3  riastrad void vmw_du_plane_unpin_surf(struct vmw_plane_state *vps,
    475  1.3  riastrad 			     bool unreference);
    476  1.3  riastrad 
    477  1.3  riastrad int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
    478  1.3  riastrad 			     struct drm_crtc_state *state);
    479  1.3  riastrad void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
    480  1.3  riastrad 			      struct drm_crtc_state *old_crtc_state);
    481  1.3  riastrad void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
    482  1.3  riastrad 			      struct drm_crtc_state *old_crtc_state);
    483  1.3  riastrad void vmw_du_crtc_reset(struct drm_crtc *crtc);
    484  1.3  riastrad struct drm_crtc_state *vmw_du_crtc_duplicate_state(struct drm_crtc *crtc);
    485  1.3  riastrad void vmw_du_crtc_destroy_state(struct drm_crtc *crtc,
    486  1.3  riastrad 				struct drm_crtc_state *state);
    487  1.3  riastrad void vmw_du_connector_reset(struct drm_connector *connector);
    488  1.3  riastrad struct drm_connector_state *
    489  1.3  riastrad vmw_du_connector_duplicate_state(struct drm_connector *connector);
    490  1.3  riastrad 
    491  1.3  riastrad void vmw_du_connector_destroy_state(struct drm_connector *connector,
    492  1.3  riastrad 				    struct drm_connector_state *state);
    493  1.1  riastrad 
    494  1.1  riastrad /*
    495  1.1  riastrad  * Legacy display unit functions - vmwgfx_ldu.c
    496  1.1  riastrad  */
    497  1.2  riastrad int vmw_kms_ldu_init_display(struct vmw_private *dev_priv);
    498  1.2  riastrad int vmw_kms_ldu_close_display(struct vmw_private *dev_priv);
    499  1.3  riastrad int vmw_kms_ldu_do_bo_dirty(struct vmw_private *dev_priv,
    500  1.3  riastrad 			    struct vmw_framebuffer *framebuffer,
    501  1.3  riastrad 			    unsigned int flags, unsigned int color,
    502  1.3  riastrad 			    struct drm_clip_rect *clips,
    503  1.3  riastrad 			    unsigned int num_clips, int increment);
    504  1.2  riastrad int vmw_kms_update_proxy(struct vmw_resource *res,
    505  1.2  riastrad 			 const struct drm_clip_rect *clips,
    506  1.2  riastrad 			 unsigned num_clips,
    507  1.2  riastrad 			 int increment);
    508  1.1  riastrad 
    509  1.1  riastrad /*
    510  1.1  riastrad  * Screen Objects display functions - vmwgfx_scrn.c
    511  1.1  riastrad  */
    512  1.2  riastrad int vmw_kms_sou_init_display(struct vmw_private *dev_priv);
    513  1.2  riastrad int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv,
    514  1.2  riastrad 				 struct vmw_framebuffer *framebuffer,
    515  1.2  riastrad 				 struct drm_clip_rect *clips,
    516  1.2  riastrad 				 struct drm_vmw_rect *vclips,
    517  1.2  riastrad 				 struct vmw_resource *srf,
    518  1.2  riastrad 				 s32 dest_x,
    519  1.2  riastrad 				 s32 dest_y,
    520  1.2  riastrad 				 unsigned num_clips, int inc,
    521  1.3  riastrad 				 struct vmw_fence_obj **out_fence,
    522  1.3  riastrad 				 struct drm_crtc *crtc);
    523  1.3  riastrad int vmw_kms_sou_do_bo_dirty(struct vmw_private *dev_priv,
    524  1.3  riastrad 			    struct vmw_framebuffer *framebuffer,
    525  1.3  riastrad 			    struct drm_clip_rect *clips,
    526  1.3  riastrad 			    struct drm_vmw_rect *vclips,
    527  1.3  riastrad 			    unsigned int num_clips, int increment,
    528  1.3  riastrad 			    bool interruptible,
    529  1.3  riastrad 			    struct vmw_fence_obj **out_fence,
    530  1.3  riastrad 			    struct drm_crtc *crtc);
    531  1.2  riastrad int vmw_kms_sou_readback(struct vmw_private *dev_priv,
    532  1.2  riastrad 			 struct drm_file *file_priv,
    533  1.2  riastrad 			 struct vmw_framebuffer *vfb,
    534  1.2  riastrad 			 struct drm_vmw_fence_rep __user *user_fence_rep,
    535  1.2  riastrad 			 struct drm_vmw_rect *vclips,
    536  1.3  riastrad 			 uint32_t num_clips,
    537  1.3  riastrad 			 struct drm_crtc *crtc);
    538  1.2  riastrad 
    539  1.2  riastrad /*
    540  1.2  riastrad  * Screen Target Display Unit functions - vmwgfx_stdu.c
    541  1.2  riastrad  */
    542  1.2  riastrad int vmw_kms_stdu_init_display(struct vmw_private *dev_priv);
    543  1.2  riastrad int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv,
    544  1.2  riastrad 			       struct vmw_framebuffer *framebuffer,
    545  1.2  riastrad 			       struct drm_clip_rect *clips,
    546  1.2  riastrad 			       struct drm_vmw_rect *vclips,
    547  1.2  riastrad 			       struct vmw_resource *srf,
    548  1.2  riastrad 			       s32 dest_x,
    549  1.2  riastrad 			       s32 dest_y,
    550  1.2  riastrad 			       unsigned num_clips, int inc,
    551  1.3  riastrad 			       struct vmw_fence_obj **out_fence,
    552  1.3  riastrad 			       struct drm_crtc *crtc);
    553  1.2  riastrad int vmw_kms_stdu_dma(struct vmw_private *dev_priv,
    554  1.2  riastrad 		     struct drm_file *file_priv,
    555  1.2  riastrad 		     struct vmw_framebuffer *vfb,
    556  1.2  riastrad 		     struct drm_vmw_fence_rep __user *user_fence_rep,
    557  1.2  riastrad 		     struct drm_clip_rect *clips,
    558  1.2  riastrad 		     struct drm_vmw_rect *vclips,
    559  1.2  riastrad 		     uint32_t num_clips,
    560  1.2  riastrad 		     int increment,
    561  1.2  riastrad 		     bool to_surface,
    562  1.3  riastrad 		     bool interruptible,
    563  1.3  riastrad 		     struct drm_crtc *crtc);
    564  1.3  riastrad 
    565  1.3  riastrad int vmw_du_helper_plane_update(struct vmw_du_update_plane *update);
    566  1.3  riastrad 
    567  1.3  riastrad /**
    568  1.3  riastrad  * vmw_du_translate_to_crtc - Translate a rect from framebuffer to crtc
    569  1.3  riastrad  * @state: Plane state.
    570  1.3  riastrad  * @r: Rectangle to translate.
    571  1.3  riastrad  */
    572  1.3  riastrad static inline void vmw_du_translate_to_crtc(struct drm_plane_state *state,
    573  1.3  riastrad 					    struct drm_rect *r)
    574  1.3  riastrad {
    575  1.3  riastrad 	int translate_crtc_x = -((state->src_x >> 16) - state->crtc_x);
    576  1.3  riastrad 	int translate_crtc_y = -((state->src_y >> 16) - state->crtc_y);
    577  1.1  riastrad 
    578  1.3  riastrad 	drm_rect_translate(r, translate_crtc_x, translate_crtc_y);
    579  1.3  riastrad }
    580  1.1  riastrad 
    581  1.1  riastrad #endif
    582