Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/nouveau: make general drm modesetting init common

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

+32 -67
+1 -2
drivers/gpu/drm/nouveau/nouveau_crtc.h
··· 82 82 } 83 83 84 84 int nv50_crtc_create(struct drm_device *dev, int index); 85 - int nv50_cursor_init(struct nouveau_crtc *); 86 - void nv50_cursor_fini(struct nouveau_crtc *); 87 85 int nv50_crtc_cursor_set(struct drm_crtc *drm_crtc, struct drm_file *file_priv, 88 86 uint32_t buffer_handle, uint32_t width, 89 87 uint32_t height); 90 88 int nv50_crtc_cursor_move(struct drm_crtc *drm_crtc, int x, int y); 91 89 92 90 int nv04_cursor_init(struct nouveau_crtc *); 91 + int nv50_cursor_init(struct nouveau_crtc *); 93 92 94 93 struct nouveau_connector * 95 94 nouveau_crtc_connector_get(struct nouveau_crtc *crtc);
-1
drivers/gpu/drm/nouveau/nouveau_drv.h
··· 736 736 uint64_t vram_size; 737 737 uint64_t vram_sys_base; 738 738 739 - uint64_t fb_phys; 740 739 uint64_t fb_available_size; 741 740 uint64_t fb_mappable_pages; 742 741 uint64_t fb_aper_free;
-2
drivers/gpu/drm/nouveau/nouveau_mem.c
··· 408 408 if (ret) 409 409 return ret; 410 410 411 - dev_priv->fb_phys = pci_resource_start(dev->pdev, 1); 412 - 413 411 ret = nouveau_ttm_global_init(dev_priv); 414 412 if (ret) 415 413 return ret;
+21
drivers/gpu/drm/nouveau/nouveau_state.c
··· 657 657 goto out_engine; 658 658 } 659 659 660 + /* initialise general modesetting */ 661 + drm_mode_config_init(dev); 662 + drm_mode_create_scaling_mode_property(dev); 663 + drm_mode_create_dithering_property(dev); 664 + dev->mode_config.funcs = (void *)&nouveau_mode_config_funcs; 665 + dev->mode_config.fb_base = pci_resource_start(dev->pdev, 1); 666 + dev->mode_config.min_width = 0; 667 + dev->mode_config.min_height = 0; 668 + if (dev_priv->card_type < NV_10) { 669 + dev->mode_config.max_width = 2048; 670 + dev->mode_config.max_height = 2048; 671 + } else 672 + if (dev_priv->card_type < NV_50) { 673 + dev->mode_config.max_width = 4096; 674 + dev->mode_config.max_height = 4096; 675 + } else { 676 + dev->mode_config.max_width = 8192; 677 + dev->mode_config.max_height = 8192; 678 + } 679 + 660 680 ret = engine->display.create(dev); 661 681 if (ret) 662 682 goto out_fifo; ··· 767 747 } 768 748 769 749 engine->display.destroy(dev); 750 + drm_mode_config_cleanup(dev); 770 751 771 752 if (!dev_priv->noaccel) { 772 753 engine->fifo.takedown(dev);
-23
drivers/gpu/drm/nouveau/nv04_display.c
··· 126 126 127 127 nouveau_hw_save_vga_fonts(dev, 1); 128 128 129 - drm_mode_config_init(dev); 130 - drm_mode_create_scaling_mode_property(dev); 131 - drm_mode_create_dithering_property(dev); 132 - 133 - dev->mode_config.funcs = (void *)&nouveau_mode_config_funcs; 134 - 135 - dev->mode_config.min_width = 0; 136 - dev->mode_config.min_height = 0; 137 - switch (dev_priv->card_type) { 138 - case NV_04: 139 - dev->mode_config.max_width = 2048; 140 - dev->mode_config.max_height = 2048; 141 - break; 142 - default: 143 - dev->mode_config.max_width = 4096; 144 - dev->mode_config.max_height = 4096; 145 - break; 146 - } 147 - 148 - dev->mode_config.fb_base = dev_priv->fb_phys; 149 - 150 129 nv04_crtc_create(dev, 0); 151 130 if (nv_two_heads(dev)) 152 131 nv04_crtc_create(dev, 1); ··· 213 234 214 235 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) 215 236 crtc->funcs->restore(crtc); 216 - 217 - drm_mode_config_cleanup(dev); 218 237 219 238 nouveau_hw_save_vga_fonts(dev, 0); 220 239 }
-2
drivers/gpu/drm/nouveau/nv50_crtc.c
··· 329 329 330 330 drm_crtc_cleanup(&nv_crtc->base); 331 331 332 - nv50_cursor_fini(nv_crtc); 333 - 334 332 nouveau_bo_unmap(nv_crtc->lut.nvbo); 335 333 nouveau_bo_ref(NULL, &nv_crtc->lut.nvbo); 336 334 nouveau_bo_unmap(nv_crtc->cursor.nvbo);
-18
drivers/gpu/drm/nouveau/nv50_cursor.c
··· 137 137 nv_crtc->cursor.show = nv50_cursor_show; 138 138 return 0; 139 139 } 140 - 141 - void 142 - nv50_cursor_fini(struct nouveau_crtc *nv_crtc) 143 - { 144 - struct drm_device *dev = nv_crtc->base.dev; 145 - int idx = nv_crtc->index; 146 - 147 - NV_DEBUG_KMS(dev, "\n"); 148 - 149 - nv_wr32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx), 0); 150 - if (!nv_wait(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx), 151 - NV50_PDISPLAY_CURSOR_CURSOR_CTRL2_STATUS, 0)) { 152 - NV_ERROR(dev, "timeout: CURSOR_CTRL2_STATUS == 0\n"); 153 - NV_ERROR(dev, "CURSOR_CTRL2 = 0x%08x\n", 154 - nv_rd32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx))); 155 - } 156 - } 157 -
+10 -19
drivers/gpu/drm/nouveau/nv50_display.c
··· 247 247 } 248 248 } 249 249 250 + for (i = 0; i < 2; i++) { 251 + nv_wr32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i), 0); 252 + if (!nv_wait(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i), 253 + NV50_PDISPLAY_CURSOR_CURSOR_CTRL2_STATUS, 0)) { 254 + NV_ERROR(dev, "timeout: CURSOR_CTRL2_STATUS == 0\n"); 255 + NV_ERROR(dev, "CURSOR_CTRL2 = 0x%08x\n", 256 + nv_rd32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i))); 257 + } 258 + } 259 + 250 260 nv50_evo_fini(dev); 251 261 252 262 for (i = 0; i < 3; i++) { ··· 295 285 if (!priv) 296 286 return -ENOMEM; 297 287 dev_priv->engine.display.priv = priv; 298 - 299 - /* init basic kernel modesetting */ 300 - drm_mode_config_init(dev); 301 - 302 - /* Initialise some optional connector properties. */ 303 - drm_mode_create_scaling_mode_property(dev); 304 - drm_mode_create_dithering_property(dev); 305 - 306 - dev->mode_config.min_width = 0; 307 - dev->mode_config.min_height = 0; 308 - 309 - dev->mode_config.funcs = (void *)&nouveau_mode_config_funcs; 310 - 311 - dev->mode_config.max_width = 8192; 312 - dev->mode_config.max_height = 8192; 313 - 314 - dev->mode_config.fb_base = dev_priv->fb_phys; 315 288 316 289 /* Create CRTC objects */ 317 290 for (i = 0; i < 2; i++) ··· 356 363 struct nv50_display *disp = nv50_display(dev); 357 364 358 365 NV_DEBUG_KMS(dev, "\n"); 359 - 360 - drm_mode_config_cleanup(dev); 361 366 362 367 nv50_display_disable(dev); 363 368 nouveau_irq_unregister(dev, 26);