diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-01-21 21:58:12 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-01-22 22:39:18 -0500 |
commit | 2332b31116d5500d05173b2a7aaa95ba15d7983a (patch) | |
tree | 0c9280cc0440b64905f3a9b10587881bc696c58f | |
parent | ea7dce90105ff2eb81958498d6d9f30a0753bbe8 (diff) |
drm/nouveau: create base display from common code
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/dispnv04/disp.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/dispnv04/disp.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_display.c | 32 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_display.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drm.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_display.c | 22 |
6 files changed, 31 insertions, 31 deletions
diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c index b13ff0fc42de..2f1ed61f7c8c 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c | |||
@@ -77,11 +77,6 @@ nv04_display_create(struct drm_device *dev) | |||
77 | 77 | ||
78 | nouveau_hw_save_vga_fonts(dev, 1); | 78 | nouveau_hw_save_vga_fonts(dev, 1); |
79 | 79 | ||
80 | ret = nouveau_object_new(nv_object(drm), NVDRM_DEVICE, 0xd1500000, | ||
81 | NV04_DISP_CLASS, NULL, 0, &disp->core); | ||
82 | if (ret) | ||
83 | return ret; | ||
84 | |||
85 | nv04_crtc_create(dev, 0); | 80 | nv04_crtc_create(dev, 0); |
86 | if (nv_two_heads(dev)) | 81 | if (nv_two_heads(dev)) |
87 | nv04_crtc_create(dev, 1); | 82 | nv04_crtc_create(dev, 1); |
diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.h b/drivers/gpu/drm/nouveau/dispnv04/disp.h index 56a28db04000..4245fc3dab70 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/disp.h +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.h | |||
@@ -80,7 +80,6 @@ struct nv04_display { | |||
80 | struct nv04_mode_state saved_reg; | 80 | struct nv04_mode_state saved_reg; |
81 | uint32_t saved_vga_font[4][16384]; | 81 | uint32_t saved_vga_font[4][16384]; |
82 | uint32_t dac_users[4]; | 82 | uint32_t dac_users[4]; |
83 | struct nouveau_object *core; | ||
84 | struct nouveau_bo *image[2]; | 83 | struct nouveau_bo *image[2]; |
85 | }; | 84 | }; |
86 | 85 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 8b757483a107..a22d019bb217 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -407,10 +407,31 @@ nouveau_display_create(struct drm_device *dev) | |||
407 | drm_kms_helper_poll_disable(dev); | 407 | drm_kms_helper_poll_disable(dev); |
408 | 408 | ||
409 | if (drm->vbios.dcb.entries) { | 409 | if (drm->vbios.dcb.entries) { |
410 | if (nv_device(drm->device)->card_type < NV_50) | 410 | static const u16 oclass[] = { |
411 | ret = nv04_display_create(dev); | 411 | NVF0_DISP_CLASS, |
412 | else | 412 | NVE0_DISP_CLASS, |
413 | ret = nv50_display_create(dev); | 413 | NVD0_DISP_CLASS, |
414 | NVA3_DISP_CLASS, | ||
415 | NV94_DISP_CLASS, | ||
416 | NVA0_DISP_CLASS, | ||
417 | NV84_DISP_CLASS, | ||
418 | NV50_DISP_CLASS, | ||
419 | NV04_DISP_CLASS, | ||
420 | }; | ||
421 | int i; | ||
422 | |||
423 | for (i = 0, ret = -ENODEV; ret && i < ARRAY_SIZE(oclass); i++) { | ||
424 | ret = nouveau_object_new(nv_object(drm), NVDRM_DEVICE, | ||
425 | NVDRM_DISPLAY, oclass[i], | ||
426 | NULL, 0, &disp->core); | ||
427 | } | ||
428 | |||
429 | if (ret == 0) { | ||
430 | if (nv_mclass(disp->core) < NV50_DISP_CLASS) | ||
431 | ret = nv04_display_create(dev); | ||
432 | else | ||
433 | ret = nv50_display_create(dev); | ||
434 | } | ||
414 | } else { | 435 | } else { |
415 | ret = 0; | 436 | ret = 0; |
416 | } | 437 | } |
@@ -439,6 +460,7 @@ void | |||
439 | nouveau_display_destroy(struct drm_device *dev) | 460 | nouveau_display_destroy(struct drm_device *dev) |
440 | { | 461 | { |
441 | struct nouveau_display *disp = nouveau_display(dev); | 462 | struct nouveau_display *disp = nouveau_display(dev); |
463 | struct nouveau_drm *drm = nouveau_drm(dev); | ||
442 | 464 | ||
443 | nouveau_backlight_exit(dev); | 465 | nouveau_backlight_exit(dev); |
444 | nouveau_display_vblank_fini(dev); | 466 | nouveau_display_vblank_fini(dev); |
@@ -449,6 +471,8 @@ nouveau_display_destroy(struct drm_device *dev) | |||
449 | if (disp->dtor) | 471 | if (disp->dtor) |
450 | disp->dtor(dev); | 472 | disp->dtor(dev); |
451 | 473 | ||
474 | nouveau_object_del(nv_object(drm), NVDRM_DEVICE, NVDRM_DISPLAY); | ||
475 | |||
452 | nouveau_drm(dev)->display = NULL; | 476 | nouveau_drm(dev)->display = NULL; |
453 | kfree(disp); | 477 | kfree(disp); |
454 | } | 478 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h index 8bc8bab90e8d..73aa231130b8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.h +++ b/drivers/gpu/drm/nouveau/nouveau_display.h | |||
@@ -36,6 +36,7 @@ struct nouveau_display { | |||
36 | int (*init)(struct drm_device *); | 36 | int (*init)(struct drm_device *); |
37 | void (*fini)(struct drm_device *); | 37 | void (*fini)(struct drm_device *); |
38 | 38 | ||
39 | struct nouveau_object *core; | ||
39 | struct nouveau_eventh **vblank; | 40 | struct nouveau_eventh **vblank; |
40 | 41 | ||
41 | struct drm_property *dithering_mode; | 42 | struct drm_property *dithering_mode; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h index 4b0fb6c66be9..23ca7a517246 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.h +++ b/drivers/gpu/drm/nouveau/nouveau_drm.h | |||
@@ -54,6 +54,7 @@ enum nouveau_drm_handle { | |||
54 | NVDRM_CLIENT = 0xffffffff, | 54 | NVDRM_CLIENT = 0xffffffff, |
55 | NVDRM_DEVICE = 0xdddddddd, | 55 | NVDRM_DEVICE = 0xdddddddd, |
56 | NVDRM_CONTROL = 0xdddddddc, | 56 | NVDRM_CONTROL = 0xdddddddc, |
57 | NVDRM_DISPLAY = 0xd1500000, | ||
57 | NVDRM_PUSH = 0xbbbb0000, /* |= client chid */ | 58 | NVDRM_PUSH = 0xbbbb0000, /* |= client chid */ |
58 | NVDRM_CHAN = 0xcccc0000, /* |= client chid */ | 59 | NVDRM_CHAN = 0xcccc0000, /* |= client chid */ |
59 | NVDRM_NVSW = 0x55550000, | 60 | NVDRM_NVSW = 0x55550000, |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 4e384a2f99c3..6ae7a697866e 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -2199,16 +2199,6 @@ nv50_display_destroy(struct drm_device *dev) | |||
2199 | int | 2199 | int |
2200 | nv50_display_create(struct drm_device *dev) | 2200 | nv50_display_create(struct drm_device *dev) |
2201 | { | 2201 | { |
2202 | static const u16 oclass[] = { | ||
2203 | NVF0_DISP_CLASS, | ||
2204 | NVE0_DISP_CLASS, | ||
2205 | NVD0_DISP_CLASS, | ||
2206 | NVA3_DISP_CLASS, | ||
2207 | NV94_DISP_CLASS, | ||
2208 | NVA0_DISP_CLASS, | ||
2209 | NV84_DISP_CLASS, | ||
2210 | NV50_DISP_CLASS, | ||
2211 | }; | ||
2212 | struct nouveau_device *device = nouveau_dev(dev); | 2202 | struct nouveau_device *device = nouveau_dev(dev); |
2213 | struct nouveau_drm *drm = nouveau_drm(dev); | 2203 | struct nouveau_drm *drm = nouveau_drm(dev); |
2214 | struct dcb_table *dcb = &drm->vbios.dcb; | 2204 | struct dcb_table *dcb = &drm->vbios.dcb; |
@@ -2225,6 +2215,7 @@ nv50_display_create(struct drm_device *dev) | |||
2225 | nouveau_display(dev)->dtor = nv50_display_destroy; | 2215 | nouveau_display(dev)->dtor = nv50_display_destroy; |
2226 | nouveau_display(dev)->init = nv50_display_init; | 2216 | nouveau_display(dev)->init = nv50_display_init; |
2227 | nouveau_display(dev)->fini = nv50_display_fini; | 2217 | nouveau_display(dev)->fini = nv50_display_fini; |
2218 | disp->core = nouveau_display(dev)->core; | ||
2228 | 2219 | ||
2229 | /* small shared memory area we use for notifiers and semaphores */ | 2220 | /* small shared memory area we use for notifiers and semaphores */ |
2230 | ret = nouveau_bo_new(dev, 4096, 0x1000, TTM_PL_FLAG_VRAM, | 2221 | ret = nouveau_bo_new(dev, 4096, 0x1000, TTM_PL_FLAG_VRAM, |
@@ -2243,17 +2234,6 @@ nv50_display_create(struct drm_device *dev) | |||
2243 | if (ret) | 2234 | if (ret) |
2244 | goto out; | 2235 | goto out; |
2245 | 2236 | ||
2246 | /* attempt to allocate a supported evo display class */ | ||
2247 | ret = -ENODEV; | ||
2248 | for (i = 0; ret && i < ARRAY_SIZE(oclass); i++) { | ||
2249 | ret = nouveau_object_new(nv_object(drm), NVDRM_DEVICE, | ||
2250 | 0xd1500000, oclass[i], NULL, 0, | ||
2251 | &disp->core); | ||
2252 | } | ||
2253 | |||
2254 | if (ret) | ||
2255 | goto out; | ||
2256 | |||
2257 | /* allocate master evo channel */ | 2237 | /* allocate master evo channel */ |
2258 | ret = nv50_dmac_create(disp->core, NV50_DISP_MAST_CLASS, 0, | 2238 | ret = nv50_dmac_create(disp->core, NV50_DISP_MAST_CLASS, 0, |
2259 | &(struct nv50_display_mast_class) { | 2239 | &(struct nv50_display_mast_class) { |