qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Henry Harrington <henry.harrington@gmail.com>
To: "Andreas Färber" <andreas.faerber@web.de>
Cc: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] cocoa: Fix VBE function Set Display Start
Date: Tue, 27 Nov 2012 18:54:08 +0000	[thread overview]
Message-ID: <CAD1s3Sxk8xtXEHypgSNGufYbX1DE_OAOBa9rYmxm+r30YK3HdA@mail.gmail.com> (raw)
In-Reply-To: <50B449A0.30108@web.de>

[-- Attachment #1: Type: text/plain, Size: 905 bytes --]

On Tue, Nov 27, 2012 at 5:03 AM, Andreas Färber <andreas.faerber@web.de> wrote:
> Am 21.11.2012 20:08, schrieb Henry Harrington:
> Apart from the style issues above (you can use scripts/checkpatch.pl to
> verify) this looks okay. Unfortunately I am not getting pixman built on
> OSX so am still unable to test...

Thanks, I'll fix the style issues and submit a new patch.

> Am I understanding correctly that this is an optional hook and not a bug
> fix for 1.3? How can it be verified?
>
> Regards,
> Andreas

The setdata callback is required, even though the Cocoa UI works reasonably
well without it. I've attached a simple testcase, which rapidly switches
between two virtual screens using VBE (one is blue/green, and the other
is green/red). Without the fix Qemu does not switch between screens.

There was a similar bug in the VNC UI which was fixed in commit 1d3323d.

Henry

[-- Attachment #2: display-test.asm --]
[-- Type: application/octet-stream, Size: 4519 bytes --]

[ORG 0x7c00]
[BITS 16]
        jmp 0:entry
entry:
        mov ax, 0
        mov ds, ax
        mov es, ax
        ;; stack goes just below the boot sector.
        mov ss, ax
        mov sp, 0x7c00

        ;; Get info for mode 111 (640x480x2)
        mov ax, 0x4f01
        mov cx, 0x0111
        mov di, mode_info
        int 0x10
        ;; Switch to mode 111, with linear framebuffer.
        mov ax, 0x4f02
        mov bx, 0x4111
        int 0x10

        ;; Enter unreal mode so memory above 1MB can be accessed.
        cli
        push es
        push ds
        lgdt [gdtinfo]
        mov eax, cr0
        or al, 1
        mov cr0, eax
        mov bx, 0x8
        mov ds, bx
        mov es, bx
        and al, 0xfe
        mov cr0, eax
        pop ds
        pop es
        sti

        ;; Fill a 640x960 area with equal parts blue, green and red.
        ;; This is twice as large as the visible screen, so only the
        ;; blue area and part of the green area will be displayed initially.
        cld
        mov edi, [PhysBasePtr]
        mov eax, 0x1f           ; blue
        mov ecx, 640*320
        rep a32 stosw
        mov eax, 0x7e0          ; green
        mov ecx, 640*320
        rep a32 stosw
        mov eax, 0xf800         ; red
        mov ecx, 640*320
        rep a32 stosw

again:
        ;; Use VBE function 7 Set Display Start to flip between
        ;; the blue/green and green/red regions.
        mov ax, 0x4f07
        mov bx, 0x0
        mov cx, 0x0
        mov dx, [offset1]
        int 0x10
        mov dx, [offset1]
        mov ax, [offset2]
        mov [offset1], ax
        mov [offset2], dx
        jmp again

offset1:        dw 0
offset2:        dw 480

gdtinfo:
   dw gdt_end - gdt - 1   ;last byte in table
   dd gdt                 ;start of table

gdt         dd 0,0        ; entry 0 is always unused
flatdesc    db 0xff, 0xff, 0, 0, 0, 10010010b, 11001111b, 0
gdt_end:

; Make the file 512 bytes long
TIMES 510-($-$$) DB 0

; Add the boot signature
dw 0AA55h

        [section .bss]
mode_info:
             ; Mandatory information for all VBE revisions
ModeAttributes          resw 1         ; mode attributes
WinAAttributes          resb 1         ; window A attributes
WinBAttributes          resb 1         ; window B attributes
WinGranularity          resw 1         ; window granularity
WinSize                 resw 1         ; window size
WinASegment             resw 1         ; window A start segment
WinBSegment             resw 1         ; window B start segment
WinFuncPtr              resd 1         ; pointer to window function
BytesPerScanLine        resw 1         ; bytes per scan line

        ; Mandatory information for VBE 1.2 and above
XResolution             resw 1         ; horizontal resolution in pixels or characters3
YResolution             resw 1         ; vertical resolution in pixels or characters
XCharSize               resb 1         ; character cell width in pixels
YCharSize               resb 1         ; character cell height in pixels
NumberOfPlanes          resb 1         ; number of memory planes
BitsPerPixel            resb 1         ; bits per pixel
NumberOfBanks           resb 1         ; number of banks
MemoryModel             resb 1         ; memory model type
BankSize                resb 1         ; bank size in KB
NumberOfImagePages      resb 1         ; number of images
Reserved                resb 1         ; reserved for page function

        ; Direct Color fields (required for direct/6 and YUV/7 memory models)
RedMaskSize             resb 1         ; size of direct color red mask in bits
RedFieldPosition        resb 1         ; bit position of lsb of red mask
GreenMaskSize           resb 1         ; size of direct color green mask in bits
GreenFieldPosition      resb 1         ; bit position of lsb of green mask
BlueMaskSize            resb 1         ; size of direct color blue mask in bits
BlueFieldPosition       resb 1         ; bit position of lsb of blue mask
RsvdMaskSize            resb 1         ; size of direct color reserved mask in bits
RsvdFieldPosition       resb 1         ; bit position of lsb of reserved mask
DirectColorModeInfo     resb 1         ; direct color mode attributes
        ; Mandatory information for VBE 2.0 and above
PhysBasePtr             resd 1         ; physical address for flat memory frame buffer
OffScreenMemOffset      resd 1         ; pointer to start of off screen memory
OffScreenMemSize        resw 1         ; amount of off screen memory in 1k units

      reply	other threads:[~2012-11-27 18:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21 19:08 [Qemu-devel] [PATCH] cocoa: Fix VBE function Set Display Start Henry Harrington
2012-11-27  5:03 ` Andreas Färber
2012-11-27 18:54   ` Henry Harrington [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAD1s3Sxk8xtXEHypgSNGufYbX1DE_OAOBa9rYmxm+r30YK3HdA@mail.gmail.com \
    --to=henry.harrington@gmail.com \
    --cc=andreas.faerber@web.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).