--- zzzz-none-000/linux-3.10.107/drivers/gpu/drm/nouveau/dispnv04/disp.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/gpu/drm/nouveau/dispnv04/disp.c 2021-02-04 17:41:59.000000000 +0000 @@ -22,9 +22,6 @@ * Author: Ben Skeggs */ -#include -#include - #include #include @@ -34,31 +31,11 @@ #include "nouveau_encoder.h" #include "nouveau_connector.h" -#include - -int -nv04_display_early_init(struct drm_device *dev) -{ - /* ensure vblank interrupts are off, they can't be enabled until - * drm_vblank has been initialised - */ - NVWriteCRTC(dev, 0, NV_PCRTC_INTR_EN_0, 0); - if (nv_two_heads(dev)) - NVWriteCRTC(dev, 1, NV_PCRTC_INTR_EN_0, 0); - - return 0; -} - -void -nv04_display_late_takedown(struct drm_device *dev) -{ -} - int nv04_display_create(struct drm_device *dev) { struct nouveau_drm *drm = nouveau_drm(dev); - struct nouveau_i2c *i2c = nouveau_i2c(drm->device); + struct nvkm_i2c *i2c = nvxx_i2c(&drm->device); struct dcb_table *dcb = &drm->vbios.dcb; struct drm_connector *connector, *ct; struct drm_encoder *encoder; @@ -70,6 +47,8 @@ if (!disp) return -ENOMEM; + nvif_object_map(&drm->device.object); + nouveau_display(dev)->priv = disp; nouveau_display(dev)->dtor = nv04_display_destroy; nouveau_display(dev)->init = nv04_display_init; @@ -77,11 +56,6 @@ nouveau_hw_save_vga_fonts(dev, 1); - ret = nouveau_object_new(nv_object(drm), NVDRM_DEVICE, 0xd1500000, - NV04_DISP_CLASS, NULL, 0, &disp->core); - if (ret) - return ret; - nv04_crtc_create(dev, 0); if (nv_two_heads(dev)) nv04_crtc_create(dev, 1); @@ -120,14 +94,16 @@ &dev->mode_config.connector_list, head) { if (!connector->encoder_ids[0]) { NV_WARN(drm, "%s has no encoders, removing\n", - drm_get_connector_name(connector)); + connector->name); connector->funcs->destroy(connector); } } list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); - nv_encoder->i2c = i2c->find(i2c, nv_encoder->dcb->i2c_index); + struct nvkm_i2c_bus *bus = + nvkm_i2c_bus_find(i2c, nv_encoder->dcb->i2c_index); + nv_encoder->i2c = bus ? &bus->i2c : NULL; } /* Save previous state */ @@ -135,11 +111,13 @@ crtc->funcs->save(crtc); list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { - struct drm_encoder_helper_funcs *func = encoder->helper_private; + const struct drm_encoder_helper_funcs *func = encoder->helper_private; func->save(encoder); } + nouveau_overlay_init(dev); + return 0; } @@ -147,6 +125,7 @@ nv04_display_destroy(struct drm_device *dev) { struct nv04_display *disp = nv04_display(dev); + struct nouveau_drm *drm = nouveau_drm(dev); struct drm_encoder *encoder; struct drm_crtc *crtc; @@ -161,7 +140,7 @@ /* Restore state */ list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { - struct drm_encoder_helper_funcs *func = encoder->helper_private; + const struct drm_encoder_helper_funcs *func = encoder->helper_private; func->restore(encoder); } @@ -173,6 +152,8 @@ nouveau_display(dev)->priv = NULL; kfree(disp); + + nvif_object_unmap(&drm->device.object); } int @@ -190,7 +171,7 @@ * on suspend too. */ list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { - struct drm_encoder_helper_funcs *func = encoder->helper_private; + const struct drm_encoder_helper_funcs *func = encoder->helper_private; func->restore(encoder); }