diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-08-09 14:10:19 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-08-09 15:12:58 -0400 |
commit | b12f0ae9e8dfee55c7757f9c4be3b1154c366754 (patch) | |
tree | 7c1a7e6b97a4f096a45e90dca13df2027f6cc41e /drivers/gpu | |
parent | 8a42364701d6860e51d53bbcbe3c84fe93816861 (diff) |
drm/nouveau: store vblank event handler data in nv_crtc
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_crtc.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_display.c | 55 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_display.h | 2 |
3 files changed, 29 insertions, 29 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_crtc.h b/drivers/gpu/drm/nouveau/nouveau_crtc.h index a7cbbe9d5d8d..6af9b58821c0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_crtc.h +++ b/drivers/gpu/drm/nouveau/nouveau_crtc.h | |||
@@ -31,6 +31,7 @@ struct nouveau_crtc { | |||
31 | struct drm_crtc base; | 31 | struct drm_crtc base; |
32 | 32 | ||
33 | int index; | 33 | int index; |
34 | struct nouveau_eventh *vblank; | ||
34 | 35 | ||
35 | uint32_t dpms_saved_fp_control; | 36 | uint32_t dpms_saved_fp_control; |
36 | uint32_t fp_users; | 37 | uint32_t fp_users; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index b6e258faa4f7..a1247f258240 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -44,28 +44,36 @@ | |||
44 | static int | 44 | static int |
45 | nouveau_display_vblank_handler(void *data, u32 type, int head) | 45 | nouveau_display_vblank_handler(void *data, u32 type, int head) |
46 | { | 46 | { |
47 | struct nouveau_drm *drm = data; | 47 | struct nouveau_crtc *nv_crtc = data; |
48 | drm_handle_vblank(drm->dev, head); | 48 | drm_handle_vblank(nv_crtc->base.dev, nv_crtc->index); |
49 | return NVKM_EVENT_KEEP; | 49 | return NVKM_EVENT_KEEP; |
50 | } | 50 | } |
51 | 51 | ||
52 | int | 52 | int |
53 | nouveau_display_vblank_enable(struct drm_device *dev, int head) | 53 | nouveau_display_vblank_enable(struct drm_device *dev, int head) |
54 | { | 54 | { |
55 | struct nouveau_display *disp = nouveau_display(dev); | 55 | struct drm_crtc *crtc; |
56 | if (disp) { | 56 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
57 | nouveau_event_get(disp->vblank[head]); | 57 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
58 | return 0; | 58 | if (nv_crtc->index == head) { |
59 | nouveau_event_get(nv_crtc->vblank); | ||
60 | return 0; | ||
61 | } | ||
59 | } | 62 | } |
60 | return -EIO; | 63 | return -EINVAL; |
61 | } | 64 | } |
62 | 65 | ||
63 | void | 66 | void |
64 | nouveau_display_vblank_disable(struct drm_device *dev, int head) | 67 | nouveau_display_vblank_disable(struct drm_device *dev, int head) |
65 | { | 68 | { |
66 | struct nouveau_display *disp = nouveau_display(dev); | 69 | struct drm_crtc *crtc; |
67 | if (disp) | 70 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
68 | nouveau_event_put(disp->vblank[head]); | 71 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
72 | if (nv_crtc->index == head) { | ||
73 | nouveau_event_put(nv_crtc->vblank); | ||
74 | return; | ||
75 | } | ||
76 | } | ||
69 | } | 77 | } |
70 | 78 | ||
71 | static inline int | 79 | static inline int |
@@ -151,36 +159,29 @@ nouveau_display_vblstamp(struct drm_device *dev, int head, int *max_error, | |||
151 | static void | 159 | static void |
152 | nouveau_display_vblank_fini(struct drm_device *dev) | 160 | nouveau_display_vblank_fini(struct drm_device *dev) |
153 | { | 161 | { |
154 | struct nouveau_display *disp = nouveau_display(dev); | 162 | struct drm_crtc *crtc; |
155 | int i; | ||
156 | 163 | ||
157 | drm_vblank_cleanup(dev); | 164 | drm_vblank_cleanup(dev); |
158 | 165 | ||
159 | if (disp->vblank) { | 166 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
160 | for (i = 0; i < dev->mode_config.num_crtc; i++) | 167 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
161 | nouveau_event_ref(NULL, &disp->vblank[i]); | 168 | nouveau_event_ref(NULL, &nv_crtc->vblank); |
162 | kfree(disp->vblank); | ||
163 | disp->vblank = NULL; | ||
164 | } | 169 | } |
165 | } | 170 | } |
166 | 171 | ||
167 | static int | 172 | static int |
168 | nouveau_display_vblank_init(struct drm_device *dev) | 173 | nouveau_display_vblank_init(struct drm_device *dev) |
169 | { | 174 | { |
170 | struct nouveau_display *disp = nouveau_display(dev); | ||
171 | struct nouveau_drm *drm = nouveau_drm(dev); | 175 | struct nouveau_drm *drm = nouveau_drm(dev); |
172 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); | 176 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); |
173 | int ret, i; | 177 | struct drm_crtc *crtc; |
174 | 178 | int ret; | |
175 | disp->vblank = kzalloc(dev->mode_config.num_crtc * | ||
176 | sizeof(*disp->vblank), GFP_KERNEL); | ||
177 | if (!disp->vblank) | ||
178 | return -ENOMEM; | ||
179 | 179 | ||
180 | for (i = 0; i < dev->mode_config.num_crtc; i++) { | 180 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
181 | ret = nouveau_event_new(pdisp->vblank, 1, i, | 181 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
182 | ret = nouveau_event_new(pdisp->vblank, 1, nv_crtc->index, | ||
182 | nouveau_display_vblank_handler, | 183 | nouveau_display_vblank_handler, |
183 | drm, &disp->vblank[i]); | 184 | nv_crtc, &nv_crtc->vblank); |
184 | if (ret) { | 185 | if (ret) { |
185 | nouveau_display_vblank_fini(dev); | 186 | nouveau_display_vblank_fini(dev); |
186 | return ret; | 187 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h index a21fd2dbeb18..37bf0d224a4c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.h +++ b/drivers/gpu/drm/nouveau/nouveau_display.h | |||
@@ -40,8 +40,6 @@ struct nouveau_display { | |||
40 | void (*fb_dtor)(struct drm_framebuffer *); | 40 | void (*fb_dtor)(struct drm_framebuffer *); |
41 | 41 | ||
42 | struct nouveau_object *core; | 42 | struct nouveau_object *core; |
43 | struct nouveau_eventh **vblank; | ||
44 | |||
45 | 43 | ||
46 | struct drm_property *dithering_mode; | 44 | struct drm_property *dithering_mode; |
47 | struct drm_property *dithering_depth; | 45 | struct drm_property *dithering_depth; |