CFbAccelCSHD2::setMode: Update for new framebuffer driver (full hd)

This commit is contained in:
M. Liebmann
2017-02-13 12:49:27 +01:00
parent 9497a3c43a
commit 33125aed06
2 changed files with 44 additions and 5 deletions

View File

@@ -185,21 +185,57 @@ void CFbAccelCSHD2::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_
CFrameBuffer::blitBox2FB(boxBuf, width, height, xoff, yoff);
}
int CFbAccelCSHD2::setMode(unsigned int, unsigned int, unsigned int)
int CFbAccelCSHD2::setMode(unsigned int nxRes, unsigned int nyRes, unsigned int nbpp)
{
if (!available&&!active)
return -1;
if (available >= 16588800) { /* new fb driver with maxres 1920x1080(*8) */
screeninfo.xres_virtual=screeninfo.xres=nxRes;
screeninfo.yres_virtual=screeninfo.yres=nyRes;
screeninfo.height=0;
screeninfo.width=0;
screeninfo.xoffset=screeninfo.yoffset=0;
screeninfo.bits_per_pixel=nbpp;
if (ioctl(fd, FBIOPUT_VSCREENINFO, &screeninfo)<0)
perror(LOGTAG "FBIOPUT_VSCREENINFO");
printf(LOGTAG "SetMode: %dbits, red %d:%d green %d:%d blue %d:%d transp %d:%d\n",
screeninfo.bits_per_pixel, screeninfo.red.length, screeninfo.red.offset, screeninfo.green.length, screeninfo.green.offset, screeninfo.blue.length, screeninfo.blue.offset, screeninfo.transp.length, screeninfo.transp.offset);
if ((screeninfo.xres != nxRes) ||
(screeninfo.yres != nyRes) ||
(screeninfo.bits_per_pixel != nbpp)) {
printf(LOGTAG "SetMode failed: wanted: %dx%dx%d, got %dx%dx%d\n",
nxRes, nyRes, nbpp,
screeninfo.xres, screeninfo.yres, screeninfo.bits_per_pixel);
return -1;
}
}
fb_fix_screeninfo _fix;
if (ioctl(fd, FBIOGET_FSCREENINFO, &_fix) < 0) {
perror("FBIOGET_FSCREENINFO");
perror(LOGTAG "FBIOGET_FSCREENINFO");
return -1;
}
stride = _fix.line_length;
if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0)
printf("screen unblanking failed\n");
printf(LOGTAG "screen unblanking failed\n");
xRes = screeninfo.xres;
yRes = screeninfo.yres;
bpp = screeninfo.bits_per_pixel;
printf(LOGTAG "%dx%dx%d line length %d. using hd2 graphics accelerator.\n", xRes, yRes, bpp, stride);
printf(LOGTAG "%dx%dx%d line length %d. using %s graphics accelerator.\n", xRes, yRes, bpp, stride, _fix.id);
/*
max res 1280x720
available 14745600
stride 5120
max res 1920x1080
available 16588800
stride 7680
*/
int needmem = stride * yRes * 2;
if (available >= needmem)
{

View File

@@ -1815,7 +1815,10 @@ void CNeutrinoApp::CmdParser(int argc, char **argv)
void CNeutrinoApp::SetupFrameBuffer()
{
frameBuffer->init();
if(frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t))) {
/* Parameters only valid for hd2 hardware and new fb drivers,
all other hardware ignores these parameters */
// if (frameBuffer->setMode(1280, 720, 8 * sizeof(fb_pixel_t)) == -1) {
if (frameBuffer->setMode(1920, 1080, 8 * sizeof(fb_pixel_t)) == -1) {
dprintf(DEBUG_NORMAL, "Error while setting framebuffer mode\n");
exit(-1);
}