| #include "drmP.h" |
| #include "drm.h" |
| #include "drm_crtc_helper.h" |
| |
| #include "glint.h" |
| #include "glint_drv.h" |
| |
| int glint_modeset_init(struct glint_device *gdev) |
| { |
| struct drm_encoder *encoder; |
| struct drm_connector *connector; |
| int i; |
| |
| drm_mode_config_init(gdev->ddev); |
| gdev->mode_info.mode_config_initialized = true; |
| |
| gdev->ddev->mode_config.max_width = GLINT_MAX_FB_WIDTH; |
| gdev->ddev->mode_config.max_height = GLINT_MAX_FB_HEIGHT; |
| |
| gdev->ddev->mode_config.fb_base = gdev->mc.aper_base; |
| |
| /* allocate crtcs */ |
| for (i = 0; i < gdev->num_crtc; i++) { |
| glint_crtc_init(gdev->ddev, i); |
| } |
| |
| encoder = glint_dac_init(gdev->ddev); |
| if (!encoder) { |
| GLINT_ERROR("glint_dac_init failed\n"); |
| return -1; |
| } |
| |
| connector = glint_vga_init(gdev->ddev); |
| if (!connector) { |
| GLINT_ERROR("glint_vga_init failed\n"); |
| return -1; |
| } |
| |
| return 0; |
| } |
| |
| void glint_modeset_fini(struct glint_device *gdev) |
| { |
| if (gdev->mode_info.mode_config_initialized) { |
| drm_mode_config_cleanup(gdev->ddev); |
| gdev->mode_info.mode_config_initialized = false; |
| } |
| } |