Re: CG14 and 16bit colour
Bob Breuer <[email protected]>
| Newsgroups | gmane.os.netbsd.ports.sparc |
|---|---|
| Message-ID | <CAHYW14_Z=PF=aviJ9SsCHDbL2Or6fefELkWTq6kW4pW57c=igA@mail.gmail.com> |
On Tue, Apr 30, 2024 at 4:35 AM Michael <[email protected]> wrote: > > Hello, > > On Wed, 24 Apr 2024 10:10:18 -0500 > Bob Breuer <[email protected]> wrote: > > > 16-bit mode can go up to 1920x1080 even with only 4MB of VRAM, > > otherwise you need 8MB for the 24-bit mode. > > > > While the CG14 can be abused to enable 16-bit modes, its native > > support is only for 8-bit and 24-bit, and also simultaneous 8 and 24 > > on a per pixel basis. The XLUT selects the color depth and which CLUT > > to use. To get 16-bit, you need to use 2 of the CLUTs, one for each > > byte, then alpha blend them together, and use the DAC gamma table to > > scale back up. Because the CLUTs are used, you can freely choose from > > any of 555, 565, RGB, BGR, or any other combination that fits into 16 > > bits. It's been a while since I experimented with this, but I can > > give more details if you want. > > Hmm, in 8bit mode the cg14 still sends RGB data to the DAC, using its > own LUT. What exactly does it send in 16bit mode? If it's just raw > pixel data, what keeps us from just putting the DAC into RGB555 mode? The cg14 always sends 24 bit color to the DAC, so no benefit to configuring the DAC for anything else. > That being said, I haven't found much on how exactly the XLUT works so > my drivers just zero it and cross fingers. 8 bit mode uses the value from PPR instead of the XLUT. 32 bit mode indexes the XLUT from the X in XBGR or the X32 plane, and 16 bit mode uses the X16 and C16 planes. From the XLUT, you get 4 fields of 2 bits, used to figure out which 2 colors to feed to the hardware blender. For each of the 2 colors, you choose which color channel (X, B, G, or R) to use as index and which CLUT to look it up in. The cg14 has either 2 or 3 CLUTs, and the 4th option is either direct 24 bit or grayscale. From one of the CLUTs, the top byte is a 5 bit alpha value with 0x8 being 50%. Thus in 16 or 32 bit modes, you can have multiple palettes on the screen at the same time with alpha blending between them. So for example in 16 bit mode, you can have a foreground window with a unique palette with alpha storing its pixels in the X16 plane, while the rest uses a global palette and stores pixel data in the C16 plane. Bob