mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
framebuffer-ng: move more hw specific stuff to fbaccel
setMode (not really the right name) is also hardware specific, so move it into fbaccel, too.
This commit is contained in:
@@ -66,6 +66,11 @@ extern GLFramebuffer *glfb;
|
||||
#define NEED_BLIT_THREAD 1
|
||||
#endif
|
||||
|
||||
/* note that it is *not* enough to just change those values */
|
||||
#define DEFAULT_XRES 1280
|
||||
#define DEFAULT_YRES 720
|
||||
#define DEFAULT_BPP 32
|
||||
|
||||
//#undef USE_NEVIS_GXA //FIXME
|
||||
/*******************************************************************************/
|
||||
#ifdef USE_NEVIS_GXA
|
||||
@@ -989,3 +994,79 @@ bool CFbAccel::init(void)
|
||||
fb->lfb = lfb;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* wrong name... */
|
||||
int CFbAccel::setMode(void)
|
||||
{
|
||||
int fd = fb->fd;
|
||||
t_fb_var_screeninfo *si = &fb->screeninfo;
|
||||
#if HAVE_AZBOX_HARDWARE
|
||||
// set auto blit if AZBOX_KERNEL_BLIT environment variable is set
|
||||
unsigned char tmp = getenv("AZBOX_KERNEL_BLIT") ? 0 : 1;
|
||||
if (ioctl(fd, FBIO_SET_MANUAL_BLIT, &tmp) < 0)
|
||||
perror("FBIO_SET_MANUAL_BLIT");
|
||||
|
||||
const unsigned int nxRes = DEFAULT_XRES;
|
||||
const unsigned int nyRes = DEFAULT_YRES;
|
||||
const unsigned int nbpp = DEFAULT_BPP;
|
||||
si->xres_virtual = si->xres = nxRes;
|
||||
si->yres_virtual = (si->yres = nyRes) * 2;
|
||||
si->height = 0;
|
||||
si->width = 0;
|
||||
si->xoffset = si->yoffset = 0;
|
||||
si->bits_per_pixel = nbpp;
|
||||
|
||||
si->transp.offset = 24;
|
||||
si->transp.length = 8;
|
||||
si->red.offset = 16;
|
||||
si->red.length = 8;
|
||||
si->green.offset = 8;
|
||||
si->green.length = 8;
|
||||
si->blue.offset = 0;
|
||||
si->blue.length = 8;
|
||||
|
||||
if (ioctl(fd, FBIOPUT_VSCREENINFO, si) < 0) {
|
||||
// try single buffering
|
||||
si->yres_virtual = si->yres = nyRes;
|
||||
if (ioctl(fd, FBIOPUT_VSCREENINFO, si) < 0)
|
||||
perror("FBIOPUT_VSCREENINFO");
|
||||
printf("FB: double buffering not available.\n");
|
||||
}
|
||||
else
|
||||
printf("FB: double buffering available!\n");
|
||||
|
||||
ioctl(fd, FBIOGET_VSCREENINFO, si);
|
||||
|
||||
if (si->xres != nxRes || si->yres != nyRes || si->bits_per_pixel != nbpp)
|
||||
{
|
||||
printf("SetMode failed: wanted: %dx%dx%d, got %dx%dx%d\n",
|
||||
nxRes, nyRes, nbpp,
|
||||
si->xres, si->yres, si->bits_per_pixel);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
/* it's all fake... :-) */
|
||||
si->xres = si->xres_virtual = DEFAULT_XRES;
|
||||
si->yres = si->yres_virtual = DEFAULT_YRES;
|
||||
si->bits_per_pixel = DEFAULT_BPP;
|
||||
fb->stride = si->xres * si->bits_per_pixel / 8;
|
||||
#else
|
||||
#ifndef USE_OPENGL
|
||||
fb_fix_screeninfo _fix;
|
||||
|
||||
if (ioctl(fd, FBIOGET_FSCREENINFO, &_fix) < 0) {
|
||||
perror("FBIOGET_FSCREENINFO");
|
||||
return -1;
|
||||
}
|
||||
fb->stride = _fix.line_length;
|
||||
#endif
|
||||
#endif
|
||||
#if HAVE_COOL_HARDWARE
|
||||
if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0)
|
||||
printf("screen unblanking failed\n");
|
||||
#endif
|
||||
/* avoid compiler warnings on various platforms */
|
||||
(void) fd;
|
||||
(void) si;
|
||||
return 0;
|
||||
}
|
||||
|
@@ -63,6 +63,7 @@ class CFbAccel
|
||||
CFbAccel(CFrameBuffer *fb);
|
||||
~CFbAccel();
|
||||
bool init(void);
|
||||
int setMode(void);
|
||||
void paintPixel(int x, int y, const fb_pixel_t col);
|
||||
void paintRect(const int x, const int y, const int dx, const int dy, const fb_pixel_t col);
|
||||
void paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col);
|
||||
|
@@ -39,11 +39,6 @@
|
||||
|
||||
#include <linux/kd.h>
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
#include <glfb.h>
|
||||
extern GLFramebuffer *glfb;
|
||||
#endif
|
||||
|
||||
#include <gui/audiomute.h>
|
||||
#include <gui/color.h>
|
||||
#include <gui/pictureviewer.h>
|
||||
@@ -365,71 +360,7 @@ fprintf(stderr, "CFrameBuffer::setMode avail: %d active: %d\n", available, activ
|
||||
if (!available&&!active)
|
||||
return -1;
|
||||
|
||||
#if HAVE_AZBOX_HARDWARE
|
||||
#ifndef FBIO_BLIT
|
||||
#define FBIO_SET_MANUAL_BLIT _IOW('F', 0x21, __u8)
|
||||
#define FBIO_BLIT 0x22
|
||||
#endif
|
||||
// set auto blit if AZBOX_KERNEL_BLIT environment variable is set
|
||||
unsigned char tmp = getenv("AZBOX_KERNEL_BLIT") ? 0 : 1;
|
||||
if (ioctl(fd, FBIO_SET_MANUAL_BLIT, &tmp)<0)
|
||||
perror("FBIO_SET_MANUAL_BLIT");
|
||||
|
||||
const unsigned int nxRes = DEFAULT_XRES;
|
||||
const unsigned int nyRes = DEFAULT_YRES;
|
||||
const unsigned int nbpp = DEFAULT_BPP;
|
||||
screeninfo.xres_virtual = screeninfo.xres = nxRes;
|
||||
screeninfo.yres_virtual = (screeninfo.yres = nyRes) * 2;
|
||||
screeninfo.height = 0;
|
||||
screeninfo.width = 0;
|
||||
screeninfo.xoffset = screeninfo.yoffset = 0;
|
||||
screeninfo.bits_per_pixel = nbpp;
|
||||
|
||||
screeninfo.transp.offset = 24;
|
||||
screeninfo.transp.length = 8;
|
||||
screeninfo.red.offset = 16;
|
||||
screeninfo.red.length = 8;
|
||||
screeninfo.green.offset = 8;
|
||||
screeninfo.green.length = 8;
|
||||
screeninfo.blue.offset = 0;
|
||||
screeninfo.blue.length = 8;
|
||||
|
||||
if (ioctl(fd, FBIOPUT_VSCREENINFO, &screeninfo)<0) {
|
||||
// try single buffering
|
||||
screeninfo.yres_virtual = screeninfo.yres = nyRes;
|
||||
if (ioctl(fd, FBIOPUT_VSCREENINFO, &screeninfo) < 0)
|
||||
perror("FBIOPUT_VSCREENINFO");
|
||||
printf("FB: double buffering not available.\n");
|
||||
}
|
||||
else
|
||||
printf("FB: double buffering available!\n");
|
||||
|
||||
ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo);
|
||||
|
||||
if ((screeninfo.xres!=nxRes) && (screeninfo.yres!=nyRes) && (screeninfo.bits_per_pixel!=nbpp))
|
||||
{
|
||||
printf("SetMode failed: wanted: %dx%dx%d, got %dx%dx%d\n",
|
||||
nxRes, nyRes, nbpp,
|
||||
screeninfo.xres, screeninfo.yres, screeninfo.bits_per_pixel);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
/* it's all fake... :-) */
|
||||
screeninfo.xres = screeninfo.xres_virtual = DEFAULT_XRES;
|
||||
screeninfo.yres = screeninfo.yres_virtual = DEFAULT_YRES;
|
||||
screeninfo.bits_per_pixel = DEFAULT_BPP;
|
||||
stride = screeninfo.xres * screeninfo.bits_per_pixel / 8;
|
||||
#else
|
||||
#ifndef USE_OPENGL
|
||||
fb_fix_screeninfo _fix;
|
||||
|
||||
if (ioctl(fd, FBIOGET_FSCREENINFO, &_fix)<0) {
|
||||
perror("FBIOGET_FSCREENINFO");
|
||||
return -1;
|
||||
}
|
||||
stride = _fix.line_length;
|
||||
#endif
|
||||
#endif
|
||||
int ret = accel->setMode();
|
||||
xRes = screeninfo.xres;
|
||||
yRes = screeninfo.yres;
|
||||
bpp = screeninfo.bits_per_pixel;
|
||||
@@ -444,12 +375,7 @@ fprintf(stderr, "CFrameBuffer::setMode avail: %d active: %d\n", available, activ
|
||||
|
||||
//memset(getFrameBufferPointer(), 0, stride * yRes);
|
||||
paintBackground();
|
||||
#if HAVE_COOL_HARDWARE
|
||||
if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0) {
|
||||
printf("screen unblanking failed\n");
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
#if 0
|
||||
//never used
|
||||
|
Reference in New Issue
Block a user