[comp.sys.mac.programmer] Video Card Driver + Sound Manager Question

jmunkki@hila.hut.fi (Juri Munkki) (03/25/91)

Here's a hard question for those who really know what is going on with
video cards:

I'm having trouble with the 8.24 video card, because it apparently disables
interrupts (including the 60 Hz VBL interrupt) while a SetEntries is executing.
I dug up the sample video card driver sources from apple.com and found the
following comment:

;  This routine can optionally be implemented to execute asynchronously, by 
;  posting the CLUT change request in a table that is loaded as part of the
;  slot interrupt handler.  The Macintosh will NOT call this Control call 
;  with the async variant of the trap, rather, the SetEntries call executes as
;  a normal Control call, and delays it's hardware activity until VBL.
;  In doing this, a few extra rules must be followed:
;
;	1) The driver should implement KillIO (see above)
;	2) If SetEntries is entered while the interrupt level is
;	   non-zero, it should write immediately to the CLUT hardware.


If I understand this correctly, it says that I can install my own video
card VBL routine that will then make a _Control call to change the clut
on the video card.

Right now my 60 Hz VBL task is not called regularly, if I call SetEntries.

I would appreciate it, if someone clarified the comment above and told me
what it means exactly. I know I will need to install a video card VBL task
that changes the clut, if I use the 3D LC shutter glasses.

------

My second question is:

	Why is there no documentation for the 6.07 sound manager on apple.com?
	Either remove the 6.02 documents or replace them with something that is
	more up to date.

I'm still using the old sound driver, because the sound manager has been so
buggy. I guess 6.07 has changed this a bit, so I would like to start using
the new sound manager, if possible.

   ____________________________________________________________________________
  / Juri Munkki	    /  Helsinki University of Technology   /  Wind  / Project /
 / jmunkki@hut.fi  /  Computing Center Macintosh Support  /  Surf  /  STORM  /
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

jmunkki@hila.hut.fi (Juri Munkki) (03/25/91)

Here's what I wrote earlier today:
>If I understand this correctly, it says that I can install my own video
>card VBL routine that will then make a _Control call to change the clut
>on the video card.

I've studied things a little closer now, and it appears that doing this
will eventually crash the machine. This might be because _Control is a
trap that might move memory and can not be called from a vertical blanking
task.

On my good old Toby frame buffer card, if I call _Control from the VBLTask,
the card driver appears to wait for the next vertical blanking period and
returns after waiting 1/66th of a second. This is not what I was aiming for.
(I tried to make the control call immediate, but that didn't help.)

>Right now my 60 Hz VBL task is not called regularly, if I call SetEntries.

This is probably what is happening on the 8.24. The old card probably allows
interrupts while it is waiting for the vertical blanking period, since my
blanking task is called regularly and things work smoothly (unless I do what
I described above and make the card wait within the interrupt task).

Could someone who can, check if the 24-bit video card waits while interrupts
are disabled? If it does, I'm inclined to call it a bug, or at least a nasty
feature. Neither card seems to support asynchronous SetEntries calls. (How
do I find out if a card supports asynch SetEntries?)

>I know I will need to install a video card VBL task
>that changes the clut, if I use the 3D LC shutter glasses.

I hope someone understood what I meant above. Maybe I should clarify a little
bit, since most people are probably not familiar with stereo 3D.

To display graphics in stereo, a different picture is shown to each eye.
This can be accomplished with the usual red-green glasses or as in my
case, with liquid crystal shutter glasses.

The glasses need to be switched very quickly and in synchronization with
the display device. This is easy to accomplish with a vertical blanking
task. What isn't quite that easy, is that the picture on the screen also
needs to be changed at every vertical blanking task.

This can either be accomplished by drawing into the display buffer from
the VBL task, or changing the way the display buffer is shown. Drawing
at VBL time is not efficient and only works, if the machine is fast enough.
Even then, it cripples the performance of the machine.

The second way to change the display contents, is to change the color lookup
table so that the some bits in a pixel are ignored for one eye and others
are ignored for the other. The problem is that it looks like you can't
change the clut at vertical blanking time. The silly thing about this is
that the clut is normally supposed to be changed only at vertical blanking
time and that the only reason you can't do it, is that the person who wrote
the drivers for these cards didn't expect anyone to make calls from an
interrupt level.

I now understand the second comment in the sample driver source, which
said:

;	2) If SetEntries is entered while the interrupt level is
;	   non-zero, it should write immediately to the CLUT hardware.

My video card at home certainly doesn't seem do this. It's probably too
old to know about asynchronous SetEntries.

Do I just have to be content that one can not efficiently use a Mac II
for stereo display and remain compatible with most video cards?

I could always dig up the hardware interface to my video card from the
driver code, but it would then be incompatible with everything else.

Does anyone know anything more about this? Apple? Radius? Anyone?

   ____________________________________________________________________________
  / Juri Munkki	    /  Helsinki University of Technology   /  Wind  / Project /
 / jmunkki@hut.fi  /  Computing Center Macintosh Support  /  Surf  /  STORM  /
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~