[PATCH xf86-video-r128 1/5] Move R128InitCrtcBase to r128_crtc.c

Kevin Brace kevinbrace at gmx.com
Sat Jun 16 15:24:33 UTC 2018


It does not make sense for this function to be inside r128_driver.c
since it is only called from a function inside r128_crtc.c.

Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
---
 src/r128.h        |  1 -
 src/r128_crtc.c   | 28 ++++++++++++++++++++++++++++
 src/r128_driver.c | 28 ----------------------------
 3 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/src/r128.h b/src/r128.h
index 5e7aeb9..769c44f 100644
--- a/src/r128.h
+++ b/src/r128.h
@@ -521,7 +521,6 @@ extern void        R128InitDACRegisters(R128SavePtr orig, R128SavePtr save, xf86
 extern void        R128InitRMXRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output, DisplayModePtr mode);
 extern void        R128InitFPRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output);
 extern void        R128InitLVDSRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output);
-extern Bool        R128InitCrtcBase(xf86CrtcPtr crtc, R128SavePtr save, int x, int y);
 extern void        R128InitPLLRegisters(xf86CrtcPtr crtc, R128SavePtr save, R128PLLPtr pll, double dot_clock);
 extern Bool        R128InitDDARegisters(xf86CrtcPtr crtc, R128SavePtr save, R128PLLPtr pll, DisplayModePtr mode);
 extern Bool        R128InitCrtc2Base(xf86CrtcPtr crtc, R128SavePtr save, int x, int y);
diff --git a/src/r128_crtc.c b/src/r128_crtc.c
index 28e9a44..20a84c0 100644
--- a/src/r128_crtc.c
+++ b/src/r128_crtc.c
@@ -239,6 +239,34 @@ Bool R128InitCrtc2Registers(xf86CrtcPtr crtc, R128SavePtr save, DisplayModePtr m
     return TRUE;
 }
 
+static Bool R128InitCrtcBase(xf86CrtcPtr crtc, R128SavePtr save, int x, int y)
+{
+    ScrnInfoPtr pScrn = crtc->scrn;
+    R128InfoPtr info  = R128PTR(pScrn);
+    int offset = y * info->CurrentLayout.displayWidth + x;
+    int Base = pScrn->fbOffset;
+
+    switch (info->CurrentLayout.pixel_code) {
+    case 15:
+    case 16: offset *= 2; break;
+    case 24: offset *= 3; break;
+    case 32: offset *= 4; break;
+    }
+    Base += offset;
+
+    if (crtc->rotatedData != NULL)
+        Base = pScrn->fbOffset + (char *)crtc->rotatedData - (char *)info->FB;
+
+    Base &= ~7;                 /* 3 lower bits are always 0 */
+    if (info->CurrentLayout.pixel_code == 24)
+    Base += 8 * (Base % 3); /* Must be multiple of 8 and 3 */
+
+    save->crtc_offset = Base;
+    save->crtc_offset_cntl = 0;
+
+    return TRUE;
+}
+
 
 static void r128_crtc_load_lut(xf86CrtcPtr crtc);
 
diff --git a/src/r128_driver.c b/src/r128_driver.c
index 45c76d1..e09bc14 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -2744,34 +2744,6 @@ void R128InitCommonRegisters(R128SavePtr save, R128InfoPtr info)
 	save->bus_cntl |= R128_BUS_RD_DISCARD_EN | R128_BUS_RD_ABORT_EN;
 }
 
-Bool R128InitCrtcBase(xf86CrtcPtr crtc, R128SavePtr save, int x, int y)
-{
-    ScrnInfoPtr pScrn = crtc->scrn;
-    R128InfoPtr info  = R128PTR(pScrn);
-    int offset = y * info->CurrentLayout.displayWidth + x;
-    int Base = pScrn->fbOffset;
-
-    switch (info->CurrentLayout.pixel_code) {
-    case 15:
-    case 16: offset *= 2; break;
-    case 24: offset *= 3; break;
-    case 32: offset *= 4; break;
-    }
-    Base += offset;
-
-    if (crtc->rotatedData != NULL)
-        Base = pScrn->fbOffset + (char *)crtc->rotatedData - (char *)info->FB;
-
-    Base &= ~7;                 /* 3 lower bits are always 0 */
-    if (info->CurrentLayout.pixel_code == 24)
-	Base += 8 * (Base % 3); /* Must be multiple of 8 and 3 */
-
-    save->crtc_offset = Base;
-    save->crtc_offset_cntl = 0;
-
-    return TRUE;
-}
-
 Bool R128InitCrtc2Base(xf86CrtcPtr crtc, R128SavePtr save, int x, int y)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
-- 
2.7.4



More information about the xorg-driver-ati mailing list