Skip to contentSkip to conversation

Scaling registers on r128

PATCH Adrian Cox 3 participants 4 messages Nov 12, 2001 – Nov 22, 2001 Framebuffer layer

lore
Share & tools
lore

Adrian Cox

author
#0 lore raw

This patch to aty128fb is experimental, and intended for the brave.

The attached patch turns on the panel scaling registers of the R128. I've run this on my iBook2, and I've been able to display 640x480 and 800x600 modes on the panel successfully.

The panel sizes are currently hardwired on the iBook. This code will benefit greatly from a reliable means to find the panel size.

This has revealed problems in the X server: if the XF86Config-4 specifies 800x600 and the current console is in 1024x768, the display is broken. This looks like a generic problem in fbdevhw based Xservers, as I saw something similar on 69030.

--
Adrian Cox http://www.humboldt.co.uk/

===== drivers/video/aty128.h 1.3 vs edited =====

drivers/video/aty128.h +32 -0
@@ -48,6 +48,13 @@
 #define OVR_CLR					0x0230
 #define OVR_WID_LEFT_RIGHT			0x0234
 #define OVR_WID_TOP_BOTTOM			0x0238
+#define FP_CRTC_H_TOTAL_DISP         	    	0x0250
+#define FP_CRTC_V_TOTAL_DISP         	    	0x0254
+#define FP_GEN_CNTL                  	    	0x0284
+#define FP_HORZ_STRETCH              	    	0x028c
+#define FP_VERT_STRETCH              	    	0x0290
+#define FP_H_SYNC_STRT_WID           	    	0x02c4
+#define FP_V_SYNC_STRT_WID           	    	0x02c8
 #define LVDS_GEN_CNTL				0x02d0
 #define DDA_CONFIG				0x02e0
 #define DDA_ON_OFF				0x02e4
@@ -414,5 +421,30 @@
 #define PWR_MGT_SLOWDOWN_MCLK			0x00002000
 
 #define PMI_PMSCR_REG				0x60
+
+/* FP_HORZ_STRETCH constants */
+#define HORZ_STRETCH_RATIO_MASK     	    	0xffff
+#define HORZ_STRETCH_RATIO_SHIFT    	    	0
+#define HORZ_STRETCH_RATIO_MAX      	    	4096
+#define HORZ_PANEL_SIZE 	    	    	(0xff   << 16)
+#define HORZ_PANEL_SHIFT	    	    	16
+#define HORZ_STRETCH_PIXREP	    	    	(0	 << 25)
+#define HORZ_STRETCH_BLEND	    	    	(1	 << 25)
+#define HORZ_STRETCH_ENABLE	    	    	(1	 << 26)
+#define HORZ_FP_LOOP_STRETCH	    	    	(0x7	 << 27)
+#define HORZ_STRETCH_RESERVED	    	    	(1	 << 30)
+#define HORZ_AUTO_RATIO_FIX_EN      	    	(1	 << 31)
+
+/* FP_VERT_STRETCH constants */
+#define VERT_PANEL_SIZE 	    	    	(0x7ff <<  0)
+#define VERT_PANEL_SHIFT	    	    	0
+#define VERT_STRETCH_RATIO_MASK     	    	0x3ff
+#define VERT_STRETCH_RATIO_SHIFT    	    	11
+#define VERT_STRETCH_RATIO_MAX      	    	1024
+#define VERT_STRETCH_ENABLE	    	    	(1	<< 24)
+#define VERT_STRETCH_LINEREP	    	    	(0	<< 25)
+#define VERT_STRETCH_BLEND	    	    	(1	<< 25)
+#define VERT_AUTO_RATIO_EN	    	    	(1	<< 26)
+#define VERT_STRETCH_RESERVED	    	    	0xf8e00000
 
 #endif /* REG_RAGE128_H */

===== drivers/video/aty128fb.c 1.19 vs edited =====

drivers/video/aty128fb.c +58 -2

93 lines not on this page · raw message

#1 lore raw
Quoted 7 lines

This patch to aty128fb is experimental, and intended for the brave.

The attached patch turns on the panel scaling registers of the R128. I've run this on my iBook2, and I've been able to display 640x480 and 800x600 modes on the panel successfully.

Quoted 7 lines

The panel sizes are currently hardwired on the iBook. This code will benefit greatly from a reliable means to find the panel size.

This has revealed problems in the X server: if the XF86Config-4 specifies 800x600 and the current console is in 1024x768, the display is broken. This looks like a generic problem in fbdevhw based Xservers, as I saw something similar on 69030.

great. I'm working on some way to probe the panel type on those machines as it doesn't seem to follow any standard. Once don

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw
In reply to Adrian Cox
Quoted 7 lines · Adrian Cox

This patch to aty128fb is experimental, and intended for the brave.

The attached patch turns on the panel scaling registers of the R128. I've run this on my iBook2, and I've been able to display 640x480 and 800x600 modes on the panel successfully.

Quoted 6 lines

The panel sizes are currently hardwired on the iBook. This code will benefit greatly from a reliable means to find the panel size.

This has revealed problems in the X server: if the XF86Config-4 specifies 800x600 and the current console is in 1024x768, the display is broken.

Does switching resolutions in X fix it again?

Quoted 2 lines

This looks like a generic problem in fbdevhw based Xservers, as I saw something similar on 69030.

Yes, I suspect some fbdevHW functions return information about the current console mode instead of the one the X server wants to set up. I'm not sure how to fix, you seem to be working a lot with that code recently so I expect you to find a way. :)

--
Earthling Michel Dänzer (MrCooper)/ Debian GNU/Linux (powerpc) developer
XFree86 and DRI project member / CS student, Free Software enthusiast

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw
In reply to Adrian Cox
Quoted 3 lines · Adrian Cox

The attached patch turns on the panel scaling registers of the R128. I've run this on my iBook2, and I've been able to display 640x480 and 800x600 modes on the panel successfully.

So have I, but they both flicker noticeably, and there is corruption in X with the server built-in modes, but not with modes generated with fbset -x. Both effects are only slightly noticeable in 800x600 but more so in 640x480.

Nice work though!

--
Earthling Michel Dänzer (MrCooper)/ Debian GNU/Linux (powerpc) developer
XFree86 and DRI project member / CS student, Free Software enthusiast

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/