Home | History | Annotate | Download | only in drm

Lines Matching refs:crtc

8  * DRM core CRTC related functions
61 * A CRTC represents the overall display pipeline. It receives pixel data from
63 * to the CRTC, specifying display timings. On the output side the data is fed
67 * To create a CRTC, a KMS drivers allocates and zeroes an instances of
71 * The CRTC is also the entry point for legacy modeset operations, see
80 * drm_crtc_from_index - find the registered CRTC at an index
82 * @idx: index of registered CRTC to find for
84 * Given a CRTC index, return the registered CRTC from DRM device's
92 struct drm_crtc *crtc;
94 drm_for_each_crtc(crtc, dev)
95 if (idx == crtc->index)
96 return crtc;
102 int drm_crtc_force_disable(struct drm_crtc *crtc)
105 .crtc = crtc,
108 WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
127 struct drm_crtc *crtc;
130 drm_for_each_crtc(crtc, dev) {
131 drm_debugfs_crtc_add(crtc);
133 if (crtc->funcs->late_register)
134 ret = crtc->funcs->late_register(crtc);
144 struct drm_crtc *crtc;
146 drm_for_each_crtc(crtc, dev) {
147 if (crtc->funcs->early_unregister)
148 crtc->funcs->early_unregister(crtc);
149 drm_debugfs_crtc_remove(crtc);
153 static int drm_crtc_crc_init(struct drm_crtc *crtc)
156 spin_lock_init(&crtc->crc.lock);
157 init_waitqueue_head(&crtc->crc.wq);
158 crtc->crc.source = kstrdup("auto", GFP_KERNEL);
159 if (!crtc->crc.source)
165 static void drm_crtc_crc_fini(struct drm_crtc *crtc)
168 kfree(crtc->crc.source);
182 struct drm_crtc *crtc = fence_to_crtc(fence);
184 return crtc->dev->driver->name;
189 struct drm_crtc *crtc = fence_to_crtc(fence);
191 return crtc->timeline_name;
199 struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc)
207 dma_fence_init(fence, &drm_crtc_fence_ops, &crtc->fence_lock,
208 crtc->fence_context, ++crtc->fence_seqno);
214 * drm_crtc_init_with_planes - Initialise a new CRTC object with
217 * @crtc: CRTC object to init
218 * @primary: Primary plane for CRTC
219 * @cursor: Cursor plane for CRTC
220 * @funcs: callbacks for the new CRTC
221 * @name: printf style format string for the CRTC name, or NULL for default name
223 * Inits a new object created as base part of a driver crtc object. Drivers
232 int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
244 /* crtc index is used with 32bit bitmasks */
252 crtc->dev = dev;
253 crtc->funcs = funcs;
255 INIT_LIST_HEAD(&crtc->commit_list);
256 spin_lock_init(&crtc->commit_lock);
258 drm_modeset_lock_init(&crtc->mutex);
259 ret = drm_mode_object_add(dev, &crtc->base, DRM_MODE_OBJECT_CRTC);
267 crtc->name = kvasprintf(GFP_KERNEL, name, ap);
270 crtc->name = kasprintf(GFP_KERNEL, "crtc-%d",
273 if (!crtc->name) {
274 drm_mode_object_unregister(dev, &crtc->base);
278 crtc->fence_context = dma_fence_context_alloc(1);
279 spin_lock_init(&crtc->fence_lock);
280 snprintf(crtc->timeline_name, sizeof(crtc->timeline_name),
281 "CRTC:%d-%s", crtc->base.id, crtc->name);
283 crtc->base.properties = &crtc->properties;
285 list_add_tail(&crtc->head, &config->crtc_list);
286 crtc->index = config->num_crtc++;
288 crtc->primary = primary;
289 crtc->cursor = cursor;
291 primary->possible_crtcs = drm_crtc_mask(crtc);
293 cursor->possible_crtcs = drm_crtc_mask(crtc);
295 ret = drm_crtc_crc_init(crtc);
297 drm_mode_object_unregister(dev, &crtc->base);
302 drm_object_attach_property(&crtc->base, config->prop_active, 0);
303 drm_object_attach_property(&crtc->base, config->prop_mode_id, 0);
304 drm_object_attach_property(&crtc->base,
306 drm_object_attach_property(&crtc->base,
315 * drm_crtc_cleanup - Clean up the core crtc usage
316 * @crtc: CRTC to cleanup
318 * This function cleans up @crtc and removes it from the DRM mode setting
319 * core. Note that the function does *not* free the crtc structure itself,
322 void drm_crtc_cleanup(struct drm_crtc *crtc)
324 struct drm_device *dev = crtc->dev;
331 drm_crtc_crc_fini(crtc);
333 kfree(crtc->gamma_store);
334 crtc->gamma_store = NULL;
336 drm_modeset_lock_fini(&crtc->mutex);
338 drm_mode_object_unregister(dev, &crtc->base);
339 list_del(&crtc->head);
342 WARN_ON(crtc->state && !crtc->funcs->atomic_destroy_state);
343 if (crtc->state && crtc->funcs->atomic_destroy_state)
344 crtc->funcs->atomic_destroy_state(crtc, crtc->state);
346 kfree(crtc->name);
348 memset(crtc, 0, sizeof(*crtc));
353 * drm_mode_getcrtc - get CRTC configuration
358 * Construct a CRTC configuration structure to return to the user.
369 struct drm_crtc *crtc;
375 crtc = drm_crtc_find(dev, file_priv, crtc_resp->crtc_id);
376 if (!crtc)
379 plane = crtc->primary;
381 crtc_resp->gamma_size = crtc->gamma_size;
397 drm_modeset_lock(&crtc->mutex, NULL);
398 if (crtc->state) {
399 if (crtc->state->enable) {
400 drm_mode_convert_to_umode(&crtc_resp->mode, &crtc->state->mode);
406 crtc_resp->x = crtc->x;
407 crtc_resp->y = crtc->y;
409 if (crtc->enabled) {
410 drm_mode_convert_to_umode(&crtc_resp->mode, &crtc->mode);
419 drm_modeset_unlock(&crtc->mutex);
427 struct drm_crtc *crtc = set->crtc;
432 WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));
439 drm_for_each_crtc(tmp, crtc->dev) {
447 ret = crtc->funcs->set_config(set, ctx);
449 struct drm_plane *plane = crtc->primary;
451 plane->crtc = fb ? crtc : NULL;
455 drm_for_each_crtc(tmp, crtc->dev) {
483 WARN_ON(drm_drv_uses_atomic_modeset(set->crtc->dev));
491 * CRTC viewport
492 * @crtc: CRTC that framebuffer will be displayed on
498 int drm_crtc_check_viewport(const struct drm_crtc *crtc,
508 if (crtc->state &&
509 drm_rotation_90_or_270(crtc->primary->state->rotation))
519 * drm_mode_setcrtc - set CRTC configuration
524 * Build a new CRTC configuration based on user request.
536 struct drm_crtc *crtc;
557 crtc = drm_crtc_find(dev, file_priv, crtc_req->crtc_id);
558 if (!crtc) {
559 DRM_DEBUG_KMS("Unknown CRTC ID %d\n", crtc_req->crtc_id);
562 DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
564 plane = crtc->primary;
570 mutex_lock(&crtc->dev->mode_config.mutex);
586 DRM_DEBUG_KMS("CRTC doesn't have current FB\n");
646 ret = drm_crtc_check_viewport(crtc, crtc_req->x, crtc_req->y,
706 set.crtc = crtc;
715 ret = crtc->funcs->set_config(&set, &ctx);
738 mutex_unlock(&crtc->dev->mode_config.mutex);
748 struct drm_crtc *crtc = obj_to_crtc(obj);
750 if (crtc->funcs->set_property)
751 ret = crtc->funcs->set_property(crtc, property, value);