6d99728b852588c42fc19bc8a1b0cc223e4ab9c0
1 /**************************************************************************
3 Copyright 2006 Stephane Marchesin
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 on the rights to use, copy, modify, merge, publish, distribute, sub
10 license, and/or sell copies of the Software, and to permit persons to whom
11 the Software is furnished to do so, subject to the following conditions:
13 The above copyright notice and this permission notice (including the next
14 paragraph) shall be included in all copies or substantial portions of the
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
21 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23 USE OR OTHER DEALINGS IN THE SOFTWARE.
25 **************************************************************************/
28 #include "nouveau_context.h"
29 #include "nouveau_span.h"
30 #include "nouveau_fifo.h"
31 #include "nouveau_lock.h"
33 #include "swrast/swrast.h"
35 #define HAVE_HW_DEPTH_SPANS 0
36 #define HAVE_HW_DEPTH_PIXELS 0
37 #define HAVE_HW_STENCIL_SPANS 0
38 #define HAVE_HW_STENCIL_PIXELS 0
41 nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); \
42 __DRIscreenPrivate *sPriv = nmesa->driScreen; \
43 __DRIdrawablePrivate *dPriv = nmesa->driDrawable; \
44 driRenderbuffer *drb = (driRenderbuffer *) rb; \
45 GLuint height = dPriv->h; \
49 #define Y_FLIP( _y ) (height - _y - 1)
57 /* ================================================================
62 #define SPANTMP_PIXEL_FMT GL_RGB
63 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
65 #define TAG(x) nouveau##x##_RGB565
66 #define TAG2(x,y) nouveau##x##_RGB565##y
67 #define GET_PTR(X,Y) (sPriv->pFB + drb->flippedOffset \
68 + ((dPriv->y + (Y)) * drb->flippedPitch + (dPriv->x + (X))) * drb->cpp)
73 #define SPANTMP_PIXEL_FMT GL_BGRA
74 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
76 #define TAG(x) nouveau##x##_ARGB8888
77 #define TAG2(x,y) nouveau##x##_ARGB8888##y
78 #define GET_PTR(X,Y) (sPriv->pFB + drb->flippedOffset \
79 + ((dPriv->y + (Y)) * drb->flippedPitch + (dPriv->x + (X))) * drb->cpp)
83 nouveauSpanRenderStart( GLcontext
*ctx
)
85 nouveauContextPtr nmesa
= NOUVEAU_CONTEXT(ctx
);
88 nouveauWaitForIdleLocked( nmesa
);
92 nouveauSpanRenderFinish( GLcontext
*ctx
)
94 nouveauContextPtr nmesa
= NOUVEAU_CONTEXT(ctx
);
96 nouveauWaitForIdleLocked( nmesa
);
97 UNLOCK_HARDWARE( nmesa
);
100 void nouveauSpanInitFunctions( GLcontext
*ctx
)
102 struct swrast_device_driver
*swdd
= _swrast_GetDeviceDriverReference(ctx
);
103 swdd
->SpanRenderStart
= nouveauSpanRenderStart
;
104 swdd
->SpanRenderFinish
= nouveauSpanRenderFinish
;
109 * Plug in the Get/Put routines for the given driRenderbuffer.
112 nouveauSpanSetFunctions(nouveau_renderbuffer
*nrb
, const GLvisual
*vis
)
114 if (nrb
->mesa
._ActualFormat
== GL_RGBA8
)
115 nouveauInitPointers_ARGB8888(&nrb
->mesa
);
116 else if (nrb
->mesa
._ActualFormat
== GL_RGB5
)
117 nouveauInitPointers_RGB565(&nrb
->mesa
);