From antoine@mna75-2-82-67-196-50.fbx.proxad.net  Fri Jun  3 15:59:09 2005
Return-Path: <antoine@mna75-2-82-67-196-50.fbx.proxad.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C22A016A41C
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  3 Jun 2005 15:59:09 +0000 (GMT)
	(envelope-from antoine@mna75-2-82-67-196-50.fbx.proxad.net)
Received: from barton.dreadbsd.org (madhouse.dreadbsd.org [82.67.196.50])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1548D43D48
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  3 Jun 2005 15:59:08 +0000 (GMT)
	(envelope-from antoine@mna75-2-82-67-196-50.fbx.proxad.net)
Received: from barton.dreadbsd.org (localhost [127.0.0.1])
	by barton.dreadbsd.org (8.13.3/8.13.1) with ESMTP id j53Fx6kl028183
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 3 Jun 2005 17:59:06 +0200 (CEST)
	(envelope-from antoine@mna75-2-82-67-196-50.fbx.proxad.net)
Received: (from antoine@localhost)
	by barton.dreadbsd.org (8.13.3/8.13.1/Submit) id j53Fx6VP028182;
	Fri, 3 Jun 2005 17:59:06 +0200 (CEST)
	(envelope-from antoine)
Message-Id: <200506031559.j53Fx6VP028182@barton.dreadbsd.org>
Date: Fri, 3 Jun 2005 17:59:06 +0200 (CEST)
From: Antoine Brodin <antoine.brodin@laposte.net>
Reply-To: Antoine Brodin <antoine.brodin@laposte.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: ioctl collision between pcvt(4) and vga(4) after recent vesa changes
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         81867
>Category:       kern
>Synopsis:       [ioctl] [patch] ioctl collision between pcvt(4) and vga(4) after recent vesa changes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    delphij
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 03 16:00:21 GMT 2005
>Closed-Date:    Sat May 20 04:24:27 GMT 2006
>Last-Modified:  Sat May 20 04:24:27 GMT 2006
>Originator:     Antoine Brodin
>Release:        FreeBSD 6.0-CURRENT i386
>Organization:
none
>Environment:
System: FreeBSD barton.dreadbsd.org 6.0-CURRENT FreeBSD 6.0-CURRENT #1: Sun May 29 17:26:31 CEST 2005 antoine@barton.dreadbsd.org:/usr/obj/usr/src/sys/BARTON i386
>Description:
I've already sent a description to current@ without feedback:
http://docs.freebsd.org/cgi/mid.cgi?20050602171012.61b4568e.antoine.brodin

The recent vesa changes cause a problem on my laptop.
During startup, when ispcvt is called by syscons_precmd
(in /etc/rc.d/syscons), it clears my screen and the screen keeps
cleared.  My kernel doesn't have pcvt compiled in so it's strange.

I investigated a bit, and chmod'ing -x ispcvt solves the problem.

vidcontrol -i mode shows that mode 369 is supported but mode 369 doesn't
work so I think that there is an ioctl collision between:
. this mode: _IO('V', 369 - 256) (from vga(4))
. and VGAPCVTID: _IOWR('V',113, struct pcvtid) (form pcvt(4), used by ispcvt(8))

>How-To-Repeat:
Run ispcvt on a computer where mode 369 is claimed to be supported but doesn't work.
The screen is cleared and it stays cleared.

>Fix:
Collisions must be avoided.

The attached patch works:

--- scvesactl.diff begins here ---
Index: scvesactl.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/syscons/scvesactl.c,v
retrieving revision 1.21
diff -u -p -r1.21 scvesactl.c
--- scvesactl.c	29 May 2005 08:43:43 -0000	1.21
+++ scvesactl.c	2 Jun 2005 14:56:09 -0000
@@ -115,7 +115,9 @@ vesa_ioctl(struct cdev *dev, u_long cmd,
 
 			mode = (cmd & 0xff) + M_VESA_BASE;
 
-			if ((mode > M_VESA_FULL_1280) &&
+			/* Avoid collisions with pcvt. */
+			if (((cmd & IOC_DIRMASK) == IOC_VOID) &&
+			    (mode > M_VESA_FULL_1280) &&
 			    (mode < M_VESA_MODE_MAX))
 				return sc_set_graphics_mode(scp, tp, mode);
 		}
--- scvesactl.diff ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->delphij 
Responsible-Changed-By: arved 
Responsible-Changed-When: Sat Jun 4 20:55:20 GMT 2005 
Responsible-Changed-Why:  
Over to responsible committer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=81867 
State-Changed-From-To: open->suspended 
State-Changed-By: delphij 
State-Changed-When: Fri Jun 10 05:50:50 GMT 2005 
State-Changed-Why:  
Patch committed, thanks! 

However, this reveals that there is some underlying issues that 
should be resolved in other way.  I will take a further investigation 
about the issue and try to provide a cleaner solution. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=81867 
State-Changed-From-To: suspended->closed 
State-Changed-By: delphij 
State-Changed-When: Sat May 20 04:22:47 UTC 2006 
State-Changed-Why:  
With the patch in HEAD and RELENG_6 and now that pcvt(4) was 
removed from -HEAD and thus the collison no longer persist. 

Thanks for your submission. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=81867 
>Unformatted:
