Skip to content

Commit

Permalink
More PB fb setup trickery (#793)
Browse files Browse the repository at this point in the history
Should properly handle 600x800 devices, like in
koreader/koreader#4476
  • Loading branch information
NiLuJe committed Jan 13, 2019
1 parent 4b05da6 commit 95da0ed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ffi/framebuffer_linux.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ function framebuffer:init()
-- Make sure xres_virtual is aligned to 8-bytes
local xres_virtual = vinfo.xres_virtual
vinfo.xres_virtual = bit.band(vinfo.xres_virtual + 7, bit.bnot(7))
-- If it's already aligned, we're probably good, but if it's not, make sure we added at least 8px...
if xres_virtual ~= vinfo.xres_virtual then
-- If it's already aligned, we're probably good (unless we still match xres), but if it's not, make sure we added at least 8px...
if xres_virtual ~= vinfo.xres_virtual or vinfo.xres_virtual == vinfo.xres then
if (vinfo.xres_virtual - xres_virtual) < 8 then
-- Align to 16-bytes instead to get that extra scratch space...
vinfo.xres_virtual = bit.band(xres_virtual + 15, bit.bnot(15))
Expand All @@ -136,6 +136,7 @@ function framebuffer:init()
finfo.line_length = bit.band(finfo.line_length + (vinfo.bits_per_pixel - 1), bit.bnot(vinfo.bits_per_pixel - 1))
-- Much like the other branch,
-- if it's already aligned, we're probably good, but if it's not, make sure we added at least 8px...
-- NOTE: This unfortunately *might* not cover every case (c.f., the extra xres_virtual == xres check in the previous branch)?
if line_length ~= finfo.line_length then
-- Again, 8px * bpp / 8 == bpp ;).
if (finfo.line_length - line_length) < vinfo.bits_per_pixel then
Expand Down

0 comments on commit 95da0ed

Please sign in to comment.