vmwgfx: Make the preferred autofit mode have a 60Hz vrefresh
[deliverable/linux.git] / drivers / gpu / drm / vmwgfx / vmwgfx_kms.h
CommitLineData
fb1d9738
JB
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
56d1c78d
JB
34#define VMWGFX_NUM_DISPLAY_UNITS 8
35
fb1d9738
JB
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 */
46struct vmw_framebuffer {
47 struct drm_framebuffer base;
48 int (*pin)(struct vmw_framebuffer *fb);
49 int (*unpin)(struct vmw_framebuffer *fb);
2fcd5a73 50 bool dmabuf;
90ff18bc
TH
51 struct ttm_base_object *user_obj;
52 uint32_t user_handle;
fb1d9738
JB
53};
54
55
56#define vmw_crtc_to_du(x) \
57 container_of(x, struct vmw_display_unit, crtc)
58
59/*
60 * Basic cursor manipulation
61 */
62int vmw_cursor_update_image(struct vmw_private *dev_priv,
63 u32 *image, u32 width, u32 height,
64 u32 hotspotX, u32 hotspotY);
65void vmw_cursor_update_position(struct vmw_private *dev_priv,
66 bool show, int x, int y);
67
68/**
69 * Base class display unit.
70 *
71 * Since the SVGA hw doesn't have a concept of a crtc, encoder or connector
72 * so the display unit is all of them at the same time. This is true for both
73 * legacy multimon and screen objects.
74 */
75struct vmw_display_unit {
76 struct drm_crtc crtc;
77 struct drm_encoder encoder;
78 struct drm_connector connector;
79
80 struct vmw_surface *cursor_surface;
81 struct vmw_dma_buffer *cursor_dmabuf;
82 size_t cursor_age;
83
84 int cursor_x;
85 int cursor_y;
86
87 int hotspot_x;
88 int hotspot_y;
89
90 unsigned unit;
626ab771
JB
91
92 /*
93 * Prefered mode tracking.
94 */
95 unsigned pref_width;
96 unsigned pref_height;
97 bool pref_active;
98 struct drm_display_mode *pref_mode;
cd2b89e7
TH
99
100 /*
101 * Gui positioning
102 */
103 int gui_x;
104 int gui_y;
fb1d9738
JB
105};
106
2fcd5a73
JB
107#define vmw_crtc_to_du(x) \
108 container_of(x, struct vmw_display_unit, crtc)
626ab771
JB
109#define vmw_connector_to_du(x) \
110 container_of(x, struct vmw_display_unit, connector)
111
112
fb1d9738
JB
113/*
114 * Shared display unit functions - vmwgfx_kms.c
115 */
116void vmw_display_unit_cleanup(struct vmw_display_unit *du);
626ab771
JB
117void vmw_du_crtc_save(struct drm_crtc *crtc);
118void vmw_du_crtc_restore(struct drm_crtc *crtc);
119void vmw_du_crtc_gamma_set(struct drm_crtc *crtc,
120 u16 *r, u16 *g, u16 *b,
121 uint32_t start, uint32_t size);
fb1d9738
JB
122int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
123 uint32_t handle, uint32_t width, uint32_t height);
124int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);
626ab771
JB
125void vmw_du_connector_dpms(struct drm_connector *connector, int mode);
126void vmw_du_connector_save(struct drm_connector *connector);
127void vmw_du_connector_restore(struct drm_connector *connector);
128enum drm_connector_status
129vmw_du_connector_detect(struct drm_connector *connector, bool force);
130int vmw_du_connector_fill_modes(struct drm_connector *connector,
131 uint32_t max_width, uint32_t max_height);
132int vmw_du_connector_set_property(struct drm_connector *connector,
133 struct drm_property *property,
134 uint64_t val);
cd2b89e7 135
fb1d9738
JB
136
137/*
d8bd19d2 138 * Legacy display unit functions - vmwgfx_ldu.c
fb1d9738
JB
139 */
140int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv);
141int vmw_kms_close_legacy_display_system(struct vmw_private *dev_priv);
142
56d1c78d
JB
143/*
144 * Screen Objects display functions - vmwgfx_scrn.c
145 */
146int vmw_kms_init_screen_object_display(struct vmw_private *dev_priv);
147int vmw_kms_close_screen_object_display(struct vmw_private *dev_priv);
148int vmw_kms_sou_update_layout(struct vmw_private *dev_priv, unsigned num,
149 struct drm_vmw_rect *rects);
150
fb1d9738 151#endif
This page took 0.146246 seconds and 5 git commands to generate.