Lines Matching full:vkms
110 container_of(work, struct vmw_display_unit, vkms.crc_generator_work);
118 spin_lock_irq(&du->vkms.crc_state_lock);
119 crc_pending = du->vkms.crc_pending;
120 spin_unlock_irq(&du->vkms.crc_state_lock);
129 spin_lock_irq(&du->vkms.crc_state_lock);
130 surf = vmw_surface_reference(du->vkms.surface);
131 spin_unlock_irq(&du->vkms.crc_state_lock);
145 spin_lock_irq(&du->vkms.crc_state_lock);
146 frame_start = du->vkms.frame_start;
147 frame_end = du->vkms.frame_end;
148 du->vkms.frame_start = 0;
149 du->vkms.frame_end = 0;
150 du->vkms.crc_pending = false;
151 spin_unlock_irq(&du->vkms.crc_state_lock);
163 struct vmw_display_unit *du = container_of(timer, struct vmw_display_unit, vkms.timer);
170 ret_overrun = hrtimer_forward_now(&du->vkms.timer,
171 du->vkms.period_ns);
181 has_surface = du->vkms.surface != NULL;
184 if (du->vkms.crc_enabled && has_surface) {
187 spin_lock(&du->vkms.crc_state_lock);
188 if (!du->vkms.crc_pending)
189 du->vkms.frame_start = frame;
193 du->vkms.frame_start, frame);
194 du->vkms.frame_end = frame;
195 du->vkms.crc_pending = true;
196 spin_unlock(&du->vkms.crc_state_lock);
198 ret = queue_work(vmw->crc_workq, &du->vkms.crc_generator_work);
229 drm_warn(&vmw->drm, "crc workqueue allocation failed. Disabling vkms.");
233 drm_info(&vmw->drm, "VKMS enabled\n");
262 *vblank_time = READ_ONCE(du->vkms.timer.node.expires);
274 *vblank_time -= du->vkms.period_ns;
293 hrtimer_setup(&du->vkms.timer, &vmw_vkms_vblank_simulate, CLOCK_MONOTONIC,
295 du->vkms.period_ns = ktime_set(0, vblank->framedur_ns);
296 hrtimer_start(&du->vkms.timer, du->vkms.period_ns, HRTIMER_MODE_REL);
310 hrtimer_cancel(&du->vkms.timer);
311 du->vkms.surface = NULL;
312 du->vkms.period_ns = ktime_set(0, 0);
326 atomic_set(&du->vkms.atomic_lock, VMW_VKMS_LOCK_UNLOCKED);
327 spin_lock_init(&du->vkms.crc_state_lock);
329 INIT_WORK(&du->vkms.crc_generator_work, crc_generate_worker);
330 du->vkms.surface = NULL;
338 if (du->vkms.surface)
339 vmw_surface_unreference(&du->vkms.surface);
340 WARN_ON(work_pending(&du->vkms.crc_generator_work));
341 hrtimer_cancel(&du->vkms.timer);
483 prev_enabled = du->vkms.crc_enabled;
484 du->vkms.crc_enabled = enabled;
501 if (vmw->vkms_enabled && du->vkms.surface != surf) {
502 WARN_ON(atomic_read(&du->vkms.atomic_lock) != VMW_VKMS_LOCK_MODESET);
503 if (du->vkms.surface)
504 vmw_surface_unreference(&du->vkms.surface);
506 du->vkms.surface = vmw_surface_reference(surf);
511 * vmw_vkms_lock_max_wait_ns - Return the max wait for the vkms lock
514 * Returns the maximum wait time used to acquire the vkms lock. By
521 s64 nsecs = ktime_to_ns(du->vkms.period_ns);
528 * @crtc: The crtc to lock for vkms
530 * This function prevents the VKMS timers/callbacks from being called
541 * of kms - so use an atomic_t to track which part of vkms has access
542 * to the basic vkms state.
554 ret = atomic_cmpxchg(&du->vkms.atomic_lock,
564 drm_warn(crtc->dev, "VKMS lock expired! total_delay = %lld, ret = %d, cur = %d\n",
565 total_delay, ret, atomic_read(&du->vkms.atomic_lock));
571 * @crtc: The crtc to lock for vkms
576 * Returns true if actually locked vkms to modeset or false otherwise.
588 ret = atomic_cmpxchg(&du->vkms.atomic_lock,
600 drm_warn(crtc->dev, "VKMS relaxed lock expired!\n");
609 * @crtc: The crtc to lock for vkms
611 * Tries to lock vkms for vblank, returns immediately.
613 * Returns true if locked vkms to vblank or false otherwise.
621 ret = atomic_cmpxchg(&du->vkms.atomic_lock,
634 atomic_set(&du->vkms.atomic_lock, VMW_VKMS_LOCK_UNLOCKED);