summaryrefslogtreecommitdiff
path: root/user/xf86-video-r128/0001-Fix-output-detection-on-non-x86-and-allow-override.patch
blob: 83f70bef6602d29735e93681bbedb9303f672201 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
From c0d6b63859c4ef67bc87cf2efae1d608db176286 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
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 <AWilcox@Wilcox-Tech.com>
---
 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)