Esempio n. 1
0
/*! Init primary accelerant */
status_t
radeon_init_accelerant(int device)
{
	TRACE("%s enter\n", __func__);

	status_t status = init_common(device, false);
	if (status != B_OK)
		return status;

	radeon_shared_info &info = *gInfo->shared_info;

	init_lock(&info.accelerant_lock, "radeon hd accelerant");
	init_lock(&info.engine_lock, "radeon hd engine");

	radeon_init_bios(gInfo->rom);

	// disable spread spectrum as it requires lots of extra calculations
	radeon_gpu_ss_disable();

	// find GPIO pins from AtomBIOS
	gpio_probe();

	// find physical card connectors from AtomBIOS
	status = connector_probe();

	if (status != B_OK) {
		TRACE("%s: falling back to legacy connector probe.\n", __func__);
		status = connector_probe_legacy();
	}

	if (status != B_OK) {
		TRACE("%s: couldn't detect supported connectors!\n", __func__);
		return status;
	}

	// print found connectors
	debug_connectors();

	// setup encoders on each connector if needed
	encoder_init();

	// setup link on any DisplayPort connectors
	dp_setup_connectors();

	// detect attached displays
	status = detect_displays();
	//if (status != B_OK)
	//	return status;

	// print found displays
	debug_displays();

	// create initial list of video modes
	status = create_mode_list();
	//if (status != B_OK) {
	//	radeon_uninit_accelerant();
	//	return status;
	//}

	radeon_gpu_mc_setup();

	// Set up data crunching + irq rings
	radeon_gpu_ring_setup();

	radeon_gpu_ring_boot(RADEON_QUEUE_TYPE_GFX_INDEX);

	TRACE("%s done\n", __func__);
	return B_OK;
}
Esempio n. 2
0
void gui_thread(GUI_DRIVER_INFO* drv_info)
{
    unsigned int res, tmp, redraw;
    WINDOW win;
    WINDOW top;
    WINDOW desktop;		//main_dlg;
    CHandle key_hnd;
    CHandle gui_hnd;

    //prevent these signals not to be used from task handles
    ALLOCATE_SIGNAL(SIG_GUI_TASK);

    //wait for static constructors (lcd object)
    while(!detect_displays(drv_info))
        tsk_sleep(10);

    // start desktop
    while( !(desktop = tsk_new_window(maindlg_cb)) )
    {
        tsk_sleep(10);
    }
    desktop->next = NULL;
    top = desktop;
    desktop->rect.x1 = drv_info->lcd[0]->size_x;
    desktop->rect.y1 = drv_info->lcd[0]->size_y;

    for(int i=0; i<GUI_DISPLAYS; i++)
    {
        if(drv_info->lcd[i])
        {
#if GUI_DISPLAYS > 1
            desktop->displays |= (1<<i);
#endif
            drv_info->lcd[i]->lcd_init((GUI_CB)splashdlg_cb);
        }
    }
    tsk_sleep(3000);


    init_main_menu();


    // start key handle
    key_hnd.tsk_safe_open(KEY_DRV_INDX, 0);
    key_hnd.src.as_int = 0;
    key_hnd.tsk_start_read(&key_hnd.src.as_int, 1);


    // start gui handle
    gui_hnd.tsk_safe_open(GUI_DRV_INDX, 0);			//mode = 1 - control handle
    gui_hnd.tsk_start_read(NULL, 0);

    for(;;)
    {
        res = tsk_wait_signal(-1u, 1000 - (CURRENT_TIME %1000));
        redraw = res>>8;;

        if(!res)
            redraw = 0xFF;

        // 1) get waiting objects
        if(res & gui_hnd.signal)
        {
            drv_info->lcd[0]->backlight_signal();
            gui_hnd.res &= ~FLG_SIGNALED;
            win = (WINDOW)gui_hnd.dst.as_voidptr;
            if(win)
            {
                top->next = win;
                do
                {
                    top = (WINDOW)top->next;
                    top->rect.x1 = desktop->rect.x1;
                    top->rect.y1 = desktop->rect.y1;
                    top->callback(NULL , WM_INIT);
#if GUI_DISPLAYS > 1
                    redraw |= top->displays;
#endif
                } while( top->next );
            }
            gui_hnd.tsk_start_read(NULL, 0);
#if GUI_DISPLAYS == 1
            redraw |= 1;
#endif
        }


        // 2) check keyboard
        if(res &  key_hnd.signal)
        {
            drv_info->lcd[0]->backlight_signal();
            key_hnd.res &= ~FLG_SIGNALED;
            //send to top
            tmp = top->callback(key_hnd.src.as_int , WM_KEY);
            if(tmp & FLG_BUSY)	//FLG_BUSY returned to redraw
            {
                tmp ^= FLG_BUSY;
#if GUI_DISPLAYS > 1
                redraw |= top->displays;
#else
                redraw |= 1;
#endif
            }
            top->mode1 = tmp;
            key_hnd.tsk_start_read(&key_hnd.src.as_int, 1);
        }

        // 3)  command loop
        top = NULL;
        win = desktop;
        do
        {
            // check for pending commands
            if(win->mode0 & FLG_OK)
            {
                locked_clr_byte(&win->mode0, FLG_OK);
                tmp = win->callback(win->dst.as_int, WM_USER);
                if(tmp & FLG_BUSY)	//FLG_BUSY returned to redraw
                {
                    tmp ^= FLG_BUSY;
#if GUI_DISPLAYS > 1
                    redraw |= win->displays;
#else
                    redraw |= 1;
#endif
                }
                win->mode1 |= tmp;

            }

            //check for complete (close object)
            if(top && ((win->mode0 | win->mode1) & FLG_SIGNALED) )
            {
                top->next = win->next;
#if GUI_DISPLAYS > 1
                redraw |= win->displays;
#else
                redraw |= 1;
#endif
                usr_HND_SET_STATUS(win, win->mode1 | FLG_SIGNALED);
                win = (WINDOW)top->next;
            } else
            {
                top = win;
                win = (WINDOW)win->next;
            }

        } while (win );

        // 3) draw loop
        for(int i=0; i<GUI_DISPLAYS; i++)
        {
            if( (redraw & (1<<i)) && drv_info->lcd[i])
            {
                drv_info->lcd[i]->redraw_screen(desktop);
            }
        }
    }

}