Hello,
I have read the documentation where it is said that the BT817 chip is not using a frame buffer, but rather computing each pixel value from items in RAM_DL every time it sends RGB values to the attached LCD.
This gave me the idea to create a display list with the coprocessor, wait for it to have done its job, and then change VERTEX2F values directly into RAM_DL to achieve some nice animation effects without having to resend the entire display list.
So now, in my application, I start with the "main" display list that looks like this:
CMD_DLSTART
CLEAR_COLOR_RGB(255,255,255)
CLEAR(1, 1, 1)
COLOR_RGB(0, 0, 0)
CMD_TEXT(100, 100, 29, 0, "Welcome")
DL_DISPLAY
CMD_SWAP
Then after the user has interacted properly with the device, I start a new display list:
CMD_DLSTART
CLEAR_COLOR_RGB(0,0,0)
CLEAR(1, 1, 1)
VERTEX_FORMAT(0)
COLOR_RGB(255, 255, 255)
CMD_TEXT(400, 200, 24, OPT_CENTER, "Star field")
POINT_SIZE(32)
BEGIN(POINTS)
VERTEX2F(150,200);
VERTEX2F(450,380);
VERTEX2F(500,20);
VERTEX2F(400,250);
VERTEX2F(50,300);
VERTEX2F(600,400);
END
DISPLAY
CMD_SWAP
With this, I get a nicely written text with a 6 points, all white on a black background, as expected.
After having waited for the co processor to do its, I now use host memory read to look for 0x1F000002 starting at RAM_DL as this would be the location of the BEGIN(POINTS) command. Then I add another 4 bytes to skip the actual command and this gives me an address not too far from 0x300000
Now that I have the address for the first of the six points, I replace the values at those RAM locations at regular intervals with new VERTEX2F commands so as to make the points move.
But to my great dismay, this does not have any effect on the image rendered on the LCD.
I went back to the programming guide which mentions the REG_DLSWAP register which is to be used to signal that a new frame should be taken into account.
So I tried waiting for it to become 0, then write 2 (or even 1) inside it like in this "pseudo" code:
for (int stepIndex = 0; stepIndex < 100; stepIndex++)
{
usleep(50 * 1000);
while (EVE_memRead32(REG_DLSWAP) != EVE_DLSWAP_DONE);
for (int starIndex = 0 ; starIndex < starsCount; starIndex++)
{
stars[starIndex].X += stars[starIndex].deltaX;
stars[starIndex].Y += stars[starIndex].deltaY;
EVE_memWrite32(starsRAMAddress + starIndex * sizeof(int32_t), VERTEX2F(stars[starIndex].X, stars[starIndex].Y));
}
EVE_memWrite32(REG_DLSWAP, EVE_DLSWAP_FRAME);
}
But this did not have the expected effect as it made the previous display list come back, then the star field one, then the white one and so on, each being activated in turn for the duration of the loop step. As I wait for 50milliseconds at each step, this causes quite a bit of flickering.
I must have missed something here, but what?
I really thought I would be able to perform fast animation by direct RAM_DL manipulation, but right now, I'm quite stuck.
Thanks for any suggestion