From c0d6b63859c4ef67bc87cf2efae1d608db176286 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 11 Nov 2023 21:15:29 -0600 Subject: [PATCH 1/3] Fix output detection on non-x86 and allow override This exposes a new option, "ForceOutput", which is read when the VBIOS is inaccessible. With this change, r128 is usable on at least PPC systems. Signed-off-by: A. Wilcox --- man/r128.man | 4 ++++ src/r128.h | 2 +- src/r128_driver.c | 29 ++--------------------- src/r128_options.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++ src/r128_output.c | 11 ++++++++- 5 files changed, 76 insertions(+), 29 deletions(-) create mode 100644 src/r128_options.h diff --git a/man/r128.man b/man/r128.man index a93157a..c465531 100644 --- a/man/r128.man +++ b/man/r128.man @@ -94,6 +94,10 @@ Beware that this may damage your panel, so use this .B at your own risk. The default depends on the device. .TP +.BI "Option \*qForceOutput\*q \*q" integer \*q +Force a specific output layout. This option is only read when the video card BIOS is +inaccessible (typically on non-x86 architectures). This allows you to override the +default output layout, which is a single VGA output on port 0. .BI "Option \*qPanelWidth\*q \*q" integer \*q .TP .BI "Option \*qPanelHeight\*q \*q" integer \*q diff --git a/src/r128.h b/src/r128.h index 6ab6beb..1ddb0f9 100644 --- a/src/r128.h +++ b/src/r128.h @@ -66,7 +66,7 @@ #undef R128DRI #endif -#if R128DRI +#ifdef R128DRI #define _XF86DRI_SERVER_ #include "r128_dripriv.h" #include "dri.h" diff --git a/src/r128_driver.c b/src/r128_driver.c index 6791290..213b948 100644 --- a/src/r128_driver.c +++ b/src/r128_driver.c @@ -67,6 +67,7 @@ /* Driver data structures */ #include "r128.h" +#include "r128_options.h" #include "r128_probe.h" #include "r128_reg.h" #include "r128_version.h" @@ -114,33 +115,6 @@ static Bool R128SaveScreen(ScreenPtr pScreen, int mode); static void R128Save(ScrnInfoPtr pScrn); static void R128Restore(ScrnInfoPtr pScrn); -typedef enum { - OPTION_NOACCEL, - OPTION_FBDEV, - OPTION_DAC_6BIT, - OPTION_VGA_ACCESS, - OPTION_SHOW_CACHE, - OPTION_SW_CURSOR, - OPTION_VIDEO_KEY, - OPTION_PANEL_WIDTH, - OPTION_PANEL_HEIGHT, - OPTION_PROG_FP_REGS, -#ifdef R128DRI - OPTION_XV_DMA, - OPTION_IS_PCI, - OPTION_CCE_PIO, - OPTION_NO_SECURITY, - OPTION_USEC_TIMEOUT, - OPTION_AGP_MODE, - OPTION_AGP_SIZE, - OPTION_RING_SIZE, - OPTION_BUFFER_SIZE, - OPTION_PAGE_FLIP, -#endif - OPTION_ACCELMETHOD, - OPTION_RENDERACCEL -} R128Opts; - static const OptionInfoRec R128Options[] = { { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, @@ -166,6 +140,7 @@ static const OptionInfoRec R128Options[] = { #endif { OPTION_ACCELMETHOD, "AccelMethod", OPTV_STRING, {0}, FALSE }, { OPTION_RENDERACCEL, "RenderAccel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_FORCEOUTPUT, "ForceOutput", OPTV_INTEGER, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; diff --git a/src/r128_options.h b/src/r128_options.h new file mode 100644 index 0000000..cce765b --- /dev/null +++ b/src/r128_options.h @@ -0,0 +1,59 @@ +/* + * Copyright 2023 A. Wilcox, Tulsa, Oklahoma. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR + * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef _R128_OPTIONS_H_ +#define _R128_OPTIONS_H_ 1 + +typedef enum { + OPTION_NOACCEL, + OPTION_FBDEV, + OPTION_DAC_6BIT, + OPTION_VGA_ACCESS, + OPTION_SHOW_CACHE, + OPTION_SW_CURSOR, + OPTION_VIDEO_KEY, + OPTION_PANEL_WIDTH, + OPTION_PANEL_HEIGHT, + OPTION_PROG_FP_REGS, +#ifdef R128DRI + OPTION_XV_DMA, + OPTION_IS_PCI, + OPTION_CCE_PIO, + OPTION_NO_SECURITY, + OPTION_USEC_TIMEOUT, + OPTION_AGP_MODE, + OPTION_AGP_SIZE, + OPTION_RING_SIZE, + OPTION_BUFFER_SIZE, + OPTION_PAGE_FLIP, +#endif + OPTION_ACCELMETHOD, + OPTION_RENDERACCEL, + OPTION_FORCEOUTPUT +} R128Opts; + +#endif /* _R128_OPTIONS_H_ */ diff --git a/src/r128_output.c b/src/r128_output.c index 1d98fb9..05b8c1f 100644 --- a/src/r128_output.c +++ b/src/r128_output.c @@ -44,6 +44,7 @@ #endif #include "r128.h" +#include "r128_options.h" #include "r128_probe.h" #include "r128_reg.h" @@ -425,7 +426,15 @@ void R128GetConnectorInfoFromBIOS(ScrnInfoPtr pScrn, R128OutputType *otypes) /* non-x86 platform */ if (!info->VBIOS) { - otypes[0] = OUTPUT_VGA; + int outputs; + xf86GetOptValInteger(info->Options, OPTION_FORCEOUTPUT, &outputs); + if (outputs) { + otypes[0] = outputs & 0x3; + otypes[1] = (outputs >> 2) & 0x3; + } else { + otypes[0] = OUTPUT_VGA; + } + return; } bios_header = R128_BIOS16(0x48); -- 2.39.3 (Apple Git-145)