Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Aug 2013 19:06:23 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254999 - head/sys/dev/fb
Message-ID:  <201308281906.r7SJ6N4e022317@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Wed Aug 28 19:06:22 2013
New Revision: 254999
URL: http://svnweb.freebsd.org/changeset/base/254999

Log:
  Do not save/restore video memory if we are not using linear frame buffer.
  Note this partially revert r233896.

Modified:
  head/sys/dev/fb/vesa.c

Modified: head/sys/dev/fb/vesa.c
==============================================================================
--- head/sys/dev/fb/vesa.c	Wed Aug 28 18:13:37 2013	(r254998)
+++ head/sys/dev/fb/vesa.c	Wed Aug 28 19:06:22 2013	(r254999)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 1998 Kazutaka YOKOTA and Michael Smith
- * Copyright (c) 2009-2012 Jung-uk Kim <jkim@FreeBSD.org>
+ * Copyright (c) 2009-2013 Jung-uk Kim <jkim@FreeBSD.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -1463,7 +1463,7 @@ vesa_set_border(video_adapter_t *adp, in
 static int
 vesa_save_state(video_adapter_t *adp, void *p, size_t size)
 {
-	vm_offset_t buf;
+	void *buf;
 	size_t bsize;
 
 	if (adp != vesa_adp || (size == 0 && vesa_state_buf_size == 0))
@@ -1479,17 +1479,14 @@ vesa_save_state(video_adapter_t *adp, vo
 		free(vesa_vmem_buf, M_DEVBUF);
 		vesa_vmem_buf = NULL;
 	}
-	if (VESA_MODE(adp->va_mode) && adp->va_buffer != 0) {
-		buf = adp->va_buffer;
-		bsize = adp->va_buffer_size;
-	} else {
-		buf = adp->va_window;
-		bsize = adp->va_window_size;
-	}
-	if (buf != 0) {
-		vesa_vmem_buf = malloc(bsize, M_DEVBUF, M_NOWAIT);
-		if (vesa_vmem_buf != NULL)
-			bcopy((void *)buf, vesa_vmem_buf, bsize);
+	if (VESA_MODE(adp->va_mode)) {
+		buf = (void *)adp->va_buffer;
+		if (buf != NULL) {
+			bsize = adp->va_buffer_size;
+			vesa_vmem_buf = malloc(bsize, M_DEVBUF, M_NOWAIT);
+			if (vesa_vmem_buf != NULL)
+				bcopy(buf, vesa_vmem_buf, bsize);
+		}
 	}
 	if (vesa_state_buf_size == 0)
 		return ((*prevvidsw->save_state)(adp, p, size));
@@ -1500,7 +1497,7 @@ vesa_save_state(video_adapter_t *adp, vo
 static int
 vesa_load_state(video_adapter_t *adp, void *p)
 {
-	vm_offset_t buf;
+	void *buf;
 	size_t bsize;
 	int error, mode;
 
@@ -1515,16 +1512,12 @@ vesa_load_state(video_adapter_t *adp, vo
 		error = vesa_set_mode(adp, mode);
 
 	if (vesa_vmem_buf != NULL) {
-		if (error == 0) {
-			if (VESA_MODE(mode) && adp->va_buffer != 0) {
-				buf = adp->va_buffer;
+		if (error == 0 && VESA_MODE(mode)) {
+			buf = (void *)adp->va_buffer;
+			if (buf != NULL) {
 				bsize = adp->va_buffer_size;
-			} else {
-				buf = adp->va_window;
-				bsize = adp->va_window_size;
+				bcopy(vesa_vmem_buf, buf, bsize);
 			}
-			if (buf != 0)
-				bcopy(vesa_vmem_buf, (void *)buf, bsize);
 		}
 		free(vesa_vmem_buf, M_DEVBUF);
 		vesa_vmem_buf = NULL;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308281906.r7SJ6N4e022317>