VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.1.0/exa.h@ 64670

Last change on this file since 64670 was 51223, checked in by vboxsync, 11 years ago

Additions/x11/x11include: added header files for X.Org Server 1.0 and 1.1.

  • Property svn:eol-style set to native
File size: 29.1 KB
Line 
1/*
2 *
3 * Copyright (C) 2000 Keith Packard
4 * 2004 Eric Anholt
5 * 2005 Zack Rusin
6 *
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of copyright holders not be used in
12 * advertising or publicity pertaining to distribution of the software without
13 * specific, written prior permission. Copyright holders make no
14 * representations about the suitability of this software for any purpose. It
15 * is provided "as is" without express or implied warranty.
16 *
17 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
18 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
19 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
21 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
22 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
23 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
24 * SOFTWARE.
25 */
26
27/** @file
28 * This is the header containing the public API of EXA for exa drivers.
29 */
30
31#ifndef EXA_H
32#define EXA_H
33
34#include "scrnintstr.h"
35#include "pixmapstr.h"
36#include "windowstr.h"
37#include "gcstruct.h"
38#include "picturestr.h"
39
40#define EXA_VERSION_MAJOR 2
41#define EXA_VERSION_MINOR 0
42#define EXA_VERSION_RELEASE 0
43
44typedef struct _ExaOffscreenArea ExaOffscreenArea;
45
46typedef void (*ExaOffscreenSaveProc) (ScreenPtr pScreen, ExaOffscreenArea *area);
47
48typedef enum _ExaOffscreenState {
49 ExaOffscreenAvail,
50 ExaOffscreenRemovable,
51 ExaOffscreenLocked
52} ExaOffscreenState;
53
54struct _ExaOffscreenArea {
55 int base_offset; /* allocation base */
56 int offset; /* aligned offset */
57 int size; /* total allocation size */
58 int score;
59 pointer privData;
60
61 ExaOffscreenSaveProc save;
62
63 ExaOffscreenState state;
64
65 ExaOffscreenArea *next;
66};
67
68/**
69 * The ExaDriver structure is allocated through exaDriverAlloc(), and then
70 * fllled in by drivers.
71 */
72typedef struct _ExaDriver {
73 /**
74 * exa_major and exa_minor should be set by the driver to the version of
75 * EXA which the driver was compiled for (or configures itself at runtime to
76 * support). This allows EXA to extend the structure for new features
77 * without breaking ABI for drivers compiled against older versions.
78 */
79 int exa_major, exa_minor;
80
81 /**
82 * memoryBase is the address of the beginning of framebuffer memory.
83 * The visible screen should be within memoryBase to memoryBase +
84 * memorySize.
85 */
86 CARD8 *memoryBase;
87
88 /**
89 * offScreenBase is the offset from memoryBase of the beginning of the area
90 * to be managed by EXA's linear offscreen memory manager.
91 *
92 * In XFree86 DDX drivers, this is probably:
93 * (pScrn->displayWidth * cpp * pScrn->virtualY)
94 */
95 unsigned long offScreenBase;
96
97 /**
98 * memorySize is the length (in bytes) of framebuffer memory beginning
99 * from memoryBase.
100 *
101 * The offscreen memory manager will manage the area beginning at
102 * (memoryBase + offScreenBase), with a length of (memorySize -
103 * offScreenBase)
104 *
105 * In XFree86 DDX drivers, this is probably (pScrn->videoRam * 1024)
106 */
107 unsigned long memorySize;
108
109 /**
110 * pixmapOffsetAlign is the byte alignment necessary for pixmap offsets
111 * within framebuffer.
112 *
113 * Hardware typically has a required alignment of offsets, which may or may
114 * not be a power of two. EXA will ensure that pixmaps managed by the
115 * offscreen memory manager meet this alignment requirement.
116 */
117 int pixmapOffsetAlign;
118
119 /**
120 * pixmapPitchAlign is the byte alignment necessary for pixmap pitches
121 * within the framebuffer.
122 *
123 * Hardware typically has a required alignment of pitches for acceleration.
124 * For 3D hardware, Composite acceleration often requires that source and
125 * mask pixmaps (textures) have a power-of-two pitch, which can be demanded
126 * using EXA_OFFSCREEN_ALIGN_POT. These pitch requirements only apply to
127 * pixmaps managed by the offscreen memory manager. Thus, it is up to the
128 * driver to ensure that the visible screen has an appropriate pitch for
129 * acceleration.
130 */
131 int pixmapPitchAlign;
132
133 /**
134 * The flags field is bitfield of boolean values controlling EXA's behavior.
135 *
136 * The flags in clude EXA_OFFSCREEN_PIXMAPS, EXA_OFFSCREEN_ALIGN_POT, and
137 * EXA_TWO_BITBLT_DIRECTIONS.
138 */
139 int flags;
140
141 /** @{ */
142 /**
143 * maxX controls the X coordinate limitation for rendering from the card.
144 * The driver should never receive a request for rendering beyond maxX
145 * in the X direction from the origin of a pixmap.
146 */
147 int maxX;
148
149 /**
150 * maxY controls the Y coordinate limitation for rendering from the card.
151 * The driver should never receive a request for rendering beyond maxY
152 * in the Y direction from the origin of a pixmap.
153 */
154 int maxY;
155 /** @} */
156
157 /* private */
158 ExaOffscreenArea *offScreenAreas;
159 Bool needsSync;
160 int lastMarker;
161
162 /** @name Solid
163 * @{
164 */
165 /**
166 * PrepareSolid() sets up the driver for doing a solid fill.
167 * @param pPixmap Destination pixmap
168 * @param alu raster operation
169 * @param planemask write mask for the fill
170 * @param fg "foreground" color for the fill
171 *
172 * This call should set up the driver for doing a series of solid fills
173 * through the Solid() call. The alu raster op is one of the GX*
174 * graphics functions listed in X.h, and typically maps to a similar
175 * single-byte "ROP" setting in all hardware. The planemask controls
176 * which bits of the destination should be affected, and will only represent
177 * the bits up to the depth of pPixmap. The fg is the pixel value of the
178 * foreground color referred to in ROP descriptions.
179 *
180 * Note that many drivers will need to store some of the data in the driver
181 * private record, for sending to the hardware with each drawing command.
182 *
183 * The PrepareSolid() call is required of all drivers, but it may fail for any
184 * reason. Failure results in a fallback to software rendering.
185 */
186 Bool (*PrepareSolid) (PixmapPtr pPixmap,
187 int alu,
188 Pixel planemask,
189 Pixel fg);
190
191 /**
192 * Solid() performs a solid fill set up in the last PrepareSolid() call.
193 *
194 * @param pPixmap destination pixmap
195 * @param x1 left coordinate
196 * @param y1 top coordinate
197 * @param x2 right coordinate
198 * @param y2 bottom coordinate
199 *
200 * Performs the fill set up by the last PrepareSolid() call, covering the
201 * area from (x1,y1) to (x2,y2) in pPixmap. Note that the coordinates are
202 * in the coordinate space of the destination pixmap, so the driver will
203 * need to set up the hardware's offset and pitch for the destination
204 * coordinates according to the pixmap's offset and pitch within
205 * framebuffer. This likely means using exaGetPixmapOffset() and
206 * exaGetPixmapPitch().
207 *
208 * This call is required if PrepareSolid() ever succeeds.
209 */
210 void (*Solid) (PixmapPtr pPixmap, int x1, int y1, int x2, int y2);
211
212 /**
213 * DoneSolid() finishes a set of solid fills.
214 *
215 * @param pPixmap destination pixmap.
216 *
217 * The DoneSolid() call is called at the end of a series of consecutive
218 * Solid() calls following a successful PrepareSolid(). This allows drivers
219 * to finish up emitting drawing commands that were buffered, or clean up
220 * state from PrepareSolid().
221 *
222 * This call is required if PrepareSolid() ever succeeds.
223 */
224 void (*DoneSolid) (PixmapPtr pPixmap);
225 /** @} */
226
227 /** @name Copy
228 * @{
229 */
230 /**
231 * PrepareCopy() sets up the driver for doing a copy within offscreen
232 * memory.
233 *
234 * @param pSrcPixmap source pixmap
235 * @param pDstPixmap destination pixmap
236 * @param dx X copy direction
237 * @param dy Y copy direction
238 * @param alu raster operation
239 * @param planemask write mask for the fill
240 *
241 * This call should set up the driver for doing a series of copies from the
242 * the pSrcPixmap to the pDstPixmap. The dx flag will be positive if the
243 * hardware should do the copy from the left to the right, and dy will be
244 * positive if the copy should be done from the top to the bottom. This
245 * is to deal with self-overlapping copies when pSrcPixmap == pDstPixmap.
246 * If your hardware can only support blits that are (left to right, top to
247 * bottom) or (right to left, bottom to top), then you should set
248 * #EXA_TWO_BITBLT_DIRECTIONS, and EXA will break down Copy operations to
249 * ones that meet those requirements. The alu raster op is one of the GX*
250 * graphics functions listed in X.h, and typically maps to a similar
251 * single-byte "ROP" setting in all hardware. The planemask controls which
252 * bits of the destination should be affected, and will only represent the
253 * bits up to the depth of pPixmap.
254 *
255 * Note that many drivers will need to store some of the data in the driver
256 * private record, for sending to the hardware with each drawing command.
257 *
258 * The PrepareCopy() call is required of all drivers, but it may fail for any
259 * reason. Failure results in a fallback to software rendering.
260 */
261 Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
262 PixmapPtr pDstPixmap,
263 int dx,
264 int dy,
265 int alu,
266 Pixel planemask);
267
268 /**
269 * Copy() performs a copy set up in the last PrepareCopy call.
270 *
271 * @param pDstPixmap destination pixmap
272 * @param srcX source X coordinate
273 * @param srcY source Y coordinate
274 * @param dstX destination X coordinate
275 * @param dstY destination Y coordinate
276 * @param width width of the rectangle to be copied
277 * @param height height of the rectangle to be copied.
278 *
279 * Performs the copy set up by the last PrepareCopy() call, copying the
280 * rectangle from (srcX, srcY) to (srcX + width, srcY + width) in the source
281 * pixmap to the same-sized rectangle at (dstX, dstY) in the destination
282 * pixmap. Those rectangles may overlap in memory, if
283 * pSrcPixmap == pDstPixmap. Note that this call does not receive the
284 * pSrcPixmap as an argument -- if it's needed in this function, it should
285 * be stored in the driver private during PrepareCopy(). As with Solid(),
286 * the coordinates are in the coordinate space of each pixmap, so the driver
287 * will need to set up source and destination pitches and offsets from those
288 * pixmaps, probably using exaGetPixmapOffset() and exaGetPixmapPitch().
289 *
290 * This call is required if PrepareCopy ever succeeds.
291 */
292 void (*Copy) (PixmapPtr pDstPixmap,
293 int srcX,
294 int srcY,
295 int dstX,
296 int dstY,
297 int width,
298 int height);
299
300 /**
301 * DoneCopy() finishes a set of copies.
302 *
303 * @param pPixmap destination pixmap.
304 *
305 * The DoneCopy() call is called at the end of a series of consecutive
306 * Copy() calls following a successful PrepareCopy(). This allows drivers
307 * to finish up emitting drawing commands that were buffered, or clean up
308 * state from PrepareCopy().
309 *
310 * This call is required if PrepareCopy() ever succeeds.
311 */
312 void (*DoneCopy) (PixmapPtr pDstPixmap);
313 /** @} */
314
315 /** @name Composite
316 * @{
317 */
318 /**
319 * CheckComposite() checks to see if a composite operation could be
320 * accelerated.
321 *
322 * @param op Render operation
323 * @param pSrcPicture source Picture
324 * @param pMaskPicture mask picture
325 * @param pDstPicture destination Picture
326 *
327 * The CheckComposite() call checks if the driver could handle acceleration
328 * of op with the given source, mask, and destination pictures. This allows
329 * drivers to check source and destination formats, supported operations,
330 * transformations, and component alpha state, and send operations it can't
331 * support to software rendering early on. This avoids costly pixmap
332 * migration to the wrong places when the driver can't accelerate
333 * operations. Note that because migration hasn't happened, the driver
334 * can't know during CheckComposite() what the offsets and pitches of the
335 * pixmaps are going to be.
336 *
337 * See PrepareComposite() for more details on likely issues that drivers
338 * will have in accelerating Composite operations.
339 *
340 * The CheckComposite() call is recommended if PrepareComposite() is
341 * implemented, but is not required.
342 */
343 Bool (*CheckComposite) (int op,
344 PicturePtr pSrcPicture,
345 PicturePtr pMaskPicture,
346 PicturePtr pDstPicture);
347
348 /**
349 * PrepareComposite() sets up the driver for doing a Composite operation
350 * described in the Render extension protocol spec.
351 *
352 * @param op Render operation
353 * @param pSrcPicture source Picture
354 * @param pMaskPicture mask picture
355 * @param pDstPicture destination Picture
356 * @param pSrc source pixmap
357 * @param pMask mask pixmap
358 * @param pDst destination pixmap
359 *
360 * This call should set up the driver for doing a series of Composite
361 * operations, as described in the Render protocol spec, with the given
362 * pSrcPicture, pMaskPicture, and pDstPicture. The pSrc, pMask, and
363 * pDst are the pixmaps containing the pixel data, and should be used for
364 * setting the offset and pitch used for the coordinate spaces for each of
365 * the Pictures.
366 *
367 * Notes on interpreting Picture structures:
368 * - The Picture structures will always have a valid pDrawable.
369 * - The Picture structures will never have alphaMap set.
370 * - The mask Picture (and therefore pMask) may be NULL, in which case the
371 * operation is simply src OP dst instead of src IN mask OP dst, and
372 * mask coordinates should be ignored.
373 * - pMarkPicture may have componentAlpha set, which greatly changes
374 * the behavior of the Composite operation. componentAlpha has no effect
375 * when set on pSrcPicture or pDstPicture.
376 * - The source and mask Pictures may have a transformation set
377 * (Picture->transform != NULL), which means that the source coordinates
378 * should be transformed by that transformation, resulting in scaling,
379 * rotation, etc. The PictureTransformPoint() call can transform
380 * coordinates for you. Transforms have no effect on Pictures when used
381 * as a destination.
382 * - The source and mask pictures may have a filter set. PictFilterNearest
383 * and PictFilterBilinear are defined in the Render protocol, but others
384 * may be encountered, and must be handled correctly (usually by
385 * PrepareComposite failing, and falling back to software). Filters have
386 * no effect on Pictures when used as a destination.
387 * - The source and mask Pictures may have repeating set, which must be
388 * respected. Many chipsets will be unable to support repeating on
389 * pixmaps that have a width or height that is not a power of two.
390 *
391 * If your hardware can't support source pictures (textures) with
392 * non-power-of-two pitches, you should set #EXA_OFFSCREEN_ALIGN_POT.
393 *
394 * Note that many drivers will need to store some of the data in the driver
395 * private record, for sending to the hardware with each drawing command.
396 *
397 * The PrepareComposite() call is not required. However, it is highly
398 * recommended for performance of antialiased font rendering and performance
399 * of cairo applications. Failure results in a fallback to software
400 * rendering.
401 */
402 Bool (*PrepareComposite) (int op,
403 PicturePtr pSrcPicture,
404 PicturePtr pMaskPicture,
405 PicturePtr pDstPicture,
406 PixmapPtr pSrc,
407 PixmapPtr pMask,
408 PixmapPtr pDst);
409
410 /**
411 * Composite() performs a Composite operation set up in the last
412 * PrepareComposite() call.
413 *
414 * @param pDstPixmap destination pixmap
415 * @param srcX source X coordinate
416 * @param srcY source Y coordinate
417 * @param maskX source X coordinate
418 * @param maskY source Y coordinate
419 * @param dstX destination X coordinate
420 * @param dstY destination Y coordinate
421 * @param width destination rectangle width
422 * @param height destination rectangle height
423 *
424 * Performs the Composite operation set up by the last PrepareComposite()
425 * call, to the rectangle from (dstX, dstY) to (dstX + width, dstY + height)
426 * in the destination Pixmap. Note that if a transformation was set on
427 * the source or mask Pictures, the source rectangles may not be the same
428 * size as the destination rectangles and filtering. Getting the coordinate
429 * transformation right at the subpixel level can be tricky, and rendercheck
430 * can test this for you.
431 *
432 * This call is required if PrepareComposite() ever succeeds.
433 */
434 void (*Composite) (PixmapPtr pDst,
435 int srcX,
436 int srcY,
437 int maskX,
438 int maskY,
439 int dstX,
440 int dstY,
441 int width,
442 int height);
443
444 /**
445 * DoneComposite() finishes a set of Composite operations.
446 *
447 * @param pPixmap destination pixmap.
448 *
449 * The DoneComposite() call is called at the end of a series of consecutive
450 * Composite() calls following a successful PrepareComposite(). This allows
451 * drivers to finish up emitting drawing commands that were buffered, or
452 * clean up state from PrepareComposite().
453 *
454 * This call is required if PrepareComposite() ever succeeds.
455 */
456 void (*DoneComposite) (PixmapPtr pDst);
457 /** @} */
458
459 /**
460 * UploadToScreen() loads a rectangle of data from src into pDst.
461 *
462 * @param pDst destination pixmap
463 * @param x destination X coordinate.
464 * @param y destination Y coordinate
465 * @param width width of the rectangle to be copied
466 * @param height height of the rectangle to be copied
467 * @param src pointer to the beginning of the source data
468 * @param src_pitch pitch (in bytes) of the lines of source data.
469 *
470 * UploadToScreen() copies data in system memory beginning at src (with
471 * pitch src_pitch) into the destination pixmap from (x, y) to
472 * (x + width, y + height). This is typically done with hostdata uploads,
473 * where the CPU sets up a blit command on the hardware with instructions
474 * that the blit data will be fed through some sort of aperture on the card.
475 *
476 * If UploadToScreen() is performed asynchronously, it is up to the driver
477 * to call exaMarkSync(). This is in contrast to most other acceleration
478 * calls in EXA.
479 *
480 * UploadToScreen() can aid in pixmap migration, but is most important for
481 * the performance of exaGlyphs() (antialiased font drawing) by allowing
482 * pipelining of data uploads, avoiding a sync of the card after each glyph.
483 *
484 * @return TRUE if the driver successfully uploaded the data. FALSE
485 * indicates that EXA should fall back to doing the upload in software.
486 *
487 * UploadToScreen() is not required, but is recommended if Composite
488 * acceleration is supported.
489 */
490 Bool (*UploadToScreen) (PixmapPtr pDst,
491 int x,
492 int y,
493 int w,
494 int h,
495 char *src,
496 int src_pitch);
497
498 /**
499 * UploadToScratch() is used to upload a pixmap to a scratch area for
500 * acceleration.
501 *
502 * @param pSrc source pixmap in host memory
503 * @param pDst fake, scratch pixmap to be set up in offscreen memory.
504 *
505 * The UploadToScratch() call was added to support Xati before Xati had
506 * support for hostdata uploads and before exaGlyphs() was written. It
507 * behaves incorrectly (uses an invalid pixmap as pDst),
508 * and UploadToScreen() should be implemented instead.
509 *
510 * Drivers implementing UploadToScratch() had to set up space (likely in a
511 * statically allocated area) in offscreen memory, copy pSrc to that
512 * scratch area, and adust pDst->devKind for the pitch and
513 * pDst->devPrivate.ptr for the pointer to that scratch area. The driver
514 * was responsible for syncing (as it was implemented using memcpy() in
515 * Xati), and only the data from the last UploadToScratch() was guaranteed
516 * to be valid at any given time.
517 *
518 * UploadToScratch() should not be implemented by drivers, and will likely
519 * be removed in a future version of EXA.
520 */
521 Bool (*UploadToScratch) (PixmapPtr pSrc,
522 PixmapPtr pDst);
523
524 /**
525 * DownloadFromScreen() loads a rectangle of data from pSrc into dst
526 *
527 * @param pSrc source pixmap
528 * @param x source X coordinate.
529 * @param y source Y coordinate
530 * @param width width of the rectangle to be copied
531 * @param height height of the rectangle to be copied
532 * @param dst pointer to the beginning of the destination data
533 * @param dst_pitch pitch (in bytes) of the lines of destination data.
534 *
535 * DownloadFromScreen() copies data from offscreen memory in pSrc from
536 * (x, y) to (x + width, y + height), to system memory starting at
537 * dst (with pitch dst_pitch). This would usually be done
538 * using scatter-gather DMA, supported by a DRM call, or by blitting to AGP
539 * and then synchronously reading from AGP. Because the implementation
540 * might be synchronous, EXA leaves it up to the driver to call
541 * exaMarkSync() if DownloadFromScreen() was asynchronous. This is in
542 * contrast to most other acceleration calls in EXA.
543 *
544 * DownloadFromScreen() can aid in the largest bottleneck in pixmap
545 * migration, which is the read from framebuffer when evicting pixmaps from
546 * framebuffer memory. Thus, it is highly recommended, even though
547 * implementations are typically complicated.
548 *
549 * @return TRUE if the driver successfully downloaded the data. FALSE
550 * indicates that EXA should fall back to doing the download in software.
551 *
552 * DownloadFromScreen() is not required, but is highly recommended.
553 */
554 Bool (*DownloadFromScreen)(PixmapPtr pSrc,
555 int x, int y,
556 int w, int h,
557 char *dst, int dst_pitch);
558
559 /**
560 * MarkSync() requests that the driver mark a synchronization point,
561 * returning an driver-defined integer marker which could be requested for
562 * synchronization to later in WaitMarker(). This might be used in the
563 * future to avoid waiting for full hardware stalls before accessing pixmap
564 * data with the CPU, but is not important in the current incarnation of
565 * EXA.
566 *
567 * Note that drivers should call exaMarkSync() when they have done some
568 * acceleration, rather than their own MarkSync() handler, as otherwise EXA
569 * will be unaware of the driver's acceleration and not sync to it during
570 * fallbacks.
571 *
572 * MarkSync() is optional.
573 */
574 int (*MarkSync) (ScreenPtr pScreen);
575
576 /**
577 * WaitMarker() waits for all rendering before the given marker to have
578 * completed. If the driver does not implement MarkSync(), marker is
579 * meaningless, and all rendering by the hardware should be completed before
580 * WaitMarker() returns.
581 *
582 * Note that drivers should call exaWaitSync() to wait for all acceleration
583 * to finish, as otherwise EXA will be unaware of the driver having
584 * synchronized, resulting in excessive WaitMarker() calls.
585 *
586 * WaitMarker() is required of all drivers.
587 */
588 void (*WaitMarker) (ScreenPtr pScreen, int marker);
589
590 /** @{ */
591 /**
592 * PrepareAccess() is called before CPU access to an offscreen pixmap.
593 *
594 * @param pPix the pixmap being accessed
595 * @param index the index of the pixmap being accessed.
596 *
597 * PrepareAccess() will be called before CPU access to an offscreen pixmap.
598 * This can be used to set up hardware surfaces for byteswapping or
599 * untiling, or to adjust the pixmap's devPrivate.ptr for the purpose of
600 * making CPU access use a different aperture.
601 *
602 * The index is one of #EXA_PREPARE_DEST, #EXA_PREPARE_SRC, or
603 * #EXA_PREPARE_MASK, indicating which pixmap is in question. Since only up
604 * to three pixmaps will have PrepareAccess() called on them per operation,
605 * drivers can have a small, statically-allocated space to maintain state
606 * for PrepareAccess() and FinishAccess() in. Note that the same pixmap may
607 * have PrepareAccess() called on it more than once, for example when doing
608 * a copy within the same pixmap (so it gets PrepareAccess as()
609 * #EXA_PREPARE_DEST and then as #EXA_PREPARE_SRC).
610 *
611 * PrepareAccess() may fail. An example might be the case of hardware that
612 * can set up 1 or 2 surfaces for CPU access, but not 3. If PrepareAccess()
613 * fails, EXA will migrate the pixmap to system memory.
614 * DownloadFromScreen() must be implemented and must not fail if a driver
615 * wishes to fail in PrepareAccess(). PrepareAccess() must not fail when
616 * pPix is the visible screen, because the visible screen can not be
617 * migrated.
618 *
619 * @return TRUE if PrepareAccess() successfully prepared the pixmap for CPU
620 * drawing.
621 * @return FALSE if PrepareAccess() is unsuccessful and EXA should use
622 * DownloadFromScreen() to migate the pixmap out.
623 */
624 Bool (*PrepareAccess)(PixmapPtr pPix, int index);
625
626 /**
627 * FinishAccess() is called after CPU access to an offscreen pixmap.
628 *
629 * @param pPix the pixmap being accessed
630 * @param index the index of the pixmap being accessed.
631 *
632 * FinishAccess() will be called after finishing CPU access of an offscreen
633 * pixmap set up by PrepareAccess(). Note that the FinishAccess() will not be
634 * called if PrepareAccess() failed and the pixmap was migrated out.
635 */
636 void (*FinishAccess)(PixmapPtr pPix, int index);
637
638 /** @name PrepareAccess() and FinishAccess() indices
639 * @{
640 */
641 /**
642 * EXA_PREPARE_DEST is the index for a pixmap that may be drawn to or
643 * read from.
644 */
645 #define EXA_PREPARE_DEST 0
646 /**
647 * EXA_PREPARE_SRC is the index for a pixmap that may be read from
648 */
649 #define EXA_PREPARE_SRC 1
650 /**
651 * EXA_PREPARE_SRC is the index for a second pixmap that may be read
652 * from.
653 */
654 #define EXA_PREPARE_MASK 2
655 /** @} */
656 /** @} */
657} ExaDriverRec, *ExaDriverPtr;
658
659/** @name EXA driver flags
660 * @{
661 */
662/**
663 * EXA_OFFSCREEN_PIXMAPS indicates to EXA that the driver can support
664 * offscreen pixmaps.
665 */
666#define EXA_OFFSCREEN_PIXMAPS (1 << 0)
667
668/**
669 * EXA_OFFSCREEN_ALIGN_POT indicates to EXA that the driver needs pixmaps
670 * to have a power-of-two pitch.
671 */
672#define EXA_OFFSCREEN_ALIGN_POT (1 << 1)
673
674/**
675 * EXA_TWO_BITBLT_DIRECTIONS indicates to EXA that the driver can only
676 * support copies that are (left-to-right, top-to-bottom) or
677 * (right-to-left, bottom-to-top).
678 */
679#define EXA_TWO_BITBLT_DIRECTIONS (1 << 2)
680/** @} */
681
682ExaDriverPtr
683exaDriverAlloc(void);
684
685Bool
686exaDriverInit(ScreenPtr pScreen,
687 ExaDriverPtr pScreenInfo);
688
689void
690exaDriverFini(ScreenPtr pScreen);
691
692void
693exaMarkSync(ScreenPtr pScreen);
694void
695exaWaitSync(ScreenPtr pScreen);
696
697ExaOffscreenArea *
698exaOffscreenAlloc(ScreenPtr pScreen, int size, int align,
699 Bool locked,
700 ExaOffscreenSaveProc save,
701 pointer privData);
702
703ExaOffscreenArea *
704exaOffscreenFree(ScreenPtr pScreen, ExaOffscreenArea *area);
705
706unsigned long
707exaGetPixmapOffset(PixmapPtr pPix);
708
709unsigned long
710exaGetPixmapPitch(PixmapPtr pPix);
711
712unsigned long
713exaGetPixmapSize(PixmapPtr pPix);
714
715void
716exaEnableDisableFBAccess (int index, Bool enable);
717
718#endif /* EXA_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette