All elements of pre-DRI_NEW_INTERFACE_ONLY are removed. This allows
[mesa.git] / src / mesa / drivers / dri / mga / mgapixel.c
index 0bc4b3fac5fb12cc16e6f6035e4a574026d9f3f4..952b8d5631255a09dcb8f233857532de89c4cf67 100644 (file)
  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file mgapixel.c
+ * Implement framebuffer pixel operations for MGA.
  *
- * Authors:
- *    Keith Whitwell <keith@tungstengraphics.com>
- *    Gareth Hughes <gareth@valinux.com>
+ * \todo
+ * Someday the accelerated \c glReadPixels and \c glDrawPixels paths need to
+ * be resurrected.  They are currently ifdef'ed out because they don't seem
+ * to work and they only get activated some very rare circumstances.
+ *
+ * \author Keith Whitwell <keith@tungstengraphics.com>
+ * \author Gareth Hughes <gareth@valinux.com>
  */
 /* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.c,v 1.9 2002/11/05 17:46:08 tsi Exp $ */
 
-#include "enums.h"
 #include "mtypes.h"
 #include "macros.h"
-#include "texutil.h"
 #include "mgadd.h"
 #include "mgacontext.h"
 #include "mgaioctl.h"
 #include "mgapixel.h"
-#include "mgabuffers.h"
-
-#include "xf86drm.h"
-#include "mga_common.h"
+#include "mgastate.h"
 
 #include "swrast/swrast.h"
+#include "imports.h"
 
+#if 0
 #define IS_AGP_MEM( mmesa, p )                                           \
    ((unsigned long)mmesa->mgaScreen->buffers.map <= ((unsigned long)p) && \
     (unsigned long)mmesa->mgaScreen->buffers.map +                       \
@@ -134,7 +140,7 @@ check_color_per_fragment_ops( const GLcontext *ctx )
                    !ctx->Color.ColorMask[2] ||
                    !ctx->Color.ColorMask[3] ||
                    ctx->Color.ColorLogicOpEnabled ||
-                   ctx->Texture.Unit[0]._ReallyEnabled ||
+                   ctx->Texture._EnabledUnits ||
                    ctx->Depth.OcclusionTest
            ) &&
           ctx->Current.RasterPosValid &&
@@ -328,7 +334,7 @@ mgaTryReadPixels( GLcontext *ctx,
       for (i = 0 ; i < nbox ; )
       {
         int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
-        XF86DRIClipRectRec *box = dPriv->pClipRects;
+        drm_clip_rect_t *box = dPriv->pClipRects;
         drm_clip_rect_t *b = mmesa->sarea->boxes;
         int n = 0;
 
@@ -396,7 +402,7 @@ static void do_draw_pix( GLcontext *ctx,
    mgaContextPtr mmesa = MGA_CONTEXT(ctx);
    drmMGABlit blit;
    __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
-   XF86DRIClipRectPtr pbox = dPriv->pClipRects;
+   drm_clip_rect_t pbox = dPriv->pClipRects;
    int nbox = dPriv->numClipRects;
    int retcode, i;
 
@@ -429,7 +435,7 @@ static void do_draw_pix( GLcontext *ctx,
    for (i = 0 ; i < nbox ; )
    {
       int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
-      XF86DRIClipRectRec *box = mmesa->pClipRects;
+      drm_clip_rect_t *box = mmesa->pClipRects;
       drm_clip_rect_t *b = mmesa->sarea->boxes;
       int n = 0;
 
@@ -596,7 +602,7 @@ mgaTryDrawPixels( GLcontext *ctx,
            }
         }
 #else
-        memcpy( address, pixels, rows*bufferpitch );
+        MEMCPY( address, pixels, rows*bufferpitch );
 #endif
 
         do_draw_pix( ctx, x, y, width, rows,
@@ -632,49 +638,15 @@ mgaDDDrawPixels( GLcontext *ctx,
       _swrast_DrawPixels( ctx, x, y, width, height, format, type,
                          unpack, pixels );
 }
-
+#endif
 
 
 /* Stub functions - not a real allocator, always returns pointer to
  * the same block of agp space which isn't used for anything else at
  * present.
  */
-#if defined(MESA_hacked_agp_allocator)
-static void mgaDDFreeAgpMemory( GLcontext *ctx, void *ptr )
-{
-   (void) ptr;
-}
-
-static void *mgaDDAllocateAgpMemory( GLcontext *ctx, GLsizei size )
-{
-   mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
-   if (size < mmesa->mgaScreen->textureSize[MGA_AGP_HEAP])
-      return mmesa->mgaScreen->texVirtual[MGA_AGP_HEAP];
-   else
-      return 0;
-}
-
-static GLint mgaDDGetAgpOffset( GLcontext *ctx, const void *ptr )
-{
-   mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
-   if (!IS_AGP_MEM(mmesa, ptr))
-      return -1;
-
-   return AGP_OFFSET(mmesa, ptr);
-}
-#endif
-
-
 void mgaDDInitPixelFuncs( GLcontext *ctx )
 {
-#if defined (MESA_experimetal_agp_allocator)
-   ctx->Driver.AllocateAgpMemory = mgaDDAllocateAgpMemory;
-   ctx->Driver.GetAgpOffset = mgaDDGetAgpOffset;
-   ctx->Driver.FreeAgpMemory = mgaDDFreeAgpMemory;
-#endif
-
    /* Pixel path fallbacks.
     */
    ctx->Driver.Accum = _swrast_Accum;
@@ -683,8 +655,10 @@ void mgaDDInitPixelFuncs( GLcontext *ctx )
    ctx->Driver.DrawPixels = _swrast_DrawPixels;
    ctx->Driver.ReadPixels = _swrast_ReadPixels;
 
+#if 0
    if (getenv("MGA_BLIT_PIXELS")) {
       ctx->Driver.ReadPixels = mgaDDReadPixels; /* requires agp dest */
       ctx->Driver.DrawPixels = mgaDDDrawPixels; /* works with agp/normal mem */
    }
+#endif
 }