MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dc_init_client

Function dc_init_client

freebsd/arm/nvidia/drm2/tegra_dc.c:1191–1236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1189}
1190
1191static int
1192dc_init_client(device_t dev, device_t host1x, struct tegra_drm *drm)
1193{
1194 struct dc_softc *sc;
1195 int rv;
1196
1197 sc = device_get_softc(dev);
1198
1199 if (drm->pitch_align < sc->pitch_align)
1200 drm->pitch_align = sc->pitch_align;
1201
1202 drm_crtc_init(&drm->drm_dev, &sc->tegra_crtc.drm_crtc, &dc_crtc_funcs);
1203 drm_mode_crtc_set_gamma_size(&sc->tegra_crtc.drm_crtc, 256);
1204 drm_crtc_helper_add(&sc->tegra_crtc.drm_crtc, &dc_crtc_helper_funcs);
1205
1206 rv = dc_init_planes(sc, drm);
1207 if (rv!= 0){
1208 device_printf(dev, "Cannot init planes\n");
1209 return (rv);
1210 }
1211
1212 WR4(sc, DC_CMD_INT_TYPE,
1213 WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT |
1214 WIN_A_OF_INT | WIN_B_OF_INT | WIN_C_OF_INT);
1215
1216 WR4(sc, DC_CMD_INT_POLARITY,
1217 WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT |
1218 WIN_A_OF_INT | WIN_B_OF_INT | WIN_C_OF_INT);
1219
1220 WR4(sc, DC_CMD_INT_ENABLE, 0);
1221 WR4(sc, DC_CMD_INT_MASK, 0);
1222
1223 rv = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE,
1224 NULL, dc_intr, sc, &sc->irq_ih);
1225 if (rv != 0) {
1226 device_printf(dev, "Cannot register interrupt handler\n");
1227 return (rv);
1228 }
1229
1230 /* allocate memory for cursor cache */
1231 sc->tegra_crtc.cursor_vbase = kmem_alloc_contig(256 * 256 * 4,
1232 M_WAITOK | M_ZERO, 0, -1UL, PAGE_SIZE, 0,
1233 VM_MEMATTR_WRITE_COMBINING);
1234 sc->tegra_crtc.cursor_pbase = vtophys(sc->tegra_crtc.cursor_vbase);
1235 return (0);
1236}
1237
1238static int
1239dc_exit_client(device_t dev, device_t host1x, struct tegra_drm *drm)

Callers

nothing calls this directly

Calls 6

device_get_softcFunction · 0.85
dc_init_planesFunction · 0.85
device_printfFunction · 0.85
bus_setup_intrFunction · 0.85
WR4Function · 0.50
kmem_alloc_contigFunction · 0.50

Tested by

no test coverage detected