[PATCH xf86-video-r128 2/5] Move R128InitCrtc2Base to r128_crtc.c

Kevin Brace kevinbrace at gmx.com
Sat Jun 16 15:24:34 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 769c44f..aa98dd0 100644
--- a/src/r128.h
+++ b/src/r128.h
@@ -523,7 +523,6 @@ extern void        R128InitFPRegisters(R128SavePtr orig, R128SavePtr save, xf86O
 extern void        R128InitLVDSRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output);
 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);
 extern void        R128InitPLL2Registers(xf86CrtcPtr crtc, R128SavePtr save, R128PLLPtr pll, double dot_clock);
 extern Bool        R128InitDDA2Registers(xf86CrtcPtr crtc, R128SavePtr save, R128PLLPtr pll, DisplayModePtr mode);
 extern void        R128RestoreCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
diff --git a/src/r128_crtc.c b/src/r128_crtc.c
index 20a84c0..534caf6 100644
--- a/src/r128_crtc.c
+++ b/src/r128_crtc.c
@@ -267,6 +267,34 @@ static Bool R128InitCrtcBase(xf86CrtcPtr crtc, R128SavePtr save, int x, int y)
     return TRUE;
 }
 
+static Bool R128InitCrtc2Base(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->crtc2_offset = Base;
+    save->crtc2_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 e09bc14..e902d6f 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 R128InitCrtc2Base(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->crtc2_offset = Base;
-    save->crtc2_offset_cntl = 0;
-
-    return TRUE;
-}
-
 /* Define DAC registers for the requested video mode. */
 void R128InitDACRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output)
 {
-- 
2.7.4



More information about the xorg-driver-ati mailing list