st/xorg: Cleanly shutdown
[mesa.git] / src / gallium / state_trackers / xorg / xorg_driver.c
index 24d3c23fa6a17c0476ee6cd19a5ed1d91e23c3a2..7da10427eca44002b93f021b955b0b2e4044fef7 100644 (file)
@@ -541,6 +541,9 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
            return FALSE;
     }
 
+    if (!ms->api)
+       ms->api = drm_api_create();
+
     if (!ms->screen) {
        ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL);
 
@@ -651,8 +654,8 @@ AdjustFrame(int scrnIndex, int x, int y, int flags)
     xf86CrtcPtr crtc = output->crtc;
 
     if (crtc && crtc->enabled) {
-       crtc->funcs->mode_set(crtc, pScrn->currentMode, pScrn->currentMode, x,
-                             y);
+       crtc->funcs->set_mode_major(crtc, pScrn->currentMode,
+                                   RR_Rotate_0, x, y);
        crtc->x = output->initial_x + x;
        crtc->y = output->initial_y + y;
     }
@@ -774,7 +777,7 @@ CloseScreen(int scrnIndex, ScreenPtr pScreen)
     if (ms->exa)
        xorg_exa_close(pScrn);
 
-    if (ms->api->destroy)
+    if (ms->api && ms->api->destroy)
        ms->api->destroy(ms->api);
     ms->api = NULL;