delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/29/14:36:45

Message-ID: <F77915E7F086D31197F4009027CC81C90DC46B@probe-2.as-london.acclaim.com>
From: Shawn Hargreaves <SHargreaves AT acclaimstudios DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: HELP - GFX programming
Date: Mon, 29 Nov 1999 17:47:29 -0000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)
Reply-To: djgpp AT delorie DOT com

sl writes:
> I have been studying the VESA 1.2 document and I have some technical
> questions.. I need to know what the following things are and what 
> they are used for:
>
> 1) Memory windows

When in banked modes (ie. not using a linear framebuffer) the 
processor can usually only access 64k of video memory, starting at
0xA0000. Since the card usually has much more than this, you treat
that 64k block as a sliding window that can be used to access just
part of the real, larger memory inside the card. For instance you
could position your window at zero, and then write a pixel to
0xA0000, to set the top left pixel on the screen. Then offset your
window by 64k, and write another pixel to 0xA0000, and it will
appear at the 64k'th pixel of the screen.

These days most video cards have only a single window which is 64k
in size, but some older ones used other schemes, which were usually
more efficient for actually drawing things (I think it is a shame
that they all standardised on the inferior 64k single window). For
this reason, VESA gives you information about two different windows,
which may support different things, and be mapped at different 
addresses. The most likely organisations are:

- a single 64k window, starting at 0xA0000.

- one 64k window which is used for reading video memory, and a
different one which is used for writing. These can be positioned
independently, so you can read one place at the same time as
writing another, and not have to keep moving the windows around in
order to do it.

- two 32k windows, one starting at 0xA0000 and another at 0xA8000,
which can be positioned independently.

Other combinations are possible, so you have to look at the VESA
driver information to find out what scheme your card provides. Or
you can choose to ignore this and just use window 0 for writing
(which will always work), but if you want to read from vram, you
need to look at the window information because some cards can only
read from window 1.

> 2) Window granularity

This refers to how accurately you can position the windows. If you
have a 64k window granularity, you can only place it at offset zero,
offset 64k, offset 128k, etc. With a 4k granularity you can place it
at any multiple of 4k, which is obviously much more flexible. If you
have a 64k window size but with a 4k granularity, there will be
several different places where you could position the window and then
use a different offset to refer to the same actual byte of video
memory, which lets you choose between these alternatives when deciding
where to put the window, so you can try to minimise the number of
times you have to move it while drawing.

> 3) Memory banks

A different term for memory windows.

> 4) Memory model - How does it help us when we know which memory 
> model the card uses?

This tells you how the pixel data is stored. Most commonly you will
find model 4 (packed pixel), where consecutive chunks of video memory
store consecutive paletted pixels, or model 6 (direct color), where
the RGB value is stored encoded inside the pixel number. But you may
also see models of 7 (YUV color format), or 3 (planar, with individual
bits of the pixel value interleaved through memory), etc, etc.

> 5) If NumberOfImagePages is nonzero and there is space for virtual 
> display images/pages, how does one flip between them? How does one 
> write into these virtual pages as opposed to the displayed page?

I don't think the NumberOfImagePages is a terribly useful variable
to report: it is a mixing of metaphors, and nowhere else in the VESA
interface does it use that metaphor of having more than one page
of vram.

You draw to offscreen pages simply by treating the video memory as
a single large array, and writing past the end of the part that is
normally visible. Then you use the set display start function (0x4F07)
to flip what area is currently being displayed.


	Shawn Hargreaves.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019