Lines Matching +full:auto +full:- +full:retry

55 	nvif_event_allow(&nv_crtc->vblank);  in nouveau_display_vblank_enable()
66 nvif_event_block(&nv_crtc->vblank); in nouveau_display_vblank_disable()
74 line -= total; in calc()
77 line -= total; in calc()
78 line -= blanke + 1; in calc()
88 struct nvif_head *head = &nouveau_crtc(crtc)->head; in nouveau_display_scanoutpos_head()
90 int retry = 20; in nouveau_display_scanoutpos_head() local
96 ret = nvif_mthd(&head->object, NVIF_HEAD_V0_SCANOUTPOS, &args, sizeof(args)); in nouveau_display_scanoutpos_head()
105 if (retry) ndelay(vblank->linedur_ns); in nouveau_display_scanoutpos_head()
106 } while (retry--); in nouveau_display_scanoutpos_head()
137 struct nouveau_display *disp = nouveau_display(drm->dev); in nouveau_decode_mod()
152 modifier |= disp->format_modifiers[0] & (0xffull << 12); in nouveau_decode_mod()
158 if (drm->client.device.info.chipset >= 0xc0) in nouveau_decode_mod()
168 if (fb->flags & DRM_MODE_FB_MODIFIERS) { in nouveau_framebuffer_get_layout()
169 struct nouveau_drm *drm = nouveau_drm(fb->dev); in nouveau_framebuffer_get_layout()
171 nouveau_decode_mod(drm, fb->modifier, tile_mode, kind); in nouveau_framebuffer_get_layout()
173 const struct nouveau_bo *nvbo = nouveau_gem_object(fb->obj[0]); in nouveau_framebuffer_get_layout()
175 *tile_mode = nvbo->mode; in nouveau_framebuffer_get_layout()
176 *kind = nvbo->kind; in nouveau_framebuffer_get_layout()
196 struct nouveau_display *disp = nouveau_display(drm->dev); in nouveau_validate_decode_mod()
199 if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) { in nouveau_validate_decode_mod()
200 return -EINVAL; in nouveau_validate_decode_mod()
203 BUG_ON(!disp->format_modifiers); in nouveau_validate_decode_mod()
206 (disp->format_modifiers[mod] != DRM_FORMAT_MOD_INVALID) && in nouveau_validate_decode_mod()
207 (disp->format_modifiers[mod] != modifier); in nouveau_validate_decode_mod()
210 if (disp->format_modifiers[mod] == DRM_FORMAT_MOD_INVALID) { in nouveau_validate_decode_mod()
216 return -EINVAL; in nouveau_validate_decode_mod()
232 BUG_ON(drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA); in nouveau_check_bl_size()
234 if (nouveau_check_tile_mode(tile_mode, drm->client.device.info.chipset)) in nouveau_check_bl_size()
235 return -EINVAL; in nouveau_check_bl_size()
237 gobs_in_block = nouveau_get_gobs_in_block(tile_mode, drm->client.device.info.chipset); in nouveau_check_bl_size()
239 bh = nouveau_get_height_in_blocks(h, gobs_in_block, drm->client.device.info.family); in nouveau_check_bl_size()
240 gob_size = nouveau_get_gob_size(drm->client.device.info.family); in nouveau_check_bl_size()
246 bl_size, nvbo->bo.base.size); in nouveau_check_bl_size()
248 if (bl_size + offset > nvbo->bo.base.size) in nouveau_check_bl_size()
249 return -ERANGE; in nouveau_check_bl_size()
269 /* YUV overlays have special requirements pre-NV50 */ in nouveau_framebuffer_new()
270 if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA && in nouveau_framebuffer_new()
272 (mode_cmd->pixel_format == DRM_FORMAT_YUYV || in nouveau_framebuffer_new()
273 mode_cmd->pixel_format == DRM_FORMAT_UYVY || in nouveau_framebuffer_new()
274 mode_cmd->pixel_format == DRM_FORMAT_NV12 || in nouveau_framebuffer_new()
275 mode_cmd->pixel_format == DRM_FORMAT_NV21) && in nouveau_framebuffer_new()
276 (mode_cmd->pitches[0] & 0x3f || /* align 64 */ in nouveau_framebuffer_new()
277 mode_cmd->pitches[0] >= 0x10000 || /* at most 64k pitch */ in nouveau_framebuffer_new()
278 (mode_cmd->pitches[1] && /* pitches for planes must match */ in nouveau_framebuffer_new()
279 mode_cmd->pitches[0] != mode_cmd->pitches[1]))) { in nouveau_framebuffer_new()
281 &mode_cmd->pixel_format, in nouveau_framebuffer_new()
282 mode_cmd->pitches[0], mode_cmd->pitches[1]); in nouveau_framebuffer_new()
283 return -EINVAL; in nouveau_framebuffer_new()
286 if (mode_cmd->flags & DRM_MODE_FB_MODIFIERS) { in nouveau_framebuffer_new()
287 if (nouveau_validate_decode_mod(drm, mode_cmd->modifier[0], in nouveau_framebuffer_new()
290 mode_cmd->modifier[0]); in nouveau_framebuffer_new()
291 return -EINVAL; in nouveau_framebuffer_new()
294 tile_mode = nvbo->mode; in nouveau_framebuffer_new()
295 kind = nvbo->kind; in nouveau_framebuffer_new()
300 for (i = 0; i < info->num_planes; i++) { in nouveau_framebuffer_new()
302 mode_cmd->height, in nouveau_framebuffer_new()
307 mode_cmd->offsets[i], in nouveau_framebuffer_new()
308 mode_cmd->pitches[i], in nouveau_framebuffer_new()
313 uint32_t size = mode_cmd->pitches[i] * height; in nouveau_framebuffer_new()
315 if (size + mode_cmd->offsets[i] > nvbo->bo.base.size) in nouveau_framebuffer_new()
316 return -ERANGE; in nouveau_framebuffer_new()
321 return -ENOMEM; in nouveau_framebuffer_new()
324 fb->obj[0] = gem; in nouveau_framebuffer_new()
341 gem = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]); in nouveau_user_framebuffer_create()
343 return ERR_PTR(-ENOENT); in nouveau_user_framebuffer_create()
365 { 6, UNDERSCAN_AUTO, "auto" },
372 { 7, DITHERING_MODE_AUTO, "auto" },
382 { 6, DITHERING_DEPTH_AUTO, "auto" },
391 while (l->gen_mask) { \
392 if (l->gen_mask & (1 << (gen))) \
399 while (p && l->gen_mask) { \
400 if (l->gen_mask & (1 << (gen))) { \
401 drm_property_add_enum(p, l->type, l->name); \
411 if (drm->headless) in nouveau_display_hpd_resume()
414 spin_lock_irq(&drm->hpd_lock); in nouveau_display_hpd_resume()
415 drm->hpd_pending = ~0; in nouveau_display_hpd_resume()
416 spin_unlock_irq(&drm->hpd_lock); in nouveau_display_hpd_resume()
418 schedule_work(&drm->hpd_work); in nouveau_display_hpd_resume()
425 struct drm_device *dev = drm->dev; in nouveau_display_hpd_work()
432 pm_runtime_get_sync(dev->dev); in nouveau_display_hpd_work()
434 spin_lock_irq(&drm->hpd_lock); in nouveau_display_hpd_work()
435 pending = drm->hpd_pending; in nouveau_display_hpd_work()
436 drm->hpd_pending = 0; in nouveau_display_hpd_work()
437 spin_unlock_irq(&drm->hpd_lock); in nouveau_display_hpd_work()
443 mutex_lock(&dev->mode_config.mutex); in nouveau_display_hpd_work()
448 enum drm_connector_status old_status = connector->status; in nouveau_display_hpd_work()
449 u64 bits, old_epoch_counter = connector->epoch_counter; in nouveau_display_hpd_work()
454 spin_lock_irq(&drm->hpd_lock); in nouveau_display_hpd_work()
455 bits = nv_connector->hpd_pending; in nouveau_display_hpd_work()
456 nv_connector->hpd_pending = 0; in nouveau_display_hpd_work()
457 spin_unlock_irq(&drm->hpd_lock); in nouveau_display_hpd_work()
460 connector->base.id, connector->name, in nouveau_display_hpd_work()
470 connector->status = drm_helper_probe_detect(connector, NULL, false); in nouveau_display_hpd_work()
471 if (old_epoch_counter == connector->epoch_counter) in nouveau_display_hpd_work()
480 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] status updated from %s to %s (epoch counter %llu->%llu)\n", in nouveau_display_hpd_work()
481 connector->base.id, connector->name, in nouveau_display_hpd_work()
483 drm_get_connector_status_name(connector->status), in nouveau_display_hpd_work()
484 old_epoch_counter, connector->epoch_counter); in nouveau_display_hpd_work()
488 mutex_unlock(&dev->mode_config.mutex); in nouveau_display_hpd_work()
498 pm_runtime_mark_last_busy(drm->dev->dev); in nouveau_display_hpd_work()
500 pm_runtime_put_autosuspend(dev->dev); in nouveau_display_hpd_work()
513 if (!strcmp(info->device_class, ACPI_VIDEO_CLASS)) { in nouveau_display_acpi_ntfy()
514 if (info->type == ACPI_VIDEO_NOTIFY_PROBE) { in nouveau_display_acpi_ntfy()
515 ret = pm_runtime_get(drm->dev->dev); in nouveau_display_acpi_ntfy()
516 if (ret == 1 || ret == -EACCES) { in nouveau_display_acpi_ntfy()
521 pm_runtime_put_autosuspend(drm->dev->dev); in nouveau_display_acpi_ntfy()
522 } else if (ret == 0 || ret == -EINPROGRESS) { in nouveau_display_acpi_ntfy()
528 pm_runtime_put_noidle(drm->dev->dev); in nouveau_display_acpi_ntfy()
534 /* acpi-video should not generate keypresses for this */ in nouveau_display_acpi_ntfy()
558 nvif_event_allow(&conn->hpd); in nouveau_display_init()
559 nvif_event_allow(&conn->irq); in nouveau_display_init()
563 ret = disp->init(dev, resume, runtime); in nouveau_display_init()
594 nvif_event_block(&conn->irq); in nouveau_display_fini()
595 nvif_event_block(&conn->hpd); in nouveau_display_fini()
599 if (!runtime && !drm->headless) in nouveau_display_fini()
600 cancel_work_sync(&drm->hpd_work); in nouveau_display_fini()
603 disp->fini(dev, runtime, suspend); in nouveau_display_fini()
612 if (disp->disp.object.oclass < NV50_DISP) in nouveau_display_create_properties()
615 if (disp->disp.object.oclass < GF110_DISP) in nouveau_display_create_properties()
620 PROP_ENUM(disp->dithering_mode, gen, "dithering mode", dither_mode); in nouveau_display_create_properties()
621 PROP_ENUM(disp->dithering_depth, gen, "dithering depth", dither_depth); in nouveau_display_create_properties()
622 PROP_ENUM(disp->underscan_property, gen, "underscan", underscan); in nouveau_display_create_properties()
624 disp->underscan_hborder_property = in nouveau_display_create_properties()
627 disp->underscan_vborder_property = in nouveau_display_create_properties()
633 /* -90..+90 */ in nouveau_display_create_properties()
634 disp->vibrant_hue_property = in nouveau_display_create_properties()
637 /* -100..+100 */ in nouveau_display_create_properties()
638 disp->color_vibrance_property = in nouveau_display_create_properties()
649 disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL); in nouveau_display_create()
651 return -ENOMEM; in nouveau_display_create()
657 dev->mode_config.funcs = &nouveau_mode_config_funcs; in nouveau_display_create()
659 dev->mode_config.min_width = 0; in nouveau_display_create()
660 dev->mode_config.min_height = 0; in nouveau_display_create()
661 if (drm->client.device.info.family < NV_DEVICE_INFO_V0_CELSIUS) { in nouveau_display_create()
662 dev->mode_config.max_width = 2048; in nouveau_display_create()
663 dev->mode_config.max_height = 2048; in nouveau_display_create()
665 if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) { in nouveau_display_create()
666 dev->mode_config.max_width = 4096; in nouveau_display_create()
667 dev->mode_config.max_height = 4096; in nouveau_display_create()
669 if (drm->client.device.info.family < NV_DEVICE_INFO_V0_FERMI) { in nouveau_display_create()
670 dev->mode_config.max_width = 8192; in nouveau_display_create()
671 dev->mode_config.max_height = 8192; in nouveau_display_create()
673 dev->mode_config.max_width = 16384; in nouveau_display_create()
674 dev->mode_config.max_height = 16384; in nouveau_display_create()
677 dev->mode_config.preferred_depth = 24; in nouveau_display_create()
678 dev->mode_config.prefer_shadow = 1; in nouveau_display_create()
680 if (drm->client.device.info.chipset < 0x11) in nouveau_display_create()
681 dev->mode_config.async_page_flip = false; in nouveau_display_create()
683 dev->mode_config.async_page_flip = true; in nouveau_display_create()
689 ret = nvif_disp_ctor(&drm->client.device, "kmsDisp", 0, &disp->disp); in nouveau_display_create()
691 if (ret == -ENODEV) { in nouveau_display_create()
693 drm->headless = true; in nouveau_display_create()
697 if (!ret && (disp->disp.outp_mask || drm->vbios.dcb.entries)) { in nouveau_display_create()
699 if (disp->disp.object.oclass < NV50_DISP) { in nouveau_display_create()
700 dev->mode_config.fb_modifiers_not_supported = true; in nouveau_display_create()
715 if (dev->mode_config.num_crtc) { in nouveau_display_create()
716 ret = drm_vblank_init(dev, dev->mode_config.num_crtc); in nouveau_display_create()
720 if (disp->disp.object.oclass >= NV50_DISP) in nouveau_display_create()
724 INIT_WORK(&drm->hpd_work, nouveau_display_hpd_work); in nouveau_display_create()
725 spin_lock_init(&drm->hpd_lock); in nouveau_display_create()
727 drm->acpi_nb.notifier_call = nouveau_display_acpi_ntfy; in nouveau_display_create()
728 register_acpi_notifier(&drm->acpi_nb); in nouveau_display_create()
734 disp->dtor(dev); in nouveau_display_create()
748 unregister_acpi_notifier(&drm->acpi_nb); in nouveau_display_destroy()
754 if (disp->dtor) in nouveau_display_destroy()
755 disp->dtor(dev); in nouveau_display_destroy()
757 nvif_disp_dtor(&disp->disp); in nouveau_display_destroy()
759 drm->display = NULL; in nouveau_display_destroy()
772 disp->suspend = drm_atomic_helper_suspend(dev); in nouveau_display_suspend()
773 if (IS_ERR(disp->suspend)) { in nouveau_display_suspend()
774 int ret = PTR_ERR(disp->suspend); in nouveau_display_suspend()
775 disp->suspend = NULL; in nouveau_display_suspend()
793 if (disp->suspend) { in nouveau_display_resume()
794 drm_atomic_helper_resume(dev, disp->suspend); in nouveau_display_resume()
795 disp->suspend = NULL; in nouveau_display_resume()
811 args->pitch = roundup(args->width * (args->bpp / 8), 256); in nouveau_display_dumb_create()
812 args->size = args->pitch * args->height; in nouveau_display_dumb_create()
813 args->size = roundup(args->size, PAGE_SIZE); in nouveau_display_dumb_create()
816 if (nouveau_drm(dev)->client.device.info.ram_size != 0) in nouveau_display_dumb_create()
821 ret = nouveau_gem_new(cli, args->size, 0, domain, 0, 0, &bo); in nouveau_display_dumb_create()
825 ret = drm_gem_handle_create(file_priv, &bo->bo.base, &args->handle); in nouveau_display_dumb_create()
826 drm_gem_object_put(&bo->bo.base); in nouveau_display_dumb_create()