[PATCH r128 3/6] Cleanup entity struct
Connor Behan
connor.behan at gmail.com
Wed Jul 16 18:34:54 PDT 2014
This moves HasCRTC2 into the entity to make it more similar to radeon.
It also removes IsDRIEnabled for being dead code.
Signed-off-by: Connor Behan <connor.behan at gmail.com>
---
src/r128.h | 1 -
src/r128_crtc.c | 3 +--
src/r128_driver.c | 21 ++++++++-------------
src/r128_output.c | 12 +++++++-----
src/r128_probe.c | 1 -
src/r128_probe.h | 3 +--
6 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/src/r128.h b/src/r128.h
index d01b5c1..0308130 100644
--- a/src/r128.h
+++ b/src/r128.h
@@ -520,7 +520,6 @@ typedef struct {
R128BIOSConnector BiosConnector[R128_MAX_BIOS_CONNECTOR];
/****** Added for dualhead support *******************/
- BOOL HasCRTC2; /* M3/M4 */
BOOL IsSecondary; /* second Screen */
BOOL IsPrimary; /* primary Screen */
BOOL UseCRT; /* force use CRT port as primary */
diff --git a/src/r128_crtc.c b/src/r128_crtc.c
index 9c3d0a9..e48e4d5 100644
--- a/src/r128_crtc.c
+++ b/src/r128_crtc.c
@@ -388,7 +388,6 @@ static const xf86CrtcFuncsRec r128_crtc_funcs = {
Bool R128AllocateControllers(ScrnInfoPtr pScrn, int mask)
{
R128EntPtr pR128Ent = R128EntPriv(pScrn);
- R128InfoPtr info = R128PTR(pScrn);
if (mask & 1) {
if (pR128Ent->Controller[0])
@@ -407,7 +406,7 @@ Bool R128AllocateControllers(ScrnInfoPtr pScrn, int mask)
}
if (mask & 2) {
- if (!info->HasCRTC2)
+ if (!pR128Ent->HasCRTC2)
return TRUE;
pR128Ent->pCrtc[1] = xf86CrtcCreate(pScrn, &r128_crtc_funcs);
diff --git a/src/r128_driver.c b/src/r128_driver.c
index c62a1af..3cd3773 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -469,8 +469,9 @@ static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Video BIOS not found!\n");
}
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
- if(info->HasCRTC2)
+ if(pR128Ent->HasCRTC2)
{
if(info->IsSecondary)
{
@@ -480,7 +481,6 @@ static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
if(info->DisplayType > MT_NONE)
{
- R128EntPtr pR128Ent = R128EntPriv(pScrn);
pR128Ent->HasSecondary = TRUE;
}
@@ -771,6 +771,7 @@ static Bool R128PreInitWeight(ScrnInfoPtr pScrn)
static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
{
R128InfoPtr info = R128PTR(pScrn);
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
unsigned char *R128MMIO = info->MMIO;
EntityInfoPtr pEnt = info->pEnt;
GDevPtr dev = pEnt->device;
@@ -865,7 +866,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
} else {
info->isDFP = FALSE;
info->isPro2 = FALSE;
- info->HasCRTC2 = FALSE;
+ pR128Ent->HasCRTC2 = FALSE;
switch (info->Chipset) {
/* R128 Pro and Pro2 can have DFP, we will deal with it.
No support for dual-head/xinerama yet.
@@ -918,7 +919,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
case PCI_CHIP_RAGE128ML:
info->HasPanelRegs = TRUE;
/* which chips support dualhead? */
- info->HasCRTC2 = TRUE;
+ pR128Ent->HasCRTC2 = TRUE;
break;
case PCI_CHIP_RAGE128RE:
case PCI_CHIP_RAGE128RF:
@@ -1428,7 +1429,6 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
info->IsPrimary = TRUE;
xf86SetPrimInitDone(pScrn->entityList[0]);
pR128Ent->pPrimaryScrn = pScrn;
- pR128Ent->IsDRIEnabled = FALSE;
pR128Ent->BypassSecondary = FALSE;
pR128Ent->HasSecondary = FALSE;
pR128Ent->RestorePrimary = FALSE;
@@ -1872,13 +1872,7 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
"section in your XFConfig file.\n");
}
else
- info->directRenderingEnabled =
- R128DRIScreenInit(pScreen);
- if(xf86IsEntityShared(pScrn->entityList[0]))
- {
- R128EntPtr pR128Ent = R128EntPriv(pScrn);
- pR128Ent->IsDRIEnabled = info->directRenderingEnabled;
- }
+ info->directRenderingEnabled = R128DRIScreenInit(pScreen);
}
}
}
@@ -2854,6 +2848,7 @@ static void R128Save(ScrnInfoPtr pScrn)
static void R128Restore(ScrnInfoPtr pScrn)
{
R128InfoPtr info = R128PTR(pScrn);
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
unsigned char *R128MMIO = info->MMIO;
R128SavePtr restore = &info->SavedReg;
@@ -2873,7 +2868,7 @@ static void R128Restore(ScrnInfoPtr pScrn)
OUTREG(R128_DP_DATATYPE, restore->dp_datatype);
R128RestoreCommonRegisters(pScrn, restore);
- if (info->HasCRTC2) {
+ if (pR128Ent->HasCRTC2) {
R128RestoreDDA2Registers(pScrn, restore);
R128RestoreCrtc2Registers(pScrn, restore);
R128RestorePLL2Registers(pScrn, restore);
diff --git a/src/r128_output.c b/src/r128_output.c
index d7a1c55..e5306d6 100644
--- a/src/r128_output.c
+++ b/src/r128_output.c
@@ -400,13 +400,14 @@ void R128SetOutputType(ScrnInfoPtr pScrn, R128OutputPrivatePtr r128_output)
void R128SetupGenericConnectors(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
- if (!info->HasCRTC2 && !info->isDFP) {
+ if (!pR128Ent->HasCRTC2 && !info->isDFP) {
info->BiosConnector[0].ConnectorType = CONNECTOR_VGA;
info->BiosConnector[0].valid = TRUE;
return;
- } else if (!info->HasCRTC2) {
+ } else if (!pR128Ent->HasCRTC2) {
info->BiosConnector[0].ConnectorType = CONNECTOR_DVI_D;
info->BiosConnector[0].valid = TRUE;
return;
@@ -421,7 +422,8 @@ void R128SetupGenericConnectors(ScrnInfoPtr pScrn)
Bool R128SetupConnectors(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
+ R128EntPtr pR128Ent = R128EntPriv(pScrn);
xf86OutputPtr output;
int num_vga = 0;
int num_dvi = 0;
@@ -476,7 +478,7 @@ Bool R128SetupConnectors(ScrnInfoPtr pScrn)
output->doubleScanAllowed = TRUE;
output->driver_private = r128_output;
output->possible_clones = 0;
- if (conntype == CONNECTOR_LVDS || !info->HasCRTC2)
+ if (conntype == CONNECTOR_LVDS || !pR128Ent->HasCRTC2)
output->possible_crtcs = 1;
else
output->possible_crtcs = 2;
diff --git a/src/r128_probe.c b/src/r128_probe.c
index e623bc9..348d15b 100644
--- a/src/r128_probe.c
+++ b/src/r128_probe.c
@@ -288,7 +288,6 @@ r128_get_scrninfo(int entity_num)
R128EntPtr pR128Ent;
pPriv->ptr = xnfcalloc(sizeof(R128EntRec), 1);
pR128Ent = pPriv->ptr;
- pR128Ent->IsDRIEnabled = FALSE;
pR128Ent->BypassSecondary = FALSE;
pR128Ent->HasSecondary = FALSE;
pR128Ent->IsSecondaryRestored = FALSE;
diff --git a/src/r128_probe.h b/src/r128_probe.h
index 95988ec..426840a 100644
--- a/src/r128_probe.h
+++ b/src/r128_probe.h
@@ -170,9 +170,8 @@ typedef struct _R128OutputPrivateRec {
typedef struct
{
- Bool IsDRIEnabled;
-
Bool HasSecondary;
+ Bool HasCRTC2;
Bool BypassSecondary;
/*These two registers are used to make sure the CRTC2 is
retored before CRTC_EXT, otherwise it could lead to blank screen.*/
--
2.0.0
More information about the xorg-driver-ati
mailing list