Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 1 | /************************************************************************** |
| 2 | * |
| 3 | * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA |
| 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 | |
| 31 | #include "drmP.h" |
| 32 | #include "vmwgfx_drv.h" |
| 33 | |
Jakob Bornecrantz | 56d1c78 | 2011-10-04 20:13:22 +0200 | [diff] [blame] | 34 | #define VMWGFX_NUM_DISPLAY_UNITS 8 |
| 35 | |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 36 | |
| 37 | #define vmw_framebuffer_to_vfb(x) \ |
| 38 | container_of(x, struct vmw_framebuffer, base) |
| 39 | |
| 40 | /** |
| 41 | * Base class for framebuffers |
| 42 | * |
| 43 | * @pin is called the when ever a crtc uses this framebuffer |
| 44 | * @unpin is called |
| 45 | */ |
| 46 | struct vmw_framebuffer { |
| 47 | struct drm_framebuffer base; |
| 48 | int (*pin)(struct vmw_framebuffer *fb); |
| 49 | int (*unpin)(struct vmw_framebuffer *fb); |
Jakob Bornecrantz | 2fcd5a7 | 2011-10-04 20:13:26 +0200 | [diff] [blame^] | 50 | bool dmabuf; |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | |
| 54 | #define vmw_crtc_to_du(x) \ |
| 55 | container_of(x, struct vmw_display_unit, crtc) |
| 56 | |
| 57 | /* |
| 58 | * Basic cursor manipulation |
| 59 | */ |
| 60 | int vmw_cursor_update_image(struct vmw_private *dev_priv, |
| 61 | u32 *image, u32 width, u32 height, |
| 62 | u32 hotspotX, u32 hotspotY); |
| 63 | void vmw_cursor_update_position(struct vmw_private *dev_priv, |
| 64 | bool show, int x, int y); |
| 65 | |
| 66 | /** |
| 67 | * Base class display unit. |
| 68 | * |
| 69 | * Since the SVGA hw doesn't have a concept of a crtc, encoder or connector |
| 70 | * so the display unit is all of them at the same time. This is true for both |
| 71 | * legacy multimon and screen objects. |
| 72 | */ |
| 73 | struct vmw_display_unit { |
| 74 | struct drm_crtc crtc; |
| 75 | struct drm_encoder encoder; |
| 76 | struct drm_connector connector; |
| 77 | |
| 78 | struct vmw_surface *cursor_surface; |
| 79 | struct vmw_dma_buffer *cursor_dmabuf; |
| 80 | size_t cursor_age; |
| 81 | |
| 82 | int cursor_x; |
| 83 | int cursor_y; |
| 84 | |
| 85 | int hotspot_x; |
| 86 | int hotspot_y; |
| 87 | |
| 88 | unsigned unit; |
Jakob Bornecrantz | 626ab77 | 2011-10-04 20:13:20 +0200 | [diff] [blame] | 89 | |
| 90 | /* |
| 91 | * Prefered mode tracking. |
| 92 | */ |
| 93 | unsigned pref_width; |
| 94 | unsigned pref_height; |
| 95 | bool pref_active; |
| 96 | struct drm_display_mode *pref_mode; |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 97 | }; |
| 98 | |
Jakob Bornecrantz | 2fcd5a7 | 2011-10-04 20:13:26 +0200 | [diff] [blame^] | 99 | #define vmw_crtc_to_du(x) \ |
| 100 | container_of(x, struct vmw_display_unit, crtc) |
Jakob Bornecrantz | 626ab77 | 2011-10-04 20:13:20 +0200 | [diff] [blame] | 101 | #define vmw_connector_to_du(x) \ |
| 102 | container_of(x, struct vmw_display_unit, connector) |
| 103 | |
| 104 | |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 105 | /* |
| 106 | * Shared display unit functions - vmwgfx_kms.c |
| 107 | */ |
| 108 | void vmw_display_unit_cleanup(struct vmw_display_unit *du); |
Jakob Bornecrantz | 626ab77 | 2011-10-04 20:13:20 +0200 | [diff] [blame] | 109 | void vmw_du_crtc_save(struct drm_crtc *crtc); |
| 110 | void vmw_du_crtc_restore(struct drm_crtc *crtc); |
| 111 | void vmw_du_crtc_gamma_set(struct drm_crtc *crtc, |
| 112 | u16 *r, u16 *g, u16 *b, |
| 113 | uint32_t start, uint32_t size); |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 114 | int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, |
| 115 | uint32_t handle, uint32_t width, uint32_t height); |
| 116 | int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y); |
Jakob Bornecrantz | 626ab77 | 2011-10-04 20:13:20 +0200 | [diff] [blame] | 117 | void vmw_du_connector_dpms(struct drm_connector *connector, int mode); |
| 118 | void vmw_du_connector_save(struct drm_connector *connector); |
| 119 | void vmw_du_connector_restore(struct drm_connector *connector); |
| 120 | enum drm_connector_status |
| 121 | vmw_du_connector_detect(struct drm_connector *connector, bool force); |
| 122 | int vmw_du_connector_fill_modes(struct drm_connector *connector, |
| 123 | uint32_t max_width, uint32_t max_height); |
| 124 | int vmw_du_connector_set_property(struct drm_connector *connector, |
| 125 | struct drm_property *property, |
| 126 | uint64_t val); |
| 127 | int vmw_du_update_layout(struct vmw_private *dev_priv, unsigned num, |
| 128 | struct drm_vmw_rect *rects); |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 129 | |
| 130 | /* |
Jakob Bornecrantz | d8bd19d | 2010-06-01 11:54:20 +0200 | [diff] [blame] | 131 | * Legacy display unit functions - vmwgfx_ldu.c |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 132 | */ |
| 133 | int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv); |
| 134 | int vmw_kms_close_legacy_display_system(struct vmw_private *dev_priv); |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 135 | |
Jakob Bornecrantz | 56d1c78 | 2011-10-04 20:13:22 +0200 | [diff] [blame] | 136 | /* |
| 137 | * Screen Objects display functions - vmwgfx_scrn.c |
| 138 | */ |
| 139 | int vmw_kms_init_screen_object_display(struct vmw_private *dev_priv); |
| 140 | int vmw_kms_close_screen_object_display(struct vmw_private *dev_priv); |
| 141 | int vmw_kms_sou_update_layout(struct vmw_private *dev_priv, unsigned num, |
| 142 | struct drm_vmw_rect *rects); |
| 143 | |
Jakob Bornecrantz | fb1d973 | 2009-12-10 00:19:58 +0000 | [diff] [blame] | 144 | #endif |