Lines Matching full:cursor
52 * STI Cursor structure
56 * @regs: cursor registers
57 * @width: cursor width
58 * @height: cursor height
61 * @pixmap: pixmap dma buffer (clut8-format cursor)
81 readl(cursor->regs + reg))
94 struct sti_cursor *cursor, u32 val) in cursor_dbg_pml() argument
96 if (cursor->pixmap.paddr == val) in cursor_dbg_pml()
97 seq_printf(s, "\tVirt @: %p", cursor->pixmap.base); in cursor_dbg_pml()
101 struct sti_cursor *cursor, u32 val) in cursor_dbg_cml() argument
103 if (cursor->clut_paddr == val) in cursor_dbg_cml()
104 seq_printf(s, "\tVirt @: %p", cursor->clut); in cursor_dbg_cml()
110 struct sti_cursor *cursor = (struct sti_cursor *)node->info_ent->data; in cursor_dbg_show() local
113 sti_plane_to_str(&cursor->plane), cursor->regs); in cursor_dbg_show()
117 cursor_dbg_vpo(s, readl(cursor->regs + CUR_VPO)); in cursor_dbg_show()
119 cursor_dbg_pml(s, cursor, readl(cursor->regs + CUR_PML)); in cursor_dbg_show()
122 cursor_dbg_size(s, readl(cursor->regs + CUR_SIZE)); in cursor_dbg_show()
124 cursor_dbg_cml(s, cursor, readl(cursor->regs + CUR_CML)); in cursor_dbg_show()
132 { "cursor", cursor_dbg_show, 0, NULL },
135 static void cursor_debugfs_init(struct sti_cursor *cursor, in cursor_debugfs_init() argument
141 cursor_debugfs_files[i].data = cursor; in cursor_debugfs_init()
148 static void sti_cursor_argb8888_to_clut8(struct sti_cursor *cursor, u32 *src) in sti_cursor_argb8888_to_clut8() argument
150 u8 *dst = cursor->pixmap.base; in sti_cursor_argb8888_to_clut8()
154 for (i = 0; i < cursor->height; i++) { in sti_cursor_argb8888_to_clut8()
155 for (j = 0; j < cursor->width; j++) { in sti_cursor_argb8888_to_clut8()
168 static void sti_cursor_init(struct sti_cursor *cursor) in sti_cursor_init() argument
170 unsigned short *base = cursor->clut; in sti_cursor_init()
190 struct sti_cursor *cursor = to_sti_cursor(plane); in sti_cursor_atomic_check() local
218 DRM_ERROR("Invalid cursor size (%dx%d)\n", in sti_cursor_atomic_check()
223 /* If the cursor size has changed, re-allocated the pixmap */ in sti_cursor_atomic_check()
224 if (!cursor->pixmap.base || in sti_cursor_atomic_check()
225 (cursor->width != src_w) || in sti_cursor_atomic_check()
226 (cursor->height != src_h)) { in sti_cursor_atomic_check()
227 cursor->width = src_w; in sti_cursor_atomic_check()
228 cursor->height = src_h; in sti_cursor_atomic_check()
230 if (cursor->pixmap.base) in sti_cursor_atomic_check()
231 dma_free_wc(cursor->dev, cursor->pixmap.size, in sti_cursor_atomic_check()
232 cursor->pixmap.base, cursor->pixmap.paddr); in sti_cursor_atomic_check()
234 cursor->pixmap.size = cursor->width * cursor->height; in sti_cursor_atomic_check()
236 cursor->pixmap.base = dma_alloc_wc(cursor->dev, in sti_cursor_atomic_check()
237 cursor->pixmap.size, in sti_cursor_atomic_check()
238 &cursor->pixmap.paddr, in sti_cursor_atomic_check()
240 if (!cursor->pixmap.base) { in sti_cursor_atomic_check()
265 struct sti_cursor *cursor = to_sti_cursor(plane); in sti_cursor_atomic_update() local
284 sti_cursor_argb8888_to_clut8(cursor, (u32 *)dma_obj->vaddr); in sti_cursor_atomic_update()
290 writel(val, cursor->regs + CUR_AWS); in sti_cursor_atomic_update()
294 writel(val, cursor->regs + CUR_AWE); in sti_cursor_atomic_update()
297 writel(cursor->pixmap.paddr, cursor->regs + CUR_PML); in sti_cursor_atomic_update()
298 writel(cursor->width, cursor->regs + CUR_PMP); in sti_cursor_atomic_update()
299 writel(cursor->height << 16 | cursor->width, cursor->regs + CUR_SIZE); in sti_cursor_atomic_update()
303 writel((y << 16) | x, cursor->regs + CUR_VPO); in sti_cursor_atomic_update()
306 writel(cursor->clut_paddr, cursor->regs + CUR_CML); in sti_cursor_atomic_update()
307 writel(CUR_CTL_CLUT_UPDATE, cursor->regs + CUR_CTL); in sti_cursor_atomic_update()
344 struct sti_cursor *cursor = to_sti_cursor(plane); in sti_cursor_late_register() local
346 cursor_debugfs_init(cursor, drm_plane->dev->primary); in sti_cursor_late_register()
366 struct sti_cursor *cursor; in sti_cursor_create() local
370 cursor = devm_kzalloc(dev, sizeof(*cursor), GFP_KERNEL); in sti_cursor_create()
371 if (!cursor) { in sti_cursor_create()
372 DRM_ERROR("Failed to allocate memory for cursor\n"); in sti_cursor_create()
378 cursor->clut = dma_alloc_wc(dev, size, &cursor->clut_paddr, in sti_cursor_create()
381 if (!cursor->clut) { in sti_cursor_create()
382 DRM_ERROR("Failed to allocate memory for cursor clut\n"); in sti_cursor_create()
386 cursor->dev = dev; in sti_cursor_create()
387 cursor->regs = baseaddr; in sti_cursor_create()
388 cursor->plane.desc = desc; in sti_cursor_create()
389 cursor->plane.status = STI_PLANE_DISABLED; in sti_cursor_create()
391 sti_cursor_init(cursor); in sti_cursor_create()
393 res = drm_universal_plane_init(drm_dev, &cursor->plane.drm_plane, in sti_cursor_create()
404 drm_plane_helper_add(&cursor->plane.drm_plane, in sti_cursor_create()
407 sti_plane_init_property(&cursor->plane, DRM_PLANE_TYPE_CURSOR); in sti_cursor_create()
409 return &cursor->plane.drm_plane; in sti_cursor_create()
412 dma_free_wc(dev, size, cursor->clut, cursor->clut_paddr); in sti_cursor_create()
414 devm_kfree(dev, cursor); in sti_cursor_create()