svn commit: r327418 - head/sys/powerpc/ps3

Nathan Whitehorn nwhitehorn at FreeBSD.org
Sun Dec 31 06:10:08 UTC 2017


Author: nwhitehorn
Date: Sun Dec 31 06:10:07 2017
New Revision: 327418
URL: https://svnweb.freebsd.org/changeset/base/327418

Log:
  Use data from the boot loader to pick the appropriate output graphics mode
  instead of hard-coding a default. This information is passed implicitly by
  the PS3 firmware and can be relied upon. Also adjust the default mode, if
  somehow firmware doesn't pass one, to 1920x1080 from 720x480 since it is
  2017.
  
  MFC after:	2 weeks

Modified:
  head/sys/powerpc/ps3/ps3_syscons.c

Modified: head/sys/powerpc/ps3/ps3_syscons.c
==============================================================================
--- head/sys/powerpc/ps3/ps3_syscons.c	Sun Dec 31 05:38:19 2017	(r327417)
+++ head/sys/powerpc/ps3/ps3_syscons.c	Sun Dec 31 06:10:07 2017	(r327418)
@@ -159,16 +159,62 @@ static int
 ps3fb_init(struct vt_device *vd)
 {
 	struct ps3fb_softc *sc;
+	char linux_video_mode[24];
+	int linux_video_mode_num = 0;
 
 	/* Init softc */
 	vd->vd_softc = sc = &ps3fb_softc;
 
-	/* XXX: get from HV repository */
 	sc->fb_info.fb_depth = 32;
-	sc->fb_info.fb_height = 480;
-	sc->fb_info.fb_width = 720;
+	sc->fb_info.fb_height = 1080;
+	sc->fb_info.fb_width = 1920;
+
+	/* See if the bootloader has passed a graphics mode to use */
+	bzero(linux_video_mode, sizeof(linux_video_mode));
+	TUNABLE_STR_FETCH("video", linux_video_mode, sizeof(linux_video_mode));
+	sscanf(linux_video_mode, "ps3fb:mode:%d", &linux_video_mode_num);
+	
+	switch (linux_video_mode_num) {
+	case 1:
+	case 2:
+		sc->fb_info.fb_height = 480;
+		sc->fb_info.fb_width = 720;
+		break;
+	case 3:
+	case 8:
+		sc->fb_info.fb_height = 720;
+		sc->fb_info.fb_width = 1280;
+		break;
+	case 4:
+	case 5:
+	case 9:
+	case 10:
+		sc->fb_info.fb_height = 1080;
+		sc->fb_info.fb_width = 1920;
+		break;
+	case 6:
+	case 7:
+		sc->fb_info.fb_height = 576;
+		sc->fb_info.fb_width = 720;
+		break;
+	case 11:
+		sc->fb_info.fb_height = 768;
+		sc->fb_info.fb_width = 1024;
+		break;
+	case 12:
+		sc->fb_info.fb_height = 1024;
+		sc->fb_info.fb_width = 1280;
+		break;
+	case 13:
+		sc->fb_info.fb_height = 1200;
+		sc->fb_info.fb_width = 1920;
+		break;
+	}
+	
+	/* Allow explicitly-specified values for us to override everything */
 	TUNABLE_INT_FETCH("hw.ps3fb.height", &sc->fb_info.fb_height);
 	TUNABLE_INT_FETCH("hw.ps3fb.width", &sc->fb_info.fb_width);
+
 	sc->fb_info.fb_stride = sc->fb_info.fb_width*4;
 	sc->fb_info.fb_size = sc->fb_info.fb_height * sc->fb_info.fb_stride;
 	sc->fb_info.fb_bpp = sc->fb_info.fb_stride / sc->fb_info.fb_width * 8;


More information about the svn-src-head mailing list