Lines Matching defs:gdrm

152 static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb,
157 u8 compression = gdrm->compression;
164 if (len > gdrm->bulk_len)
170 buf = gdrm->compress_buf;
172 buf = gdrm->bulk_buf;
215 complen = LZ4_compress_default(buf, gdrm->bulk_buf, len, len, gdrm->lz4_comp_mem);
240 static int gud_usb_bulk(struct gud_device *gdrm, size_t len)
245 ret = usb_sg_init(&ctx.sgr, gud_to_usb_device(gdrm), gdrm->bulk_pipe, 0,
246 gdrm->bulk_sgt.sgl, gdrm->bulk_sgt.nents, len, GFP_KERNEL);
267 static int gud_flush_rect(struct gud_device *gdrm, struct drm_framebuffer *fb,
275 drm_dbg(&gdrm->drm, "Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
277 ret = gud_prep_flush(gdrm, fb, src, cached_reads, format, rect, &req);
288 gdrm->stats_length += len;
290 if (gdrm->stats_length <= len && gdrm->stats_actual_length) {
291 gdrm->stats_length = len;
292 gdrm->stats_actual_length = 0;
294 gdrm->stats_actual_length += trlen;
296 if (!(gdrm->flags & GUD_DISPLAY_FLAG_FULL_UPDATE) || gdrm->prev_flush_failed) {
297 ret = gud_usb_set(gdrm, GUD_REQ_SET_BUFFER, 0, &req, sizeof(req));
302 ret = gud_usb_bulk(gdrm, trlen);
304 gdrm->stats_num_errors++;
309 void gud_clear_damage(struct gud_device *gdrm)
311 gdrm->damage.x1 = INT_MAX;
312 gdrm->damage.y1 = INT_MAX;
313 gdrm->damage.x2 = 0;
314 gdrm->damage.y2 = 0;
317 static void gud_flush_damage(struct gud_device *gdrm, struct drm_framebuffer *fb,
327 if (format->format == DRM_FORMAT_XRGB8888 && gdrm->xrgb8888_emulation_format)
328 format = gdrm->xrgb8888_emulation_format;
334 if (gdrm->bulk_len < lines * pitch)
335 lines = gdrm->bulk_len / pitch;
343 ret = gud_flush_rect(gdrm, fb, src, cached_reads, format, &rect);
349 gdrm->prev_flush_failed = true;
357 struct gud_device *gdrm = container_of(work, struct gud_device, work);
363 if (!drm_dev_enter(&gdrm->drm, &idx))
366 mutex_lock(&gdrm->damage_lock);
367 fb = gdrm->fb;
368 gdrm->fb = NULL;
369 iosys_map_set_vaddr(&shadow_map, gdrm->shadow_buf);
370 damage = gdrm->damage;
371 gud_clear_damage(gdrm);
372 mutex_unlock(&gdrm->damage_lock);
377 gud_flush_damage(gdrm, fb, &shadow_map, true, &damage);
384 static int gud_fb_queue_damage(struct gud_device *gdrm, struct drm_framebuffer *fb,
390 mutex_lock(&gdrm->damage_lock);
392 if (!gdrm->shadow_buf) {
393 gdrm->shadow_buf = vcalloc(fb->pitches[0], fb->height);
394 if (!gdrm->shadow_buf) {
395 mutex_unlock(&gdrm->damage_lock);
400 iosys_map_set_vaddr(&shadow_map, gdrm->shadow_buf);
404 if (fb != gdrm->fb) {
405 old_fb = gdrm->fb;
407 gdrm->fb = fb;
410 gdrm->damage.x1 = min(gdrm->damage.x1, damage->x1);
411 gdrm->damage.y1 = min(gdrm->damage.y1, damage->y1);
412 gdrm->damage.x2 = max(gdrm->damage.x2, damage->x2);
413 gdrm->damage.y2 = max(gdrm->damage.y2, damage->y2);
415 mutex_unlock(&gdrm->damage_lock);
417 queue_work(system_long_wq, &gdrm->work);
425 static void gud_fb_handle_damage(struct gud_device *gdrm, struct drm_framebuffer *fb,
430 if (gdrm->flags & GUD_DISPLAY_FLAG_FULL_UPDATE)
434 ret = gud_fb_queue_damage(gdrm, fb, src, damage);
440 gud_flush_damage(gdrm, fb, src, !fb->obj[0]->import_attach, damage);
447 struct gud_device *gdrm = to_gud_device(pipe->crtc.dev);
477 if (format->format == DRM_FORMAT_XRGB8888 && gdrm->xrgb8888_emulation_format)
478 format = gdrm->xrgb8888_emulation_format;
526 for (i = 0; i < gdrm->num_properties; i++) {
527 u16 prop = gdrm->properties[i];
548 ret = gud_usb_set(gdrm, GUD_REQ_SET_STATE_CHECK, 0, req, len);
563 struct gud_device *gdrm = to_gud_device(drm);
572 cancel_work_sync(&gdrm->work);
573 mutex_lock(&gdrm->damage_lock);
574 if (gdrm->fb) {
575 drm_framebuffer_put(gdrm->fb);
576 gdrm->fb = NULL;
578 gud_clear_damage(gdrm);
579 vfree(gdrm->shadow_buf);
580 gdrm->shadow_buf = NULL;
581 mutex_unlock(&gdrm->damage_lock);
588 gud_usb_set_u8(gdrm, GUD_REQ_SET_CONTROLLER_ENABLE, 1);
591 gud_usb_set(gdrm, GUD_REQ_SET_STATE_COMMIT, 0, NULL, 0);
594 gud_usb_set_u8(gdrm, GUD_REQ_SET_DISPLAY_ENABLE, crtc->state->active);
604 gud_fb_handle_damage(gdrm, fb, &shadow_plane_state->data[0], &damage);
610 gud_usb_set_u8(gdrm, GUD_REQ_SET_CONTROLLER_ENABLE, 0);