optimize Ps3GpuTransferData, RSX is capable to transfer 2047 lines at once
[ps3freebsd_xf86_video_ps3gpu.git] / src / ps3gpu_accel.c
blobec9841bf8ef4ede10ae3e9e417cda38376f03275
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, INT32 dst_pitch, CARD32 src_offset, INT32 src_pitch,
194 CARD32 row_length, CARD32 row_count)
196 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
197 CARD32 src, dst;
198 CARD32 h;
200 if (row_length == 0 || row_count == 0)
201 return (TRUE);
203 switch (mode) {
204 case XFER_MODE_VIDEO_TO_VIDEO:
205 src = 0xfeed0000;
206 dst = 0xfeed0000;
207 break;
208 case XFER_MODE_GART_TO_VIDEO:
209 src = 0xfeed0001;
210 dst = 0xfeed0000;
211 break;
212 case XFER_MODE_VIDEO_TO_GART:
213 src = 0xfeed0000;
214 dst = 0xfeed0001;
215 break;
216 case XFER_MODE_GART_TO_GART:
217 src = 0xfeed0001;
218 dst = 0xfeed0001;
219 break;
220 default:
221 return (FALSE);
224 Ps3GpuFifoReserveSpace(pScrn, 3);
225 Ps3GpuFifoPut(pScrn, 0x00082184);
226 Ps3GpuFifoPut(pScrn, src);
227 Ps3GpuFifoPut(pScrn, dst);
229 while (row_count) {
230 h = row_count;
231 if (h > 2047)
232 h = 2047;
234 Ps3GpuFifoReserveSpace(pScrn, 9);
235 Ps3GpuFifoPut(pScrn, 0x0020230c);
236 Ps3GpuFifoPut(pScrn, src_offset);
237 Ps3GpuFifoPut(pScrn, dst_offset);
238 Ps3GpuFifoPut(pScrn, src_pitch);
239 Ps3GpuFifoPut(pScrn, dst_pitch);
240 Ps3GpuFifoPut(pScrn, row_length);
241 Ps3GpuFifoPut(pScrn, h);
242 Ps3GpuFifoPut(pScrn, 0x00000101);
243 Ps3GpuFifoPut(pScrn, 0x00000000);
245 src_offset += h * src_pitch;
246 dst_offset += h * dst_pitch;
247 row_count -= h;
250 Ps3GpuFifoKick(pScrn);
252 return (TRUE);
255 static Bool
256 Ps3GpuUploadInline(PixmapPtr pDst, int x, int y, int w, int h,
257 char *src, int src_pitch)
259 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
260 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
261 int cpp = pDst->drawable.bitsPerPixel >> 3;
262 int row_length = w * cpp;
264 /*FIXME*/
266 return (FALSE);
269 static Bool
270 Ps3GpuUploadDma(PixmapPtr pDst, int x, int y, int w, int h,
271 char *src, int src_pitch)
273 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
274 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
275 int cpp = pDst->drawable.bitsPerPixel >> 3;
276 int dst_pitch = exaGetPixmapPitch(pDst);
277 int dst_offset = exaGetPixmapOffset(pDst) + y * dst_pitch + x * cpp;
278 int row_length = w * cpp;
279 int max_row_count = gPtr->gartSize / row_length;
280 int row_count;
281 char *dst;
282 int i;
284 while (h) {
285 row_count = h;
286 if (row_count > max_row_count)
287 row_count = max_row_count;
289 dst = (char *) gPtr->gartBase;
291 if (src_pitch == row_length) {
292 memcpy(dst, src, src_pitch * row_count);
293 src += src_pitch * row_count;
294 } else {
295 for (i = 0; i < row_count; i++) {
296 memcpy(dst, src, row_length);
297 dst += row_length;
298 src += src_pitch;
302 Ps3GpuTransferData(pScrn, XFER_MODE_GART_TO_VIDEO,
303 gPtr->fbGpuAddress + dst_offset, dst_pitch,
304 gPtr->gartGpuAddress, row_length,
305 row_length, row_count);
307 exaWaitSync(pDst->drawable.pScreen);
309 dst_offset += row_count * dst_pitch;
310 h -= row_count;
313 return (TRUE);
316 static Bool
317 Ps3GpuDownloadDma(PixmapPtr pSrc, int x, int y, int w, int h,
318 char *dst, int dst_pitch)
320 ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
321 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
322 int cpp = pSrc->drawable.bitsPerPixel >> 3;
323 int src_pitch = exaGetPixmapPitch(pSrc);
324 int src_offset = exaGetPixmapOffset(pSrc) + y * src_pitch + x * cpp;
325 int row_length = w * cpp;
326 int max_row_count = gPtr->gartSize / row_length;
327 int row_count;
328 char *src;
329 int i;
331 while (h) {
332 row_count = h;
333 if (row_count > max_row_count)
334 row_count = max_row_count;
336 Ps3GpuTransferData(pScrn, XFER_MODE_VIDEO_TO_GART,
337 gPtr->gartGpuAddress, row_length,
338 gPtr->fbGpuAddress + src_offset, src_pitch,
339 row_length, row_count);
341 exaWaitSync(pSrc->drawable.pScreen);
343 src = (char *) gPtr->gartBase;
345 if (dst_pitch == row_length) {
346 memcpy(dst, src, dst_pitch * row_count);
347 dst += dst_pitch * row_count;
348 } else {
349 for (i = 0; i < row_count; i++) {
350 memcpy(dst, src, row_length);
351 dst += dst_pitch;
352 src += row_length;
356 src_offset += row_count * src_pitch;
357 h -= row_count;
360 return (TRUE);
363 static Bool
364 Ps3GpuPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
366 /*FIXME*/
368 return (FALSE);
371 static void
372 Ps3GpuSolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
374 /*FIXME*/
377 static void
378 Ps3GpuDoneSolid(PixmapPtr pPixmap)
380 /*FIXME*/
383 static Bool
384 Ps3GpuPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap,
385 int dx, int dy, int alu, Pixel planemask)
387 ScrnInfoPtr pScrn = xf86Screens[pSrcPixmap->drawable.pScreen->myNum];
388 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
390 DPRINTF(pScrn, "%s:%d: sbpp=%d dbpp=%d dx=%d dy=%d alu=%d\n",
391 __func__, __LINE__, pSrcPixmap->drawable.bitsPerPixel,
392 pDstPixmap->drawable.bitsPerPixel, dx, dy, alu);
394 if (pSrcPixmap->drawable.bitsPerPixel !=
395 pDstPixmap->drawable.bitsPerPixel)
396 return (FALSE);
398 if (dx < 0 || dy < 0)
399 return (FALSE);
401 planemask |= ~0 << pDstPixmap->drawable.bitsPerPixel;
403 if (planemask != ~0 || alu != GXcopy)
404 return (FALSE);
406 gPtr->copyDx = dx;
407 gPtr->copyDy = dy;
408 gPtr->pCopySrcPixmap = pSrcPixmap;
410 return (TRUE);
413 static void
414 Ps3GpuCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
415 int width, int height)
417 ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
418 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
419 int cpp = pDstPixmap->drawable.bitsPerPixel >> 3;
420 int src_pitch = exaGetPixmapPitch(gPtr->pCopySrcPixmap);
421 int src_offset = exaGetPixmapOffset(gPtr->pCopySrcPixmap) +
422 srcY * src_pitch + srcX * cpp;
423 int dst_pitch = exaGetPixmapPitch(pDstPixmap);
424 int dst_offset = exaGetPixmapOffset(pDstPixmap) +
425 dstY * dst_pitch + dstX * cpp;
427 DPRINTF(pScrn, "%s:%d: srcX=%d srcY=%d dstX=%d dstY=%d width=%d height=%d\n",
428 __func__, __LINE__, srcX, srcY, dstX, dstY, width, height);
430 Ps3GpuTransferData(pScrn, XFER_MODE_VIDEO_TO_VIDEO,
431 gPtr->fbGpuAddress + dst_offset, dst_pitch,
432 gPtr->fbGpuAddress + src_offset, src_pitch,
433 width * cpp, height);
436 static void
437 Ps3GpuDoneCopy(PixmapPtr pDstPixmap)
439 ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
440 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
442 gPtr->pCopySrcPixmap = NULL;
445 static Bool
446 Ps3GpuUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
447 char *src, int src_pitch)
449 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
451 #if 0
452 if (Ps3GpuUploadInline(pDst, x, y, w, h, src, src_pitch))
453 return (TRUE);
455 if (Ps3GpuUploadDma(pDst, x, y, w, h, src, src_pitch))
456 return (TRUE);
457 #endif
459 return (FALSE);
462 static Bool
463 Ps3GpuDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
464 char *dst, int dst_pitch)
466 ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
468 #if 0
469 if (Ps3GpuDownloadDma(pSrc, x, y, w, h, dst, dst_pitch))
470 return (TRUE);
471 #endif
473 return (FALSE);
476 static Bool
477 Ps3GpuCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
478 PicturePtr pDstPicture)
480 /*FIXME*/
482 return (FALSE);
485 static Bool
486 Ps3GpuPrepareComposite(int op, PicturePtr pSrcPicture,
487 PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc,
488 PixmapPtr pMask, PixmapPtr pDst)
490 /*FIXME*/
492 return (FALSE);
495 static void
496 Ps3GpuComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
497 int dstX, int dstY, int width, int height)
499 /*FIXME*/
502 static void
503 Ps3GpuDoneComposite(PixmapPtr pDst)
505 /*FIXME*/
508 static int
509 Ps3GpuMarkSync(ScreenPtr screen)
511 /*FIXME*/
514 static void
515 Ps3GpuWaitMarker(ScreenPtr pScreen, int marker)
517 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
518 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
519 volatile CARD32 *controlBase = (CARD32 *) gPtr->controlBase;
520 int retries = 5000;
522 Ps3GpuFifoKick(pScrn);
524 while (retries--) {
525 if (controlBase[0x10] == controlBase[0x11])
526 break;
529 if (controlBase[0x10] != controlBase[0x11])
530 FatalError("Failed to flush GPU FIFO\n");
533 Bool
534 Ps3GpuAccelInit(ScreenPtr pScreen)
536 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
537 Ps3GpuPtr gPtr = PS3GPUPTR(pScrn);
538 struct ps3gpu_ctl_memory_allocate memoryAllocate;
539 struct ps3gpu_ctl_setup_control setupControl;
540 ExaDriverPtr exaDriver;
541 int err;
543 gPtr->controlBase = (pointer) mmap(NULL, gPtr->gpuControlSize,
544 PROT_READ | PROT_WRITE, MAP_SHARED, gPtr->fd,
545 gPtr->gpuControlHandle);
546 if (gPtr->controlBase == (pointer *) MAP_FAILED) {
547 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
548 "Failed to map GPU control\n");
549 return (FALSE);
552 gPtr->fifoSize = 64 * 1024;
554 memoryAllocate.context_id = gPtr->gpuContextId;
555 memoryAllocate.type = PS3GPU_CTL_MEMORY_TYPE_GART;
556 memoryAllocate.size = gPtr->fifoSize;
557 memoryAllocate.align = 12;
559 err = ioctl(gPtr->fd, PS3GPU_CTL_MEMORY_ALLOCATE,
560 &memoryAllocate);
561 if (err) {
562 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
563 "Failed to allocate FIFO memory\n");
564 return (FALSE);
567 gPtr->fifoHandle = memoryAllocate.handle;
568 gPtr->fifoGpuAddress = memoryAllocate.gpu_addr;
570 gPtr->fifoBase = (pointer) mmap(NULL, gPtr->fifoSize,
571 PROT_READ | PROT_WRITE, MAP_SHARED, gPtr->fd,
572 gPtr->fifoHandle);
573 if (gPtr->fifoBase == (pointer *) MAP_FAILED) {
574 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
575 "Failed to map FIFO memory\n");
576 return (FALSE);
579 setupControl.context_id = gPtr->gpuContextId;
580 setupControl.put = gPtr->fifoHandle;
581 setupControl.get = gPtr->fifoHandle;
582 setupControl.ref = 0xffffffff;
584 err = ioctl(gPtr->fd, PS3GPU_CTL_SETUP_CONTROL, &setupControl);
585 if (err < 0) {
586 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
587 "Failed to setup GPU control\n");
588 return (FALSE);
591 gPtr->fifoMaxSlots = (gPtr->fifoSize - 1032) >> 2;
592 gPtr->fifoPutSlot = 0;
593 gPtr->fifoCurrentSlot = 0;
594 gPtr->fifoFreeSlots = gPtr->fifoMaxSlots - gPtr->fifoCurrentSlot;
596 gPtr->gartSize = 1 * 1024 * 1024;
598 memoryAllocate.context_id = gPtr->gpuContextId;
599 memoryAllocate.type = PS3GPU_CTL_MEMORY_TYPE_GART;
600 memoryAllocate.size = gPtr->gartSize;
601 memoryAllocate.align = 12;
603 err = ioctl(gPtr->fd, PS3GPU_CTL_MEMORY_ALLOCATE,
604 &memoryAllocate);
605 if (err) {
606 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
607 "Failed to allocate GART memory\n");
608 return (FALSE);
611 gPtr->gartHandle = memoryAllocate.handle;
612 gPtr->gartGpuAddress = memoryAllocate.gpu_addr;
614 gPtr->gartBase = (pointer) mmap(NULL, gPtr->gartSize,
615 PROT_READ | PROT_WRITE, MAP_SHARED, gPtr->fd,
616 gPtr->gartHandle);
617 if (gPtr->gartBase == (pointer *) MAP_FAILED) {
618 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
619 "Failed to map GART memory\n");
620 return (FALSE);
623 if (!Ps3GpuContextInit(pScrn))
624 return (FALSE);
626 exaDriver = exaDriverAlloc();
627 if(!exaDriver)
628 return (FALSE);
630 gPtr->exaDriver = exaDriver;
632 exaDriver->exa_major = EXA_VERSION_MAJOR;
633 exaDriver->exa_minor = EXA_VERSION_MINOR;
635 exaDriver->memoryBase = (CARD8 *) gPtr->fbBase;
636 exaDriver->offScreenBase = pScrn->displayWidth * pScrn->virtualY *
637 (pScrn->bitsPerPixel >> 3);
638 exaDriver->offScreenBase = (exaDriver->offScreenBase + 0x3f) & ~0x3f;
639 exaDriver->memorySize = gPtr->fbSize;
641 exaDriver->pixmapOffsetAlign = 256;
642 exaDriver->pixmapPitchAlign = 64;
643 exaDriver->maxX = 2048;
644 exaDriver->maxY = 2048;
646 exaDriver->flags = EXA_OFFSCREEN_PIXMAPS;
648 exaDriver->PrepareSolid = Ps3GpuPrepareSolid;
649 exaDriver->Solid = Ps3GpuSolid;
650 exaDriver->DoneSolid = Ps3GpuDoneSolid;
651 exaDriver->PrepareCopy = Ps3GpuPrepareCopy;
652 exaDriver->Copy = Ps3GpuCopy;
653 exaDriver->DoneCopy = Ps3GpuDoneCopy;
654 exaDriver->UploadToScreen = Ps3GpuUploadToScreen;
655 exaDriver->DownloadFromScreen = Ps3GpuDownloadFromScreen;
656 exaDriver->CheckComposite = Ps3GpuCheckComposite;
657 exaDriver->PrepareComposite = Ps3GpuPrepareComposite;
658 exaDriver->Composite = Ps3GpuComposite;
659 exaDriver->DoneComposite = Ps3GpuDoneComposite;
660 exaDriver->MarkSync = Ps3GpuMarkSync;
661 exaDriver->WaitMarker = Ps3GpuWaitMarker;
663 gPtr->exaDriver = exaDriver;
665 return (exaDriverInit(pScreen, exaDriver));