diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2011-11-02 04:43:11 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-11-07 08:15:18 -0500 |
commit | 6987427a3953c5038dc14d2a090b5a6c93669428 (patch) | |
tree | 9e97ef3e0f57aead819845961cb6b892df0ac4e6 /drivers/gpu/drm/vmwgfx | |
parent | 1543b4dd0c4b63975ffdadccd67c3a8805f28814 (diff) |
vmwgfx: Infrastructure for explicit placement
Make it possible to use explicit placement
(although not hooked up with a user-space interface yet)
and relax the single framebuffer limit to only apply to implicit placement.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 52 |
3 files changed, 30 insertions, 24 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h index 815cf99ce06e..af8e6e5bd964 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | |||
@@ -102,6 +102,7 @@ struct vmw_display_unit { | |||
102 | */ | 102 | */ |
103 | int gui_x; | 103 | int gui_x; |
104 | int gui_y; | 104 | int gui_y; |
105 | bool is_implicit; | ||
105 | }; | 106 | }; |
106 | 107 | ||
107 | #define vmw_crtc_to_du(x) \ | 108 | #define vmw_crtc_to_du(x) \ |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c index bbfe38194910..90c5e3928491 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | |||
@@ -337,6 +337,7 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit) | |||
337 | ldu->base.pref_width = 800; | 337 | ldu->base.pref_width = 800; |
338 | ldu->base.pref_height = 600; | 338 | ldu->base.pref_height = 600; |
339 | ldu->base.pref_mode = NULL; | 339 | ldu->base.pref_mode = NULL; |
340 | ldu->base.is_implicit = true; | ||
340 | 341 | ||
341 | drm_connector_init(dev, connector, &vmw_legacy_connector_funcs, | 342 | drm_connector_init(dev, connector, &vmw_legacy_connector_funcs, |
342 | DRM_MODE_CONNECTOR_VIRTUAL); | 343 | DRM_MODE_CONNECTOR_VIRTUAL); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c index ea6583433a16..4defdcf1c72e 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | |||
@@ -36,9 +36,9 @@ | |||
36 | container_of(x, struct vmw_screen_object_unit, base.connector) | 36 | container_of(x, struct vmw_screen_object_unit, base.connector) |
37 | 37 | ||
38 | struct vmw_screen_object_display { | 38 | struct vmw_screen_object_display { |
39 | unsigned num_active; | 39 | unsigned num_implicit; |
40 | 40 | ||
41 | struct vmw_framebuffer *fb; | 41 | struct vmw_framebuffer *implicit_fb; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | /** | 44 | /** |
@@ -51,7 +51,7 @@ struct vmw_screen_object_unit { | |||
51 | struct vmw_dma_buffer *buffer; /**< Backing store buffer */ | 51 | struct vmw_dma_buffer *buffer; /**< Backing store buffer */ |
52 | 52 | ||
53 | bool defined; | 53 | bool defined; |
54 | bool active; | 54 | bool active_implicit; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | static void vmw_sou_destroy(struct vmw_screen_object_unit *sou) | 57 | static void vmw_sou_destroy(struct vmw_screen_object_unit *sou) |
@@ -75,10 +75,10 @@ static void vmw_sou_del_active(struct vmw_private *vmw_priv, | |||
75 | { | 75 | { |
76 | struct vmw_screen_object_display *ld = vmw_priv->sou_priv; | 76 | struct vmw_screen_object_display *ld = vmw_priv->sou_priv; |
77 | 77 | ||
78 | if (sou->active) { | 78 | if (sou->active_implicit) { |
79 | if (--(ld->num_active) == 0) | 79 | if (--(ld->num_implicit) == 0) |
80 | ld->fb = NULL; | 80 | ld->implicit_fb = NULL; |
81 | sou->active = false; | 81 | sou->active_implicit = false; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
@@ -88,12 +88,12 @@ static void vmw_sou_add_active(struct vmw_private *vmw_priv, | |||
88 | { | 88 | { |
89 | struct vmw_screen_object_display *ld = vmw_priv->sou_priv; | 89 | struct vmw_screen_object_display *ld = vmw_priv->sou_priv; |
90 | 90 | ||
91 | BUG_ON(!ld->num_active && ld->fb); | 91 | BUG_ON(!ld->num_implicit && ld->implicit_fb); |
92 | 92 | ||
93 | if (!sou->active) { | 93 | if (!sou->active_implicit && sou->base.is_implicit) { |
94 | ld->fb = vfb; | 94 | ld->implicit_fb = vfb; |
95 | sou->active = true; | 95 | sou->active_implicit = true; |
96 | ld->num_active++; | 96 | ld->num_implicit++; |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
@@ -132,8 +132,13 @@ static int vmw_sou_fifo_create(struct vmw_private *dev_priv, | |||
132 | (sou->base.unit == 0 ? SVGA_SCREEN_IS_PRIMARY : 0); | 132 | (sou->base.unit == 0 ? SVGA_SCREEN_IS_PRIMARY : 0); |
133 | cmd->obj.size.width = mode->hdisplay; | 133 | cmd->obj.size.width = mode->hdisplay; |
134 | cmd->obj.size.height = mode->vdisplay; | 134 | cmd->obj.size.height = mode->vdisplay; |
135 | cmd->obj.root.x = x; | 135 | if (sou->base.is_implicit) { |
136 | cmd->obj.root.y = y; | 136 | cmd->obj.root.x = x; |
137 | cmd->obj.root.y = y; | ||
138 | } else { | ||
139 | cmd->obj.root.x = sou->base.gui_x; | ||
140 | cmd->obj.root.y = sou->base.gui_y; | ||
141 | } | ||
137 | 142 | ||
138 | /* Ok to assume that buffer is pinned in vram */ | 143 | /* Ok to assume that buffer is pinned in vram */ |
139 | vmw_bo_get_guest_ptr(&sou->buffer->base, &cmd->obj.backingStore.ptr); | 144 | vmw_bo_get_guest_ptr(&sou->buffer->base, &cmd->obj.backingStore.ptr); |
@@ -280,10 +285,11 @@ static int vmw_sou_crtc_set_config(struct drm_mode_set *set) | |||
280 | } | 285 | } |
281 | 286 | ||
282 | /* sou only supports one fb active at the time */ | 287 | /* sou only supports one fb active at the time */ |
283 | if (dev_priv->sou_priv->fb && vfb && | 288 | if (sou->base.is_implicit && |
284 | !(dev_priv->sou_priv->num_active == 1 && | 289 | dev_priv->sou_priv->implicit_fb && vfb && |
285 | sou->active) && | 290 | !(dev_priv->sou_priv->num_implicit == 1 && |
286 | dev_priv->sou_priv->fb != vfb) { | 291 | sou->active_implicit) && |
292 | dev_priv->sou_priv->implicit_fb != vfb) { | ||
287 | DRM_ERROR("Multiple framebuffers not supported\n"); | 293 | DRM_ERROR("Multiple framebuffers not supported\n"); |
288 | return -EINVAL; | 294 | return -EINVAL; |
289 | } | 295 | } |
@@ -439,12 +445,13 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit) | |||
439 | encoder = &sou->base.encoder; | 445 | encoder = &sou->base.encoder; |
440 | connector = &sou->base.connector; | 446 | connector = &sou->base.connector; |
441 | 447 | ||
442 | sou->active = false; | 448 | sou->active_implicit = false; |
443 | 449 | ||
444 | sou->base.pref_active = (unit == 0); | 450 | sou->base.pref_active = (unit == 0); |
445 | sou->base.pref_width = 800; | 451 | sou->base.pref_width = 800; |
446 | sou->base.pref_height = 600; | 452 | sou->base.pref_height = 600; |
447 | sou->base.pref_mode = NULL; | 453 | sou->base.pref_mode = NULL; |
454 | sou->base.is_implicit = true; | ||
448 | 455 | ||
449 | drm_connector_init(dev, connector, &vmw_legacy_connector_funcs, | 456 | drm_connector_init(dev, connector, &vmw_legacy_connector_funcs, |
450 | DRM_MODE_CONNECTOR_VIRTUAL); | 457 | DRM_MODE_CONNECTOR_VIRTUAL); |
@@ -488,8 +495,8 @@ int vmw_kms_init_screen_object_display(struct vmw_private *dev_priv) | |||
488 | if (unlikely(!dev_priv->sou_priv)) | 495 | if (unlikely(!dev_priv->sou_priv)) |
489 | goto err_no_mem; | 496 | goto err_no_mem; |
490 | 497 | ||
491 | dev_priv->sou_priv->num_active = 0; | 498 | dev_priv->sou_priv->num_implicit = 0; |
492 | dev_priv->sou_priv->fb = NULL; | 499 | dev_priv->sou_priv->implicit_fb = NULL; |
493 | 500 | ||
494 | ret = drm_vblank_init(dev, VMWGFX_NUM_DISPLAY_UNITS); | 501 | ret = drm_vblank_init(dev, VMWGFX_NUM_DISPLAY_UNITS); |
495 | if (unlikely(ret != 0)) | 502 | if (unlikely(ret != 0)) |
@@ -524,9 +531,6 @@ int vmw_kms_close_screen_object_display(struct vmw_private *dev_priv) | |||
524 | 531 | ||
525 | drm_vblank_cleanup(dev); | 532 | drm_vblank_cleanup(dev); |
526 | 533 | ||
527 | if (dev_priv->sou_priv->num_active > 0) | ||
528 | DRM_ERROR("Still have active outputs when unloading driver"); | ||
529 | |||
530 | kfree(dev_priv->sou_priv); | 534 | kfree(dev_priv->sou_priv); |
531 | 535 | ||
532 | return 0; | 536 | return 0; |