Subversion Repositories Kolibri OS

Rev

Rev 4111 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4111 Rev 6296
Line 1... Line 1...
1
/**************************************************************************
1
/**************************************************************************
2
 *
2
 *
3
 * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA
3
 * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
4
 * All Rights Reserved.
4
 * All Rights Reserved.
5
 *
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a
6
 * Permission is hereby granted, free of charge, to any person obtaining a
7
 * copy of this software and associated documentation files (the
7
 * copy of this software and associated documentation files (the
8
 * "Software"), to deal in the Software without restriction, including
8
 * "Software"), to deal in the Software without restriction, including
Line 30... Line 30...
30
 
30
 
31
#include 
31
#include 
32
#include 
32
#include 
Line -... Line 33...
-
 
33
#include "vmwgfx_drv.h"
-
 
34
 
-
 
35
/**
-
 
36
 * struct vmw_kms_dirty - closure structure for the vmw_kms_helper_dirty
-
 
37
 * function.
-
 
38
 *
-
 
39
 * @fifo_commit: Callback that is called once for each display unit after
-
 
40
 * all clip rects. This function must commit the fifo space reserved by the
-
 
41
 * helper. Set up by the caller.
-
 
42
 * @clip: Callback that is called for each cliprect on each display unit.
-
 
43
 * Set up by the caller.
-
 
44
 * @fifo_reserve_size: Fifo size that the helper should try to allocat for
-
 
45
 * each display unit. Set up by the caller.
-
 
46
 * @dev_priv: Pointer to the device private. Set up by the helper.
-
 
47
 * @unit: The current display unit. Set up by the helper before a call to @clip.
-
 
48
 * @cmd: The allocated fifo space. Set up by the helper before the first @clip
-
 
49
 * call.
-
 
50
 * @num_hits: Number of clip rect commands for this display unit.
-
 
51
 * Cleared by the helper before the first @clip call. Updated by the @clip
-
 
52
 * callback.
-
 
53
 * @fb_x: Clip rect left side in framebuffer coordinates.
-
 
54
 * @fb_y: Clip rect right side in framebuffer coordinates.
-
 
55
 * @unit_x1: Clip rect left side in crtc coordinates.
-
 
56
 * @unit_y1: Clip rect top side in crtc coordinates.
-
 
57
 * @unit_x2: Clip rect right side in crtc coordinates.
-
 
58
 * @unit_y2: Clip rect bottom side in crtc coordinates.
-
 
59
 *
-
 
60
 * The clip rect coordinates are updated by the helper for each @clip call.
-
 
61
 * Note that this may be derived from if more info needs to be passed between
-
 
62
 * helper caller and helper callbacks.
-
 
63
 */
-
 
64
struct vmw_kms_dirty {
-
 
65
	void (*fifo_commit)(struct vmw_kms_dirty *);
-
 
66
	void (*clip)(struct vmw_kms_dirty *);
-
 
67
	size_t fifo_reserve_size;
-
 
68
	struct vmw_private *dev_priv;
-
 
69
	struct vmw_display_unit *unit;
-
 
70
	void *cmd;
-
 
71
	u32 num_hits;
-
 
72
	s32 fb_x;
-
 
73
	s32 fb_y;
-
 
74
	s32 unit_x1;
-
 
75
	s32 unit_y1;
-
 
76
	s32 unit_x2;
-
 
77
	s32 unit_y2;
33
#include "vmwgfx_drv.h"
78
};
Line 34... Line 79...
34
 
79
 
35
#define VMWGFX_NUM_DISPLAY_UNITS 1
80
#define VMWGFX_NUM_DISPLAY_UNITS 1
-
 
81
 
-
 
82
 
-
 
83
#define vmw_framebuffer_to_vfb(x) \
-
 
84
	container_of(x, struct vmw_framebuffer, base)
Line 36... Line 85...
36
 
85
#define vmw_framebuffer_to_vfbs(x) \
37
 
86
	container_of(x, struct vmw_framebuffer_surface, base.base)
38
#define vmw_framebuffer_to_vfb(x) \
87
#define vmw_framebuffer_to_vfbd(x) \
39
	container_of(x, struct vmw_framebuffer, base)
88
	container_of(x, struct vmw_framebuffer_dmabuf, base.base)
Line 51... Line 100...
51
	bool dmabuf;
100
	bool dmabuf;
52
	struct ttm_base_object *user_obj;
101
	struct ttm_base_object *user_obj;
53
	uint32_t user_handle;
102
	uint32_t user_handle;
54
};
103
};
Line -... Line 104...
-
 
104
 
-
 
105
/*
-
 
106
 * Clip rectangle
-
 
107
 */
-
 
108
struct vmw_clip_rect {
-
 
109
	int x1, x2, y1, y2;
-
 
110
};
-
 
111
 
-
 
112
struct vmw_framebuffer_surface {
-
 
113
	struct vmw_framebuffer base;
-
 
114
	struct vmw_surface *surface;
-
 
115
	struct vmw_dma_buffer *buffer;
-
 
116
	struct list_head head;
-
 
117
	bool is_dmabuf_proxy;  /* true if this is proxy surface for DMA buf */
-
 
118
};
-
 
119
 
-
 
120
 
-
 
121
struct vmw_framebuffer_dmabuf {
-
 
122
	struct vmw_framebuffer base;
-
 
123
	struct vmw_dma_buffer *buffer;
Line 55... Line -...
55
 
-
 
56
 
-
 
Line 57... Line 124...
57
#define vmw_crtc_to_du(x) \
124
};
58
	container_of(x, struct vmw_display_unit, crtc)
125
 
59
 
126
 
60
/*
127
/*
Line 90... Line 157...
90
	int cursor_x;
157
	int cursor_x;
91
	int cursor_y;
158
	int cursor_y;
Line 92... Line 159...
92
 
159
 
93
	int hotspot_x;
160
	int hotspot_x;
-
 
161
	int hotspot_y;
-
 
162
	s32 core_hotspot_x;
Line 94... Line 163...
94
	int hotspot_y;
163
	s32 core_hotspot_y;
Line 95... Line 164...
95
 
164
 
96
	unsigned unit;
165
	unsigned unit;
Line 118... Line 187...
118
 
187
 
119
 
188
 
120
/*
189
/*
121
 * Shared display unit functions - vmwgfx_kms.c
190
 * Shared display unit functions - vmwgfx_kms.c
122
 */
-
 
123
void vmw_display_unit_cleanup(struct vmw_display_unit *du);
-
 
124
int vmw_du_page_flip(struct drm_crtc *crtc,
-
 
125
		     struct drm_framebuffer *fb,
-
 
126
		     struct drm_pending_vblank_event *event,
191
 */
127
		     uint32_t page_flip_flags);
192
void vmw_du_cleanup(struct vmw_display_unit *du);
128
void vmw_du_crtc_save(struct drm_crtc *crtc);
193
void vmw_du_crtc_save(struct drm_crtc *crtc);
129
void vmw_du_crtc_restore(struct drm_crtc *crtc);
194
void vmw_du_crtc_restore(struct drm_crtc *crtc);
130
void vmw_du_crtc_gamma_set(struct drm_crtc *crtc,
195
void vmw_du_crtc_gamma_set(struct drm_crtc *crtc,
131
			   u16 *r, u16 *g, u16 *b,
196
			   u16 *r, u16 *g, u16 *b,
132
			   uint32_t start, uint32_t size);
197
			   uint32_t start, uint32_t size);
-
 
198
int vmw_du_crtc_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
133
int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
199
			    uint32_t handle, uint32_t width, uint32_t height,
134
			   uint32_t handle, uint32_t width, uint32_t height);
200
			    int32_t hot_x, int32_t hot_y);
135
int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);
201
int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);
136
void vmw_du_connector_dpms(struct drm_connector *connector, int mode);
202
int vmw_du_connector_dpms(struct drm_connector *connector, int mode);
137
void vmw_du_connector_save(struct drm_connector *connector);
203
void vmw_du_connector_save(struct drm_connector *connector);
138
void vmw_du_connector_restore(struct drm_connector *connector);
204
void vmw_du_connector_restore(struct drm_connector *connector);
139
enum drm_connector_status
205
enum drm_connector_status
140
vmw_du_connector_detect(struct drm_connector *connector, bool force);
206
vmw_du_connector_detect(struct drm_connector *connector, bool force);
141
int vmw_du_connector_fill_modes(struct drm_connector *connector,
207
int vmw_du_connector_fill_modes(struct drm_connector *connector,
142
				uint32_t max_width, uint32_t max_height);
208
				uint32_t max_width, uint32_t max_height);
143
int vmw_du_connector_set_property(struct drm_connector *connector,
209
int vmw_du_connector_set_property(struct drm_connector *connector,
-
 
210
				  struct drm_property *property,
-
 
211
				  uint64_t val);
-
 
212
int vmw_kms_helper_dirty(struct vmw_private *dev_priv,
-
 
213
			 struct vmw_framebuffer *framebuffer,
-
 
214
			 const struct drm_clip_rect *clips,
-
 
215
			 const struct drm_vmw_rect *vclips,
-
 
216
			 s32 dest_x, s32 dest_y,
-
 
217
			 int num_clips,
144
				  struct drm_property *property,
218
			 int increment,
-
 
219
			 struct vmw_kms_dirty *dirty);
-
 
220
 
-
 
221
int vmw_kms_helper_buffer_prepare(struct vmw_private *dev_priv,
-
 
222
				  struct vmw_dma_buffer *buf,
-
 
223
				  bool interruptible,
-
 
224
				  bool validate_as_mob);
-
 
225
void vmw_kms_helper_buffer_revert(struct vmw_dma_buffer *buf);
-
 
226
void vmw_kms_helper_buffer_finish(struct vmw_private *dev_priv,
-
 
227
				  struct drm_file *file_priv,
-
 
228
				  struct vmw_dma_buffer *buf,
-
 
229
				  struct vmw_fence_obj **out_fence,
-
 
230
				  struct drm_vmw_fence_rep __user *
-
 
231
				  user_fence_rep);
-
 
232
int vmw_kms_helper_resource_prepare(struct vmw_resource *res,
-
 
233
				    bool interruptible);
-
 
234
void vmw_kms_helper_resource_revert(struct vmw_resource *res);
-
 
235
void vmw_kms_helper_resource_finish(struct vmw_resource *res,
-
 
236
				    struct vmw_fence_obj **out_fence);
-
 
237
int vmw_kms_readback(struct vmw_private *dev_priv,
-
 
238
		     struct drm_file *file_priv,
-
 
239
		     struct vmw_framebuffer *vfb,
-
 
240
		     struct drm_vmw_fence_rep __user *user_fence_rep,
-
 
241
		     struct drm_vmw_rect *vclips,
-
 
242
		     uint32_t num_clips);
-
 
243
struct vmw_framebuffer *
-
 
244
vmw_kms_new_framebuffer(struct vmw_private *dev_priv,
-
 
245
			struct vmw_dma_buffer *dmabuf,
-
 
246
			struct vmw_surface *surface,
-
 
247
			bool only_2d,
-
 
248
			const struct drm_mode_fb_cmd *mode_cmd);
-
 
249
int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv,
-
 
250
			    unsigned unit,
-
 
251
			    u32 max_width,
-
 
252
			    u32 max_height,
-
 
253
			    struct drm_connector **p_con,
-
 
254
			    struct drm_crtc **p_crtc,
Line 145... Line 255...
145
				  uint64_t val);
255
			    struct drm_display_mode **p_mode);
146
 
256
void vmw_guess_mode_timing(struct drm_display_mode *mode);
147
 
257
 
148
/*
258
/*
149
 * Legacy display unit functions - vmwgfx_ldu.c
259
 * Legacy display unit functions - vmwgfx_ldu.c
-
 
260
 */
-
 
261
int vmw_kms_ldu_init_display(struct vmw_private *dev_priv);
-
 
262
int vmw_kms_ldu_close_display(struct vmw_private *dev_priv);
-
 
263
int vmw_kms_ldu_do_dmabuf_dirty(struct vmw_private *dev_priv,
-
 
264
				struct vmw_framebuffer *framebuffer,
-
 
265
				unsigned flags, unsigned color,
-
 
266
				struct drm_clip_rect *clips,
-
 
267
				unsigned num_clips, int increment);
-
 
268
int vmw_kms_update_proxy(struct vmw_resource *res,
Line 150... Line 269...
150
 */
269
			 const struct drm_clip_rect *clips,
151
int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv);
270
			 unsigned num_clips,
152
int vmw_kms_close_legacy_display_system(struct vmw_private *dev_priv);
271
			 int increment);
153
 
272
 
154
/*
273
/*
155
 * Screen Objects display functions - vmwgfx_scrn.c
274
 * Screen Objects display functions - vmwgfx_scrn.c
-
 
275
 */
-
 
276
int vmw_kms_sou_init_display(struct vmw_private *dev_priv);
156
 */
277
int vmw_kms_sou_close_display(struct vmw_private *dev_priv);
-
 
278
int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv,
-
 
279
				 struct vmw_framebuffer *framebuffer,
-
 
280
				 struct drm_clip_rect *clips,
-
 
281
				 struct drm_vmw_rect *vclips,
-
 
282
				 struct vmw_resource *srf,
157
int vmw_kms_init_screen_object_display(struct vmw_private *dev_priv);
283
				 s32 dest_x,
-
 
284
				 s32 dest_y,
158
int vmw_kms_close_screen_object_display(struct vmw_private *dev_priv);
285
				 unsigned num_clips, int inc,
-
 
286
				 struct vmw_fence_obj **out_fence);
-
 
287
int vmw_kms_sou_do_dmabuf_dirty(struct vmw_private *dev_priv,
-
 
288
				struct vmw_framebuffer *framebuffer,
-
 
289
				struct drm_clip_rect *clips,
-
 
290
				unsigned num_clips, int increment,
-
 
291
				bool interruptible,
-
 
292
				struct vmw_fence_obj **out_fence);
-
 
293
int vmw_kms_sou_readback(struct vmw_private *dev_priv,
-
 
294
			 struct drm_file *file_priv,
-
 
295
			 struct vmw_framebuffer *vfb,
-
 
296
			 struct drm_vmw_fence_rep __user *user_fence_rep,
-
 
297
			 struct drm_vmw_rect *vclips,
-
 
298
			 uint32_t num_clips);
-
 
299
 
-
 
300
/*
159
int vmw_kms_sou_update_layout(struct vmw_private *dev_priv, unsigned num,
301
 * Screen Target Display Unit functions - vmwgfx_stdu.c
-
 
302
 */
160
			      struct drm_vmw_rect *rects);
303
int vmw_kms_stdu_init_display(struct vmw_private *dev_priv);
-
 
304
int vmw_kms_stdu_close_display(struct vmw_private *dev_priv);
-
 
305
int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv,
-
 
306
			       struct vmw_framebuffer *framebuffer,
-
 
307
			       struct drm_clip_rect *clips,
-
 
308
			       struct drm_vmw_rect *vclips,
-
 
309
			       struct vmw_resource *srf,
-
 
310
			       s32 dest_x,
-
 
311
			       s32 dest_y,
-
 
312
			       unsigned num_clips, int inc,
-
 
313
			       struct vmw_fence_obj **out_fence);
-
 
314
int vmw_kms_stdu_dma(struct vmw_private *dev_priv,
-
 
315
		     struct drm_file *file_priv,
-
 
316
		     struct vmw_framebuffer *vfb,
-
 
317
		     struct drm_vmw_fence_rep __user *user_fence_rep,
-
 
318
		     struct drm_clip_rect *clips,
-
 
319
		     struct drm_vmw_rect *vclips,
Line 161... Line 320...
161
bool vmw_kms_screen_object_flippable(struct vmw_private *dev_priv,
320
		     uint32_t num_clips,