Ejemplo n.º 1
0
static int
vopen( video_desc_t *vm )
{
	XDGADevice *dev;
	int mask;
	
	if( dga.is_open )
		return 1;

	if( !XDGAOpenFramebuffer( x11.disp, x11.screen ) ) {
		printm("XDGAOpenFramebuffer failed\n");
		return 1;
	}
	if( !(dev=XDGASetMode( x11.disp, x11.screen, (int)vm->module_data )) ) {
		printf("XDGASetMode failure\n");
		XDGACloseFramebuffer( x11.disp, x11.screen );
		return 1;
	}

	printm("%d x %d: %d (%08x/%x)\n", vm->w, vm->h, vm->depth, (int)dev->data, vm->rowbytes );
	vm->lvbase = (char *)dev->data;
	vm->mmu_flags = get_bool_res("use_fb_cache")? MAPPING_FORCE_CACHE : MAPPING_MACOS_CONTROLS_CACHE;
	vm->map_base = 0;
	XFree( dev );

	dga.is_open = 1;
	use_hw_cursor(0);

	mask = KeyPressMask | KeyReleaseMask;
	if( mouse_activate(1) )
		mask |= ButtonPressMask | ButtonReleaseMask | PointerMotionMask;

	XDGASelectInput( x11.disp, x11.screen, mask );
	return 0;
}
Ejemplo n.º 2
0
static int xf86_dga_vidmode_setup_mode_restore(void)
{
	Display *disp;
	int status;
	pid_t pid;

	pid = fork();
	if(pid > 0)
	{
		waitpid(pid,&status,0);
		disp = XOpenDisplay(NULL);
		XDGACloseFramebuffer(disp, xf86ctx.screen);
		XDGASetMode(disp, xf86ctx.screen, 0);
		XCloseDisplay(disp);
		_exit(!WIFEXITED(status));
	}

	if (pid < 0)
	{
		perror("fork");
		return 1;
	}

	return 0;
}
Ejemplo n.º 3
0
static void
vclose( void )
{
	if( !dga.is_open )
		return;

	dga.is_open = 0;

	mouse_activate(0);
	XDGASetMode( x11.disp, x11.screen, 0 );
	XDGACloseFramebuffer( x11.disp, x11.screen );
}
Ejemplo n.º 4
0
static void uninit(void)
{

#ifdef HAVE_DGA2
    XDGADevice *dgadevice;
#endif

    if (!vo_config_count)
        return;

    if (vo_dga_is_running)
    {
        vo_dga_is_running = 0;
        mp_msg(MSGT_VO, MSGL_V, "vo_dga: in uninit\n");
        if (vo_grabpointer)
            XUngrabPointer(mDisplay, CurrentTime);
        XUngrabKeyboard(mDisplay, CurrentTime);
#ifdef HAVE_DGA2
        XDGACloseFramebuffer(mDisplay, mScreen);
        dgadevice = XDGASetMode(mDisplay, mScreen, 0);
        if (dgadevice != NULL)
        {
            XFree(dgadevice);
        }
#else
        XF86DGADirectVideo(mDisplay, mScreen, 0);
        // first disable DirectVideo and then switch mode back!     
#ifdef HAVE_XF86VM
        if (vo_dga_vidmodes != NULL)
        {
            int screen;

            screen = XDefaultScreen(mDisplay);
            mp_msg(MSGT_VO, MSGL_V,
                   "vo_dga: VidModeExt: Switching back..\n");
            // seems some graphics adaptors need this more than once ...
            XF86VidModeSwitchToMode(mDisplay, screen, vo_dga_vidmodes[0]);
            XF86VidModeSwitchToMode(mDisplay, screen, vo_dga_vidmodes[0]);
            XF86VidModeSwitchToMode(mDisplay, screen, vo_dga_vidmodes[0]);
            XF86VidModeSwitchToMode(mDisplay, screen, vo_dga_vidmodes[0]);
            XFree(vo_dga_vidmodes);
        }
#endif
#endif
    }
    vo_x11_uninit();
}
Ejemplo n.º 5
0
/* _xdga2_gfxdrv_exit:
 *  Shuts down gfx driver.
 */
static void _xdga2_gfxdrv_exit(BITMAP *bmp)
{
   XLOCK();
   
   if (_xwin.in_dga_mode) {
      _xwin_input_handler = 0;
       
      XDGACloseFramebuffer(_xwin.display, _xwin.screen);
      XDGASetMode(_xwin.display, _xwin.screen, 0);
      _xwin.in_dga_mode = 0;

      if (_dga_cmap) {
         XFreeColormap(_xwin.display, _dga_cmap);
         _dga_cmap = 0;
      }

      XInstallColormap(_xwin.display, _xwin.colormap);

      set_display_switch_mode(SWITCH_BACKGROUND);
   }
   
   XUNLOCK();
}