diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-08-17 17:07:23 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-08-19 01:56:51 +0200 |
commit | 1f60ac234b20b2eb7bc2b4b2cee8519aea6297ec (patch) | |
tree | ea4fa86439fe64e654088108ed5897f7df443405 | |
parent | 4b6c5d0d72be26eeb340f25d0286d5e9561f85fa (diff) |
Update fixed screen info after changing format or resolution
The line length field can change after changing the format or the
resolution. Re-read fixed screen info from the device.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | fbdev.c | 39 |
1 files changed, 28 insertions, 11 deletions
@@ -316,6 +316,25 @@ static void fb_unmap_memory(struct device *dev) * Open/close */ +static int fb_update_info(struct device *dev) +{ + int ret; + + ret = ioctl(dev->fd, FBIOGET_FSCREENINFO, &dev->fix_info); + if (ret < 0) { + printf("Error updating fixed screen info.\n"); + return ret; + } + + ret = ioctl(dev->fd, FBIOGET_VSCREENINFO, &dev->var_info); + if (ret < 0) { + printf("Error updating variable screen info.\n"); + return ret; + } + + return 0; +} + /* * fb_open - Open a frame buffer device * @dev: FB device @@ -338,18 +357,10 @@ static int fb_open(struct device *dev, const char *devname) return dev->fd; } - ret = ioctl(dev->fd, FBIOGET_FSCREENINFO, &dev->fix_info); - if (ret < 0) { - printf("Error opening device %s: unable to get fixed screen " - "info.\n", devname); - close(dev->fd); - return ret; - } - - ret = ioctl(dev->fd, FBIOGET_VSCREENINFO, &dev->var_info); + ret = fb_update_info(dev); if (ret < 0) { - printf("Error opening device %s: unable to get variable screen " - "info.\n", devname); + printf("Error opening device %s: unable to get screen info.\n", + devname); close(dev->fd); return ret; } @@ -497,6 +508,9 @@ static int fb_set_format(struct device *dev, unsigned int bpp) fb_print_var(dev, &var_info); + /* Fixed screen information might have changed, re-read it. */ + fb_update_info(dev); + return 0; } @@ -552,6 +566,9 @@ static int fb_set_resolution(struct device *dev, int xres, int yres, fb_print_var(dev, &var_info); + /* Fixed screen information might have changed, re-read it. */ + fb_update_info(dev); + return 0; } |