Ps3GpuTransferData cannot handle negative X and Y copy directions, fallback to softwa...
[ps3freebsd_xf86_video_ps3gpu.git] / src / ps3gpu_accel.c
blob7701fd547060dc95b1298d42b749d40ad988ba85
1 /*-
2 * Copyright (C) 2011 glevand <geoffrey.levand@mail.ru>
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer,
10 * without modification, immediately at the beginning of the file.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * $FreeBSD$
29 #ifdef HAVE_CONFIG_H
30 #include "config.h"
31 #endif
33 #include "xf86.h"
34 #include "xf86_OSproc.h"
36 #include "xf86Cursor.h"
38 #include "exa.h"
40 #include <sys/types.h>
41 #include <sys/stat.h>
42 #include <sys/uio.h>
43 #include <sys/ioctl.h>
44 #include <sys/mman.h>
45 #include <fcntl.h>
46 #include <unistd.h>
48 #include "ps3gpu_ctl.h"
50 #include "ps3gpu.h"
51 #include "ps3gpu_accel.h"
53 enum {
54 XFER_MODE_VIDEO_TO_VIDEO,
55 XFER_MODE_GART_TO_VIDEO,
56 XFER_MODE_VIDEO_TO_GART,
57 XFER_MODE_GART_TO_GART
60 static inline void
61 Ps3GpuFifoPut(ScrnInfoPtr pScrn, CARD32 data)
63 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
64 CARD32 *fifoBase = (CARD32 *) gPtr->fifoBase;
66 fifoBase[gPtr->fifoCurrentSlot++] = data;
69 static inline void
70 Ps3GpuFifoKick(ScrnInfoPtr pScrn)
72 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
73 volatile CARD32 *controlBase = (CARD32 *) gPtr->controlBase;
75 if (gPtr->fifoCurrentSlot == gPtr->fifoPutSlot)
76 return;
78 controlBase[0x10] = gPtr->fifoGpuAddress + (gPtr->fifoCurrentSlot << 2);
80 gPtr->fifoPutSlot = gPtr->fifoCurrentSlot;
83 static void
84 Ps3GpuFifoWait(ScrnInfoPtr pScrn, int slots)
86 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
87 volatile CARD32 *controlBase = (CARD32 *) gPtr->controlBase;
88 int retries = 5000;
90 if ((gPtr->fifoFreeSlots - 1) >= slots)
91 return;
93 Ps3GpuFifoPut(pScrn, 0x20000000 | gPtr->fifoGpuAddress);
95 controlBase[0x10] = gPtr->fifoGpuAddress;
97 while (retries--) {
98 if (controlBase[0x10] == controlBase[0x11])
99 break;
102 if (controlBase[0x10] != controlBase[0x11])
103 FatalError("Failed to flush GPU FIFO\n");
105 gPtr->fifoPutSlot = 0;
106 gPtr->fifoCurrentSlot = 0;
107 gPtr->fifoFreeSlots = gPtr->fifoMaxSlots - gPtr->fifoCurrentSlot;
110 static inline void
111 Ps3GpuFifoReserveSpace(ScrnInfoPtr pScrn, int slots)
113 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
115 Ps3GpuFifoWait(pScrn, slots);
117 gPtr->fifoFreeSlots -= slots;
120 static Bool
121 Ps3GpuContextInit(ScrnInfoPtr pScrn)
123 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
125 Ps3GpuFifoReserveSpace(pScrn, 2);
126 Ps3GpuFifoPut(pScrn, 0x00040000);
127 Ps3GpuFifoPut(pScrn, 0x31337000);
129 Ps3GpuFifoReserveSpace(pScrn, 2);
130 Ps3GpuFifoPut(pScrn, 0x00042000);
131 Ps3GpuFifoPut(pScrn, 0x31337303);
133 Ps3GpuFifoReserveSpace(pScrn, 4);
134 Ps3GpuFifoPut(pScrn, 0x000c2180);
135 Ps3GpuFifoPut(pScrn, 0x66604200);
136 Ps3GpuFifoPut(pScrn, 0xfeed0001);
137 Ps3GpuFifoPut(pScrn, 0xfeed0000);
139 Ps3GpuFifoReserveSpace(pScrn, 2);
140 Ps3GpuFifoPut(pScrn, 0x00046000);
141 Ps3GpuFifoPut(pScrn, 0x313371c3);
143 Ps3GpuFifoReserveSpace(pScrn, 4);
144 Ps3GpuFifoPut(pScrn, 0x000c6180);
145 Ps3GpuFifoPut(pScrn, 0x66604200);
146 Ps3GpuFifoPut(pScrn, 0xfeed0000);
147 Ps3GpuFifoPut(pScrn, 0xfeed0000);
149 Ps3GpuFifoReserveSpace(pScrn, 2);
150 Ps3GpuFifoPut(pScrn, 0x0004a000);
151 Ps3GpuFifoPut(pScrn, 0x31337808);
153 Ps3GpuFifoReserveSpace(pScrn, 9);
154 Ps3GpuFifoPut(pScrn, 0x0020a180);
155 Ps3GpuFifoPut(pScrn, 0x66604200);
156 Ps3GpuFifoPut(pScrn, 0x00000000);
157 Ps3GpuFifoPut(pScrn, 0x00000000);
158 Ps3GpuFifoPut(pScrn, 0x00000000);
159 Ps3GpuFifoPut(pScrn, 0x00000000);
160 Ps3GpuFifoPut(pScrn, 0x00000000);
161 Ps3GpuFifoPut(pScrn, 0x00000000);
162 Ps3GpuFifoPut(pScrn, 0x313371c3);
164 Ps3GpuFifoReserveSpace(pScrn, 3);
165 Ps3GpuFifoPut(pScrn, 0x0008a2fc);
166 Ps3GpuFifoPut(pScrn, 0x00000003);
167 Ps3GpuFifoPut(pScrn, 0x00000004);
169 Ps3GpuFifoReserveSpace(pScrn, 2);
170 Ps3GpuFifoPut(pScrn, 0x00048000);
171 Ps3GpuFifoPut(pScrn, 0x31337a73);
173 Ps3GpuFifoReserveSpace(pScrn, 3);
174 Ps3GpuFifoPut(pScrn, 0x00088180);
175 Ps3GpuFifoPut(pScrn, 0x66604200);
176 Ps3GpuFifoPut(pScrn, 0xfeed0000);
178 Ps3GpuFifoReserveSpace(pScrn, 2);
179 Ps3GpuFifoPut(pScrn, 0x0004c000);
180 Ps3GpuFifoPut(pScrn, 0x3137af00);
182 Ps3GpuFifoReserveSpace(pScrn, 2);
183 Ps3GpuFifoPut(pScrn, 0x0004c180);
184 Ps3GpuFifoPut(pScrn, 0x66604200);
186 Ps3GpuFifoKick(pScrn);
188 return (TRUE);
191 static inline Bool
192 Ps3GpuTransferData(ScrnInfoPtr pScrn, int mode,
193 CARD32 dst_offset, CARD32 dst_pitch, CARD32 src_offset, CARD32 src_pitch,
194 CARD32 row_length, CARD32 row_count)
196 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
197 CARD32 src, dst;
199 if (row_length == 0 || row_count == 0)
200 return (TRUE);
202 switch (mode) {
203 case XFER_MODE_VIDEO_TO_VIDEO:
204 src = 0xfeed0000;
205 dst = 0xfeed0000;
206 break;
207 case XFER_MODE_GART_TO_VIDEO:
208 src = 0xfeed0001;
209 dst = 0xfeed0000;
210 break;
211 case XFER_MODE_VIDEO_TO_GART:
212 src = 0xfeed0000;
213 dst = 0xfeed0001;
214 break;
215 case XFER_MODE_GART_TO_GART:
216 src = 0xfeed0001;
217 dst = 0xfeed0001;
218 break;
219 default:
220 return (FALSE);
223 Ps3GpuFifoReserveSpace(pScrn, 3);
224 Ps3GpuFifoPut(pScrn, 0x00082184);
225 Ps3GpuFifoPut(pScrn, src);
226 Ps3GpuFifoPut(pScrn, dst);
228 while (row_count--) {
229 Ps3GpuFifoReserveSpace(pScrn, 9);
230 Ps3GpuFifoPut(pScrn, 0x0020230c);
231 Ps3GpuFifoPut(pScrn, src_offset);
232 Ps3GpuFifoPut(pScrn, dst_offset);
233 Ps3GpuFifoPut(pScrn, 0x00000000);
234 Ps3GpuFifoPut(pScrn, 0x00000000);
235 Ps3GpuFifoPut(pScrn, row_length);
236 Ps3GpuFifoPut(pScrn, 0x00000001);
237 Ps3GpuFifoPut(pScrn, 0x00000101);
238 Ps3GpuFifoPut(pScrn, 0x00000000);
240 src_offset += src_pitch;
241 dst_offset += dst_pitch;
244 Ps3GpuFifoKick(pScrn);
246 return (TRUE);
249 static Bool
250 Ps3GpuUploadInline(PixmapPtr pDst, int x, int y, int w, int h,
251 char *src, int src_pitch)
253 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
254 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
255 int cpp = pDst->drawable.bitsPerPixel >> 3;
256 int row_length = w * cpp;
258 /*FIXME*/
260 return (FALSE);
263 static Bool
264 Ps3GpuUploadDma(PixmapPtr pDst, int x, int y, int w, int h,
265 char *src, int src_pitch)
267 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
268 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
269 int cpp = pDst->drawable.bitsPerPixel >> 3;
270 int dst_pitch = exaGetPixmapPitch(pDst);
271 int dst_offset = exaGetPixmapOffset(pDst) + y * dst_pitch + x * cpp;
272 int row_length = w * cpp;
273 int max_row_count = gPtr->gartSize / row_length;
274 int row_count;
275 char *dst;
276 int i;
278 while (h) {
279 row_count = h;
280 if (row_count > max_row_count)
281 row_count = max_row_count;
283 dst = (char *) gPtr->gartBase;
285 if (src_pitch == row_length) {
286 memcpy(dst, src, src_pitch * row_count);
287 src += src_pitch * row_count;
288 } else {
289 for (i = 0; i < row_count; i++) {
290 memcpy(dst, src, row_length);
291 dst += row_length;
292 src += src_pitch;
296 Ps3GpuTransferData(pScrn, XFER_MODE_GART_TO_VIDEO,
297 gPtr->fbGpuAddress + dst_offset, dst_pitch,
298 gPtr->gartGpuAddress, row_length,
299 row_length, row_count);
301 exaWaitSync(pDst->drawable.pScreen);
303 dst_offset += row_count * dst_pitch;
304 h -= row_count;
307 return (TRUE);
310 static Bool
311 Ps3GpuDownloadDma(PixmapPtr pSrc, int x, int y, int w, int h,
312 char *dst, int dst_pitch)
314 ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
315 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
316 int cpp = pSrc->drawable.bitsPerPixel >> 3;
317 int src_pitch = exaGetPixmapPitch(pSrc);
318 int src_offset = exaGetPixmapOffset(pSrc) + y * src_pitch + x * cpp;
319 int row_length = w * cpp;
320 int max_row_count = gPtr->gartSize / row_length;
321 int row_count;
322 char *src;
323 int i;
325 while (h) {
326 row_count = h;
327 if (row_count > max_row_count)
328 row_count = max_row_count;
330 Ps3GpuTransferData(pScrn, XFER_MODE_VIDEO_TO_GART,
331 gPtr->gartGpuAddress, row_length,
332 gPtr->fbGpuAddress + src_offset, src_pitch,
333 row_length, row_count);
335 exaWaitSync(pSrc->drawable.pScreen);
337 src = (char *) gPtr->gartBase;
339 if (dst_pitch == row_length) {
340 memcpy(dst, src, dst_pitch * row_count);
341 dst += dst_pitch * row_count;
342 } else {
343 for (i = 0; i < row_count; i++) {
344 memcpy(dst, src, row_length);
345 dst += dst_pitch;
346 src += row_length;
350 src_offset += row_count * src_pitch;
351 h -= row_count;
354 return (TRUE);
357 static Bool
358 Ps3GpuPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
360 /*FIXME*/
362 return (FALSE);
365 static void
366 Ps3GpuSolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
368 /*FIXME*/
371 static void
372 Ps3GpuDoneSolid(PixmapPtr pPixmap)
374 /*FIXME*/
377 static Bool
378 Ps3GpuPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap,
379 int dx, int dy, int alu, Pixel planemask)
381 ScrnInfoPtr pScrn = xf86Screens[pSrcPixmap->drawable.pScreen->myNum];
382 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
384 DPRINTF(pScrn, "%s:%d: sbpp=%d dbpp=%d dx=%d dy=%d alu=%d\n",
385 __func__, __LINE__, pSrcPixmap->drawable.bitsPerPixel,
386 pDstPixmap->drawable.bitsPerPixel, dx, dy, alu);
388 if (pSrcPixmap->drawable.bitsPerPixel !=
389 pDstPixmap->drawable.bitsPerPixel)
390 return (FALSE);
392 if (dx < 0 || dy < 0)
393 return (FALSE);
395 planemask |= ~0 << pDstPixmap->drawable.bitsPerPixel;
397 if (planemask != ~0 || alu != GXcopy)
398 return (FALSE);
400 gPtr->copyDx = dx;
401 gPtr->copyDy = dy;
402 gPtr->pCopySrcPixmap = pSrcPixmap;
404 return (TRUE);
407 static void
408 Ps3GpuCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
409 int width, int height)
411 ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
412 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
413 int cpp = pDstPixmap->drawable.bitsPerPixel >> 3;
414 int src_pitch = exaGetPixmapPitch(gPtr->pCopySrcPixmap);
415 int src_offset = exaGetPixmapOffset(gPtr->pCopySrcPixmap) +
416 srcY * src_pitch + srcX * cpp;
417 int dst_pitch = exaGetPixmapPitch(pDstPixmap);
418 int dst_offset = exaGetPixmapOffset(pDstPixmap) +
419 dstY * dst_pitch + dstX * cpp;
421 DPRINTF(pScrn, "%s:%d: srcX=%d srcY=%d dstX=%d dstY=%d width=%d height=%d\n",
422 __func__, __LINE__, srcX, srcY, dstX, dstY, width, height);
424 Ps3GpuTransferData(pScrn, XFER_MODE_VIDEO_TO_VIDEO,
425 gPtr->fbGpuAddress + dst_offset, dst_pitch,
426 gPtr->fbGpuAddress + src_offset, src_pitch,
427 width * cpp, height);
430 static void
431 Ps3GpuDoneCopy(PixmapPtr pDstPixmap)
433 ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
434 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
436 gPtr->pCopySrcPixmap = NULL;
439 static Bool
440 Ps3GpuUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
441 char *src, int src_pitch)
443 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
445 #if 0
446 if (Ps3GpuUploadInline(pDst, x, y, w, h, src, src_pitch))
447 return (TRUE);
449 if (Ps3GpuUploadDma(pDst, x, y, w, h, src, src_pitch))
450 return (TRUE);
451 #endif
453 return (FALSE);
456 static Bool
457 Ps3GpuDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
458 char *dst, int dst_pitch)
460 ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
462 #if 0
463 if (Ps3GpuDownloadDma(pSrc, x, y, w, h, dst, dst_pitch))
464 return (TRUE);
465 #endif
467 return (FALSE);
470 static Bool
471 Ps3GpuCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
472 PicturePtr pDstPicture)
474 /*FIXME*/
476 return (FALSE);
479 static Bool
480 Ps3GpuPrepareComposite(int op, PicturePtr pSrcPicture,
481 PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc,
482 PixmapPtr pMask, PixmapPtr pDst)
484 /*FIXME*/
486 return (FALSE);
489 static void
490 Ps3GpuComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
491 int dstX, int dstY, int width, int height)
493 /*FIXME*/
496 static void
497 Ps3GpuDoneComposite(PixmapPtr pDst)
499 /*FIXME*/
502 static int
503 Ps3GpuMarkSync(ScreenPtr screen)
505 /*FIXME*/
508 static void
509 Ps3GpuWaitMarker(ScreenPtr pScreen, int marker)
511 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
512 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
513 volatile CARD32 *controlBase = (CARD32 *) gPtr->controlBase;
514 int retries = 5000;
516 Ps3GpuFifoKick(pScrn);
518 while (retries--) {
519 if (controlBase[0x10] == controlBase[0x11])
520 break;
523 if (controlBase[0x10] != controlBase[0x11])
524 FatalError("Failed to flush GPU FIFO\n");
527 Bool
528 Ps3GpuAccelInit(ScreenPtr pScreen)
530 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
531 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
532 struct ps3gpu_ctl_memory_allocate memoryAllocate;
533 struct ps3gpu_ctl_setup_control setupControl;
534 ExaDriverPtr exaDriver;
535 int err;
537 gPtr->controlBase = (pointer) mmap(NULL, gPtr->gpuControlSize,
538 PROT_READ | PROT_WRITE, MAP_SHARED, gPtr->fd,
539 gPtr->gpuControlHandle);
540 if (gPtr->controlBase == (pointer *) MAP_FAILED) {
541 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
542 "Failed to map GPU control\n");
543 return (FALSE);
546 gPtr->fifoSize = 64 * 1024;
548 memoryAllocate.context_id = gPtr->gpuContextId;
549 memoryAllocate.type = PS3GPU_CTL_MEMORY_TYPE_GART;
550 memoryAllocate.size = gPtr->fifoSize;
551 memoryAllocate.align = 12;
553 err = ioctl(gPtr->fd, PS3GPU_CTL_MEMORY_ALLOCATE,
554 &memoryAllocate);
555 if (err) {
556 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
557 "Failed to allocate FIFO memory\n");
558 return (FALSE);
561 gPtr->fifoHandle = memoryAllocate.handle;
562 gPtr->fifoGpuAddress = memoryAllocate.gpu_addr;
564 gPtr->fifoBase = (pointer) mmap(NULL, gPtr->fifoSize,
565 PROT_READ | PROT_WRITE, MAP_SHARED, gPtr->fd,
566 gPtr->fifoHandle);
567 if (gPtr->fifoBase == (pointer *) MAP_FAILED) {
568 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
569 "Failed to map FIFO memory\n");
570 return (FALSE);
573 setupControl.context_id = gPtr->gpuContextId;
574 setupControl.put = gPtr->fifoHandle;
575 setupControl.get = gPtr->fifoHandle;
576 setupControl.ref = 0xffffffff;
578 err = ioctl(gPtr->fd, PS3GPU_CTL_SETUP_CONTROL, &setupControl);
579 if (err < 0) {
580 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
581 "Failed to setup GPU control\n");
582 return (FALSE);
585 gPtr->fifoMaxSlots = (gPtr->fifoSize - 1032) >> 2;
586 gPtr->fifoPutSlot = 0;
587 gPtr->fifoCurrentSlot = 0;
588 gPtr->fifoFreeSlots = gPtr->fifoMaxSlots - gPtr->fifoCurrentSlot;
590 gPtr->gartSize = 1 * 1024 * 1024;
592 memoryAllocate.context_id = gPtr->gpuContextId;
593 memoryAllocate.type = PS3GPU_CTL_MEMORY_TYPE_GART;
594 memoryAllocate.size = gPtr->gartSize;
595 memoryAllocate.align = 12;
597 err = ioctl(gPtr->fd, PS3GPU_CTL_MEMORY_ALLOCATE,
598 &memoryAllocate);
599 if (err) {
600 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
601 "Failed to allocate GART memory\n");
602 return (FALSE);
605 gPtr->gartHandle = memoryAllocate.handle;
606 gPtr->gartGpuAddress = memoryAllocate.gpu_addr;
608 gPtr->gartBase = (pointer) mmap(NULL, gPtr->gartSize,
609 PROT_READ | PROT_WRITE, MAP_SHARED, gPtr->fd,
610 gPtr->gartHandle);
611 if (gPtr->gartBase == (pointer *) MAP_FAILED) {
612 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
613 "Failed to map GART memory\n");
614 return (FALSE);
617 if (!Ps3GpuContextInit(pScrn))
618 return (FALSE);
620 exaDriver = exaDriverAlloc();
621 if(!exaDriver)
622 return (FALSE);
624 gPtr->exaDriver = exaDriver;
626 exaDriver->exa_major = EXA_VERSION_MAJOR;
627 exaDriver->exa_minor = EXA_VERSION_MINOR;
629 exaDriver->memoryBase = (CARD8 *) gPtr->fbBase;
630 exaDriver->offScreenBase = pScrn->displayWidth * pScrn->virtualY *
631 (pScrn->bitsPerPixel >> 3);
632 exaDriver->offScreenBase = (exaDriver->offScreenBase + 0x3f) & ~0x3f;
633 exaDriver->memorySize = gPtr->fbSize;
635 exaDriver->pixmapOffsetAlign = 256;
636 exaDriver->pixmapPitchAlign = 64;
637 exaDriver->maxX = 2048;
638 exaDriver->maxY = 2048;
640 exaDriver->flags = EXA_OFFSCREEN_PIXMAPS;
642 exaDriver->PrepareSolid = Ps3GpuPrepareSolid;
643 exaDriver->Solid = Ps3GpuSolid;
644 exaDriver->DoneSolid = Ps3GpuDoneSolid;
645 exaDriver->PrepareCopy = Ps3GpuPrepareCopy;
646 exaDriver->Copy = Ps3GpuCopy;
647 exaDriver->DoneCopy = Ps3GpuDoneCopy;
648 exaDriver->UploadToScreen = Ps3GpuUploadToScreen;
649 exaDriver->DownloadFromScreen = Ps3GpuDownloadFromScreen;
650 exaDriver->CheckComposite = Ps3GpuCheckComposite;
651 exaDriver->PrepareComposite = Ps3GpuPrepareComposite;
652 exaDriver->Composite = Ps3GpuComposite;
653 exaDriver->DoneComposite = Ps3GpuDoneComposite;
654 exaDriver->MarkSync = Ps3GpuMarkSync;
655 exaDriver->WaitMarker = Ps3GpuWaitMarker;
657 gPtr->exaDriver = exaDriver;
659 return (exaDriverInit(pScreen, exaDriver));