26 #define to_omap_crtc(x) container_of(x, struct omap_crtc, base)
35 struct drm_pending_vblank_event *
event;
42 omap_crtc->
plane->funcs->destroy(omap_crtc->
plane);
57 if (plane->
crtc == crtc)
62 static bool omap_crtc_mode_fixup(
struct drm_crtc *crtc,
69 static int omap_crtc_mode_set(
struct drm_crtc *crtc,
84 static void omap_crtc_prepare(
struct drm_crtc *crtc)
91 static void omap_crtc_commit(
struct drm_crtc *crtc)
98 static int omap_crtc_mode_set_base(
struct drm_crtc *crtc,
int x,
int y,
105 return plane->
funcs->update_plane(plane, crtc, crtc->
fb,
111 static void omap_crtc_load_lut(
struct drm_crtc *crtc)
115 static void vblank_cb(
void *
arg)
121 struct drm_pending_vblank_event *
event = omap_crtc->
event;
143 event->event.sequence = sequence++;
144 event->event.tv_sec = now.tv_sec;
145 event->event.tv_usec = now.tv_usec;
147 &
event->base.file_priv->event_list);
149 spin_unlock_irqrestore(&dev->event_lock, flags);
153 static void page_flip_cb(
void *arg)
158 struct drm_gem_object *bo;
162 omap_crtc_mode_set_base(crtc, crtc->
x, crtc->
y, old_fb);
171 drm_gem_object_unreference_unlocked(bo);
174 static int omap_crtc_page_flip_locked(
struct drm_crtc *crtc,
176 struct drm_pending_vblank_event *
event)
180 struct drm_gem_object *bo;
182 DBG(
"%d -> %d", crtc->
fb ? crtc->
fb->base.id : -1, fb->
base.id);
184 if (omap_crtc->
event) {
185 dev_err(dev->dev,
"already a pending flip\n");
199 drm_gem_object_reference(bo);
206 static int omap_crtc_set_property(
struct drm_crtc *crtc,
222 .destroy = omap_crtc_destroy,
223 .page_flip = omap_crtc_page_flip_locked,
224 .set_property = omap_crtc_set_property,
228 .dpms = omap_crtc_dpms,
229 .mode_fixup = omap_crtc_mode_fixup,
230 .mode_set = omap_crtc_mode_set,
231 .prepare = omap_crtc_prepare,
232 .commit = omap_crtc_commit,
233 .mode_set_base = omap_crtc_mode_set_base,
234 .load_lut = omap_crtc_load_lut,
242 struct omap_crtc *omap_crtc = kzalloc(
sizeof(*omap_crtc),
GFP_KERNEL);
247 dev_err(dev->dev,
"could not allocate CRTC\n");
251 crtc = &omap_crtc->
base;
254 omap_crtc->
plane->crtc = crtc;
259 drm_crtc_helper_add(crtc, &omap_crtc_helper_funcs);
267 omap_crtc_destroy(crtc);