From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LRWGv-0000MQ-O5 for qemu-devel@nongnu.org; Mon, 26 Jan 2009 13:33:21 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LRWGu-0000Ln-KD for qemu-devel@nongnu.org; Mon, 26 Jan 2009 13:33:21 -0500 Received: from [199.232.76.173] (port=35613 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRWGu-0000Lh-C4 for qemu-devel@nongnu.org; Mon, 26 Jan 2009 13:33:20 -0500 Received: from smtp.ctxuk.citrix.com ([62.200.22.115]:36729 helo=SMTP.EU.CITRIX.COM) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LRWGs-0003hk-FE for qemu-devel@nongnu.org; Mon, 26 Jan 2009 13:33:20 -0500 Message-ID: <497E0042.6030808@eu.citrix.com> Date: Mon, 26 Jan 2009 18:26:10 +0000 From: Stefano Stabellini MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] [v2] Update cocoa.m to match new DisplayState code References: <3097312F-7315-42BA-AF5D-4C026CD874FD@digitalescape.info> In-Reply-To: <3097312F-7315-42BA-AF5D-4C026CD874FD@digitalescape.info> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 Samuel Benson wrote: > Version 2 does as follows: > > [1]: Corrects endianness on issues by using native BGR to RGB conversion > [2]: Uses DisplayState accessors for obtaining graphics context > information, which > [3]: Removes now unused variables, and > [4]: Allows reading of varying color modes (32bit/24/16), and converting > to native colorspace > [5]: Attempts to keep itself centered on screen (as opposed to bottom > right, which immediately > goes off screen after bios load) on context changes (window resizes) > > Testing working on i386 (gentoo, Windows 2000) and PPC (debian) guests > on PPC and x86 Macs. > > In regards to [4], Windows 2000 displays fine on quick tests, but on the > lowest setting > I could test, 16bit color depth at 4bpp, colors are slightly off. I used > gentoo > install-x86-minimal-2008.0 in framebuffer mode to test above setting; > the usual grey text is > now blue, and Tux appears to be BGR shifted. I do not know if previous > code worked at such > a low color setting. > > Signed-off-by: Samuel Benson This patch looks fine to me: it uses the new interface the way it is supposed to be used. However if you are seeing some color problems you may still have few bugs in the cocoa color conversion code. To help you track them down, I'll explain a little bit more the pixel formats that the graphic card exposes to cocoa, no matter what the host endianness is: - 24 bits depth, 32 bits per pixel (8888) - 16 bits depth, 16 bits per pixel (565) usually the pixel format is RGB, look at console.c:qemu_default_pixelformat to have the details. There is just one exception: if the guest endianness differs from the host endianness and the guest native color depth is 24 bits with 32 bits per pixels, then these masks are used instead: console.c:qemu_different_endianness_pixelformat. You'll probably never see this latter case in your tests, so you can just ignore it for the moment. Did you do the blue shifted Tux test on a ppc Mac? If so my guess is that you have to call kCGImageAlphaNoneSkipLast instead of kCGImageAlphaNoneSkipFirst because the format exposed by the graphic card is already converted into big endian.