mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
fbdev: expand to allow more bpps
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@904 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
9f6bb3c76b
commit
fcd1cdf727
2 changed files with 12 additions and 16 deletions
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
#include "fbdev.h"
|
#include "fbdev.h"
|
||||||
|
|
||||||
#define FBDEV_MAX_BUFFERS 3
|
|
||||||
|
|
||||||
struct vout_fbdev {
|
struct vout_fbdev {
|
||||||
int fd;
|
int fd;
|
||||||
void *mem;
|
void *mem;
|
||||||
|
@ -60,8 +58,8 @@ void vout_fbdev_wait_vsync(struct vout_fbdev *fbdev)
|
||||||
ioctl(fbdev->fd, FBIO_WAITFORVSYNC, &arg);
|
ioctl(fbdev->fd, FBIO_WAITFORVSYNC, &arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int vout_fbdev_resize(struct vout_fbdev *fbdev, int w, int h,
|
int vout_fbdev_resize(struct vout_fbdev *fbdev, int w, int h, int bpp,
|
||||||
int left_border, int right_border, int top_border, int bottom_border, int no_dblbuf)
|
int left_border, int right_border, int top_border, int bottom_border, int buffer_cnt)
|
||||||
{
|
{
|
||||||
int w_total = left_border + w + right_border;
|
int w_total = left_border + w + right_border;
|
||||||
int h_total = top_border + h + bottom_border;
|
int h_total = top_border + h + bottom_border;
|
||||||
|
@ -71,7 +69,7 @@ int vout_fbdev_resize(struct vout_fbdev *fbdev, int w, int h,
|
||||||
// unblank to be sure the mode is really accepted
|
// unblank to be sure the mode is really accepted
|
||||||
ioctl(fbdev->fd, FBIOBLANK, FB_BLANK_UNBLANK);
|
ioctl(fbdev->fd, FBIOBLANK, FB_BLANK_UNBLANK);
|
||||||
|
|
||||||
if (fbdev->fbvar_new.bits_per_pixel != 16 ||
|
if (fbdev->fbvar_new.bits_per_pixel != bpp ||
|
||||||
w != fbdev->fbvar_new.xres ||
|
w != fbdev->fbvar_new.xres ||
|
||||||
h != fbdev->fbvar_new.yres ||
|
h != fbdev->fbvar_new.yres ||
|
||||||
w_total != fbdev->fbvar_new.xres_virtual ||
|
w_total != fbdev->fbvar_new.xres_virtual ||
|
||||||
|
@ -82,8 +80,8 @@ int vout_fbdev_resize(struct vout_fbdev *fbdev, int w, int h,
|
||||||
fbdev->fbvar_new.xres_virtual = w_total;
|
fbdev->fbvar_new.xres_virtual = w_total;
|
||||||
fbdev->fbvar_new.yres_virtual = h_total;
|
fbdev->fbvar_new.yres_virtual = h_total;
|
||||||
fbdev->fbvar_new.xoffset = left_border;
|
fbdev->fbvar_new.xoffset = left_border;
|
||||||
fbdev->fbvar_new.bits_per_pixel = 16;
|
fbdev->fbvar_new.bits_per_pixel = bpp;
|
||||||
printf(" switching to %dx%d@16\n", w, h);
|
printf(" switching to %dx%d@%d\n", w, h, bpp);
|
||||||
ret = ioctl(fbdev->fd, FBIOPUT_VSCREENINFO, &fbdev->fbvar_new);
|
ret = ioctl(fbdev->fd, FBIOPUT_VSCREENINFO, &fbdev->fbvar_new);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
perror("FBIOPUT_VSCREENINFO ioctl");
|
perror("FBIOPUT_VSCREENINFO ioctl");
|
||||||
|
@ -91,9 +89,7 @@ int vout_fbdev_resize(struct vout_fbdev *fbdev, int w, int h,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fbdev->buffer_count = FBDEV_MAX_BUFFERS; // be optimistic
|
fbdev->buffer_count = buffer_cnt;
|
||||||
if (no_dblbuf)
|
|
||||||
fbdev->buffer_count = 1;
|
|
||||||
|
|
||||||
if (fbdev->fbvar_new.yres_virtual < h_total * fbdev->buffer_count) {
|
if (fbdev->fbvar_new.yres_virtual < h_total * fbdev->buffer_count) {
|
||||||
fbdev->fbvar_new.yres_virtual = h_total * fbdev->buffer_count;
|
fbdev->fbvar_new.yres_virtual = h_total * fbdev->buffer_count;
|
||||||
|
@ -105,7 +101,7 @@ int vout_fbdev_resize(struct vout_fbdev *fbdev, int w, int h,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fbdev->fb_size = w_total * h_total * 2;
|
fbdev->fb_size = w_total * h_total * bpp / 8;
|
||||||
fbdev->top_border = top_border;
|
fbdev->top_border = top_border;
|
||||||
fbdev->bottom_border = bottom_border;
|
fbdev->bottom_border = bottom_border;
|
||||||
|
|
||||||
|
@ -157,7 +153,7 @@ int vout_fbdev_get_fd(struct vout_fbdev *fbdev)
|
||||||
return fbdev->fd;
|
return fbdev->fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct vout_fbdev *vout_fbdev_init(const char *fbdev_name, int *w, int *h, int no_dblbuf)
|
struct vout_fbdev *vout_fbdev_init(const char *fbdev_name, int *w, int *h, int bpp, int buffer_cnt)
|
||||||
{
|
{
|
||||||
struct vout_fbdev *fbdev;
|
struct vout_fbdev *fbdev;
|
||||||
int req_w, req_h;
|
int req_w, req_h;
|
||||||
|
@ -189,7 +185,7 @@ struct vout_fbdev *vout_fbdev_init(const char *fbdev_name, int *w, int *h, int n
|
||||||
if (*h != 0)
|
if (*h != 0)
|
||||||
req_h = *h;
|
req_h = *h;
|
||||||
|
|
||||||
ret = vout_fbdev_resize(fbdev, req_w, req_h, 0, 0, 0, 0, no_dblbuf);
|
ret = vout_fbdev_resize(fbdev, req_w, req_h, bpp, 0, 0, 0, 0, buffer_cnt);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
struct vout_fbdev;
|
struct vout_fbdev;
|
||||||
|
|
||||||
struct vout_fbdev *vout_fbdev_init(const char *fbdev_name, int *w, int *h, int no_dblbuf);
|
struct vout_fbdev *vout_fbdev_init(const char *fbdev_name, int *w, int *h, int bpp, int buffer_count);
|
||||||
void *vout_fbdev_flip(struct vout_fbdev *fbdev);
|
void *vout_fbdev_flip(struct vout_fbdev *fbdev);
|
||||||
void vout_fbdev_wait_vsync(struct vout_fbdev *fbdev);
|
void vout_fbdev_wait_vsync(struct vout_fbdev *fbdev);
|
||||||
int vout_fbdev_resize(struct vout_fbdev *fbdev, int w, int h,
|
int vout_fbdev_resize(struct vout_fbdev *fbdev, int w, int h, int bpp,
|
||||||
int left_border, int right_border, int top_border, int bottom_border,
|
int left_border, int right_border, int top_border, int bottom_border,
|
||||||
int no_dblbuf);
|
int buffer_count);
|
||||||
void vout_fbdev_clear(struct vout_fbdev *fbdev);
|
void vout_fbdev_clear(struct vout_fbdev *fbdev);
|
||||||
void vout_fbdev_clear_lines(struct vout_fbdev *fbdev, int y, int count);
|
void vout_fbdev_clear_lines(struct vout_fbdev *fbdev, int y, int count);
|
||||||
int vout_fbdev_get_fd(struct vout_fbdev *fbdev);
|
int vout_fbdev_get_fd(struct vout_fbdev *fbdev);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue