[PATCH 11/21] fb: Eliminate fbLaneTable, staticize fb{8,16,32}Lane
Adam Jackson
ajax at redhat.com
Wed Oct 8 06:57:53 PDT 2014
gcc doesn't appear to be smart enough to fold away the indirection here,
even if you make fbLaneTable const.
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
fb/fbbltone.c | 32 +++++++++++++++-----------------
fb/wfbrename.h | 5 -----
2 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/fb/fbbltone.c b/fb/fbbltone.c
index bfcb5a2..d2f0416 100644
--- a/fb/fbbltone.c
+++ b/fb/fbbltone.c
@@ -81,7 +81,7 @@
#endif
#if FB_SHIFT == 6
-CARD8 fb8Lane[256] = {
+static const CARD8 fb8Lane[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
@@ -107,40 +107,32 @@ CARD8 fb8Lane[256] = {
242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
};
-CARD8 fb16Lane[256] = {
+static const CARD8 fb16Lane[256] = {
0x00, 0x03, 0x0c, 0x0f,
0x30, 0x33, 0x3c, 0x3f,
0xc0, 0xc3, 0xcc, 0xcf,
0xf0, 0xf3, 0xfc, 0xff,
};
-CARD8 fb32Lane[16] = {
+static const CARD8 fb32Lane[16] = {
0x00, 0x0f, 0xf0, 0xff,
};
#endif
#if FB_SHIFT == 5
-CARD8 fb8Lane[16] = {
+static const CARD8 fb8Lane[16] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
};
-CARD8 fb16Lane[16] = {
+static const CARD8 fb16Lane[16] = {
0, 3, 12, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-CARD8 fb32Lane[16] = {
+static const CARD8 fb32Lane[16] = {
0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
#endif
-CARD8 *fbLaneTable[33] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- fb8Lane, 0, 0, 0, 0, 0, 0, 0,
- fb16Lane, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- fb32Lane
-};
-
void
fbBltOne(FbStip * src, FbStride srcStride, /* FbStip units per scanline */
int srcX, /* bit position of source */
@@ -169,7 +161,7 @@ fbBltOne(FbStip * src, FbStride srcStride, /* FbStip units per scanline */
Bool transparent; /* accelerate 0 nop */
int srcinc; /* source units consumed */
Bool endNeedsLoad = FALSE; /* need load for endmask */
- CARD8 *fbLane;
+ const CARD8 *fbLane;
int startbyte, endbyte;
if (dstBpp == 24) {
@@ -236,8 +228,14 @@ fbBltOne(FbStip * src, FbStride srcStride, /* FbStip units per scanline */
if (pixelsPerDst <= 8)
fbBits = fbStippleTable[pixelsPerDst];
fbLane = 0;
- if (transparent && fgand == 0 && dstBpp >= 8)
- fbLane = fbLaneTable[dstBpp];
+ if (transparent && fgand == 0) {
+ if (dstBpp == 8)
+ fbLane = fb8Lane;
+ if (dstBpp == 16)
+ fbLane = fb16Lane;
+ if (dstBpp == 32)
+ fbLane = fb32Lane;
+ }
/*
* Compute total number of destination words written, but
diff --git a/fb/wfbrename.h b/fb/wfbrename.h
index 54d00d0..0752cc7 100644
--- a/fb/wfbrename.h
+++ b/fb/wfbrename.h
@@ -1,4 +1,3 @@
-#define fb16Lane wfb16Lane
#define fb24_32CopyMtoN wfb24_32CopyMtoN
#define fb24_32CreateScreenResources wfb24_32CreateScreenResources
#define fb24_32GetImage wfb24_32GetImage
@@ -7,8 +6,6 @@
#define fb24_32PutZImage wfb24_32PutZImage
#define fb24_32ReformatTile wfb24_32ReformatTile
#define fb24_32SetSpans wfb24_32SetSpans
-#define fb32Lane wfb32Lane
-#define fb8Lane wfb8Lane
#define fbAddTraps wfbAddTraps
#define fbAddTriangles wfbAddTriangles
#define fbAllocatePrivates wfbAllocatePrivates
@@ -85,9 +82,7 @@
#define fbIn wfbIn
#define fbInitializeColormap wfbInitializeColormap
#define fbInitVisuals wfbInitVisuals
-#define fbInstallColormap wfbInstallColormap
#define fbLaneTable wfbLaneTable
-#define fbListInstalledColormaps wfbListInstalledColormaps
#define fbMapWindow wfbMapWindow
#define FbMergeRopBits wFbMergeRopBits
#define fbOddStipple wfbOddStipple
--
1.9.3
More information about the xorg-devel
mailing list