~gma500/+junk/emgd152-natty

« back to all changes in this revision

Viewing changes to emgd-dkms-1.5.15.3082/include/igd.h

  • Committer: Luca Forina
  • Date: 2011-02-06 15:11:54 UTC
  • Revision ID: luca.forina@gmail.com-20110206151154-9dzn5ugxjub9qenb
Upload Emgd 1.5.2 for Natty (override Maverick)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- pse-c -*-
 
2
 *-----------------------------------------------------------------------------
 
3
 * Filename: igd.h
 
4
 * $Revision: 1.12 $
 
5
 *-----------------------------------------------------------------------------
 
6
 * Copyright © 2002-2010, Intel Corporation.
 
7
 *
 
8
 * This program is free software; you can redistribute it and/or modify it
 
9
 * under the terms and conditions of the GNU General Public License,
 
10
 * version 2, as published by the Free Software Foundation.
 
11
 *
 
12
 * This program is distributed in the hope it will be useful, but WITHOUT
 
13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
14
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 
15
 * more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License along with
 
18
 * this program; if not, write to the Free Software Foundation, Inc.,
 
19
 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
 
20
 *
 
21
 *-----------------------------------------------------------------------------
 
22
 * Description:
 
23
 *  This file contains the top level dispatch table definition and includes
 
24
 *  the common header files necessary to interface with the shingle springs
 
25
 *  graphics driver.
 
26
 *-----------------------------------------------------------------------------
 
27
 */
 
28
 
 
29
#ifndef _IGD_H
 
30
#define _IGD_H
 
31
 
 
32
#include <config.h>
 
33
#include <igd_errno.h>
 
34
#include <igd_mode.h>
 
35
#include <igd_appcontext.h>
 
36
#include <igd_render.h>
 
37
#include <igd_2d.h>
 
38
#include <igd_pd.h>
 
39
#include <igd_gmm.h>
 
40
#include <igd_rb.h>
 
41
#include <igd_ovl.h>
 
42
#include <emgd_shared.h>
 
43
 
 
44
/*
 
45
 * This is needed so that 16bit ports can use a far pointer on some
 
46
 * of the prototypes.
 
47
 */
 
48
#ifndef FAR
 
49
#define FAR
 
50
#endif
 
51
 
 
52
 
 
53
 
 
54
/*!
 
55
 * @ingroup render_group
 
56
 * @brief Dispatch table for accessing all runtime driver functions.
 
57
 *
 
58
 * This is the dispatch table for the driver. All rendering and driver
 
59
 * manipulation functionality is done by calling functions within this
 
60
 * dispatch table.
 
61
 * This dispatch table will be populated during the igd_module_init()
 
62
 * function call. Upon returning from that call all usable members
 
63
 * will be populated. Any members left as NULL are not supported in the
 
64
 * current HAL configuration and cannot be used.
 
65
 */
 
66
typedef struct _igd_dispatch {
 
67
        /*!
 
68
         * Save the register state of the graphics engine.
 
69
         * This function is optional in the HAL. The caller must check that it
 
70
         * is non-null before calling.
 
71
         *
 
72
         * @param driver_handle The driver handle returned from igd_driver_init().
 
73
         *
 
74
         * @param flags Any combination of the @ref driver_save_flags
 
75
         *  flags which control the types of state to be saved.
 
76
         *
 
77
         * @return 0 on Success
 
78
         * @return <0 on Error
 
79
         */
 
80
        int (*driver_save)(igd_driver_h driver_handle,
 
81
                const unsigned long flags);
 
82
 
 
83
        /*!
 
84
         * Restore the graphics engine to a previously saved state.
 
85
         * This function is optional in the HAL. The caller must check that it
 
86
         * is non-null before calling.
 
87
         *
 
88
         * @param driver_handle The driver handle returned from igd_driver_init().
 
89
         *
 
90
         * @return 0 on Success
 
91
         * @return <0 on Error
 
92
         */
 
93
        int (*driver_restore)(igd_driver_h driver_handle);
 
94
 
 
95
        /*!
 
96
         * Save all driver registers and then restore all
 
97
         *   registers from a previously saved set.
 
98
         * This function is optional in the HAL. The caller must check that it
 
99
         * is non-null before calling.
 
100
         *
 
101
         * @param driver_handle The driver handle returned from igd_driver_init().
 
102
         *
 
103
         * @return 0 on Success
 
104
         * @return <0 on Error
 
105
         */
 
106
        int (*driver_save_restore)(igd_driver_h driver_handle);
 
107
 
 
108
        /*!
 
109
         * Gets the value of a runtime driver parameter. These parameters are
 
110
         * each defined with a unique ID and may be altered at runtime.
 
111
         *
 
112
         * @note: There is a wrapper for this function in the dispatch table that
 
113
         * takes a display instead of a driver handle. This version is for use
 
114
         * when displays are not yet available.
 
115
         *
 
116
         * @return 0 Success
 
117
         * @return -IGD_INVAL Error
 
118
         */
 
119
        int (*get_param)(igd_display_h display_handle, unsigned long id,
 
120
                unsigned long *value);
 
121
 
 
122
        /*!
 
123
         * Sets the value of a runtime driver parameter. These parameters are
 
124
         * each defined with a unique ID and may be altered at runtime.
 
125
         *
 
126
         * Note: There is a wrapper for this function in the dispatch table that
 
127
         * takes a display instead of a driver handle. This version is for use
 
128
         * when displays are not yet available.
 
129
         *
 
130
         * @return 0 Success
 
131
         * @return  -IGD_INVAL Error
 
132
         */
 
133
        int (*set_param)(igd_display_h display_handle, unsigned long id,
 
134
                unsigned long value);
 
135
 
 
136
        /*!
 
137
         *  This function returns the list of available pixel formats for the
 
138
         *  framebuffer and the list of available pixel formats for the cursor.
 
139
         *
 
140
         *  Both lists end with NULL.  They are read only and should
 
141
         *  not be modified.
 
142
         *
 
143
         *  @bug To be converted to take a driver handle for IEGD 5.1
 
144
         *
 
145
         *  @param display_handle A igd_display_h type returned from a previous
 
146
         *    display->alter_displays() call.
 
147
         *
 
148
         *  fb_list_pfs  - Returns the list of pixel formats for the framebuffer.
 
149
         *
 
150
         *  cu_list_pfs - Returns the list of pixel formats for the cursor.
 
151
         *
 
152
         *
 
153
         * Returns:
 
154
         *  0: Success
 
155
         *  -IGD_INVAL: Error;
 
156
         */
 
157
        int (*get_pixelformats)(igd_display_h display_handle,
 
158
                unsigned long **fb_list_pfs, unsigned long **cu_list_pfs,
 
159
                unsigned long **overlay_pfs, unsigned long **render_pfs,
 
160
                unsigned long **texture_pfs);
 
161
 
 
162
        /*!
 
163
         * @brief Return the list of available DCs.
 
164
         *
 
165
         * query_dc() returns the live zero terminated Display Configuration list.
 
166
         *  All usable display configurations are returned from the HAL. The IAL
 
167
         *  must select one from the list when calling alter_displays().
 
168
         *
 
169
         * @param driver_handle The driver handle returned from igd_driver_init()
 
170
         *
 
171
         * @param dc_list The returned display configuration(s) list. The IAL
 
172
         *  should use a dc from the list when calling alter_displays(). The
 
173
         *  dc_list is zero terminated and live. It should not be altered by the
 
174
         *  IAL. See @ref dc_defines
 
175
         *
 
176
         * @param flags modifies the behavior of the function.
 
177
         *   See: @ref query_dc_flags
 
178
         *
 
179
         * @return 0: Success.
 
180
         * @return -IGD_INVAL:  Otherwise
 
181
         */
 
182
        int (*query_dc)(igd_driver_h driver_handle, unsigned long request,
 
183
                unsigned long **dc_list, unsigned long flags);
 
184
 
 
185
        /*!
 
186
         * Returns a live copy of the current mode list
 
187
         * for the requested display. This mode list will be for the master
 
188
         * port on the pipe and therefore may be the mode list for a TWIN
 
189
         * of the display requested.
 
190
         *
 
191
         * @param driver_handle The driver handle returned from igd_driver_init()
 
192
         *
 
193
         * @param dc The display configuration data to use when determining the
 
194
         *  available modes. See @ref dc_defines
 
195
         *
 
196
         * @param mode_list The returned mode list. This data should be freed by
 
197
         *   calling free_modes() unless the QUERY_LIVE_MODES flag was passed, in
 
198
         *   that case the live, in-use, data structure is returned. It should not
 
199
         *   be modified or freed.
 
200
         *
 
201
         * @param flags Flags to modify the operation of the function. Flags
 
202
         *   may contain any combination of the IGD_QUERY_* flags.
 
203
         *   See: @ref query_mode_list_flags
 
204
         *
 
205
         * @return 0: Success.
 
206
         * @return -IGD_ERROR_INVAL:  Otherwise
 
207
         */
 
208
        int (*query_mode_list)(igd_driver_h driver_handle, unsigned long dc,
 
209
                igd_display_info_t **mode_list, unsigned long flags);
 
210
 
 
211
        /*!
 
212
         * Free modes that were returned from a previous call to query mode list.
 
213
         *
 
214
         * @param mode_list The mode list to be free. This data was returned
 
215
         *   from an earlier call to query_modes.=
 
216
         */
 
217
        void (*free_mode_list)(igd_display_info_t *mode_list);
 
218
 
 
219
        /*!
 
220
         * alter_displays() Modifies the modes associated with one or both display
 
221
         *  pipes according to the dc provided. The primary and secondary
 
222
         *  display handles are returned for use when rendering to these displays.
 
223
         *
 
224
         *  In extended or DIH modes only one fb_info needs to be provided at a
 
225
         *  time. In this manner two calls can be used one per framebuffer, as
 
226
         *  may be required by the OS.
 
227
         *
 
228
         *  @param driver_handle - required.  This is returned from a call to
 
229
         *   igd_init_driver().
 
230
         *
 
231
         *  @param primary A pointer to a display handle that will be populated
 
232
         *   during the call. This handle should be used for all rendering
 
233
         *   tasks directed to the primary framebuffer and pipe.
 
234
         *
 
235
         *  @param primary_pt_info The display timing information to be used for
 
236
         *    the primary display pipe.
 
237
         *
 
238
         *  @param primary_fb_info The framebuffer parameters to be used for the
 
239
         *   primary display. This data may be larger or smaller than the display
 
240
         *   timings to allow for centered/panned or scaled modes.
 
241
         *
 
242
         *  @param secondary A pointer to a display handle that will be populated
 
243
         *   during the call. This handle should be used for all rendering
 
244
         *   tasks directed to the secondary framebuffer or pipe.
 
245
         *
 
246
         *  @param secondary_pt_info The display timing information to be used for
 
247
         *   the secondary display pipe.
 
248
         *
 
249
         *  @param secondary_fb_info The framebuffer parameters to be used for the
 
250
         *   secondary display. This data may be larger or smaller than the display
 
251
         *   timings to allow for centered/panned or scaled modes.
 
252
         *
 
253
         *  @param dc A unique identifer to describe the configuration of the
 
254
         *   displays to be used. This identifier should be one returned from
 
255
         *   the _igd_dispatch::query_dc() call. See @ref dc_defines.
 
256
         *
 
257
         *  @param flags Bitfield to alter the behavior of the call.
 
258
         */
 
259
        int (*alter_displays)(igd_driver_h driver_handle,
 
260
                igd_display_h *primary,
 
261
                igd_display_info_t *primary_pt_info,
 
262
                igd_framebuffer_info_t *primary_fb_info,
 
263
                igd_display_h *secondary,
 
264
                igd_display_info_t *secondary_pt_info,
 
265
                igd_framebuffer_info_t *secondary_fb_info,
 
266
                unsigned long dc,
 
267
                unsigned long flags);
 
268
 
 
269
        /*!
 
270
         *  pan_display() pans the display on the display device.
 
271
         *  It takes a @a x_offset, @a y_offset into the frame buffer and
 
272
         *  sets the display from (x_offset, y_offset) to
 
273
         *  (x_offset+width, y_offset+height).
 
274
         *  If x_offset+width, y_offset+height crosses frame buffer
 
275
         *  width and heigth, then it will return error.
 
276
         *
 
277
         * @param display_handle pointer to an IGD_DISPLAY pointer returned
 
278
         *    from a successful call to dispatch->alter_displays().
 
279
         *
 
280
         * @param x_offset these are frame buffer offsets from (0, 0).
 
281
         * @param y_offset these are frame buffer offsets from (0, 0).
 
282
         *
 
283
         * @return 0: The paning was successfull.
 
284
         * @return -IGD_INVAL:  Otherwise
 
285
         */
 
286
        long (*pan_display)(igd_display_h display_handle,
 
287
                unsigned long x_offset,
 
288
                unsigned long y_offset);
 
289
 
 
290
        /*!
 
291
         * Alters the current power state for the display. This does not
 
292
         * change the power state for the graphics hardware device.
 
293
         *
 
294
         * @bug Needs to be modified to power all displays on a pipe
 
295
         *
 
296
         * @param driver_handle - handle to a driver handle returned from a
 
297
         *    previous call to igd_driver_init()
 
298
         *
 
299
         * @param port_number - specific display (port) to change.
 
300
         *
 
301
         * @param power_state - D state to change to.
 
302
         *
 
303
         * @returns 0 on Success
 
304
         * @returns <0 on Error
 
305
         */
 
306
        int (*power_display)(igd_driver_h driver_handle,
 
307
                        unsigned short port_number,
 
308
                        unsigned int power_state);
 
309
 
 
310
        /*!
 
311
         *  This function sets one palette entry for the framebuffer when the
 
312
         *  pixel format for the framebuffer indicates a palette is used.
 
313
         *
 
314
         * @param display_handle Display handle returned from a call to
 
315
         *   _igd_dispatch::alter_displays()
 
316
         *
 
317
         * @param palette_color A 32bit ARGB color
 
318
         *
 
319
         * @param palette_entry The palette index to set.
 
320
         *
 
321
         * @returns
 
322
         *  - 0: Success
 
323
         *  - -IGD_INVAL:  Otherwise
 
324
         */
 
325
        int (*set_palette_entry)(igd_display_h display_handle,
 
326
                unsigned long palette_entry,
 
327
                unsigned long palette_color);
 
328
        /*!
 
329
         *  This function gets the requested palette entry from the hardware.
 
330
         *  The results are undefined when not in a paletted mode or in a
 
331
         *  mode that uses palette for color correction.
 
332
         *
 
333
         * @param display_handle Display handle returned from a call to
 
334
         *   _igd_dispatch::alter_displays()
 
335
         *
 
336
         * @param palette_color A 32bit ARGB color
 
337
         *
 
338
         * @param palette_entry The palette index to return.
 
339
         *
 
340
         * @returns 0 on Success
 
341
         * @returns -IGD_ERROR_INVAL Otherwise
 
342
         */
 
343
        int (*get_palette_entry)(igd_display_h display_handle,
 
344
                unsigned long palete_entry,
 
345
                unsigned long *palette_color);
 
346
 
 
347
        /*!
 
348
         *  This function sets "count" palette entries starting with "count"
 
349
         *  offset into the palette_colors array.
 
350
         *
 
351
         * @param display_handle Display handle returned from a call to
 
352
         *   _igd_dispatch::alter_displays()
 
353
         *
 
354
         *  @param palette_colors A 32bit ARGB color array
 
355
         *
 
356
         *  @param start_index The first palette index to program.
 
357
         *
 
358
         *  @param count The number of palette entries to program.
 
359
         *
 
360
         * @returns 0 on Success
 
361
         * @return -IGD_ERROR_INVAL Otherwise
 
362
         */
 
363
        int (*set_palette_entries)(igd_display_h display_handle,
 
364
                unsigned long *palette_colors, unsigned int start_index,
 
365
                unsigned int count);
 
366
 
 
367
 
 
368
        /*!
 
369
         * Gets attributes for a display. SS will allocate the memory required to
 
370
         * return the *attr_list. This is a live copy of attributes used by both
 
371
         * IAL and HAL. Don't deallocate this memory. This will be freed by the
 
372
         * HAL.
 
373
         *
 
374
         * @param driver_handle Driver handle returned from a call to
 
375
         *   igd_driver_init()
 
376
         *
 
377
         * @param num_attrs pointer to return the number of attributes
 
378
         *    returned in attr_list.
 
379
         *
 
380
         * @param attr_list pointer to return the attributes.
 
381
         *
 
382
         * @returns 0 onSuccess
 
383
         * @returns -IGD_ERROR_NOATTR No attributes defined for this display
 
384
         * @returns -IGD_INVAL otherwise
 
385
         */
 
386
        int (*get_attrs)(igd_driver_h driver_handle,
 
387
                        unsigned short port_number,
 
388
                        unsigned long *num_attrs,
 
389
                        igd_attr_t **attr_list);
 
390
 
 
391
        /*!
 
392
         * set attributes for a display.
 
393
         *
 
394
         * @param driver_handle Driver handle returned from a call to
 
395
         *   igd_driver_init()
 
396
         *
 
397
         * @param num_attrs pointer to return the number of attributes
 
398
         *   returned in attr_list. This is equal to the num_attrs returned by
 
399
         *   igd_get_attrs().
 
400
         *
 
401
         * @param attr_list pointer returned from igd_get_attrs(). Change
 
402
         *   the attributes to desired values.
 
403
         *
 
404
         * @returns 0 on Success
 
405
         * @returns -IGD_ERROR_NOATTR No attributes defined for this display
 
406
         * @returns -IGD_INVAL Otherwise
 
407
         */
 
408
        int (*set_attrs)(igd_driver_h driver_handle,
 
409
                        unsigned short port_number,
 
410
                        unsigned long num_attrs,
 
411
                        igd_attr_t *attr_list);
 
412
 
 
413
        /*!
 
414
         * set flags for a display.
 
415
         *
 
416
         * @param display_handle Display handle returned from a call to
 
417
         *   _igd_dispatch::alter_displays()
 
418
         *
 
419
         * @param port_number of the port to modify.  (use zero to change
 
420
         *   all ports associated with a display?)
 
421
         *
 
422
         * @param flag to set in the port's pt_info before calling program
 
423
         *   port.
 
424
         *
 
425
         * @returns 0 on Success
 
426
         * @returns -IGD_INVAL Otherwise
 
427
         */
 
428
        int (*enable_port)(igd_display_h display_handle,
 
429
                        unsigned short port_number,
 
430
                        unsigned long flag,
 
431
                        unsigned long test);
 
432
 
 
433
        /*!
 
434
         * This functions returns the current scanline for the display handle
 
435
         * provided. The scanline will be accurate when possible, or equal
 
436
         * to IGD_IN_VBLANK, or IGD_IN_VSYNC during the vblank/vsync periods.
 
437
         * See @ref get_scanline_defs
 
438
         *
 
439
         * @param display_handle Display handle returned from a call to
 
440
         *   _igd_dispatch::alter_displays()
 
441
         *
 
442
         * @param scanline An unsigned long pointer which will be populated by
 
443
         *    the HAL during the call.
 
444
         *
 
445
         * @returns 0 on Success
 
446
         * @returns <0 on Error
 
447
         */
 
448
        int (*get_scanline)(igd_display_h display_handle, int *scanline);
 
449
 
 
450
        /*!
 
451
         *  This function alters the parameters associated with a cursor.
 
452
         *
 
453
         * @param display_handle Display handle returned from a call to
 
454
         *   _igd_dispatch::alter_displays()
 
455
         *
 
456
         * @param cursor_info An igd_cursor_info_t data structure with the
 
457
         *   parameters to be applied to the cursor.
 
458
         *
 
459
         * @param image A pointer to cursor image data. The image data
 
460
         *   will only be programmed with the cursor flag has either
 
461
         *   IGD_CURSOR_LOAD_ARGB_IMAGE or IGD_CURSOR_LOAD_XOR_IMAGE.
 
462
         *
 
463
         * @param 0 on Success
 
464
         * @param <0 on Error
 
465
         */
 
466
        int (*alter_cursor)(igd_display_h display_handle,
 
467
                igd_cursor_info_t *cursor_info, unsigned char *image);
 
468
 
 
469
        /*!
 
470
         *  This function alters the position parameters associated with a cursor.
 
471
         *
 
472
         * @param display_handle Display handle returned from a call to
 
473
         *   _igd_dispatch::alter_displays()
 
474
         *
 
475
         * @param cursor_info An igd_cursor_info_t data structure with the
 
476
         *   parameters to be applied to the cursor. Only the x_offset and y_offset
 
477
         *   parameters will be used.
 
478
         *
 
479
         * @param 0 on Success
 
480
         * @param <0 on Error
 
481
         */
 
482
        int (*alter_cursor_pos)(igd_display_h display_handle,
 
483
                igd_cursor_info_t *cursor_info);
 
484
 
 
485
        /*!
 
486
         * This function will block until the start of the next vblank/vsync
 
487
         * period.
 
488
         *
 
489
         * @param display_handle Display handle returned from a call to
 
490
         *   _igd_dispatch::alter_displays()
 
491
         *
 
492
         * @returns 0 on Success
 
493
         * @returns <0 on Error
 
494
         */
 
495
        int (*wait_vblank)(igd_display_h display_handle);
 
496
 
 
497
        /*!
 
498
         * This function will block until the start of the next vblank/vsync
 
499
         * period.
 
500
         *
 
501
         * @param display_handle Display handle returned from a call to
 
502
         *   _igd_dispatch::alter_displays()
 
503
         *
 
504
         * @returns 0 on Success
 
505
         * @returns <0 on Error
 
506
         */
 
507
        int (*wait_vsync)(igd_display_h display_handle);
 
508
 
 
509
        int (*query_in_vblank)(igd_display_h display_handle);
 
510
 
 
511
        /*!
 
512
         * This function is to access I2C register values for the specified I2C
 
513
         * bus. Memory for 'igd_i2c_reg_t->buffer' should be allocated and freed
 
514
         * by caller.
 
515
         * This function is valid only for display connected via DIGITAL (DVO)
 
516
         * ports.
 
517
         *
 
518
         * @bug Documentation needs update or Remove
 
519
         *
 
520
         *  @param driver IGD driver handle.
 
521
         *
 
522
         *  @param i2c_reg pointer to the i2c register structure.
 
523
         *
 
524
         *  @param flags If the flags is
 
525
         *    IGD_I2C_WRITE - then igd_i2c_reg_t->buffer should point
 
526
         *       to array of 'num_bytes' number of valid I2C registers values.
 
527
         *    IGD_I2C_READ  - then igd_i2c_reg_t->buffer pointer should have space
 
528
         *       for 'num_bytes' number of valid I2C registers.
 
529
         *
 
530
         * @returns 0 on Success
 
531
         * @returns <0 on Error
 
532
         */
 
533
        int (*access_i2c)(igd_display_h display, igd_i2c_reg_t *i2c_reg,
 
534
                        unsigned long flags);
 
535
 
 
536
        /*!
 
537
         * This function is to get the EDID information (not the actual block) for
 
538
         * the display device associated with the 'display_handle'.
 
539
         *
 
540
         * @param driver_handle The driver handle returned from igd_driver_init().
 
541
         * @param port_number display port number connected to display.
 
542
         * @param edid_version EDID version number.
 
543
         * @param edid_revision EDID revision number.
 
544
         * @param edid_size Tells the caller what size of buffer to allocate
 
545
         *   for the transfer.
 
546
         *
 
547
         * @returns 0 on Success
 
548
         * @returns -IGD_ERROR_EDID Error while reading EDID or no EDID
 
549
         * @return -IGD_INVAL Other error
 
550
         */
 
551
        int (*get_EDID_info)(igd_driver_h driver_handle,
 
552
                        unsigned short port_number,
 
553
                        unsigned char *edid_version,
 
554
                        unsigned char *edid_revision,
 
555
                        unsigned long *edid_size);
 
556
 
 
557
        /*!
 
558
         * This function is to get the EDID block of the specified size. The size
 
559
         * is returned from previous call to igd_get_EDID_info().
 
560
         *
 
561
         * @note The return value indicates success/failure, blocksize should be
 
562
         *  set by the API to the actual number of bytes transferred upon return.
 
563
         * @param driver_handle The driver handle returned from igd_driver_init().
 
564
         * @param port_number Specific display to query for EDID block data.
 
565
         * @param edid_ptr Buffer to hold the EDID block data, must be 128bytes.
 
566
         * @param block_number Tells the API which EDID block to read.
 
567
         *
 
568
         *  @returns 0 on Success
 
569
         *  @returns -IGD_ERROR_EDID Error while reading EDID or no EDID
 
570
         *  @returns -IGD_INVAL Other error
 
571
         */
 
572
        int (*get_EDID_block)(igd_driver_h driver_handle,
 
573
                unsigned short port_number,
 
574
                unsigned char FAR *edid_ptr,
 
575
                unsigned char block_number);
 
576
 
 
577
        /*!
 
578
         * This function returns the information about the port/display
 
579
         *
 
580
         * @param driver_handle pointer to an IGD_DRIVER_H pointer returned
 
581
         *    from a successful call to igd_driver_init().
 
582
         *
 
583
         * @param port_number Specific port to get information for.
 
584
         *
 
585
         * @param port_info Port/display information
 
586
         *
 
587
         * @returns 0 on Success
 
588
         * @returns -IGD_INVAL Otherwise
 
589
         */
 
590
        int (*get_port_info)(igd_driver_h driver_handle,
 
591
                        unsigned short port_number,
 
592
                        igd_port_info_t *port_info);
 
593
 
 
594
        /*
 
595
         * Sync is used to insert and check the status of synchronization
 
596
         * points in the command queue. A sync inserted into the queue and
 
597
         * then check insures that all rendering commands inserted before the
 
598
         * sync are now complete.
 
599
         *
 
600
         * Sync should be called with the IGD_RENDER_NONBLOCK flag to insert
 
601
         * a new sync without waiting for completion. When called with
 
602
         * IGD_RENDER_BLOCK the call will wait for completion but may return
 
603
         * due to a timeout. The caller should determine if calling again is
 
604
         * prudent or if some other action should be taken insead of busy
 
605
         * waiting.
 
606
         *
 
607
         * @param display_handle pointer to an IGD_DISPLAY pointer returned
 
608
         *    from a successful call to dispatch->alter_displays().
 
609
         *
 
610
         * @param priority The command queue to use. IGD_PRIORITY_NORMAL is
 
611
         *    correct for most circumstances.
 
612
         *
 
613
         * @param sync The sync identifier that will be populated and returned
 
614
         *    during the call. To insert a new sync, this should be passed
 
615
         *    containing 0 (A pointer to a zero). To check the status of an
 
616
         *    existing sync pass the value returned from a previous call to
 
617
         *    this function.
 
618
         *
 
619
         * @param flags Sync flags.
 
620
         *
 
621
         * @returns
 
622
         *   0: On Success
 
623
         *   -IGD_ERROR_BUSY: When the sync is not yet complete
 
624
         */
 
625
        int (*sync)(igd_display_h display_handle, int priority,
 
626
                unsigned long *sync, unsigned long flags);
 
627
        /*
 
628
         * Idle stalls until the entire engine has been idled.
 
629
         */
 
630
        int (*idle)(igd_driver_h driver_handle);
 
631
 
 
632
        /* igd_appcontext.h */
 
633
        igd_appcontext_h (*appcontext_alloc)(igd_display_h display_handle,
 
634
                int priority, unsigned int flags);
 
635
        void (*appcontext_free)(igd_display_h display_handle,
 
636
                int priority, igd_appcontext_h context_handle);
 
637
 
 
638
        /* igd_pwr.h */
 
639
        int (*pwr_alter)(igd_driver_h driver_handle, unsigned int power_state);
 
640
        int (*pwr_query)(igd_driver_h driver_handle, unsigned int power_state);
 
641
 
 
642
        /* igd_reset.h */
 
643
        int (*reset_alter)(igd_driver_h driver_handle);
 
644
 
 
645
        /* igd_gmm.h */
 
646
 
 
647
        /*!
 
648
         * This function is used by igd client drivers to allocate surfaces from
 
649
         * graphics memory. A driver must use this function to allocate all
 
650
         * surfaces, and must in turn free the surfaces with dispatch->gmm_free()
 
651
         * before exit. Calls to this function are only valid after the gmm_init()
 
652
         * function has been called by the igd init module.
 
653
         *
 
654
         * @param offset The offset into the Gtt memory space that the surface
 
655
         *   begins. This is an output only. Each element of this array can be
 
656
         *   added to the base physical or virtual address to obtain a full
 
657
         *   virtual or physical address. Therefore this parameter should be
 
658
         *   accessed as offset[x]. The number of offset elements is dependent on
 
659
         *   the surface type. Normal and Buffer surfaces return 1 element, Mip Map
 
660
         *   surfaces return NumMips level elements. Cube Map surfaces return
 
661
         *   NumMips level elements. Volume Map surfaces return NumSlices elements.
 
662
         *   For Volume Maps: The number of planes decreases by half for each
 
663
         *   mip level just as the number of X and Y pixels decreases by half.
 
664
         *   All plane offsets for the first mip are returned first followed
 
665
         *   by all planes for the second mip and so-forth.
 
666
         *
 
667
         * @param pixel_format The pixel format id. See @ref pixel_formats
 
668
         *
 
669
         * @param width The width in pixels of the surface. This may be modified
 
670
         *   to be larger than the requested value.
 
671
         *
 
672
         * @param height Height in pixels of the surface. This may be modified to
 
673
         *   be larger than the requested value.
 
674
         *
 
675
         * @param pitch The pitch in bytes of the surface. This value is returned
 
676
         *   by the driver.
 
677
         *
 
678
         * @param size The size of the surface in bytes. This value is returned by
 
679
         *   the driver. In Planar formats this will be greater than height*pitch
 
680
         *
 
681
         * @param type The defined type of the surface to be allocated.
 
682
         *   See @ref alloc_surface_types
 
683
         *
 
684
         * @param flags A bitfied of potential uses for the surface. These
 
685
         *   potentially impact the requried alignment of the surface offset.
 
686
         *   See @ref surface_info_flags
 
687
         *
 
688
         * @returns 0 on Success
 
689
         * @returns <0 Error
 
690
         */
 
691
        int (*gmm_alloc_surface)(unsigned long *offset,
 
692
                unsigned long pixel_format,
 
693
                unsigned int *width,
 
694
                unsigned int *height,
 
695
                unsigned int *pitch,
 
696
                unsigned long *size,
 
697
                unsigned int type,
 
698
                unsigned long *flags);
 
699
 
 
700
        int (*gmm_get_num_surface)(unsigned long *count);
 
701
        int (*gmm_get_surface_list)(unsigned long allocated_size,
 
702
                unsigned long *list_size,
 
703
                igd_surface_list_t **surface_list);
 
704
 
 
705
        /*!
 
706
         * This function is used by igd client drivers to allocate regions from
 
707
         * graphics memory. Regions are portions of video memory that do not have
 
708
         * width and height parameters, only a linear size. A driver must use this
 
709
         * function to allocate all regions, and must in turn free the regions with
 
710
         * igd_mm_free() before exit.
 
711
         * Calls to this function are only valid after the gmm_init() function
 
712
         * has been called by the igd init module.
 
713
         *
 
714
         * @param offset The offset into the Gtt memory space that the region
 
715
         *   begins. This is an output only. This value can be added to the base
 
716
         *   physical or virtual address to obtain a full virtual or physical
 
717
         *   address.
 
718
         *
 
719
         * @param size The size of the region, this value may be modified to be
 
720
         *   larger or smaller than the requested value.
 
721
         *
 
722
         * @param type The defined type of the surface to be allocated.
 
723
         *   See @ref alloc_region_types
 
724
         *
 
725
         * @param flags A bitfied of potential uses for the region. These
 
726
         *   potentially impact the requried alignment of the region offset.
 
727
         *   See @ref alloc_region_flags
 
728
         *
 
729
         * @returns 0 on Success
 
730
         * @returns <0 on Error
 
731
         */
 
732
        int (*gmm_alloc_region)(unsigned long *offset,
 
733
                unsigned long *size,
 
734
                unsigned int type,
 
735
                unsigned long flags);
 
736
 
 
737
        /*!
 
738
         * This function is used to find the actual physical address of the
 
739
         * system memory page given an offset into Gtt memory. This function
 
740
         * will only be successful if the offset provided was allocated to a
 
741
         * cursor or overlay register type.
 
742
         *
 
743
         * @param offset The offset as provided by the allocation function.
 
744
         *
 
745
         * @returns 0 on Success
 
746
         * @returns  <0 on Error
 
747
         */
 
748
        int (*gmm_virt_to_phys)(unsigned long offset,
 
749
                unsigned long *physical);
 
750
 
 
751
        /*!
 
752
         *  This function should be used to free any regions or surfaces allocated
 
753
         *  during igd use. Calling with offsets that were not obtained via a
 
754
         *  prior call to _igd_dispatch::gmm_alloc_surface() or
 
755
         *  _igd_dispatch::gmm_alloc_region() are invalid and will produce
 
756
         *  undefined results.
 
757
         *  Calls to this function are only valid after the igd_module_init()
 
758
         *  function has been called.
 
759
         *
 
760
         * @param offset The offset as provided by the allocation function.
 
761
         *
 
762
         * @returns void
 
763
         */
 
764
        void (*gmm_free)(unsigned long offset);
 
765
 
 
766
        /*!
 
767
         * This function returns current memory statistics.
 
768
         *
 
769
         * @param memstat An _igd_memstat structure to be populated during the call
 
770
         *
 
771
         * @returns 0 on Success
 
772
         * @returns  <0 on Error
 
773
         */
 
774
        int (*gmm_memstat)(igd_memstat_t *memstat);
 
775
 
 
776
        /*!
 
777
         * Allocates a surface similar to _igd_dispatch::gmm_alloc_surface();
 
778
         * however, in this case the surface is allocated from a cached pool of
 
779
         * similar surfaces to improve performance. The surface cache shrinks and
 
780
         * grows automatically based on usage model. The surface cache should
 
781
         * be used when many surfaces of similar format and size are allocated
 
782
         * and freed repeatedly and the highest performance is required. The
 
783
         * tradeoff is that memory will be consumed by the cache and which
 
784
         * can lead to the need to flush the cache when non-cached surfaces
 
785
         * fail due to out-of-memory conditions.
 
786
         *
 
787
         * Surface is passed in, and populated during call.
 
788
         * All inputs are the same as with gmm_alloc_surface.
 
789
         *
 
790
         * @param display_handle Display used with this surface
 
791
         * @param surface Input/Output structure containing surface information
 
792
         * @param flags used to modify the behavior of the function.
 
793
         *     See @ref gmm_alloc_cached_flags
 
794
         *
 
795
         * @returns 0 on Success
 
796
         * @returns  <0 on Error
 
797
         */
 
798
        int (*gmm_alloc_cached)(igd_display_h display_handle,
 
799
                igd_surface_t *surface, unsigned int flags);
 
800
 
 
801
        /*!
 
802
         * Free a surface previously allocated with the
 
803
         * _igd_dispatch::gmm_alloc_cached() dispatch function. When freeing
 
804
         * a cached surface it is not necessary for rendering to be complete. In
 
805
         * this manner better performance can be achieved because it is likely
 
806
         * that the rendering will be complete before the surface could be reused.
 
807
         * When freeing a cached surface a sync ID obtained from
 
808
         * _igd_dispatch::sync() after all rendering commands to the surface
 
809
         * should be provided such that the cache manager can be sure rendering
 
810
         * is complete before the surface is reused or freed.
 
811
         *
 
812
         * @param display_handle Display used with this surface
 
813
         * @param surface structure containing surface information
 
814
         * @param sync_id obtained after all rendering to/from this surface
 
815
         */
 
816
        void (*gmm_free_cached)(igd_display_h display_handle,
 
817
                igd_surface_t *surface,
 
818
                unsigned long sync_id);
 
819
 
 
820
        /*!
 
821
         * Allocates a region similar to _igd_dispatch::gmm_alloc_region();
 
822
         * however, in this case the region is allocated from a cached pool of
 
823
         * similar regions to improve performance. The region cache shrinks and
 
824
         * grows automatically based on usage model. The region cache should
 
825
         * be used when many regions of similar format and size are allocated
 
826
         * and freed repeatedly and the highest performance is required. The
 
827
         * tradeoff is that memory will be consumed by the cache and which
 
828
         * can lead to the need to flush the cache when non-cached regions
 
829
         * fail due to out-of-memory conditions.
 
830
         *
 
831
         * Region information is passed in, and populated during call.
 
832
         * All inputs are the same as with gmm_alloc_region.
 
833
         *
 
834
         * @param display_handle Display used with this region
 
835
         *
 
836
         * @param offset The offset into the Gtt memory space that the region
 
837
         *   begins. This is an output only. This value can be added to the base
 
838
         *   physical or virtual address to obtain a full virtual or physical
 
839
         *   address.
 
840
         *
 
841
         * @param size The size of the region, this value may be modified to be
 
842
         *   larger or smaller than the requested value.
 
843
         *
 
844
         * @param type The defined type of the region to be allocated.
 
845
         *   See @ref alloc_region_types
 
846
         *
 
847
         * @param region_flags A bitfied of potential uses for the region. These
 
848
         *   potentially impact the requried alignment of the region offset.
 
849
         *   See @ref alloc_region_flags
 
850
         *
 
851
         * @param flags used to modify the behavior of the function.
 
852
         *     See @ref gmm_alloc_cached_flags
 
853
         *
 
854
         * @returns 0 on Success
 
855
         * @returns  <0 on Error
 
856
         */
 
857
        int (*gmm_alloc_cached_region)(igd_display_h display_handle,
 
858
                unsigned long *offset,
 
859
                unsigned long *size,
 
860
                unsigned int type,
 
861
                unsigned int region_flags,
 
862
                unsigned int flags);
 
863
 
 
864
        /*!
 
865
         * Free a region previously allocated with the
 
866
         * _igd_dispatch::gmm_alloc_cached_region() dispatch function. When freeing
 
867
         * a cached region it is not necessary for rendering to be complete. In
 
868
         * this manner better performance can be achieved because it is likely
 
869
         * that the rendering will be complete before the region could be reused.
 
870
         * When freeing a cached region a sync ID obtained from
 
871
         * _igd_dispatch::sync() after all rendering commands to the region
 
872
         * should be provided such that the cache manager can be sure rendering
 
873
         * is complete before the region is reused or freed.
 
874
         *
 
875
         * @param display_handle Display used with this region
 
876
         *
 
877
         * @param offset The offset into the Gtt memory space that the region
 
878
         *   begins. This is an output only. This value can be added to the base
 
879
         *   physical or virtual address to obtain a full virtual or physical
 
880
         *   address.
 
881
         *
 
882
         * @param size The size of the region, this value may be modified to be
 
883
         *   larger or smaller than the requested value.
 
884
         *
 
885
         * @param type The defined type of the region to be allocated.
 
886
         *   See @ref alloc_region_types
 
887
         *
 
888
         * @param region_flags A bitfied of potential uses for the region. These
 
889
         *   potentially impact the requried alignment of the region offset.
 
890
         *   See @ref alloc_region_flags
 
891
         *
 
892
         * @param sync_id_write obtained after all rendering to this region
 
893
         * @param sync_id_read obtained after all rendering from this region
 
894
         */
 
895
        void (*gmm_free_cached_region)(igd_display_h display_handle,
 
896
                unsigned long offset,
 
897
                unsigned long size,
 
898
                unsigned int type,
 
899
                unsigned int region_flags,
 
900
                unsigned long sync_id_write,
 
901
                unsigned long sync_id_read);
 
902
 
 
903
        /*!
 
904
         *  Flushes surfaces out of the internal surface cache. During normal
 
905
         * operation an IAL will not need to call this. Only when an IAL is
 
906
         * making use of the surface cache for some operations and direct
 
907
         * gmm operations for others would it be necessary to flush the cache.
 
908
         *
 
909
         *
 
910
         * @returns 0 No surfaces flushed
 
911
         * @returns >0 Surfaces flushed
 
912
         * @returns <0 Error
 
913
         */
 
914
        int (*gmm_flush_cache)(void);
 
915
 
 
916
        /*!
 
917
         * Allocates a heap of the requested size.  The heap allocated is managed
 
918
         * by the GMM through "gmm_alloc_heapblock", "gmm_free_heapblock", and
 
919
         * "gmm_free_heap" functions.
 
920
         *
 
921
         * @param display_handle Used to access other GMM dispatch functions
 
922
         *
 
923
         * @param heap_offset The offset into the Gtt memory space that the heap
 
924
         *   begins.  This also serves as a "heap ID"
 
925
         *
 
926
         * @param heap_size The size of the heap.
 
927
         *
 
928
         * @param type Set to zero
 
929
         *
 
930
         * @param alignment The alignment of the blocks in this heap
 
931
         *
 
932
         * @returns 0 on Success
 
933
         * @returns  <0 on Error
 
934
         */
 
935
        int (*gmm_alloc_heap)(igd_display_h display_handle,
 
936
                unsigned long *heap_offset,
 
937
                unsigned long *heap_size,
 
938
                unsigned int   type,
 
939
                unsigned long  alignment);
 
940
 
 
941
        /*!
 
942
         * Frees the heap allocated by gmm_alloc_heap
 
943
         *
 
944
         * @param heap_offset The offset into the Gtt memory space that the heap
 
945
         *   begins
 
946
         */
 
947
        void (*gmm_free_heap)(igd_display_h display_handle,
 
948
                                unsigned long heap_offset);
 
949
 
 
950
        unsigned long (*gmm_get_pvtheap_size)(void);
 
951
        unsigned long (*gmm_get_cache_mem)(void);
 
952
        /*!
 
953
         * Allocates a block of the requested size from the heap indicated by
 
954
         * heap_offset.
 
955
         *
 
956
         * @param display_handle Used to access other GMM dispatch functions
 
957
         *
 
958
         * @param heap_offset The heap ID
 
959
         *
 
960
         * @param block_offset
 
961
         *
 
962
         * @param size The size of the block.
 
963
         *
 
964
         * @param type Set to zero
 
965
         *
 
966
         * @param flags Set to zero
 
967
         *
 
968
         * @returns 0 on Success
 
969
         * @returns  <0 on Error
 
970
         */
 
971
        int (*gmm_alloc_heap_block)(igd_display_h display_handle,
 
972
                unsigned long heap_offset,
 
973
                unsigned long *block_offset,
 
974
                unsigned long *size,
 
975
                unsigned long flags);
 
976
 
 
977
        /*!
 
978
         * Frees a block of previously allocated by gmm_alloc_heap_block
 
979
         *
 
980
         * @param display_handle Used to access other GMM dispatch functions
 
981
         *
 
982
         * @param block_offset Offset given by gmm_alloc_heap_block
 
983
         */
 
984
        void (*gmm_free_heap_block)(igd_display_h display_handle,
 
985
                unsigned long heap_offset,
 
986
                unsigned long block_offset,
 
987
                unsigned long sync_id_write,
 
988
                unsigned long sync_id_read);
 
989
 
 
990
        /*!
 
991
         * Gets the heap id/offset from which the block
 
992
         *
 
993
         * @param block_offset Offset given by gmm_alloc_heap_block
 
994
         * @param heap_offset Head ID/Offset associated with the block offset
 
995
         *
 
996
         * @returns 0 on Success
 
997
         * @returns  <0 on Error
 
998
         */
 
999
        int (*gmm_get_heap_from_block)(unsigned long block_offset,
 
1000
                unsigned long *heap_offset);
 
1001
 
 
1002
        /*!
 
1003
         * Allocates a reservation of the requested size. A reservation is a
 
1004
         * memory range that is dedicated for the callers use but it not
 
1005
         * populated with usable memory. The caller must make a single call to
 
1006
         * gmm_alloc_surface() or gmm_alloc_region() passing in the reservation
 
1007
         * address to allocate a surface within the reservation. Only a single
 
1008
         * surface or region may be placed in a reservation.
 
1009
         *
 
1010
         * @param offset The offset into the Gtt memory space that the reservation
 
1011
         *   begins. This is an output only. This value can be added to the base
 
1012
         *   physical or virtual address to obtain a full virtual or physical
 
1013
         *   address.
 
1014
         *
 
1015
         * @param size The size of the reservation.
 
1016
         *
 
1017
         * @param flags A bitfied of potential uses for the reservation. These
 
1018
         *   potentially impact the requried alignment of the reservation.
 
1019
         *   See @ref alloc_reservation_flags
 
1020
         */
 
1021
        int (*gmm_alloc_reservation)(unsigned long *offset,
 
1022
                unsigned long size,
 
1023
                unsigned long flags);
 
1024
 
 
1025
        /*!
 
1026
         * Allocates a region similar to _igd_dispatch::gmm_alloc_region();
 
1027
         * however, in this case the region is allocated from a pool of
 
1028
         * persisent regions.  The pool can only grow as additional regions
 
1029
         * are allocated. The pool can be flushed but this should only be
 
1030
         * done when GMM is being shutdown.
 
1031
         *
 
1032
         * Region information is passed in, and populated during call.
 
1033
         * All inputs are the same as with gmm_alloc_region.
 
1034
         *
 
1035
         * @param display_handle Display used with this region
 
1036
         *
 
1037
         * @param offset The offset into the Gtt memory space that the region
 
1038
         *   begins. This is an output only. This value can be added to the base
 
1039
         *   physical or virtual address to obtain a full virtual or physical
 
1040
         *   address.
 
1041
         *
 
1042
         * @param size The size of the region, this value may be modified to be
 
1043
         *   larger or smaller than the requested value.
 
1044
         *
 
1045
         * @param type The defined type of the region to be allocated.
 
1046
         *   See @ref alloc_region_types
 
1047
         *
 
1048
         * @param region_flags A bitfied of potential uses for the region. These
 
1049
         *   potentially impact the requried alignment of the region offset.
 
1050
         *   See @ref alloc_region_flags
 
1051
         *
 
1052
         * @param flags used to modify the behavior of the function.
 
1053
         *     See @ref gmm_alloc_cached_flags
 
1054
         *
 
1055
         * @returns 0 on Success
 
1056
         * @returns  <0 on Error
 
1057
         */
 
1058
        int (*gmm_alloc_persistent_region)(igd_display_h display_handle,
 
1059
                unsigned long *offset,
 
1060
                unsigned long *size,
 
1061
                unsigned int type,
 
1062
                unsigned int region_flags,
 
1063
                unsigned int flags);
 
1064
 
 
1065
        /*!
 
1066
         * Free a region previously allocated with the
 
1067
         * _igd_dispatch::gmm_alloc_persistent_region() dispatch function.
 
1068
         * The region is marked as available and may be reused by the next
 
1069
         * allocation request.  It is the callers responsibilty to make sure
 
1070
         * rendering to the region is complete before freeing it.
 
1071
         *
 
1072
         * @param display_handle Display used with this region
 
1073
         *
 
1074
         * @param offset The offset into the Gtt memory space that the region
 
1075
         *   begins. This is an input only.
 
1076
         */
 
1077
        int (*gmm_free_persistent_region)(unsigned long offset);
 
1078
 
 
1079
        /*!
 
1080
         * Flushes regions out of the internal persistent list. During normal
 
1081
         * operation an IAL will not need to call this. Only when an IAL is
 
1082
         * exiting should it flush the list.
 
1083
         *
 
1084
         *
 
1085
         * @returns 0 regions flushed
 
1086
         * @returns <0 Error
 
1087
         */
 
1088
        int (*gmm_flush_persistent_regions)(igd_display_h display_handle);
 
1089
 
 
1090
        /*!
 
1091
         * Creates a linear mapping of a video memory region into the
 
1092
         * current process address space.
 
1093
         *
 
1094
         * @param offset Offset used to identifiy the memory region
 
1095
         *
 
1096
         * @returns address to mapping
 
1097
         * @returns NULL Error
 
1098
         */
 
1099
        void *(*gmm_map)(unsigned long offset);
 
1100
 
 
1101
        /*!
 
1102
         * Unmaps a linear mapping created by gmm_map.
 
1103
         *
 
1104
         * @param address pointer to the mapping
 
1105
         */
 
1106
        void (*gmm_unmap)(void *address);
 
1107
 
 
1108
        /*!
 
1109
         * Export the list of physical pages allocated to a memory
 
1110
         * retion.
 
1111
         *
 
1112
         * @param offset Offset used to identify the memory region
 
1113
         * @param pages  Array of page structures holding the physical page
 
1114
         *               addresses.
 
1115
         * @param page_cnt Number of pages in the page array.
 
1116
         *
 
1117
         * @returns 0 if successful
 
1118
         *          -IGD_ERROR_NOMEM if offset is invalid.
 
1119
         */
 
1120
        int (*gmm_get_page_list)(unsigned long offset,
 
1121
                        unsigned long **pages,
 
1122
                        unsigned long *page_cnt);
 
1123
 
 
1124
        void (*gmm_dump)(void);
 
1125
        void (*gmm_dump_v)(void);
 
1126
        char *gmm_debug_desc;
 
1127
 
 
1128
        /* igd_2d.h */
 
1129
        int (*setup_clip_blt)(igd_display_h display_h, int priority,
 
1130
                igd_surface_t *dest, igd_rect_t *dest_rect,
 
1131
                igd_appcontext_h appcontext_handle, unsigned int flags);
 
1132
        int (*setup_blt)(igd_display_h display_handle, int priority,
 
1133
                igd_surface_t *dest_surf, igd_rect_t *dest_rect,
 
1134
                unsigned long raster_ops, unsigned long bg_color,
 
1135
                unsigned long fg_color, igd_appcontext_h appcontext_handle,
 
1136
                unsigned int flags);
 
1137
        int (*color_blt)(igd_display_h display_h, int priority,
 
1138
                igd_surface_t *dest, igd_rect_t *dest_rect, unsigned int byte_mask,
 
1139
                unsigned int color, unsigned int raster_ops,
 
1140
                igd_appcontext_h appcontext, unsigned int flags);
 
1141
        int (*rgb_color_blt)(igd_display_h display_h, int priority,
 
1142
                igd_surface_t *dest, igd_rect_t *dest_rect, unsigned int byte_mask,
 
1143
                unsigned int color, unsigned int raster_ops,
 
1144
                igd_appcontext_h appcontext, unsigned int flags);
 
1145
        int (*pat_blt)(igd_display_h display_h, int priority,
 
1146
                igd_surface_t *dest, igd_rect_t *dest_rect, unsigned int byte_mask,
 
1147
                igd_pat_t *pat, igd_chroma_t *chroma, unsigned int raster_ops,
 
1148
                igd_appcontext_h appcontext, unsigned int flags);
 
1149
        int (*mono_pat_blt)(igd_display_h display_h, int priority,
 
1150
                igd_surface_t *dest, igd_rect_t *dest_rect, unsigned int byte_mask,
 
1151
                igd_mono_pat_t *pat, unsigned int raster_ops,
 
1152
                igd_appcontext_h appcontext, unsigned int flags);
 
1153
        int (*src_copy_blt)(igd_display_h display_h, int priority,
 
1154
                igd_surface_t *dest, igd_rect_t *dest_rect, igd_surface_t *src,
 
1155
                igd_coord_t *src_coord, unsigned int byte_mask, igd_chroma_t *chroma,
 
1156
                unsigned int raster_ops, igd_appcontext_h appcontext,
 
1157
                unsigned int flags);
 
1158
        int (*mono_src_copy_blt)(igd_display_h display_h, int priority,
 
1159
                igd_surface_t *dest, igd_rect_t *dest_rect, igd_mono_src_t *src,
 
1160
                unsigned int byte_mask, unsigned int raster_ops,
 
1161
                igd_appcontext_h appcontext, unsigned int flags);
 
1162
        int (*mono_src_copy_immed_blt)(igd_display_h display_h, int priority,
 
1163
                igd_surface_t *dest, igd_rect_t *dest_rect, igd_mono_src_t *src,
 
1164
                igd_surface_t *src_surface,     igd_rect_t *src_rect,
 
1165
                unsigned int byte_mask, unsigned int raster_ops,
 
1166
                igd_appcontext_h appcontext, unsigned int flags);
 
1167
        int (*full_blt)(igd_display_h display_h, int priority,
 
1168
                igd_surface_t *dest, igd_rect_t *dest_rect, igd_surface_t *src,
 
1169
                igd_coord_t *src_coord, unsigned int byte_mask, igd_pat_t *pat,
 
1170
                unsigned int raster_ops, igd_appcontext_h appcontext,
 
1171
                unsigned int flags);
 
1172
        int (*full_mono_src_blt)(igd_display_h display_h, int priority,
 
1173
                igd_surface_t *dest, igd_rect_t *dest_rect, igd_mono_src_t *src,
 
1174
                unsigned int byte_mask, igd_pat_t *pat, unsigned int raster_ops,
 
1175
                igd_appcontext_h appcontext, unsigned int flags);
 
1176
        int (*full_mono_pat_blt)(igd_display_h display_h, int priority,
 
1177
                igd_surface_t *dest, igd_rect_t *dest_rect, igd_coord_t *src_coord,
 
1178
                igd_surface_t *src,     unsigned int byte_mask, igd_mono_pat_t *pat,
 
1179
                unsigned int raster_ops, igd_appcontext_h appcontext,
 
1180
                unsigned int flags);
 
1181
        int (*full_mono_pat_mono_src_blt)(igd_display_h display_h,
 
1182
                int priority, igd_surface_t *dest, igd_rect_t *dest_rect,
 
1183
                igd_mono_src_t *src, unsigned int byte_mask, igd_mono_pat_t *pat,
 
1184
                unsigned int raster_ops, igd_appcontext_h appcontext,
 
1185
                unsigned int flags);
 
1186
        int (*text_immed_blt)(igd_display_h display_h,
 
1187
                int priority, igd_surface_t *dest_surf,
 
1188
                igd_rect_t *dest_rect,
 
1189
                unsigned char *glyph_data, unsigned int num_glyph_bytes,
 
1190
                igd_appcontext_h appcontext_handle, unsigned long raster_ops,
 
1191
                unsigned long bg_color, unsigned long fg_color,
 
1192
                unsigned int flags);
 
1193
 
 
1194
        /* igd_blend.h */
 
1195
        /*!
 
1196
         * Blend and stretch and color convert a stack of input surfaces into a
 
1197
         * destination surface.
 
1198
         *
 
1199
         * Blend takes N input surfaces and N corresponding input rectangles
 
1200
         * and output rectangles. This allows for any subset of an input surface
 
1201
         * to be output to any rectangle on the destination surface. The input
 
1202
         * and output rectangles need not have any correlation between inputs.
 
1203
         * Also, the input and output rectangle for any given surface need not
 
1204
         * be the same size or aspect ratio, full up and down scaling is possible.
 
1205
         * The destination surface is provided with a clip rectangle. All
 
1206
         * rendering will be clipped to this rectangle regardless of the
 
1207
         * provided destination rectangles.
 
1208
         * Each input surface has a set of render_ops that will be respected
 
1209
         * during the blend operation.
 
1210
         * The IGD_RENDER_OP_BLEND render operation will allow the surface to
 
1211
         * blend with the surfaces below it in the stack. The bottom surface
 
1212
         * in the stack will then optionally blend with the existing contents
 
1213
         * of the destination surface.
 
1214
         *
 
1215
         * All input surface must be allocated with the IGD_SURFACE_TEXTURE
 
1216
         * flag and all output surfaces must be allocated with the
 
1217
         * IGD_SURFACE_RENDER flag.
 
1218
         *
 
1219
         * When a stretch blit is performed (No blending) the surface should not
 
1220
         * have the IGD_RENDER_OP_BLEND bit set in the render_ops to insure
 
1221
         * that the fastest possible method is used and that no format
 
1222
         * conversion takes place.
 
1223
         *
 
1224
         * Due to the number of possible permutations of this API it is
 
1225
         * necessary to constrain the parameters that can be expected to work.
 
1226
         * Specific hardware implementations may support more, however there is
 
1227
         * no guarentee of functionality beyond those listed here.
 
1228
         *
 
1229
         * Blend will accept 1 or 2 input surfaces.
 
1230
         * Blend will accept a maximum of 1 input surface with a palette.
 
1231
         * Blend will accept a maximum of 1 input surface in planar format.
 
1232
         * All Surfaces can output to ARGB format.
 
1233
         * Only YUV inputs may output to YUV format.
 
1234
         * xRGB formats will output ARGB with Alpha of 1.0 when
 
1235
         *  IGD_RENDER_OP_BLEND is set on the surface. Otherwise the x will
 
1236
         *  be retained from the original source.
 
1237
         * Surfaces that are not pre-multipled cannot have a global alpha.
 
1238
         *
 
1239
         */
 
1240
        int (*blend)(igd_display_h display, int priority,
 
1241
                igd_appcontext_h appcontext,
 
1242
                igd_surface_t *src_surface, igd_rect_t *src_rect,
 
1243
                igd_surface_t *mask_surface, igd_rect_t *mask_rect,
 
1244
                igd_rect_t *dest_rect, igd_surface_t *dest_surface,
 
1245
                igd_rect_t *clip_rect, unsigned long flags);
 
1246
 
 
1247
        /* igd_ovl.h */
 
1248
        /*!
 
1249
         * Alter the overlay associated with the given display_h.
 
1250
         *  Only 1 video surface can be associated with a given display_h
 
1251
         *  (i.e. you can not have 2 video surfaces using the same display).
 
1252
         *  This function should be called once for each unique framebuffer.
 
1253
         *  Therefore, single, twin, clone, and vertical extended  modes
 
1254
         *  should call this function once, and the HAL will properly display
 
1255
         *  video using the primary overlay and second overlay if necessary.
 
1256
         *  Whereas extended should call this function twice (once for each
 
1257
         *  display_h) if the video spans multiple displays.
 
1258
         *  In DIH, this function can be called once for each display, since a
 
1259
         *  video surface can not span displays in DIH.
 
1260
         *
 
1261
         * The primary display in clone, the primary display in vertical extended,
 
1262
         *  and the primary display in extended will always use the primary
 
1263
         *  overlay.  The secondary display in clone, the secondary display in
 
1264
         *  vertical extended, and the secondary display in extended will always
 
1265
         *  use the secondary overlay.  The hardware overlay resources (excluding
 
1266
         *  any video memory) will be allocated internal to the HAL during the
 
1267
         *  _igd_dispatch::alter_displays() call.  Video memory surfaces required
 
1268
         *  internal to the HAL, for stretching or pixel format conversions, will
 
1269
         *  be dynamically allocated and freed as necessary.
 
1270
         *
 
1271
         * @param display_h Input display used with this overlay
 
1272
         * @param appcontext_h Input appcontext which may be used for blend.
 
1273
         *     This can be the same appcontext which is used for blend and
 
1274
         *     2d (DD and XAA/EXA).
 
1275
         * @param src_surf Input src surface information
 
1276
         * @param src_rect Input src surface rectangle.
 
1277
         *     This is useful for clone, extended, and vertical extended modes
 
1278
         *     where the entire src_surf may not be displayed.
 
1279
         * @param dest_rect Input dest surface rectangle.  This is relative to the
 
1280
         *     framebuffer not the display (so clone mode works properly).
 
1281
         * @param ovl_info Input overlay information to display.
 
1282
         *     The color key, video quality, and gamma must be valid
 
1283
         *     and correct when the overlay is on.  That means NO passing in NULL
 
1284
         *     values to use previous settings.
 
1285
         * @param flags Input to turn on/off the overlay and set other flags.
 
1286
         *   See: @ref alter_ovl_flags
 
1287
         *
 
1288
         * @returns 0 (IGD_SUCCESS) on Success
 
1289
         * @returns <0 (-igd_errno) on Error.  The overlay will be off, no need
 
1290
         *     for the IAL to call the HAL to turn the overlay off.
 
1291
         *     If -IGD_ERROR_INVAL is returned, something is either to big or
 
1292
         *      to small for the overlay to handle, or it is panned off of the
 
1293
         *      displayed.  This is likely not critical, since it may be stretched
 
1294
         *      or panned back, so the overlay can support it.  The IAL
 
1295
         *      should not return an error to the application, or else the
 
1296
         *      application will likely exit.
 
1297
         *     If -IGD_ERROR_HWERROR is returned, something is outside of what
 
1298
         *      the overlay can support (pitch to large, dot clock to large,
 
1299
         *      invalid pixel format, ring or flip not happening).  In this case,
 
1300
         *      the IAL should return an error to the application, since
 
1301
         *      additional calls will always fail as well.
 
1302
         */
 
1303
        int (*alter_ovl)(igd_display_h display_h,
 
1304
                igd_appcontext_h     appcontext_h,
 
1305
                igd_surface_t       *src_surf,
 
1306
                igd_rect_t          *src_rect,
 
1307
                igd_rect_t          *dest_rect,
 
1308
                igd_ovl_info_t      *ovl_info,
 
1309
                unsigned int         flags);
 
1310
 
 
1311
        int (*alter_ovl2)(igd_display_h display_h,
 
1312
                igd_surface_t       *src_surf,
 
1313
                igd_rect_t          *src_rect,
 
1314
                igd_rect_t          *dest_rect,
 
1315
                igd_ovl_info_t      *ovl_info,
 
1316
                unsigned int         flags);
 
1317
 
 
1318
        /* igd_ovl.h */
 
1319
        /*!
 
1320
         *  Retrieve the kernel mode initialization parameters for overlay.
 
1321
         *  This function should be called by user-mode drivers as they are
 
1322
         *  initialized, to retrieve overlay initialization parameters
 
1323
         *  discovered and held by the kernel driver.
 
1324
         *
 
1325
         * @returns 0 (IGD_SUCCESS) on Success
 
1326
         * @returns <0 (-igd_errno) on Error.
 
1327
         */
 
1328
        int (*get_ovl_init_params)(igd_driver_h driver_handle,
 
1329
                                   ovl_um_context_t *ovl_um_context);
 
1330
  
 
1331
        /*!
 
1332
         * Query the overlay to determine if an event is complete or if a given
 
1333
         * capability is present.
 
1334
         *
 
1335
         * @param display_h Display used with this overlay
 
1336
         * @param flags Used to check for which event is complete or which
 
1337
         *     capability is present.
 
1338
         *     See @ref query_ovl_flags
 
1339
         *
 
1340
         * @returns TRUE if event has occured or capability is available
 
1341
         * @returns FALSE if event is pending or capability is not available
 
1342
         */
 
1343
        int (*query_ovl)(igd_display_h display_h,
 
1344
                unsigned int flags);
 
1345
 
 
1346
        /*!
 
1347
         * Query the overlay for the maximum width and height given the input
 
1348
         * src video pixel format.
 
1349
         *
 
1350
         * @param display_h Display used with this overlay
 
1351
         * @param pf Input src video pixel format
 
1352
         * @param max_width Output maximum overlay width supported (in pixels)
 
1353
         * @param max_height Output maximum overlay height supported (in pixels)
 
1354
         *
 
1355
         * @returns 0 (IGD_SUCCESS) on Success - will return success
 
1356
         *    even if overlay is currently in use.
 
1357
         * @returns <0 (-igd_errno) on Error
 
1358
         */
 
1359
        int (*query_max_size_ovl)(igd_display_h display_h,
 
1360
                unsigned long pf,
 
1361
                unsigned int *max_width,
 
1362
                unsigned int *max_height);
 
1363
 
 
1364
        /* igd_render.h */
 
1365
        _igd_get_surface_fn_t get_surface;
 
1366
        _igd_set_surface_fn_t set_surface;
 
1367
        _igd_query_event_fn_t query_event;
 
1368
 
 
1369
        /* These functions are only to be used by priveledged IALs */
 
1370
        _igd_alloc_ring_fn_t alloc_ring;
 
1371
        _igd_exec_buffer_fn_t execute_buffer;
 
1372
        _igd_rb_reserve_fn_t rb_reserve;
 
1373
        _igd_rb_update_fn_t rb_update;
 
1374
        _igd_get_sync_slot_fn_t get_sync_slot;
 
1375
        _igd_query_buffer_fn_t query_buffer; 
 
1376
 
 
1377
        /*!
 
1378
         *  dispatch->get_display() returns the current framebuffer and
 
1379
         *  display information.
 
1380
         *
 
1381
         * @param display_handle required.  The display_handle contains the
 
1382
         *  display information to return.  This parameter was returned from a
 
1383
         *  previous call to dispatch->alter_displays().
 
1384
         *
 
1385
         * @param port_number required. The port number will determine which
 
1386
         *  port's display info data to return.
 
1387
         *
 
1388
         * @param fb_info required and allocated by the caller.  The fb_info
 
1389
         *  struct is returned to the caller describing the current
 
1390
         *  frame buffer.
 
1391
         *
 
1392
         * @param pt_info required and allocated by the caller.  The
 
1393
         *  pt_info struct is returned to caller describing the
 
1394
         *  requested display parameters.
 
1395
         *
 
1396
         * @param flags - Currently not used
 
1397
         *
 
1398
         * @returns 0 The mode was successfully returned for all displays.
 
1399
         * @returns -IGD_INVAL: Was not able to return the display information.
 
1400
         */
 
1401
        int (*get_display)(igd_display_h display_handle,
 
1402
                        unsigned short port_number, igd_framebuffer_info_t *fb_info,
 
1403
                        igd_display_info_t *pt_info, unsigned long flags);
 
1404
 
 
1405
#ifdef D3D_DPM_ALLOC
 
1406
   /* FIXEME: Somehow this D3D_DPM_ALLOC is always invisible to display dll.
 
1407
    * To avoid the whole structure corruption, the following delcaration 
 
1408
    * appended at the very end.
 
1409
    */
 
1410
   unsigned long* (*gmm_map_sgx)(unsigned long size, unsigned long offset, 
 
1411
      unsigned long flag);
 
1412
#endif
 
1413
        int (*get_golden_htotal)(igd_display_info_t *drm_mode_in, igd_display_info_t *drm_mode_out  );
 
1414
 
 
1415
        /*!
 
1416
         *  Registers a VBlank interrupt callback function (and its parameter) to
 
1417
         *  call when a VBlank interrupt occurs for a given port.
 
1418
         *
 
1419
         * @param callback (IN).  A callback (function pointer) to a non-HAL
 
1420
         * function that processes a VBlank interrupt.
 
1421
         *
 
1422
         * @param priv (IN).  An opaque pointer to a non-HAL data structure.
 
1423
         *  This pointer is passed as a parameter of the callback function.
 
1424
         *
 
1425
         * @param port_number (IN).  The EMGD port number to register a VBlank
 
1426
         *  interrupt callback for.
 
1427
         *
 
1428
         * @return A handle that uniquely identifies this callback/port
 
1429
         *  combination, or NULL if a failure.
 
1430
         */
 
1431
        emgd_vblank_callback_h (*register_vblank_callback)(
 
1432
                emgd_process_vblank_interrupt_t callback,
 
1433
                void *priv,
 
1434
                unsigned long port_number);
 
1435
 
 
1436
        /*!
 
1437
         *  Unregisters a previously-registered VBlank interrupt callback function
 
1438
         *  for a given port.
 
1439
         *
 
1440
         * @param callback_h (IN).  The handle that uniquely identifies the VBlank
 
1441
         *  interrupt callback to unregister.
 
1442
         */
 
1443
        void (*unregister_vblank_callback)(
 
1444
                emgd_vblank_callback_h callback_h);
 
1445
 
 
1446
        /*!
 
1447
         *  Enable delivering VBlank interrupts to the callback function for the
 
1448
         *  registered callback/port combination.
 
1449
         *
 
1450
         * @param callback_h (IN).  The handle that uniquely identifies which
 
1451
         *  VBlank interrupt callback/port combination to enable.
 
1452
         *
 
1453
         * @return Zero if successful, non-zero if a failure.
 
1454
         */
 
1455
        int (*enable_vblank_callback)(emgd_vblank_callback_h callback_h);
 
1456
 
 
1457
        /*!
 
1458
         *  Disable delivering VBlank interrupts to the callback function for the
 
1459
         *  registered function/port combination.
 
1460
         *
 
1461
         * @param callback_h (IN).  The handle that uniquely identifies which
 
1462
         *  VBlank interrupt callback/port combination to disable.
 
1463
         */
 
1464
        void (*disable_vblank_callback)(
 
1465
                emgd_vblank_callback_h callback_h);
 
1466
 
 
1467
        /*!
 
1468
         * Shutdown MSVDX before the X exits.
 
1469
         */ 
 
1470
        void (*video_shutdown)(void);
 
1471
 
 
1472
} igd_dispatch_t;
 
1473
 
 
1474
#endif