From owner-freebsd-current@FreeBSD.ORG Tue Sep 6 12:08:12 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 636FB16A41F; Tue, 6 Sep 2005 12:08:12 +0000 (GMT) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [194.58.105.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id E6C0843D45; Tue, 6 Sep 2005 12:08:11 +0000 (GMT) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.44 (FreeBSD)) id 1ECcFG-00087v-0E; Tue, 06 Sep 2005 16:08:10 +0400 Date: Tue, 6 Sep 2005 16:08:09 +0400 From: Slawa Olhovchenkov To: Giorgos Keramidas Message-ID: <20050906120809.GP69481@zxy.spb.ru> References: <20050903133344.GA633@gothmog.gr> <20050905162713.GA92142@crodrigues.org> <20050905175826.GL69481@zxy.spb.ru> <20050906015418.GA590@gothmog.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050906015418.GA590@gothmog.gr> User-Agent: Mutt/1.5.7i X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: rodrigc@freebsd.org, Craig Rodrigues , freebsd-current@freebsd.org, mirya@matrix.kiev.ua Subject: Re: moused related panic X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2005 12:08:12 -0000 On Tue, Sep 06, 2005 at 04:54:19AM +0300, Giorgos Keramidas wrote: > On 2005-09-05 21:58, Slawa Olhovchenkov wrote: > > On Mon, Sep 05, 2005 at 12:27:13PM -0400, Craig Rodrigues wrote: > > > > > On Sat, Sep 03, 2005 at 04:33:44PM +0300, Giorgos Keramidas wrote: > > > > This was on a console running with 132x25 mode. > > > > > > Can you try this? > > > > 1. I think your remember '()' around '||' > > 2. Now mouse cursor not moved. > > I think I've found why this seems broken in non-graphics VESA modes. In I am use non-vesa, non-graphics mode (80x30). I am not use VESA module and don't have option VESA in the kernel. This is diffirent case? I am use loading external fonts (koi8-r) and screenmap (koi8-r->ibm866). > vesa_ioctl(), the 132x25 text mode triggers (diff since August 30): > > - return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0); > + return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0, 0); > > By calling sc_set_text_mode() with a font width of zero, scp->font_width is > then initialized to 0 and all set_mouse_pos() calls avoid running the patched > section: > > > > - if (scp->mouse_xpos != scp->mouse_oldxpos || scp->mouse_ypos != scp->mouse_oldypos) { > > > + if (scp->mouse_xpos != scp->mouse_oldxpos || scp->mouse_ypos != scp->mouse_oldypos && scp->font_size != 0 && scp->font_width != 0) { > > > scp->status |= MOUSE_MOVED; > > > scp->mouse_pos = > > > (scp->mouse_ypos/scp->font_size - scp->yoff)*scp->xsize > > The following patch fixes the movement of the cursor in VESA text modes and > avoids a panic in non-graphics VESA modes, by wrapping the graphics-specific > changes to the position of the cursor in ISGRAPHSC(scp) checks. The extra > KASSERT() is probably not necessary, but I'd vote for leaving it there anyway. > > %%% > Index: scmouse.c > =================================================================== > RCS file: /home/ncvs/src/sys/dev/syscons/scmouse.c,v > retrieving revision 1.38 > diff -u -r1.38 scmouse.c > --- scmouse.c 30 Aug 2005 18:58:16 -0000 1.38 > +++ scmouse.c 6 Sep 2005 01:51:08 -0000 > @@ -140,9 +140,12 @@ > static void > set_mouse_pos(scr_stat *scp) > { > - if (scp->mouse_xpos < scp->xoff*scp->font_width) > - scp->mouse_xpos = scp->xoff*scp->font_width; > - if (scp->mouse_ypos < scp->yoff*scp->font_size) > + > + KASSERT(scp != NULL, ("null scp")); > + > + if (scp->font_width != 0 && scp->mouse_xpos < scp->xoff * scp->font_width) > + scp->mouse_xpos = scp->xoff * scp->font_width; > + if (scp->font_size != 0 && scp->mouse_ypos < scp->yoff * scp->font_size) > scp->mouse_ypos = scp->yoff*scp->font_size; > if (ISGRAPHSC(scp)) { > if (scp->mouse_xpos > scp->xpixel-1) > @@ -151,17 +154,21 @@ > scp->mouse_ypos = scp->ypixel-1; > return; > } else { > - if (scp->mouse_xpos > (scp->xsize + scp->xoff)*scp->font_width - 1) > - scp->mouse_xpos = (scp->xsize + scp->xoff)*scp->font_width - 1; > - if (scp->mouse_ypos > (scp->ysize + scp->yoff)*scp->font_size - 1) > - scp->mouse_ypos = (scp->ysize + scp->yoff)*scp->font_size - 1; > + if (scp->font_width != 0 && > + scp->mouse_xpos > (scp->xsize + scp->xoff) * scp->font_width - 1) > + scp->mouse_xpos = (scp->xsize + scp->xoff) * scp->font_width - 1; > + if (scp->font_size != 0 && > + scp->mouse_ypos > (scp->ysize + scp->yoff) * scp->font_size - 1) > + scp->mouse_ypos = (scp->ysize + scp->yoff) * scp->font_size - 1; > } > > if (scp->mouse_xpos != scp->mouse_oldxpos || scp->mouse_ypos != scp->mouse_oldypos) { > scp->status |= MOUSE_MOVED; > - scp->mouse_pos = > - (scp->mouse_ypos/scp->font_size - scp->yoff)*scp->xsize > - + scp->mouse_xpos/scp->font_width - scp->xoff; > + if (ISGRAPHSC(scp)) { > + scp->mouse_pos = > + (scp->mouse_ypos / scp->font_size - scp->yoff) * scp->xsize + > + scp->mouse_xpos / scp->font_width - scp->xoff; > + } > #ifndef SC_NO_CUTPASTE > if ((scp->status & MOUSE_VISIBLE) && (scp->status & MOUSE_CUTTING)) > mouse_cut(scp); > %%%