diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-08-09 14:10:28 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-08-09 15:28:12 -0400 |
commit | 80bc340b3dd720c5b7818e21a9a1ee36e1d7ef30 (patch) | |
tree | 045d3cd23efc3ba26f2c7dbf954274260a397065 | |
parent | b76f15295eadd37405cdb4855351a6ceda0bd1b1 (diff) |
drm/nouveau/disp: implement nvif event sources for vblank/connector notifiers
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/disp/base.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/disp/nv04.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/disp/nv50.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/disp/priv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_connector.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_connector.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_crtc.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_display.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/class.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/device.h | 2 |
11 files changed, 47 insertions, 20 deletions
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/base.c b/drivers/gpu/drm/nouveau/core/engine/disp/base.c index d1df0ce990e9..22d55f6cde50 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/base.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/base.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <core/os.h> | 25 | #include <core/os.h> |
26 | #include <nvif/unpack.h> | 26 | #include <nvif/unpack.h> |
27 | #include <nvif/class.h> | ||
27 | #include <nvif/event.h> | 28 | #include <nvif/event.h> |
28 | 29 | ||
29 | #include "priv.h" | 30 | #include "priv.h" |
@@ -93,6 +94,24 @@ nouveau_disp_hpd_func = { | |||
93 | }; | 94 | }; |
94 | 95 | ||
95 | int | 96 | int |
97 | nouveau_disp_ntfy(struct nouveau_object *object, u32 type, | ||
98 | struct nvkm_event **event) | ||
99 | { | ||
100 | struct nouveau_disp *disp = (void *)object->engine; | ||
101 | switch (type) { | ||
102 | case NV04_DISP_NTFY_VBLANK: | ||
103 | *event = &disp->vblank; | ||
104 | return 0; | ||
105 | case NV04_DISP_NTFY_CONN: | ||
106 | *event = &disp->hpd; | ||
107 | return 0; | ||
108 | default: | ||
109 | break; | ||
110 | } | ||
111 | return -EINVAL; | ||
112 | } | ||
113 | |||
114 | int | ||
96 | _nouveau_disp_fini(struct nouveau_object *object, bool suspend) | 115 | _nouveau_disp_fini(struct nouveau_object *object, bool suspend) |
97 | { | 116 | { |
98 | struct nouveau_disp *disp = (void *)object; | 117 | struct nouveau_disp *disp = (void *)object; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv04.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv04.c index 9f0ae05f7d37..366f315fc9a5 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/nv04.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv04.c | |||
@@ -112,6 +112,7 @@ nv04_disp_ofuncs = { | |||
112 | .init = nouveau_object_init, | 112 | .init = nouveau_object_init, |
113 | .fini = nouveau_object_fini, | 113 | .fini = nouveau_object_fini, |
114 | .mthd = nv04_disp_mthd, | 114 | .mthd = nv04_disp_mthd, |
115 | .ntfy = nouveau_disp_ntfy, | ||
115 | }; | 116 | }; |
116 | 117 | ||
117 | static struct nouveau_oclass | 118 | static struct nouveau_oclass |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c index 858386bdd4bd..2703910a0211 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c | |||
@@ -1142,6 +1142,7 @@ nv50_disp_base_ofuncs = { | |||
1142 | .init = nv50_disp_base_init, | 1142 | .init = nv50_disp_base_init, |
1143 | .fini = nv50_disp_base_fini, | 1143 | .fini = nv50_disp_base_fini, |
1144 | .mthd = nv50_disp_base_mthd, | 1144 | .mthd = nv50_disp_base_mthd, |
1145 | .ntfy = nouveau_disp_ntfy, | ||
1145 | }; | 1146 | }; |
1146 | 1147 | ||
1147 | static struct nouveau_oclass | 1148 | static struct nouveau_oclass |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c index 9c2ac1390ef6..a4bb3c774ee1 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c | |||
@@ -716,6 +716,7 @@ nvd0_disp_base_ofuncs = { | |||
716 | .init = nvd0_disp_base_init, | 716 | .init = nvd0_disp_base_init, |
717 | .fini = nvd0_disp_base_fini, | 717 | .fini = nvd0_disp_base_fini, |
718 | .mthd = nv50_disp_base_mthd, | 718 | .mthd = nv50_disp_base_mthd, |
719 | .ntfy = nouveau_disp_ntfy, | ||
719 | }; | 720 | }; |
720 | 721 | ||
721 | static struct nouveau_oclass | 722 | static struct nouveau_oclass |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/priv.h b/drivers/gpu/drm/nouveau/core/engine/disp/priv.h index 5506d119b144..dbd43ae9df81 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/priv.h +++ b/drivers/gpu/drm/nouveau/core/engine/disp/priv.h | |||
@@ -42,5 +42,6 @@ extern struct nouveau_oclass *nvkm_connector_oclass; | |||
42 | 42 | ||
43 | int nouveau_disp_vblank_ctor(void *data, u32 size, struct nvkm_notify *); | 43 | int nouveau_disp_vblank_ctor(void *data, u32 size, struct nvkm_notify *); |
44 | void nouveau_disp_vblank(struct nouveau_disp *, int head); | 44 | void nouveau_disp_vblank(struct nouveau_disp *, int head); |
45 | int nouveau_disp_ntfy(struct nouveau_object *, u32, struct nvkm_event **); | ||
45 | 46 | ||
46 | #endif | 47 | #endif |
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 1b009f73e85f..1ec44c83e919 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c | |||
@@ -100,7 +100,7 @@ static void | |||
100 | nouveau_connector_destroy(struct drm_connector *connector) | 100 | nouveau_connector_destroy(struct drm_connector *connector) |
101 | { | 101 | { |
102 | struct nouveau_connector *nv_connector = nouveau_connector(connector); | 102 | struct nouveau_connector *nv_connector = nouveau_connector(connector); |
103 | nvkm_notify_fini(&nv_connector->hpd); | 103 | nvif_notify_fini(&nv_connector->hpd); |
104 | kfree(nv_connector->edid); | 104 | kfree(nv_connector->edid); |
105 | drm_connector_unregister(connector); | 105 | drm_connector_unregister(connector); |
106 | drm_connector_cleanup(connector); | 106 | drm_connector_cleanup(connector); |
@@ -937,7 +937,7 @@ nouveau_connector_funcs_dp = { | |||
937 | }; | 937 | }; |
938 | 938 | ||
939 | static int | 939 | static int |
940 | nouveau_connector_hotplug(struct nvkm_notify *notify) | 940 | nouveau_connector_hotplug(struct nvif_notify *notify) |
941 | { | 941 | { |
942 | struct nouveau_connector *nv_connector = | 942 | struct nouveau_connector *nv_connector = |
943 | container_of(notify, typeof(*nv_connector), hpd); | 943 | container_of(notify, typeof(*nv_connector), hpd); |
@@ -959,7 +959,7 @@ nouveau_connector_hotplug(struct nvkm_notify *notify) | |||
959 | drm_helper_hpd_irq_event(connector->dev); | 959 | drm_helper_hpd_irq_event(connector->dev); |
960 | } | 960 | } |
961 | 961 | ||
962 | return NVKM_NOTIFY_KEEP; | 962 | return NVIF_NOTIFY_KEEP; |
963 | } | 963 | } |
964 | 964 | ||
965 | static ssize_t | 965 | static ssize_t |
@@ -1029,7 +1029,6 @@ nouveau_connector_create(struct drm_device *dev, int index) | |||
1029 | struct nouveau_drm *drm = nouveau_drm(dev); | 1029 | struct nouveau_drm *drm = nouveau_drm(dev); |
1030 | struct nouveau_display *disp = nouveau_display(dev); | 1030 | struct nouveau_display *disp = nouveau_display(dev); |
1031 | struct nouveau_connector *nv_connector = NULL; | 1031 | struct nouveau_connector *nv_connector = NULL; |
1032 | struct nouveau_disp *pdisp = nvkm_disp(&drm->device); | ||
1033 | struct drm_connector *connector; | 1032 | struct drm_connector *connector; |
1034 | int type, ret = 0; | 1033 | int type, ret = 0; |
1035 | bool dummy; | 1034 | bool dummy; |
@@ -1215,7 +1214,8 @@ nouveau_connector_create(struct drm_device *dev, int index) | |||
1215 | break; | 1214 | break; |
1216 | } | 1215 | } |
1217 | 1216 | ||
1218 | ret = nvkm_notify_init(&pdisp->hpd, nouveau_connector_hotplug, true, | 1217 | ret = nvif_notify_init(&disp->disp, NULL, nouveau_connector_hotplug, |
1218 | true, NV04_DISP_NTFY_CONN, | ||
1219 | &(struct nvif_notify_conn_req_v0) { | 1219 | &(struct nvif_notify_conn_req_v0) { |
1220 | .mask = NVIF_NOTIFY_CONN_V0_ANY, | 1220 | .mask = NVIF_NOTIFY_CONN_V0_ANY, |
1221 | .conn = index, | 1221 | .conn = index, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h b/drivers/gpu/drm/nouveau/nouveau_connector.h index a64f4629628d..68029d041dd2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.h +++ b/drivers/gpu/drm/nouveau/nouveau_connector.h | |||
@@ -27,6 +27,8 @@ | |||
27 | #ifndef __NOUVEAU_CONNECTOR_H__ | 27 | #ifndef __NOUVEAU_CONNECTOR_H__ |
28 | #define __NOUVEAU_CONNECTOR_H__ | 28 | #define __NOUVEAU_CONNECTOR_H__ |
29 | 29 | ||
30 | #include <nvif/notify.h> | ||
31 | |||
30 | #include <drm/drm_edid.h> | 32 | #include <drm/drm_edid.h> |
31 | #include <drm/drm_dp_helper.h> | 33 | #include <drm/drm_dp_helper.h> |
32 | #include "nouveau_crtc.h" | 34 | #include "nouveau_crtc.h" |
@@ -63,7 +65,7 @@ struct nouveau_connector { | |||
63 | u8 index; | 65 | u8 index; |
64 | u8 *dcb; | 66 | u8 *dcb; |
65 | 67 | ||
66 | struct nvkm_notify hpd; | 68 | struct nvif_notify hpd; |
67 | 69 | ||
68 | struct drm_dp_aux aux; | 70 | struct drm_dp_aux aux; |
69 | 71 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_crtc.h b/drivers/gpu/drm/nouveau/nouveau_crtc.h index 6358640387b8..f19cb1c5fc5a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_crtc.h +++ b/drivers/gpu/drm/nouveau/nouveau_crtc.h | |||
@@ -27,11 +27,13 @@ | |||
27 | #ifndef __NOUVEAU_CRTC_H__ | 27 | #ifndef __NOUVEAU_CRTC_H__ |
28 | #define __NOUVEAU_CRTC_H__ | 28 | #define __NOUVEAU_CRTC_H__ |
29 | 29 | ||
30 | #include <nvif/notify.h> | ||
31 | |||
30 | struct nouveau_crtc { | 32 | struct nouveau_crtc { |
31 | struct drm_crtc base; | 33 | struct drm_crtc base; |
32 | 34 | ||
33 | int index; | 35 | int index; |
34 | struct nvkm_notify vblank; | 36 | struct nvif_notify vblank; |
35 | 37 | ||
36 | uint32_t dpms_saved_fp_control; | 38 | uint32_t dpms_saved_fp_control; |
37 | uint32_t fp_users; | 39 | uint32_t fp_users; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index a5a1f298c001..62f969608c2f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -42,12 +42,12 @@ | |||
42 | #include <nvif/event.h> | 42 | #include <nvif/event.h> |
43 | 43 | ||
44 | static int | 44 | static int |
45 | nouveau_display_vblank_handler(struct nvkm_notify *notify) | 45 | nouveau_display_vblank_handler(struct nvif_notify *notify) |
46 | { | 46 | { |
47 | struct nouveau_crtc *nv_crtc = | 47 | struct nouveau_crtc *nv_crtc = |
48 | container_of(notify, typeof(*nv_crtc), vblank); | 48 | container_of(notify, typeof(*nv_crtc), vblank); |
49 | drm_handle_vblank(nv_crtc->base.dev, nv_crtc->index); | 49 | drm_handle_vblank(nv_crtc->base.dev, nv_crtc->index); |
50 | return NVKM_NOTIFY_KEEP; | 50 | return NVIF_NOTIFY_KEEP; |
51 | } | 51 | } |
52 | 52 | ||
53 | int | 53 | int |
@@ -57,7 +57,7 @@ nouveau_display_vblank_enable(struct drm_device *dev, int head) | |||
57 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 57 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
58 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 58 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
59 | if (nv_crtc->index == head) { | 59 | if (nv_crtc->index == head) { |
60 | nvkm_notify_get(&nv_crtc->vblank); | 60 | nvif_notify_get(&nv_crtc->vblank); |
61 | return 0; | 61 | return 0; |
62 | } | 62 | } |
63 | } | 63 | } |
@@ -71,7 +71,7 @@ nouveau_display_vblank_disable(struct drm_device *dev, int head) | |||
71 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 71 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
72 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 72 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
73 | if (nv_crtc->index == head) { | 73 | if (nv_crtc->index == head) { |
74 | nvkm_notify_put(&nv_crtc->vblank); | 74 | nvif_notify_put(&nv_crtc->vblank); |
75 | return; | 75 | return; |
76 | } | 76 | } |
77 | } | 77 | } |
@@ -172,22 +172,22 @@ nouveau_display_vblank_fini(struct drm_device *dev) | |||
172 | 172 | ||
173 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 173 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
174 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 174 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
175 | nvkm_notify_fini(&nv_crtc->vblank); | 175 | nvif_notify_fini(&nv_crtc->vblank); |
176 | } | 176 | } |
177 | } | 177 | } |
178 | 178 | ||
179 | static int | 179 | static int |
180 | nouveau_display_vblank_init(struct drm_device *dev) | 180 | nouveau_display_vblank_init(struct drm_device *dev) |
181 | { | 181 | { |
182 | struct nouveau_drm *drm = nouveau_drm(dev); | 182 | struct nouveau_display *disp = nouveau_display(dev); |
183 | struct nouveau_disp *pdisp = nvkm_disp(&drm->device); | ||
184 | struct drm_crtc *crtc; | 183 | struct drm_crtc *crtc; |
185 | int ret; | 184 | int ret; |
186 | 185 | ||
187 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 186 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
188 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 187 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
189 | ret = nvkm_notify_init(&pdisp->vblank, | 188 | ret = nvif_notify_init(&disp->disp, NULL, |
190 | nouveau_display_vblank_handler, false, | 189 | nouveau_display_vblank_handler, false, |
190 | NV04_DISP_NTFY_VBLANK, | ||
191 | &(struct nvif_notify_head_req_v0) { | 191 | &(struct nvif_notify_head_req_v0) { |
192 | .head = nv_crtc->index, | 192 | .head = nv_crtc->index, |
193 | }, | 193 | }, |
@@ -371,7 +371,7 @@ nouveau_display_init(struct drm_device *dev) | |||
371 | /* enable hotplug interrupts */ | 371 | /* enable hotplug interrupts */ |
372 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 372 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
373 | struct nouveau_connector *conn = nouveau_connector(connector); | 373 | struct nouveau_connector *conn = nouveau_connector(connector); |
374 | nvkm_notify_get(&conn->hpd); | 374 | nvif_notify_get(&conn->hpd); |
375 | } | 375 | } |
376 | 376 | ||
377 | return ret; | 377 | return ret; |
@@ -391,7 +391,7 @@ nouveau_display_fini(struct drm_device *dev) | |||
391 | /* disable hotplug interrupts */ | 391 | /* disable hotplug interrupts */ |
392 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 392 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
393 | struct nouveau_connector *conn = nouveau_connector(connector); | 393 | struct nouveau_connector *conn = nouveau_connector(connector); |
394 | nvkm_notify_put(&conn->hpd); | 394 | nvif_notify_put(&conn->hpd); |
395 | } | 395 | } |
396 | 396 | ||
397 | drm_kms_helper_poll_disable(dev); | 397 | drm_kms_helper_poll_disable(dev); |
diff --git a/drivers/gpu/drm/nouveau/nvif/class.h b/drivers/gpu/drm/nouveau/nvif/class.h index 15dc6a35589e..c9897f4003a9 100644 --- a/drivers/gpu/drm/nouveau/nvif/class.h +++ b/drivers/gpu/drm/nouveau/nvif/class.h | |||
@@ -343,6 +343,9 @@ struct kepler_channel_gpfifo_a_v0 { | |||
343 | * legacy display | 343 | * legacy display |
344 | ******************************************************************************/ | 344 | ******************************************************************************/ |
345 | 345 | ||
346 | #define NV04_DISP_NTFY_VBLANK 0x00 | ||
347 | #define NV04_DISP_NTFY_CONN 0x01 | ||
348 | |||
346 | struct nv04_disp_mthd_v0 { | 349 | struct nv04_disp_mthd_v0 { |
347 | __u8 version; | 350 | __u8 version; |
348 | #define NV04_DISP_SCANOUTPOS 0x00 | 351 | #define NV04_DISP_SCANOUTPOS 0x00 |
@@ -365,7 +368,6 @@ struct nv04_disp_scanoutpos_v0 { | |||
365 | __u16 hline; | 368 | __u16 hline; |
366 | }; | 369 | }; |
367 | 370 | ||
368 | |||
369 | /******************************************************************************* | 371 | /******************************************************************************* |
370 | * display | 372 | * display |
371 | ******************************************************************************/ | 373 | ******************************************************************************/ |
diff --git a/drivers/gpu/drm/nouveau/nvif/device.h b/drivers/gpu/drm/nouveau/nvif/device.h index c208bad984b3..b3928765f659 100644 --- a/drivers/gpu/drm/nouveau/nvif/device.h +++ b/drivers/gpu/drm/nouveau/nvif/device.h | |||
@@ -54,13 +54,11 @@ void nvif_device_ref(struct nvif_device *, struct nvif_device **); | |||
54 | 54 | ||
55 | #include <engine/device.h> | 55 | #include <engine/device.h> |
56 | #include <engine/fifo.h> | 56 | #include <engine/fifo.h> |
57 | #include <engine/disp.h> | ||
58 | #include <engine/graph.h> | 57 | #include <engine/graph.h> |
59 | #include <engine/software.h> | 58 | #include <engine/software.h> |
60 | 59 | ||
61 | #define nvkm_fifo(a) nouveau_fifo(nvkm_device(a)) | 60 | #define nvkm_fifo(a) nouveau_fifo(nvkm_device(a)) |
62 | #define nvkm_fifo_chan(a) ((struct nouveau_fifo_chan *)nvkm_object(a)) | 61 | #define nvkm_fifo_chan(a) ((struct nouveau_fifo_chan *)nvkm_object(a)) |
63 | #define nvkm_disp(a) nouveau_disp(nvkm_device(a)) | ||
64 | #define nvkm_gr(a) ((struct nouveau_graph *)nouveau_engine(nvkm_object(a), NVDEV_ENGINE_GR)) | 62 | #define nvkm_gr(a) ((struct nouveau_graph *)nouveau_engine(nvkm_object(a), NVDEV_ENGINE_GR)) |
65 | 63 | ||
66 | #endif | 64 | #endif |