diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2011-10-31 10:50:09 +0100 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2011-10-31 15:27:12 +0100 |
commit | cc7c1c961b77c139b95fbb6948204def1b4b908a (patch) | |
tree | 72960207eb10dd617ee39965657e23861845d94a /vmwgfx/vmwgfx_output.c | |
parent | 427064b57c52c8881c7a64d9c9e21411e79e644b (diff) |
vmwgfx: Fall back to sw cursors if needed
If there is a risc that we need two simultaneous cursors,
(two outputs showing the same contents, at least one of them explicit),
fall back to sw cursor.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Diffstat (limited to 'vmwgfx/vmwgfx_output.c')
-rw-r--r-- | vmwgfx/vmwgfx_output.c | 102 |
1 files changed, 92 insertions, 10 deletions
diff --git a/vmwgfx/vmwgfx_output.c b/vmwgfx/vmwgfx_output.c index d0f238d..1a0835d 100644 --- a/vmwgfx/vmwgfx_output.c +++ b/vmwgfx/vmwgfx_output.c @@ -56,6 +56,8 @@ struct output_private drmModeConnectorPtr drm_connector; int c; + + Bool is_implicit; }; static char *output_enum_list[] = { @@ -237,6 +239,75 @@ static const xf86OutputFuncsRec output_funcs = { .destroy = output_destroy, }; +/** + * vmwgfx_output_explicit_overlap -- Check for explicit output overlaps + * + * This function returns TRUE iff the bounding box in screen space of an + * exlplicit output overlaps the bounding box in screen space of any other + * output. + */ +Bool +vmwgfx_output_explicit_overlap(ScrnInfoPtr pScrn) +{ + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + xf86OutputPtr output; + ScreenPtr pScreen = pScrn->pScreen; + RegionRec output_union; + RegionRec cur_output; + RegionRec result; + struct output_private *priv; + xf86CrtcPtr crtc; + Bool overlap = FALSE; + int i; + + (void) pScreen; + REGION_NULL(pScreen, &output_union); + REGION_NULL(pScreen, &cur_output); + REGION_NULL(pScreen, &result); + + /* + * Collect a region of implicit outputs. These may overlap. + */ + for (i = 0; i < config->num_output; i++) { + output = config->output[i]; + priv = output->driver_private; + crtc = output->crtc; + + if (!crtc || !crtc->enabled || !priv->is_implicit) + continue; + + REGION_RESET(pScreen, &cur_output, &crtc->bounds); + REGION_UNION(pScreen, &output_union, &output_union, &cur_output); + } + + /* + * Explicit outputs may not overlap any other output. + */ + for (i = 0; i < config->num_output; i++) { + output = config->output[i]; + priv = output->driver_private; + crtc = output->crtc; + + if (!crtc || !crtc->enabled || priv->is_implicit) + continue; + + REGION_RESET(pScreen, &cur_output, &crtc->bounds); + REGION_NULL(pScreen, &result); + REGION_INTERSECT(pScreen, &result, &output_union, &cur_output); + overlap = REGION_NOTEMPTY(vsaa->pScreen, &result); + if (overlap) + break; + + REGION_UNION(pScreen, &output_union, &output_union, &cur_output); + } + + REGION_UNINIT(pScreen, &output_union); + REGION_UNINIT(pScreen, &cur_output); + REGION_UNINIT(pScreen, &result); + + return overlap; +} + void xorg_output_init(ScrnInfoPtr pScrn) { @@ -247,7 +318,7 @@ xorg_output_init(ScrnInfoPtr pScrn) drmModeEncoderPtr drm_encoder = NULL; struct output_private *priv; char name[32]; - int c, v, p; + int c, p; res = drmModeGetResources(ms->fd); if (res == 0) { @@ -256,28 +327,37 @@ xorg_output_init(ScrnInfoPtr pScrn) } for (c = 0; c < res->count_connectors; c++) { + Bool is_implicit = TRUE; + drm_connector = drmModeGetConnector(ms->fd, res->connectors[c]); if (!drm_connector) goto out; -#if 0 + for (p = 0; p < drm_connector->count_props; p++) { drmModePropertyPtr prop; prop = drmModeGetProperty(ms->fd, drm_connector->props[p]); - name = NULL; if (prop) { - ErrorF("VALUES %d\n", prop->count_values); - for (v = 0; v < prop->count_values; v++) - ErrorF("%s %lld\n", prop->name, prop->values[v]); +#if 0 + /* + * Disabled until we sort out what the interface should + * look like. + */ + + if (strcmp(prop->name, "implicit placement") == 0) { + drmModeConnectorSetProperty(ms->fd, + drm_connector->connector_id, + prop->prop_id, + 0); + is_implicit = FALSE; + } +#endif + drmModeFreeProperty(prop); } } -#else - (void)p; - (void)v; -#endif if (drm_connector->connector_type >= sizeof(output_enum_list) / sizeof(output_enum_list[0])) @@ -299,6 +379,8 @@ xorg_output_init(ScrnInfoPtr pScrn) continue; } + priv->is_implicit = is_implicit; + drm_encoder = drmModeGetEncoder(ms->fd, drm_connector->encoders[0]); if (drm_encoder) { output->possible_crtcs = drm_encoder->possible_crtcs; |