31 #define vmw_crtc_to_ldu(x) \
32 container_of(x, struct vmw_legacy_display_unit, base.crtc)
33 #define vmw_encoder_to_ldu(x) \
34 container_of(x, struct vmw_legacy_display_unit, base.encoder)
35 #define vmw_connector_to_ldu(x) \
36 container_of(x, struct vmw_legacy_display_unit, base.connector)
58 list_del_init(&ldu->
active);
88 crtc = &entry->
base.crtc;
89 w =
max(w, crtc->
x + crtc->
mode.hdisplay);
96 fb = entry->
base.crtc.fb;
102 if (!list_empty(&lds->
active)) {
104 fb = entry->
base.crtc.fb;
116 crtc = &entry->
base.crtc;
149 DRM_ERROR(
"Could not update cursor image\n");
155 static int vmw_ldu_del_active(
struct vmw_private *vmw_priv,
159 if (list_empty(&ldu->
active))
163 list_del_init(&ldu->
active);
167 ld->
fb->unpin(ld->
fb);
174 static int vmw_ldu_add_active(
struct vmw_private *vmw_priv,
184 if (ld->
fb && ld->
fb->unpin)
185 ld->
fb->unpin(ld->
fb);
191 if (!list_empty(&ldu->
active))
196 if (entry->
base.unit > ldu->
base.unit)
202 list_add(&ldu->
active, at);
209 static int vmw_ldu_crtc_set_config(
struct drm_mode_set *
set)
230 dev_priv = vmw_priv(crtc->
dev);
232 if (
set->num_connectors > 1) {
233 DRM_ERROR(
"to many connectors\n");
237 if (
set->num_connectors == 1 &&
238 set->connectors[0] != &ldu->
base.connector) {
239 DRM_ERROR(
"connector doesn't match %p %p\n",
240 set->connectors[0], &ldu->
base.connector);
245 if (dev_priv->
ldu_priv->fb && vfb &&
246 !(dev_priv->
ldu_priv->num_active == 1 &&
247 !list_empty(&ldu->
active)) &&
249 DRM_ERROR(
"Multiple framebuffers not supported\n");
254 connector = &ldu->
base.connector;
255 encoder = &ldu->
base.encoder;
258 if (
set->num_connectors == 0 || !
set->mode || !
set->fb) {
264 vmw_ldu_del_active(dev_priv, ldu);
266 return vmw_ldu_commit_list(dev_priv);
276 DRM_ERROR(
"set outside of framebuffer\n");
283 encoder->
crtc = crtc;
289 vmw_ldu_add_active(dev_priv, ldu, vfb);
291 return vmw_ldu_commit_list(dev_priv);
300 .destroy = vmw_ldu_crtc_destroy,
301 .set_config = vmw_ldu_crtc_set_config,
309 static void vmw_ldu_encoder_destroy(
struct drm_encoder *encoder)
315 .destroy = vmw_ldu_encoder_destroy,
322 static void vmw_ldu_connector_destroy(
struct drm_connector *connector)
334 .destroy = vmw_ldu_connector_destroy,
350 crtc = &ldu->
base.crtc;
351 encoder = &ldu->
base.encoder;
352 connector = &ldu->
base.connector;
354 INIT_LIST_HEAD(&ldu->
active);
356 ldu->
base.pref_active = (unit == 0);
360 ldu->
base.is_implicit =
true;
377 dev->mode_config.dirty_info_property,
389 DRM_INFO(
"ldu system already on\n");
397 INIT_LIST_HEAD(&dev_priv->
ldu_priv->active);
399 dev_priv->
ldu_priv->last_num_active = 0;
412 goto err_vblank_cleanup;
416 vmw_ldu_init(dev_priv, i);
418 vmw_ldu_init(dev_priv, 0);