Skip to content

Allow framebuffers larger than virtual resolution #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions internal/fb/fb.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ func (d *Device) Image() (draw.Image, error) {
// The Linux efifb driver typically defaults to 32 bpp.

virtual := image.Rect(0, 0, int(vinfo.Xres_virtual), int(vinfo.Yres_virtual))
if virtual.Dx()*virtual.Dy()*4 != len(d.mmap) {
return nil, errors.New("virtual resolution doesn't match framebuffer size")
if virtual.Dx()*virtual.Dy()*4 > len(d.mmap) {
return nil, errors.New("framebuffer is too small")
}
visual := image.Rect(int(vinfo.Xoffset), int(vinfo.Yoffset), int(vinfo.Xres), int(vinfo.Yres))
if !visual.In(virtual) {
Expand All @@ -108,8 +108,8 @@ func (d *Device) Image() (draw.Image, error) {
// Blue:{Offset:0 Length:5 Right:0} Transp:{Offset:0 Length:0 Right:0} Nonstd:0 Activate:0 Height:290 Width:520 Accel_flags:1 Pixclock:0 Left_margin:0 Right_margin:0 Upper_margin:0 Lower_margin:0 Hsync_len:0 Vsync_len:0 Sync:0 Vmode:0 Rotate:0 Colorspace:0 Reserved:[0 0 0 0]}

virtual := image.Rect(0, 0, int(vinfo.Xres_virtual), int(vinfo.Yres_virtual))
if virtual.Dx()*virtual.Dy()*2 != len(d.mmap) {
return nil, errors.New("virtual resolution doesn't match framebuffer size")
if virtual.Dx()*virtual.Dy()*2 > len(d.mmap) {
return nil, errors.New("framebuffer is too small")
}
visual := image.Rect(int(vinfo.Xoffset), int(vinfo.Yoffset), int(vinfo.Xres), int(vinfo.Yres))
if !visual.In(virtual) {
Expand Down
Loading