From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LYYxu-0005cM-Pv for qemu-devel@nongnu.org; Sat, 14 Feb 2009 23:50:50 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LYYxs-0005bt-9I for qemu-devel@nongnu.org; Sat, 14 Feb 2009 23:50:49 -0500 Received: from [199.232.76.173] (port=50146 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LYYxs-0005bq-3X for qemu-devel@nongnu.org; Sat, 14 Feb 2009 23:50:48 -0500 Received: from smtprelay0017.hostedemail.com ([216.40.44.17]:48040 helo=smtprelay.hostedemail.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LYYxr-00055i-NW for qemu-devel@nongnu.org; Sat, 14 Feb 2009 23:50:47 -0500 Received: from filter.hostedemail.com (ff-bigip1 [10.5.19.254]) by smtprelay02.hostedemail.com (Postfix) with SMTP id 9A2CC216E2BF for ; Sun, 15 Feb 2009 04:50:44 +0000 (UTC) Received: from [192.168.2.184] (cpe-66-66-167-50.rochester.res.rr.com [66.66.167.50]) (Authenticated sender: kressb@moose.net) by omf05.hostedemail.com (Postfix) with ESMTP for ; Sun, 15 Feb 2009 04:50:44 +0000 (UTC) Message-ID: <49979F23.6010500@moose.net> Date: Sat, 14 Feb 2009 23:50:43 -0500 From: Brian Kress MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000805030900090801090703" Subject: [Qemu-devel] [PATCH] Fix hardware accelerated video to video copy on Cirrus VGA Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------000805030900090801090703 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cirrus_do_copy() in hw/cirrus_vga.c seems to make some incorrect assumptions about video memory layout. It tries to convert addresses to coordinates assuming that one row of data is (width * depth) bytes long. The correct way seems to be to use the pitch fields in the CirrusVGAState structure instead. Without this patch, I get lots of screen corruption when I try to drag a window under X as it's passing the wrong coordinates to the display surface for the copy. With this patch I can drag a window with no screen corruption. --------------000805030900090801090703 Content-Type: text/plain; name="patch.cirrus_vga" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch.cirrus_vga" Signed-off-by: Brian Kressb get_resolution((VGAState *)s, &width, &height); /* extra x, y */ - sx = (src % (width * depth)) / depth; - sy = (src / (width * depth)); - dx = (dst % (width *depth)) / depth; - dy = (dst / (width * depth)); + sx = (src % ABS(s->cirrus_blt_srcpitch)) / depth; + sy = (src / ABS(s->cirrus_blt_srcpitch)); + dx = (dst % ABS(s->cirrus_blt_dstpitch)) / depth; + dy = (dst / ABS(s->cirrus_blt_dstpitch)); /* normalize width */ w /= depth; --------------000805030900090801090703--