Skip to content

Commit

Permalink
Clean-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
piranna committed Mar 21, 2020
1 parent 6161eb7 commit f884acc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
16 changes: 3 additions & 13 deletions src/backend/FBDevBackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ cairo_format_t bits2format(__u32 bits_per_pixel)
FBDevBackend::FBDevBackend(int width, int height, string deviceName,
bool useDoubleBuffer, bool enableFlipPages)
: ScreenBackend("fbdev", width, height)
, fb_data(NULL)
, back_buffer(NULL)
, useDoubleBuffer(useDoubleBuffer)
, useInMemoryBackBuffer(false)
, useFlipPages(false)
, enableFlipPages(enableFlipPages)
{
struct fb_var_screeninfo fb_vinfo;
Expand All @@ -55,11 +51,7 @@ FBDevBackend::FBDevBackend(int width, int height, string deviceName,
FBDevBackend::FBDevBackend(string deviceName, bool useDoubleBuffer,
bool enableFlipPages)
: ScreenBackend("fbdev")
, fb_data(NULL)
, back_buffer(NULL)
, useDoubleBuffer(useDoubleBuffer)
, useInMemoryBackBuffer(false)
, useFlipPages(false)
, enableFlipPages(enableFlipPages)
{
struct fb_var_screeninfo fb_vinfo;
Expand Down Expand Up @@ -123,9 +115,7 @@ void FBDevBackend::createSurface()
// Check support for double buffering features
if(useDoubleBuffer || fb_vinfo.bits_per_pixel == 24)
{
useFlipPages = false;

// Try to use page flipping inside graphic card memory. If FbDev driver
// Try to use real double buffer inside graphic card memory. If FbDev driver
// don't support to have a virtual framebuffer bigger than the actual one,
// then we'll use a buffer in memory. It's not so efficient and could lead
// to some tearing, but with VSync this should be minimal and at least we'll
Expand All @@ -149,6 +139,8 @@ void FBDevBackend::createSurface()

useFlipPages = ioctl(this->fb_fd, FBIOPAN_DISPLAY, &fb_vinfo) == 0;
}
else
useFlipPages = false;
}

// Map the device to memory with new virtual framebuffer dimensions and config
Expand Down Expand Up @@ -281,8 +273,6 @@ void FBDevBackend::copyBackBuffer(struct fb_var_screeninfo* fb_vinfo)
}
void FBDevBackend::flipPages(struct fb_var_screeninfo* fb_vinfo)
{
if(!this->surface) return;

// Update display panning
fb_vinfo->yoffset = fb_vinfo->yoffset ? 0 : fb_vinfo->yres;

Expand Down
8 changes: 4 additions & 4 deletions src/backend/FBDevBackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class FBDevBackend : public ScreenBackend
private:
int fb_fd;
struct fb_fix_screeninfo fb_finfo;
unsigned char* fb_data;
unsigned char* fb_data = NULL;
unsigned char* front_buffer;
unsigned char* back_buffer;
unsigned char* back_buffer = NULL;
bool useDoubleBuffer;
bool useInMemoryBackBuffer;
bool useFlipPages;
bool useInMemoryBackBuffer = false;
bool useFlipPages = false;
bool enableFlipPages;

~FBDevBackend();
Expand Down

0 comments on commit f884acc

Please sign in to comment.