diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2011-11-02 04:43:09 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-11-07 08:14:31 -0500 |
commit | 0e708bc5d6403d1a64a0e4155f1b91e318318989 (patch) | |
tree | 896ab31125b0e5acc3295a7f7949cdb73bfdbdb9 | |
parent | d4528b846ec8ba7ccf3116f1c2157c5e14ba46f3 (diff) |
vmwgfx: Remove screen object active list
It isn't used for anything. Replace with an active bool.
Also make a couple of functions return void instead of int
since their return value wasn't checked anyway.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakbo Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 52 |
1 files changed, 15 insertions, 37 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c index edfecc79d957..ea6583433a16 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | |||
@@ -36,8 +36,6 @@ | |||
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 | struct list_head active; | ||
40 | |||
41 | unsigned num_active; | 39 | unsigned num_active; |
42 | 40 | ||
43 | struct vmw_framebuffer *fb; | 41 | struct vmw_framebuffer *fb; |
@@ -53,13 +51,11 @@ struct vmw_screen_object_unit { | |||
53 | struct vmw_dma_buffer *buffer; /**< Backing store buffer */ | 51 | struct vmw_dma_buffer *buffer; /**< Backing store buffer */ |
54 | 52 | ||
55 | bool defined; | 53 | bool defined; |
56 | 54 | bool active; | |
57 | struct list_head active; | ||
58 | }; | 55 | }; |
59 | 56 | ||
60 | static void vmw_sou_destroy(struct vmw_screen_object_unit *sou) | 57 | static void vmw_sou_destroy(struct vmw_screen_object_unit *sou) |
61 | { | 58 | { |
62 | list_del_init(&sou->active); | ||
63 | vmw_display_unit_cleanup(&sou->base); | 59 | vmw_display_unit_cleanup(&sou->base); |
64 | kfree(sou); | 60 | kfree(sou); |
65 | } | 61 | } |
@@ -74,48 +70,31 @@ static void vmw_sou_crtc_destroy(struct drm_crtc *crtc) | |||
74 | vmw_sou_destroy(vmw_crtc_to_sou(crtc)); | 70 | vmw_sou_destroy(vmw_crtc_to_sou(crtc)); |
75 | } | 71 | } |
76 | 72 | ||
77 | static int vmw_sou_del_active(struct vmw_private *vmw_priv, | 73 | static void vmw_sou_del_active(struct vmw_private *vmw_priv, |
78 | struct vmw_screen_object_unit *sou) | 74 | struct vmw_screen_object_unit *sou) |
79 | { | 75 | { |
80 | struct vmw_screen_object_display *ld = vmw_priv->sou_priv; | 76 | struct vmw_screen_object_display *ld = vmw_priv->sou_priv; |
81 | if (list_empty(&sou->active)) | ||
82 | return 0; | ||
83 | |||
84 | /* Must init otherwise list_empty(&sou->active) will not work. */ | ||
85 | list_del_init(&sou->active); | ||
86 | if (--(ld->num_active) == 0) | ||
87 | ld->fb = NULL; | ||
88 | 77 | ||
89 | return 0; | 78 | if (sou->active) { |
79 | if (--(ld->num_active) == 0) | ||
80 | ld->fb = NULL; | ||
81 | sou->active = false; | ||
82 | } | ||
90 | } | 83 | } |
91 | 84 | ||
92 | static int vmw_sou_add_active(struct vmw_private *vmw_priv, | 85 | static void vmw_sou_add_active(struct vmw_private *vmw_priv, |
93 | struct vmw_screen_object_unit *sou, | 86 | struct vmw_screen_object_unit *sou, |
94 | struct vmw_framebuffer *vfb) | 87 | struct vmw_framebuffer *vfb) |
95 | { | 88 | { |
96 | struct vmw_screen_object_display *ld = vmw_priv->sou_priv; | 89 | struct vmw_screen_object_display *ld = vmw_priv->sou_priv; |
97 | struct vmw_screen_object_unit *entry; | ||
98 | struct list_head *at; | ||
99 | 90 | ||
100 | BUG_ON(!ld->num_active && ld->fb); | 91 | BUG_ON(!ld->num_active && ld->fb); |
101 | ld->fb = vfb; | ||
102 | 92 | ||
103 | if (!list_empty(&sou->active)) | 93 | if (!sou->active) { |
104 | return 0; | 94 | ld->fb = vfb; |
105 | 95 | sou->active = true; | |
106 | at = &ld->active; | 96 | ld->num_active++; |
107 | list_for_each_entry(entry, &ld->active, active) { | ||
108 | if (entry->base.unit > sou->base.unit) | ||
109 | break; | ||
110 | |||
111 | at = &entry->active; | ||
112 | } | 97 | } |
113 | |||
114 | list_add(&sou->active, at); | ||
115 | |||
116 | ld->num_active++; | ||
117 | |||
118 | return 0; | ||
119 | } | 98 | } |
120 | 99 | ||
121 | /** | 100 | /** |
@@ -303,7 +282,7 @@ static int vmw_sou_crtc_set_config(struct drm_mode_set *set) | |||
303 | /* sou only supports one fb active at the time */ | 282 | /* sou only supports one fb active at the time */ |
304 | if (dev_priv->sou_priv->fb && vfb && | 283 | if (dev_priv->sou_priv->fb && vfb && |
305 | !(dev_priv->sou_priv->num_active == 1 && | 284 | !(dev_priv->sou_priv->num_active == 1 && |
306 | !list_empty(&sou->active)) && | 285 | sou->active) && |
307 | dev_priv->sou_priv->fb != vfb) { | 286 | dev_priv->sou_priv->fb != vfb) { |
308 | DRM_ERROR("Multiple framebuffers not supported\n"); | 287 | DRM_ERROR("Multiple framebuffers not supported\n"); |
309 | return -EINVAL; | 288 | return -EINVAL; |
@@ -460,7 +439,7 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit) | |||
460 | encoder = &sou->base.encoder; | 439 | encoder = &sou->base.encoder; |
461 | connector = &sou->base.connector; | 440 | connector = &sou->base.connector; |
462 | 441 | ||
463 | INIT_LIST_HEAD(&sou->active); | 442 | sou->active = false; |
464 | 443 | ||
465 | sou->base.pref_active = (unit == 0); | 444 | sou->base.pref_active = (unit == 0); |
466 | sou->base.pref_width = 800; | 445 | sou->base.pref_width = 800; |
@@ -509,7 +488,6 @@ int vmw_kms_init_screen_object_display(struct vmw_private *dev_priv) | |||
509 | if (unlikely(!dev_priv->sou_priv)) | 488 | if (unlikely(!dev_priv->sou_priv)) |
510 | goto err_no_mem; | 489 | goto err_no_mem; |
511 | 490 | ||
512 | INIT_LIST_HEAD(&dev_priv->sou_priv->active); | ||
513 | dev_priv->sou_priv->num_active = 0; | 491 | dev_priv->sou_priv->num_active = 0; |
514 | dev_priv->sou_priv->fb = NULL; | 492 | dev_priv->sou_priv->fb = NULL; |
515 | 493 | ||
@@ -546,7 +524,7 @@ int vmw_kms_close_screen_object_display(struct vmw_private *dev_priv) | |||
546 | 524 | ||
547 | drm_vblank_cleanup(dev); | 525 | drm_vblank_cleanup(dev); |
548 | 526 | ||
549 | if (!list_empty(&dev_priv->sou_priv->active)) | 527 | if (dev_priv->sou_priv->num_active > 0) |
550 | DRM_ERROR("Still have active outputs when unloading driver"); | 528 | DRM_ERROR("Still have active outputs when unloading driver"); |
551 | 529 | ||
552 | kfree(dev_priv->sou_priv); | 530 | kfree(dev_priv->sou_priv); |