Page 1 of 1
VESA plotting pixel issue
Posted: Mon Feb 28, 2011 9:08 pm
by NickJohnson
I have VM86 working as well as a method for calling various VBE functions, which at the very least gives sane data for controller and mode info blocks. However, I'm having trouble properly plotting pixels. I set mode 0x112 (640x480x24 direct color, according to the mode info block), switch to bank 0 for window A (which is at 0xA0000), and set the first byte to 0xFF. I would expect this to make a single blue pixel at the top left corner of the screen, but instead, I get eight white pixels in a line from the top left corner of the screen. Nothing I do seems to be able to create color; at best, I can mostly fill the screen with white. What could the problem be?
I'm using QEMU, and I get the same problem with all other direct color modes that I can set (I haven't tried any of the packed pixel modes.)
Re: VESA plotting pixel issue
Posted: Mon Feb 28, 2011 11:42 pm
by Karlosoft
The blocks are very slow, why don't you use the LBA? (if you are on a version of vesa 1.2 or better i think)
Re: VESA plotting pixel issue
Posted: Tue Mar 01, 2011 1:35 am
by Chandra
Karlosoft wrote:The blocks are very slow, why don't you use the LBA? (if you are on a version of vesa 1.2 or better i think)
LBA?
It's LFB, and that too on VESA 2.0 or higher.
Re: VESA plotting pixel issue
Posted: Tue Mar 01, 2011 1:48 am
by Chandra
Now, onto the point
NickJohnson wrote:I have VM86 working as well as a method for calling various VBE functions, which at the very least gives sane data for controller and mode info blocks. However, I'm having trouble properly plotting pixels. I set mode 0x112 (640x480x24 direct color, according to the mode info block), switch to bank 0 for window A (which is at 0xA0000), and set the first byte to 0xFF. I would expect this to make a single blue pixel at the top left corner of the screen, but instead, I get eight white pixels in a line from the top left corner of the screen. Nothing I do seems to be able to create color; at best, I can mostly fill the screen with white. What could the problem be?
I'm using QEMU, and I get the same problem with all other direct color modes that I can set (I haven't tried any of the packed pixel modes.)
Hmm... the mode no. might be wrong. You should never rely on the standard mode numbers because they are no longer STANDARD. Rather, you have to query for the available video modes and then set the mode you want, if available.
Re: VESA plotting pixel issue
Posted: Tue Mar 01, 2011 1:57 am
by Combuster
I noticed your screen behaves as 640x480x4, VGA mode 0x12 (the lower byte of 0x112) - have you tried dumping the register values before calling the INT?
Re: VESA plotting pixel issue [SOLVED]
Posted: Tue Mar 01, 2011 5:45 am
by NickJohnson
@Chandra: I am reading the mode numbers from the controller info block, not using standard ones. It just so happens that QEMU's video card's mode numbers match the obsolete standard numbers.
@Combuster: Yep, that was the problem. It turns out that I was casting the mode number to a uint8_t at one point, because I misread the spec as saying it was 8 bits wide instead of 9 bits.
Everything works fine now.
Re: VESA plotting pixel issue [SOLVED]
Posted: Tue Mar 01, 2011 6:47 am
by Chandra
NickJohnson wrote: I am reading the mode numbers from the controller info block, not using standard ones. It just so happens that QEMU's video card's mode numbers match the obsolete standard numbers.
You're right. I missed that myself though I use QEMU and VESA everyday. It just happened, never mind.
Good to hear you got that solved. Cheers.
Re: VESA plotting pixel issue
Posted: Tue Mar 01, 2011 7:40 am
by Karlosoft
@Chandra Sorry it was 6 AM here when I wrote that post -.-. I think I was a bit tired because I misunderstood all the meaning of the original post. XD Please forgive me!
Re: VESA plotting pixel issue
Posted: Tue Mar 01, 2011 7:44 am
by Chandra
Karlosoft wrote:@Chandra Sorry it was 6 AM here when I wrote that post -.-. I think I was a bit tired because I misunderstood all the meaning of the original post. XD Please forgive me!
That's OK. After all, we all are here to learn.