31 #define vmw_crtc_to_sou(x) \
32 container_of(x, struct vmw_screen_object_unit, base.crtc)
33 #define vmw_encoder_to_sou(x) \
34 container_of(x, struct vmw_screen_object_unit, base.encoder)
35 #define vmw_connector_to_sou(x) \
36 container_of(x, struct vmw_screen_object_unit, base.connector)
73 static void vmw_sou_del_active(
struct vmw_private *vmw_priv,
85 static void vmw_sou_add_active(
struct vmw_private *vmw_priv,
119 fifo_size =
sizeof(*cmd);
123 DRM_ERROR(
"Fifo reserve failed.\n");
135 if (sou->
base.is_implicit) {
139 cmd->obj.root.x = sou->
base.gui_x;
140 cmd->obj.root.y = sou->
base.gui_y;
157 static int vmw_sou_fifo_destroy(
struct vmw_private *dev_priv,
174 fifo_size =
sizeof(*cmd);
178 DRM_ERROR(
"Fifo reserve failed.\n");
184 cmd->body.screenId = sou->
base.unit;
191 DRM_ERROR(
"Failed to sync with HW");
201 static void vmw_sou_backing_free(
struct vmw_private *dev_priv,
218 static int vmw_sou_backing_alloc(
struct vmw_private *dev_priv,
228 vmw_sou_backing_free(dev_priv, sou);
251 static int vmw_sou_crtc_set_config(
struct drm_mode_set *
set)
273 dev_priv = vmw_priv(crtc->
dev);
275 if (
set->num_connectors > 1) {
276 DRM_ERROR(
"to many connectors\n");
280 if (
set->num_connectors == 1 &&
281 set->connectors[0] != &sou->
base.connector) {
282 DRM_ERROR(
"connector doesn't match %p %p\n",
283 set->connectors[0], &sou->
base.connector);
288 if (sou->
base.is_implicit &&
289 dev_priv->
sou_priv->implicit_fb && vfb &&
290 !(dev_priv->
sou_priv->num_implicit == 1 &&
292 dev_priv->
sou_priv->implicit_fb != vfb) {
293 DRM_ERROR(
"Multiple framebuffers not supported\n");
298 connector = &sou->
base.connector;
299 encoder = &sou->
base.encoder;
302 if (
set->num_connectors == 0 || !
set->mode || !
set->fb) {
303 ret = vmw_sou_fifo_destroy(dev_priv, sou);
314 vmw_sou_del_active(dev_priv, sou);
316 vmw_sou_backing_free(dev_priv, sou);
328 DRM_ERROR(
"set outside of framebuffer\n");
340 ret = vmw_sou_fifo_destroy(dev_priv, sou);
345 vmw_sou_backing_free(dev_priv, sou);
351 ret = vmw_sou_backing_alloc(dev_priv, sou, size);
356 ret = vmw_sou_fifo_create(dev_priv, sou,
set->x,
set->y, mode);
377 vmw_sou_add_active(dev_priv, sou, vfb);
380 encoder->
crtc = crtc;
395 .destroy = vmw_sou_crtc_destroy,
396 .set_config = vmw_sou_crtc_set_config,
404 static void vmw_sou_encoder_destroy(
struct drm_encoder *encoder)
410 .destroy = vmw_sou_encoder_destroy,
417 static void vmw_sou_connector_destroy(
struct drm_connector *connector)
429 .destroy = vmw_sou_connector_destroy,
445 crtc = &sou->
base.crtc;
446 encoder = &sou->
base.encoder;
447 connector = &sou->
base.connector;
451 sou->
base.pref_active = (unit == 0);
455 sou->
base.is_implicit =
true;
472 dev->mode_config.dirty_info_property,
484 DRM_INFO(
"sou system already on\n");
489 DRM_INFO(
"Not using screen objects,"
490 " missing cap SCREEN_OBJECT_2\n");
499 dev_priv->
sou_priv->num_implicit = 0;
508 goto err_vblank_cleanup;
511 vmw_sou_init(dev_priv, i);
513 DRM_INFO(
"Screen objects system initialized\n");
549 if (!sou->
base.is_implicit)
552 if (dev_priv->
sou_priv->num_implicit != 1)