static int query_format(uint32_t format)
{
	// open the device, etc.
	if (fb_preinit(0)) return 0;
	if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR) {
		int fb_target_bpp = format & 0xff;
		set_bpp(&fb_vinfo, fb_target_bpp);
		fb_vinfo.xres_virtual = fb_vinfo.xres;
		fb_vinfo.yres_virtual = fb_vinfo.yres;
		if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo))
			// Needed for Intel framebuffer with 32 bpp
			fb_vinfo.transp.length = fb_vinfo.transp.offset = 0;
		if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo)) {
			mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't put VSCREENINFO: %s\n", strerror(errno));
			return 0;
		}
		fb_pixel_size = fb_vinfo.bits_per_pixel / 8;
		fb_bpp = fb_vinfo.bits_per_pixel;
		if (fb_bpp == 16)
			fb_bpp = fb_vinfo.red.length + fb_vinfo.green.length + fb_vinfo.blue.length;
		if (fb_bpp == fb_target_bpp)
			return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_ACCEPT_STRIDE;
	}
	return 0;
}
Example #2
0
static void uninit(void)
{
    if (fb_cmap_changed) {
        if (ioctl(fb_dev_fd, FBIOPUTCMAP, &fb_oldcmap))
            mp_msg(MSGT_VO, MSGL_WARN, "Can't restore original cmap\n");
        fb_cmap_changed = 0;
    }
    if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo))
        mp_msg(MSGT_VO, MSGL_WARN, "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno));
    fb_orig_vinfo.xoffset = fb_vinfo.xoffset;
    fb_orig_vinfo.yoffset = fb_vinfo.yoffset;
    if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo))
        mp_msg(MSGT_VO, MSGL_WARN, "Can't reset original fb_var_screeninfo: %s\n", strerror(errno));
    if (fb_tty_fd >= 0) {
        if (ioctl(fb_tty_fd, KDSETMODE, KD_TEXT) < 0)
            mp_msg(MSGT_VO, MSGL_WARN, "Can't restore text mode: %s\n", strerror(errno));
    }
    vt_set_textarea(0, fb_orig_vinfo.yres);
    close(fb_tty_fd);
    close(fb_dev_fd);
    if (frame_buffer)
        munmap(frame_buffer, fb_size);
    frame_buffer = NULL;
    fb_preinit(1);
}
Example #3
0
static int preinit(const char *vo_subdevice)
{
  pre_init_err = 0;

  if (!pre_init_err)
    return pre_init_err = (fb_preinit(0) ? 0 : -1);
  return -1;
}
Example #4
0
static int preinit(const char *subdevice)
{
	if (subdevice)
	{
	    if (fb_dev_name) free(fb_dev_name);
	    fb_dev_name = strdup(subdevice);
	}
	return fb_preinit(0);
}
Example #5
0
static int query_format(uint32_t format)
{
  if (!fb_preinit(0))
    return 0;

  if (format != IMGFMT_YUY2)
    return 0;

  return VFCAP_ACCEPT_STRIDE | VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
}
Example #6
0
static int query_format(uint32_t format)
{
    if (!fb_preinit(0))
        return 0;
    if ((format & IMGFMT_BGR_MASK) == (fb_rgb ? IMGFMT_RGB : IMGFMT_BGR)) {
        int bpp = format & 0xff;

        if (bpp == fb_bpp)
            return VFCAP_ACCEPT_STRIDE | VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
    }
    return 0;
}
Example #7
0
static int preinit(const char *vo_subdevice)
{
    pre_init_err = 0;

    if (vo_subdevice) {
        {
            free(fb_dev_name);
            fb_dev_name = strdup(vo_subdevice);
        }
    }
    if (!pre_init_err)
        return pre_init_err = fb_preinit(0) ? 0 : -1;
    return -1;
}
Example #8
0
static void uninit(void)
{
	if (fb_cmap_changed) {
		if (ioctl(fb_dev_fd, FBIOPUTCMAP, &fb_oldcmap))
			mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't restore original cmap\n");
		fb_cmap_changed = 0;
	}
	if(next_frame) free(next_frame);
	if (fb_dev_fd >= 0) {
		if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo))
			mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't reset original fb_var_screeninfo: %s\n", strerror(errno));
		close(fb_dev_fd);
		fb_dev_fd = -1;
	}
	if(frame_buffer) munmap(frame_buffer, fb_size);
	next_frame = frame_buffer = NULL;
	fb_preinit(1); // so that later calls to preinit don't fail
}
Example #9
0
static int query_format(uint32_t format)
{
	// open the device, etc.
	if (fb_preinit(0)) return 0;
	// At least IntelFB silently ignores nonstd value,
	// so we can run the ioctl check only if already
	// determined we are running on OMAPFB
	if (fb_omap && (format == IMGFMT_YUY2 ||
	                format == IMGFMT_UYVY)) {
		fb_vinfo.xres_virtual = fb_vinfo.xres;
		fb_vinfo.yres_virtual = fb_vinfo.yres;
		fb_vinfo.nonstd = format == IMGFMT_YUY2 ? 8 : 1;
		if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo) == 0)
			return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_ACCEPT_STRIDE;
		return 0;
	}
	if (IMGFMT_IS_BGR(format)) {
		int bpp;
		int fb_target_bpp = format & 0xff;
		set_bpp(&fb_vinfo, fb_target_bpp);
		fb_vinfo.xres_virtual = fb_vinfo.xres;
		fb_vinfo.yres_virtual = fb_vinfo.yres;
		fb_vinfo.nonstd = 0;
		if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo))
			// Needed for Intel framebuffer with 32 bpp
			fb_vinfo.transp.length = fb_vinfo.transp.offset = 0;
		if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo)) {
			mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't put VSCREENINFO: %s\n", strerror(errno));
			return 0;
		}
		bpp = fb_vinfo.bits_per_pixel;
		if (bpp == 16)
			bpp = fb_vinfo.red.length + fb_vinfo.green.length + fb_vinfo.blue.length;
		if (bpp == fb_target_bpp)
			return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_ACCEPT_STRIDE;
	}
	return 0;
}