3
$\begingroup$

Most information about memory mapped displays on the net are about those in which there is essentially a location in main memory for each pixel on the display. A hypothetical 1024 x 512 display would therefore have 524,288 locations each mapped to a unique pixel. To set a pixel to a particular color, all you basically need to do is write an RGB value into the corresponding memory location for that pixel, eg: MOV 0xFF3C0A, 0x00BB75. The first argument in that instruction is the address holding the RGB value and the second is the address of the pixel you are copying it to.

However, this can use up a quite a lot of main memory, which might not be ideal for certain systems. In a machine with a 32 bit or higher word size, it could instead be possible to have a single "display output register" into which you would write a single word of data containing the X and Y coordinates as well as the RGB value for the pixel you want to set. For a 1024 x 512 display with a 12-bit color depth, 31 bits would suffice to specify all this. The data 'written' into that register would either be sent to a display adapter or sent directly to the display and decoded there. This would save over half a megabyte of memory while still retaining the memory-mapped model.

So is this actually a thing or not?

$\endgroup$
  • $\begingroup$ and what's wrong with a 1024x512 texture that gets blitted to the display buffer by the hardware? $\endgroup$ – ratchet freak Oct 21 '15 at 16:03
  • $\begingroup$ Nothing is inherently wrong with that, but what about smaller operations like outputting a single character? Also some smaller systems might not have a GPU, etc. $\endgroup$ – Cyber99 Oct 21 '15 at 16:16
  • 4
    $\begingroup$ This used to be a thing in VGA days. 0xA0000 anyone? $\endgroup$ – Nathan Reed Oct 21 '15 at 16:59
  • $\begingroup$ 1024 x 512 x 4 bytes = 2MB. Peanuts in a 2GB address space. $\endgroup$ – Yves Daoust Oct 23 '15 at 13:37
2
$\begingroup$

In your 31 bit solution, the thing most likely to happen there is that you'd give an extra bit to green and make a 32 bit solution. In 16 bit color for instance, r and b get 5 bits while g gets 6 bits, because your eye can distinguish more greens.

Or maybe you'd use that extra bit to have 1 bit alpha? Not sure if that'd be very useful though...

As far as the rest, whether you have a gpu or not, writing to single pixels at a time is bad form.

Instead, you ideally want to do block operations that either fill or copy large strips of memory.

For some things, like alpha blending, that isn't able to be done as a block operation very easily so is a more expensive operation in general.

As a solution to this, modern computers have a processor that is closer to the video memory, so there isn't too much latency when pushing pixels back and forth across the main bus to do things like calculate alpha blended values involving the source and destination pixel.

Also, instead of fewer more powerful cores, there are many less powerful cores, which helps address the situation of needing "one off" pixel operations.

That processor I'm referring to is the gpu and the programs you write for it are called shaders (;

What you are asking about doesn't exist to my knowledge and seems like a bad usage pattern, so seems unlikely to exist IMO.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.