mirror of
https://github.com/X11Libre/xf86-video-r128.git
synced 2026-03-24 01:24:26 +00:00
Remove custom dualhead code
There are probably no reasons left to use Xinerama over xrandr. This removes the screen based dualhead code and the BIOS Display option in xorg.conf. Additionally, R128ValidMode() is wrapped so that it can be aware of multiple displays. Even though some Crtc functions refer to them, PanelXRes and PanelYRes should be properties of the Output. If this change to the code seems awkward, see http://marc.info/?t=107222330700001 for more information. Signed-off-by: Connor Behan <connor.behan@gmail.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
18
man/r128.man
18
man/r128.man
@@ -88,24 +88,6 @@ are used. The default is
|
||||
This overrides the default pixel value for the YUV video overlay key.
|
||||
The default value is
|
||||
.B undefined.
|
||||
.TP
|
||||
.BI "Option \*qDisplay\*q \*q" string \*q
|
||||
Select display mode for devices which support flat panels. Supported modes are:
|
||||
|
||||
.B \*qFP\*q
|
||||
- use flat panel;
|
||||
|
||||
.B \*qCRT\*q
|
||||
- use cathode ray tube;
|
||||
|
||||
.B \*qMirror\*q
|
||||
- use both FP and CRT;
|
||||
|
||||
.B \*qBIOS\*q
|
||||
- use mode as configured in the BIOS.
|
||||
|
||||
The default is
|
||||
.B FP.
|
||||
|
||||
.PP
|
||||
The following
|
||||
|
||||
42
src/r128.h
42
src/r128.h
@@ -136,6 +136,14 @@
|
||||
#define R128_ALIGN(x,bytes) (((x) + ((bytes) - 1)) & ~((bytes) - 1))
|
||||
#define R128PTR(pScrn) ((R128InfoPtr)(pScrn)->driverPrivate)
|
||||
|
||||
#define R128_BIOS8(v) ((info->VBIOS[(v)]))
|
||||
#define R128_BIOS16(v) ((info->VBIOS[(v)]) | \
|
||||
(info->VBIOS[(v) + 1] << 8))
|
||||
#define R128_BIOS32(v) ((info->VBIOS[(v)]) | \
|
||||
(info->VBIOS[(v) + 1] << 8) | \
|
||||
(info->VBIOS[(v) + 2] << 16) | \
|
||||
(info->VBIOS[(v) + 3] << 24))
|
||||
|
||||
typedef struct { /* All values in XCLKS */
|
||||
int ML; /* Memory Read Latency */
|
||||
int MB; /* Memory Burst Length */
|
||||
@@ -311,16 +319,8 @@ typedef struct {
|
||||
uint32_t MemCntl;
|
||||
uint32_t BusCntl;
|
||||
unsigned long FbMapSize; /* Size of frame buffer, in bytes */
|
||||
|
||||
uint8_t BIOSDisplay; /* Device the BIOS is set to display to */
|
||||
|
||||
Bool HasPanelRegs; /* Current chip can connect to a FP */
|
||||
|
||||
/* Computed values for FPs */
|
||||
int PanelXRes;
|
||||
int PanelYRes;
|
||||
int PanelPwrDly;
|
||||
|
||||
R128PLLRec pll;
|
||||
R128RAMPtr ram;
|
||||
|
||||
@@ -501,17 +501,10 @@ typedef struct {
|
||||
|
||||
Bool isDFP;
|
||||
Bool isPro2;
|
||||
Bool SwitchingMode;
|
||||
Bool DDC;
|
||||
|
||||
Bool VGAAccess;
|
||||
|
||||
/****** Added for dualhead support *******************/
|
||||
BOOL IsSecondary; /* second Screen */
|
||||
BOOL IsPrimary; /* primary Screen */
|
||||
BOOL UseCRT; /* force use CRT port as primary */
|
||||
BOOL SwitchingMode;
|
||||
R128MonitorType DisplayType; /* Monitor connected on*/
|
||||
|
||||
} R128InfoRec, *R128InfoPtr;
|
||||
|
||||
#define R128WaitForFifo(pScrn, entries) \
|
||||
@@ -535,6 +528,7 @@ extern Bool R128CursorInit(ScreenPtr pScreen);
|
||||
extern Bool R128DGAInit(ScreenPtr pScreen);
|
||||
|
||||
extern int R128MinBits(int val);
|
||||
extern xf86OutputPtr R128FirstOutput(xf86CrtcPtr crtc);
|
||||
|
||||
extern void R128InitVideo(ScreenPtr pScreen);
|
||||
|
||||
@@ -544,13 +538,13 @@ extern void R128InitRMXRegisters(R128SavePtr orig, R128SavePtr save, xf86
|
||||
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 Bool R128InitCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr save, DisplayModePtr mode, R128InfoPtr info);
|
||||
extern void R128InitPLLRegisters(ScrnInfoPtr pScrn, R128SavePtr save, R128PLLPtr pll, double dot_clock);
|
||||
extern Bool R128InitDDARegisters(ScrnInfoPtr pScrn, R128SavePtr save, R128PLLPtr pll, R128InfoPtr info, DisplayModePtr mode);
|
||||
extern Bool R128InitCrtcRegisters(xf86CrtcPtr crtc, R128SavePtr save, DisplayModePtr mode);
|
||||
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 Bool R128InitCrtc2Registers(ScrnInfoPtr pScrn, R128SavePtr save, DisplayModePtr mode, R128InfoPtr info);
|
||||
extern void R128InitPLL2Registers(ScrnInfoPtr pScrn, R128SavePtr save, R128PLLPtr pll, double dot_clock);
|
||||
extern Bool R128InitDDA2Registers(ScrnInfoPtr pScrn, R128SavePtr save, R128PLLPtr pll, R128InfoPtr info, DisplayModePtr mode);
|
||||
extern Bool R128InitCrtc2Registers(xf86CrtcPtr crtc, R128SavePtr save, DisplayModePtr mode);
|
||||
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);
|
||||
extern void R128RestoreDACRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
|
||||
extern void R128RestoreRMXRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
|
||||
@@ -571,11 +565,13 @@ extern void r128_crtc_load_cursor_image(xf86CrtcPtr crtc, unsigned char *
|
||||
|
||||
extern uint32_t R128AllocateMemory(ScrnInfoPtr pScrn, void **mem_struct, int size, int align, Bool need_accel);
|
||||
extern Bool R128SetupConnectors(ScrnInfoPtr pScrn);
|
||||
extern Bool R128AllocateControllers(ScrnInfoPtr pScrn, int mask);
|
||||
extern Bool R128AllocateControllers(ScrnInfoPtr pScrn);
|
||||
extern void R128GetPanelInfoFromBIOS(xf86OutputPtr output);
|
||||
extern void R128Blank(ScrnInfoPtr pScrn);
|
||||
extern void R128Unblank(ScrnInfoPtr pScrn);
|
||||
extern void R128DPMSSetOn(xf86OutputPtr output);
|
||||
extern void R128DPMSSetOff(xf86OutputPtr output);
|
||||
extern ModeStatus R128DoValidMode(xf86OutputPtr output, DisplayModePtr mode, int flags);
|
||||
extern DisplayModePtr R128ProbeOutputModes(xf86OutputPtr output);
|
||||
|
||||
#ifdef R128DRI
|
||||
|
||||
@@ -1746,7 +1746,7 @@ static void R128CCEAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a)
|
||||
| HARDWARE_PATTERN_SCREEN_ORIGIN
|
||||
| BIT_ORDER_IN_BYTE_LSBFIRST);
|
||||
|
||||
if(!info->IsSecondary && xf86IsEntityShared(pScrn->entityList[0]))
|
||||
if (xf86IsEntityShared(info->pEnt->index))
|
||||
a->RestoreAccelState = R128RestoreCCEAccelState;
|
||||
|
||||
}
|
||||
@@ -1851,15 +1851,13 @@ static void R128MMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a)
|
||||
| LEFT_EDGE_CLIPPING_NEGATIVE_X
|
||||
| SCANLINE_PAD_DWORD;
|
||||
|
||||
if(xf86IsEntityShared(pScrn->entityList[0]))
|
||||
{
|
||||
R128EntPtr pR128Ent = R128EntPriv(pScrn);
|
||||
|
||||
/*if there are more than one devices sharing this entity, we
|
||||
have to assign this call back, otherwise the XAA will be
|
||||
disabled */
|
||||
if(pR128Ent->HasSecondary || pR128Ent->BypassSecondary)
|
||||
a->RestoreAccelState = R128RestoreAccelState;
|
||||
if (xf86IsEntityShared(info->pEnt-index)) {
|
||||
/* If there are more than one devices sharing this entity, we
|
||||
* have to assign this call back, otherwise the XAA will be
|
||||
* disabled.
|
||||
*/
|
||||
if (xf86GetNumEntityInstances(info->pEnt->index) > 1)
|
||||
a->RestoreAccelState = R128RestoreAccelState;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -143,11 +143,11 @@ static void r128_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayMod
|
||||
|
||||
switch (r128_crtc->crtc_id) {
|
||||
case 0:
|
||||
R128InitCrtcRegisters(pScrn, &info->ModeReg, adjusted_mode, info);
|
||||
R128InitCrtcRegisters(crtc, &info->ModeReg, adjusted_mode);
|
||||
R128InitCrtcBase(crtc, &info->ModeReg, x, y);
|
||||
if (dot_clock) {
|
||||
R128InitPLLRegisters(pScrn, &info->ModeReg, &info->pll, dot_clock);
|
||||
R128InitDDARegisters(pScrn, &info->ModeReg, &info->pll, info, adjusted_mode);
|
||||
R128InitPLLRegisters(crtc, &info->ModeReg, &info->pll, dot_clock);
|
||||
R128InitDDARegisters(crtc, &info->ModeReg, &info->pll, adjusted_mode);
|
||||
} else {
|
||||
info->ModeReg.ppll_ref_div = info->SavedReg.ppll_ref_div;
|
||||
info->ModeReg.ppll_div_3 = info->SavedReg.ppll_div_3;
|
||||
@@ -157,11 +157,11 @@ static void r128_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayMod
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
R128InitCrtc2Registers(pScrn, &info->ModeReg, adjusted_mode, info);
|
||||
R128InitCrtc2Registers(crtc, &info->ModeReg, adjusted_mode);
|
||||
R128InitCrtc2Base(crtc, &info->ModeReg, x, y);
|
||||
if (dot_clock) {
|
||||
R128InitPLL2Registers(pScrn, &info->ModeReg, &info->pll, dot_clock);
|
||||
R128InitDDA2Registers(pScrn, &info->ModeReg, &info->pll, info, adjusted_mode);
|
||||
R128InitPLL2Registers(crtc, &info->ModeReg, &info->pll, dot_clock);
|
||||
R128InitDDA2Registers(crtc, &info->ModeReg, &info->pll, adjusted_mode);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -327,43 +327,39 @@ static const xf86CrtcFuncsRec r128_crtc_funcs = {
|
||||
.destroy = NULL,
|
||||
};
|
||||
|
||||
Bool R128AllocateControllers(ScrnInfoPtr pScrn, int mask)
|
||||
Bool R128AllocateControllers(ScrnInfoPtr pScrn)
|
||||
{
|
||||
R128EntPtr pR128Ent = R128EntPriv(pScrn);
|
||||
|
||||
if (mask & 1) {
|
||||
if (pR128Ent->Controller[0])
|
||||
return TRUE;
|
||||
if (pR128Ent->Controller[0])
|
||||
return TRUE;
|
||||
|
||||
pR128Ent->pCrtc[0] = xf86CrtcCreate(pScrn, &r128_crtc_funcs);
|
||||
if (!pR128Ent->pCrtc[0])
|
||||
return FALSE;
|
||||
pR128Ent->pCrtc[0] = xf86CrtcCreate(pScrn, &r128_crtc_funcs);
|
||||
if (!pR128Ent->pCrtc[0])
|
||||
return FALSE;
|
||||
|
||||
pR128Ent->Controller[0] = xnfcalloc(sizeof(R128CrtcPrivateRec), 1);
|
||||
if (!pR128Ent->Controller[0])
|
||||
return FALSE;
|
||||
pR128Ent->Controller[0] = xnfcalloc(sizeof(R128CrtcPrivateRec), 1);
|
||||
if (!pR128Ent->Controller[0])
|
||||
return FALSE;
|
||||
|
||||
pR128Ent->pCrtc[0]->driver_private = pR128Ent->Controller[0];
|
||||
pR128Ent->Controller[0]->crtc_id = 0;
|
||||
pR128Ent->pCrtc[0]->driver_private = pR128Ent->Controller[0];
|
||||
pR128Ent->Controller[0]->crtc_id = 0;
|
||||
|
||||
if (!pR128Ent->HasCRTC2)
|
||||
return TRUE;
|
||||
|
||||
pR128Ent->pCrtc[1] = xf86CrtcCreate(pScrn, &r128_crtc_funcs);
|
||||
if (!pR128Ent->pCrtc[1])
|
||||
return FALSE;
|
||||
|
||||
pR128Ent->Controller[1] = xnfcalloc(sizeof(R128CrtcPrivateRec), 1);
|
||||
if (!pR128Ent->Controller[1]) {
|
||||
free(pR128Ent->Controller[0]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (mask & 2) {
|
||||
if (!pR128Ent->HasCRTC2)
|
||||
return TRUE;
|
||||
|
||||
pR128Ent->pCrtc[1] = xf86CrtcCreate(pScrn, &r128_crtc_funcs);
|
||||
if (!pR128Ent->pCrtc[1])
|
||||
return FALSE;
|
||||
|
||||
pR128Ent->Controller[1] = xnfcalloc(sizeof(R128CrtcPrivateRec), 1);
|
||||
if (!pR128Ent->Controller[1]) {
|
||||
free(pR128Ent->Controller[0]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pR128Ent->pCrtc[1]->driver_private = pR128Ent->Controller[1];
|
||||
pR128Ent->Controller[1]->crtc_id = 1;
|
||||
}
|
||||
pR128Ent->pCrtc[1]->driver_private = pR128Ent->Controller[1];
|
||||
pR128Ent->Controller[1]->crtc_id = 1;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -181,7 +181,7 @@ void R128DPMSSetOn(xf86OutputPtr output)
|
||||
switch(MonType) {
|
||||
case MT_LCD:
|
||||
OUTREGP(R128_LVDS_GEN_CNTL, R128_LVDS_BLON, ~R128_LVDS_BLON);
|
||||
usleep(info->PanelPwrDly * 1000);
|
||||
usleep(r128_output->PanelPwrDly * 1000);
|
||||
OUTREGP(R128_LVDS_GEN_CNTL, R128_LVDS_ON, ~R128_LVDS_ON);
|
||||
save->lvds_gen_cntl |= (R128_LVDS_ON | R128_LVDS_BLON);
|
||||
break;
|
||||
@@ -307,7 +307,7 @@ DisplayModePtr R128ProbeOutputModes(xf86OutputPtr output)
|
||||
for (mode = modes; mode != NULL; mode = mode->next) {
|
||||
xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
|
||||
if (mode->status == MODE_OK)
|
||||
mode->status = R128ValidMode(XF86_SCRN_ARG(pScrn), mode, TRUE, MODECHECK_FINAL);
|
||||
mode->status = R128DoValidMode(output, mode, MODECHECK_FINAL);
|
||||
}
|
||||
|
||||
xf86ValidateModesUserConfig(pScrn, modes);
|
||||
@@ -457,10 +457,10 @@ Bool R128SetupConnectors(ScrnInfoPtr pScrn)
|
||||
}
|
||||
r128_output->ddc_i2c = i2c;
|
||||
R128I2CInit(output, &r128_output->pI2CBus, output->name);
|
||||
} else if (otypes[i] == OUTPUT_LVDS) {
|
||||
r128_output->PanelXRes = info->PanelXRes;
|
||||
r128_output->PanelYRes = info->PanelYRes;
|
||||
}
|
||||
|
||||
if (otypes[i] != OUTPUT_VGA)
|
||||
R128GetPanelInfoFromBIOS(output);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -288,7 +288,6 @@ r128_get_scrninfo(int entity_num)
|
||||
R128EntPtr pR128Ent;
|
||||
pPriv->ptr = xnfcalloc(sizeof(R128EntRec), 1);
|
||||
pR128Ent = pPriv->ptr;
|
||||
pR128Ent->BypassSecondary = FALSE;
|
||||
pR128Ent->HasSecondary = FALSE;
|
||||
pR128Ent->IsSecondaryRestored = FALSE;
|
||||
}
|
||||
|
||||
@@ -142,6 +142,7 @@ typedef struct _R128OutputPrivateRec {
|
||||
R128I2CBusRec ddc_i2c;
|
||||
int PanelXRes;
|
||||
int PanelYRes;
|
||||
int PanelPwrDly;
|
||||
} R128OutputPrivateRec, *R128OutputPrivatePtr;
|
||||
|
||||
#define R128_MAX_CRTC 2
|
||||
@@ -151,7 +152,6 @@ typedef struct
|
||||
{
|
||||
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.*/
|
||||
Bool IsSecondaryRestored;
|
||||
@@ -160,7 +160,7 @@ typedef struct
|
||||
xf86CrtcPtr pCrtc[R128_MAX_CRTC];
|
||||
R128CrtcPrivatePtr Controller[R128_MAX_CRTC];
|
||||
|
||||
ScrnInfoPtr pSecondaryScrn;
|
||||
ScrnInfoPtr pSecondaryScrn;
|
||||
ScrnInfoPtr pPrimaryScrn;
|
||||
} R128EntRec, *R128EntPtr;
|
||||
|
||||
|
||||
@@ -661,8 +661,12 @@ R128DisplayVideo422(
|
||||
short drw_w, short drw_h
|
||||
){
|
||||
R128InfoPtr info = R128PTR(pScrn);
|
||||
R128EntPtr pR128Ent = R128EntPriv(pScrn);
|
||||
xf86OutputPtr output = R128FirstOutput(pR128Ent->pCrtc[0]);
|
||||
R128OutputPrivatePtr r128_output = output->driver_private;
|
||||
unsigned char *R128MMIO = info->MMIO;
|
||||
R128PortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr;
|
||||
|
||||
int v_inc, h_inc, step_by, tmp, v_inc_shift;
|
||||
int p1_h_accum_init, p23_h_accum_init;
|
||||
int p1_v_accum_init;
|
||||
@@ -678,7 +682,7 @@ R128DisplayVideo422(
|
||||
|
||||
rmx_active = INREG(R128_FP_VERT_STRETCH) & R128_VERT_STRETCH_ENABLE;
|
||||
if (rmx_active) {
|
||||
v_inc = ((src_h * pScrn->currentMode->CrtcVDisplay / info->PanelYRes) << v_inc_shift) / drw_h;
|
||||
v_inc = ((src_h * pScrn->currentMode->CrtcVDisplay / r128_output->PanelYRes) << v_inc_shift) / drw_h;
|
||||
} else {
|
||||
v_inc = (src_h << v_inc_shift) / drw_h;
|
||||
}
|
||||
@@ -747,6 +751,9 @@ R128DisplayVideo420(
|
||||
short drw_w, short drw_h
|
||||
){
|
||||
R128InfoPtr info = R128PTR(pScrn);
|
||||
R128EntPtr pR128Ent = R128EntPriv(pScrn);
|
||||
xf86OutputPtr output = R128FirstOutput(pR128Ent->pCrtc[0]);
|
||||
R128OutputPrivatePtr r128_output = output->driver_private;
|
||||
unsigned char *R128MMIO = info->MMIO;
|
||||
R128PortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr;
|
||||
int v_inc, h_inc, step_by, tmp, leftUV, v_inc_shift;
|
||||
@@ -762,7 +769,7 @@ R128DisplayVideo420(
|
||||
|
||||
rmx_active = INREG(R128_FP_VERT_STRETCH) & R128_VERT_STRETCH_ENABLE;
|
||||
if (rmx_active) {
|
||||
v_inc = ((src_h * pScrn->currentMode->CrtcVDisplay / info->PanelYRes) << v_inc_shift) / drw_h;
|
||||
v_inc = ((src_h * pScrn->currentMode->CrtcVDisplay / r128_output->PanelYRes) << v_inc_shift) / drw_h;
|
||||
} else {
|
||||
v_inc = (src_h << v_inc_shift) / drw_h;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user