[PATCH xf86-video-r128] Reorganize r128_exa.c

Kevin Brace kevinbrace at gmx.com
Fri Jul 27 02:45:54 UTC 2018


Stop the use of #include to include r128_exa_render.c inside
r128_exa.c.

Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
---
 src/Makefile.am       | 23 ++++++++++++------
 src/r128.h            | 24 +++++++++++++++++++
 src/r128_accel.c      | 22 +-----------------
 src/r128_exa.c        | 31 +++----------------------
 src/r128_exa_render.c | 20 +++++++++++-----
 src/r128_rop.h        | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 122 insertions(+), 62 deletions(-)
 create mode 100644 src/r128_rop.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 05fbe6c..45aafb5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,7 +31,9 @@ R128_DRI_SRCS = r128_dri.c
 endif
 
 if USE_EXA
-R128_EXA_SRCS = r128_exa.c
+R128_EXA_SRCS = \
+	r128_exa.c \
+	r128_exa_render.c
 endif
 
 AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@
@@ -40,19 +42,26 @@ r128_drv_la_LTLIBRARIES = r128_drv.la
 r128_drv_la_LDFLAGS = -module -avoid-version
 r128_drv_ladir = @moduledir@/drivers
 r128_drv_la_SOURCES = \
-	r128_accel.c r128_cursor.c r128_driver.c \
-	r128_video.c r128_misc.c r128_crtc.c r128_output.c r128_probe.c \
-	$(R128_EXA_SRCS) $(R128_DRI_SRCS)
+	r128_accel.c \
+	r128_crtc.c \
+	r128_cursor.c \
+	r128_driver.c \
+	r128_misc.c \
+	r128_output.c \
+	r128_probe.c \
+	r128_video.c \
+	$(R128_EXA_SRCS) \
+	$(R128_DRI_SRCS)
 
 EXTRA_DIST = \
-        compat-api.h \
+	compat-api.h \
+	r128.h \
 	r128_common.h \
 	r128_dri.h \
 	r128_dripriv.h \
-	r128.h \
 	r128_probe.h \
 	r128_reg.h \
+	r128_rop.h \
 	r128_sarea.h \
 	r128_version.h \
-	r128_exa_render.c \
 	atipcirename.h
diff --git a/src/r128.h b/src/r128.h
index d09429b..e88e8ec 100644
--- a/src/r128.h
+++ b/src/r128.h
@@ -606,6 +606,30 @@ extern Bool	   R128GetDatatypeBpp(int bpp, uint32_t *type);
 extern Bool	   R128GetPixmapOffsetPitch(PixmapPtr pPix, uint32_t *pitch_offset);
 extern void	   R128DoPrepareCopy(ScrnInfoPtr pScrn, uint32_t src_pitch_offset,
 				    uint32_t dst_pitch_offset, uint32_t datatype, int alu, Pixel planemask);
+extern void R128Done(PixmapPtr pPixmap);
+
+#ifdef R128DRI
+extern void EmitCCE2DState(ScrnInfoPtr pScrn);
+#endif
+
+#ifdef RENDER
+extern Bool R128CCECheckComposite(int op,
+                                    PicturePtr pSrcPicture,
+                                    PicturePtr pMaskPicture,
+                                    PicturePtr pDstPicture);
+extern Bool R128CCEPrepareComposite(int op,                                    PicturePtr pSrcPicture,
+                                    PicturePtr pMaskPicture,
+                                    PicturePtr pDstPicture,
+                                    PixmapPtr pSrc,
+                                    PixmapPtr pMask,
+                                    PixmapPtr pDst);
+extern void R128CCEComposite(PixmapPtr pDst,
+                                int srcX, int srcY,
+                                int maskX, int maskY,
+                                int dstX, int dstY,
+                                int w, int h);
+#define R128CCEDoneComposite R128Done
+#endif
 #endif
 
 
diff --git a/src/r128_accel.c b/src/r128_accel.c
index 0ad4edc..72cc443 100644
--- a/src/r128_accel.c
+++ b/src/r128_accel.c
@@ -102,27 +102,7 @@
 #include "xf86.h"
 
 #ifdef HAVE_XAA_H
-static struct {
-    int rop;
-    int pattern;
-} R128_ROP[] = {
-    { R128_ROP3_ZERO, R128_ROP3_ZERO }, /* GXclear        */
-    { R128_ROP3_DSa,  R128_ROP3_DPa  }, /* Gxand          */
-    { R128_ROP3_SDna, R128_ROP3_PDna }, /* GXandReverse   */
-    { R128_ROP3_S,    R128_ROP3_P    }, /* GXcopy         */
-    { R128_ROP3_DSna, R128_ROP3_DPna }, /* GXandInverted  */
-    { R128_ROP3_D,    R128_ROP3_D    }, /* GXnoop         */
-    { R128_ROP3_DSx,  R128_ROP3_DPx  }, /* GXxor          */
-    { R128_ROP3_DSo,  R128_ROP3_DPo  }, /* GXor           */
-    { R128_ROP3_DSon, R128_ROP3_DPon }, /* GXnor          */
-    { R128_ROP3_DSxn, R128_ROP3_PDxn }, /* GXequiv        */
-    { R128_ROP3_Dn,   R128_ROP3_Dn   }, /* GXinvert       */
-    { R128_ROP3_SDno, R128_ROP3_PDno }, /* GXorReverse    */
-    { R128_ROP3_Sn,   R128_ROP3_Pn   }, /* GXcopyInverted */
-    { R128_ROP3_DSno, R128_ROP3_DPno }, /* GXorInverted   */
-    { R128_ROP3_DSan, R128_ROP3_DPan }, /* GXnand         */
-    { R128_ROP3_ONE,  R128_ROP3_ONE  }  /* GXset          */
-};
+#include "r128_rop.h"
 #endif
 
 extern int getR128EntityIndex(void);
diff --git a/src/r128_exa.c b/src/r128_exa.c
index 5099915..b7501ac 100644
--- a/src/r128_exa.c
+++ b/src/r128_exa.c
@@ -36,31 +36,10 @@
 #include "exa.h"
 
 #include "r128_reg.h"
+#include "r128_rop.h"
 
 #include "xf86.h"
 
-static struct {
-    int rop;
-    int pattern;
-} R128_ROP[] = {
-    { R128_ROP3_ZERO, R128_ROP3_ZERO }, /* GXclear        */
-    { R128_ROP3_DSa,  R128_ROP3_DPa  }, /* Gxand          */
-    { R128_ROP3_SDna, R128_ROP3_PDna }, /* GXandReverse   */
-    { R128_ROP3_S,    R128_ROP3_P    }, /* GXcopy         */
-    { R128_ROP3_DSna, R128_ROP3_DPna }, /* GXandInverted  */
-    { R128_ROP3_D,    R128_ROP3_D    }, /* GXnoop         */
-    { R128_ROP3_DSx,  R128_ROP3_DPx  }, /* GXxor          */
-    { R128_ROP3_DSo,  R128_ROP3_DPo  }, /* GXor           */
-    { R128_ROP3_DSon, R128_ROP3_DPon }, /* GXnor          */
-    { R128_ROP3_DSxn, R128_ROP3_PDxn }, /* GXequiv        */
-    { R128_ROP3_Dn,   R128_ROP3_Dn   }, /* GXinvert       */
-    { R128_ROP3_SDno, R128_ROP3_PDno }, /* GXorReverse    */
-    { R128_ROP3_Sn,   R128_ROP3_Pn   }, /* GXcopyInverted */
-    { R128_ROP3_DSno, R128_ROP3_DPno }, /* GXorInverted   */
-    { R128_ROP3_DSan, R128_ROP3_DPan }, /* GXnand         */
-    { R128_ROP3_ONE,  R128_ROP3_ONE  }  /* GXset          */
-};
-
 /* Assumes that depth 15 and 16 can be used as depth 16, which is okay since we
  * require src and dest datatypes to be equal.
  */
@@ -145,7 +124,7 @@ static void Emit2DState(ScrnInfoPtr pScrn)
 }
 
 #ifdef R128DRI
-static void EmitCCE2DState(ScrnInfoPtr pScrn)
+void EmitCCE2DState(ScrnInfoPtr pScrn)
 {
     R128InfoPtr   info      = R128PTR(pScrn);
     int has_src		    = info->state_2d.src_pitch_offset;
@@ -335,7 +314,7 @@ R128Sync(ScreenPtr pScreen, int marker)
     R128WaitForIdle(xf86ScreenToScrn(pScreen));
 }
 
-static void
+void
 R128Done(PixmapPtr pPixmap)
 {
     ScreenPtr     pScreen   = pPixmap->drawable.pScreen;
@@ -412,10 +391,6 @@ R128CCESync(ScreenPtr pScreen, int marker)
     R128CCEWaitForIdle(xf86ScreenToScrn(pScreen));
 }
 
-#ifdef RENDER
-#include "r128_exa_render.c"
-#endif
-
 #endif
 
 Bool
diff --git a/src/r128_exa_render.c b/src/r128_exa_render.c
index 06de074..5f265e3 100644
--- a/src/r128_exa_render.c
+++ b/src/r128_exa_render.c
@@ -34,8 +34,17 @@
 
 /* The following is based on the kdrive ATI driver. */
 
-#include <stdio.h>
-#include <string.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "xf86.h"
+#include "exa.h"
+
+#include "r128.h"
+#include "r128_reg.h"
+#include "r128_rop.h"
+
 
 static struct {
     Bool dst_alpha;
@@ -203,7 +212,7 @@ R128CheckCompositeTexture(PicturePtr pPict, PicturePtr pDstPict, int op)
     return TRUE;
 }
 
-static Bool
+Bool
 R128CCECheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture)
 {
 #if R128_DEBUG
@@ -405,7 +414,7 @@ do {							\
     ADVANCE_RING();					\
 } while(0)
 
-static Bool
+Bool
 R128CCEPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
     PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
 {
@@ -650,7 +659,7 @@ do {								       			\
     OUT_RING(R128FloatAsInt((((float)(_srcY)) + 0.5) / (info->state_2d.heights[0])));	\
 } while (0)
 
-static void
+void
 R128CCEComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, int w, int h)
 {
     ScreenPtr     pScreen   = pDst->drawable.pScreen;
@@ -733,4 +742,3 @@ R128CCEComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, int d
     ADVANCE_RING();
 }
 
-#define R128CCEDoneComposite R128Done
diff --git a/src/r128_rop.h b/src/r128_rop.h
new file mode 100644
index 0000000..6b98868
--- /dev/null
+++ b/src/r128_rop.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
+ *                      Precision Insight, Inc., Cedar Park, Texas, and
+ *                      VA Linux Systems Inc., Fremont, California.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
+ * SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * 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.
+ */
+
+/*
+ * Authors:
+ *   Rickard E. Faith <faith at valinux.com>
+ *   Kevin E. Martin <martin at valinux.com>
+ *
+ */
+
+#ifndef _R128_ROP_H_
+#define _R128_ROP_H_
+
+#include "r128_reg.h"
+
+static struct {
+    int rop;
+    int pattern;
+} R128_ROP[] = {
+    { R128_ROP3_ZERO, R128_ROP3_ZERO }, /* GXclear        */
+    { R128_ROP3_DSa,  R128_ROP3_DPa  }, /* Gxand          */
+    { R128_ROP3_SDna, R128_ROP3_PDna }, /* GXandReverse   */
+    { R128_ROP3_S,    R128_ROP3_P    }, /* GXcopy         */
+    { R128_ROP3_DSna, R128_ROP3_DPna }, /* GXandInverted  */
+    { R128_ROP3_D,    R128_ROP3_D    }, /* GXnoop         */
+    { R128_ROP3_DSx,  R128_ROP3_DPx  }, /* GXxor          */
+    { R128_ROP3_DSo,  R128_ROP3_DPo  }, /* GXor           */
+    { R128_ROP3_DSon, R128_ROP3_DPon }, /* GXnor          */
+    { R128_ROP3_DSxn, R128_ROP3_PDxn }, /* GXequiv        */
+    { R128_ROP3_Dn,   R128_ROP3_Dn   }, /* GXinvert       */
+    { R128_ROP3_SDno, R128_ROP3_PDno }, /* GXorReverse    */
+    { R128_ROP3_Sn,   R128_ROP3_Pn   }, /* GXcopyInverted */
+    { R128_ROP3_DSno, R128_ROP3_DPno }, /* GXorInverted   */
+    { R128_ROP3_DSan, R128_ROP3_DPan }, /* GXnand         */
+    { R128_ROP3_ONE,  R128_ROP3_ONE  }  /* GXset          */
+};
+#endif
+
-- 
2.7.4



More information about the xorg-driver-ati mailing list