Lines Matching defs:crc
54 * file dri/0/crtc-N/crc/control in debugfs, with N being the index of the CRTC.
60 * the dri/0/crtc-N/crc/data file. Each line in that file contains the frame
105 if (strcmp(sources[i], crtc->crc.source))
114 seq_printf(m, "%s*\n", crtc->crc.source);
130 struct drm_crtc_crc *crc = &crtc->crc;
139 DRM_DEBUG_KMS("Expected < %lu bytes into crtc crc control\n",
155 spin_lock_irq(&crc->lock);
157 if (crc->opened) {
158 spin_unlock_irq(&crc->lock);
163 kfree(crc->source);
164 crc->source = source;
166 spin_unlock_irq(&crc->lock);
181 static int crtc_crc_data_count(struct drm_crtc_crc *crc)
183 assert_spin_locked(&crc->lock);
184 return CIRC_CNT(crc->head, crc->tail, DRM_CRC_ENTRIES_NR);
187 static void crtc_crc_cleanup(struct drm_crtc_crc *crc)
189 kfree(crc->entries);
190 crc->overflow = false;
191 crc->entries = NULL;
192 crc->head = 0;
193 crc->tail = 0;
194 crc->values_cnt = 0;
195 crc->opened = false;
201 struct drm_crtc_crc *crc = &crtc->crc;
219 ret = crtc->funcs->verify_crc_source(crtc, crc->source, &values_cnt);
233 spin_lock_irq(&crc->lock);
234 if (!crc->opened) {
235 crc->opened = true;
236 crc->entries = entries;
237 crc->values_cnt = values_cnt;
241 spin_unlock_irq(&crc->lock);
248 ret = crtc->funcs->set_crc_source(crtc, crc->source);
255 spin_lock_irq(&crc->lock);
256 crtc_crc_cleanup(crc);
257 spin_unlock_irq(&crc->lock);
264 struct drm_crtc_crc *crc = &crtc->crc;
267 spin_lock_irq(&crc->lock);
268 crc->opened = false;
269 spin_unlock_irq(&crc->lock);
273 spin_lock_irq(&crc->lock);
274 crtc_crc_cleanup(crc);
275 spin_unlock_irq(&crc->lock);
291 struct drm_crtc_crc *crc = &crtc->crc;
296 spin_lock_irq(&crc->lock);
298 if (!crc->source) {
299 spin_unlock_irq(&crc->lock);
304 while (crtc_crc_data_count(crc) == 0) {
306 spin_unlock_irq(&crc->lock);
310 ret = wait_event_interruptible_lock_irq(crc->wq,
311 crtc_crc_data_count(crc),
312 crc->lock);
314 spin_unlock_irq(&crc->lock);
320 entry = &crc->entries[crc->tail];
322 if (count < LINE_LEN(crc->values_cnt)) {
323 spin_unlock_irq(&crc->lock);
328 crc->tail = (crc->tail + 1) & (DRM_CRC_ENTRIES_NR - 1);
330 spin_unlock_irq(&crc->lock);
337 for (i = 0; i < crc->values_cnt; i++)
339 sprintf(buf + 10 + crc->values_cnt * 11, "\n");
341 if (copy_to_user(user_buf, buf, LINE_LEN(crc->values_cnt)))
344 return LINE_LEN(crc->values_cnt);
350 struct drm_crtc_crc *crc = &crtc->crc;
353 poll_wait(file, &crc->wq, wait);
355 spin_lock_irq(&crc->lock);
356 if (crc->source && crtc_crc_data_count(crc))
358 spin_unlock_irq(&crc->lock);
378 crc_ent = debugfs_create_dir("crc", crtc->debugfs_entry);
399 struct drm_crtc_crc *crc = &crtc->crc;
404 spin_lock_irqsave(&crc->lock, flags);
407 if (!crc->entries) {
408 spin_unlock_irqrestore(&crc->lock, flags);
412 head = crc->head;
413 tail = crc->tail;
416 bool was_overflow = crc->overflow;
418 crc->overflow = true;
419 spin_unlock_irqrestore(&crc->lock, flags);
427 entry = &crc->entries[head];
430 memcpy(&entry->crcs, crcs, sizeof(*crcs) * crc->values_cnt);
433 crc->head = head;
435 spin_unlock_irqrestore(&crc->lock, flags);
437 wake_up_interruptible(&crc->wq);