aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2016-11-04 03:20:36 -0400
committerBen Skeggs <bskeggs@redhat.com>2016-11-06 23:05:02 -0500
commitf00f0e218b5d6347f28c0f2d80ee46c45b28f3c3 (patch)
tree7ef27757704bb869f2e0838bebdcc7a337f41feb /drivers
parente1ef6b42d9014079e5ab71acd8669d39808c3c73 (diff)
drm/nouveau/kms/nv50: remove code to create ctxdma for every framebuffer
This is now handled by prepare_fb(). Legacy flips were the last user. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c19
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.h3
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c75
3 files changed, 7 insertions, 90 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 62d75308c57c..75c90a8da18a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -223,10 +223,6 @@ static void
223nouveau_user_framebuffer_destroy(struct drm_framebuffer *drm_fb) 223nouveau_user_framebuffer_destroy(struct drm_framebuffer *drm_fb)
224{ 224{
225 struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb); 225 struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb);
226 struct nouveau_display *disp = nouveau_display(drm_fb->dev);
227
228 if (disp->fb_dtor)
229 disp->fb_dtor(drm_fb);
230 226
231 if (fb->nvbo) 227 if (fb->nvbo)
232 drm_gem_object_unreference_unlocked(&fb->nvbo->gem); 228 drm_gem_object_unreference_unlocked(&fb->nvbo->gem);
@@ -256,27 +252,18 @@ nouveau_framebuffer_new(struct drm_device *dev,
256 struct nouveau_bo *nvbo, 252 struct nouveau_bo *nvbo,
257 struct nouveau_framebuffer **pfb) 253 struct nouveau_framebuffer **pfb)
258{ 254{
259 struct nouveau_display *disp = nouveau_display(dev);
260 struct nouveau_framebuffer *fb; 255 struct nouveau_framebuffer *fb;
261 int ret; 256 int ret;
262 257
263 if (!(fb = kzalloc(sizeof(*fb), GFP_KERNEL))) 258 if (!(fb = *pfb = kzalloc(sizeof(*fb), GFP_KERNEL)))
264 return -ENOMEM; 259 return -ENOMEM;
265 260
266 drm_helper_mode_fill_fb_struct(&fb->base, mode_cmd); 261 drm_helper_mode_fill_fb_struct(&fb->base, mode_cmd);
267 fb->nvbo = nvbo; 262 fb->nvbo = nvbo;
268 263
269 ret = drm_framebuffer_init(dev, &fb->base, &nouveau_framebuffer_funcs); 264 ret = drm_framebuffer_init(dev, &fb->base, &nouveau_framebuffer_funcs);
270 if (ret == 0) { 265 if (ret)
271 if (!disp->fb_ctor || !(ret = disp->fb_ctor(&fb->base))) { 266 kfree(fb);
272 *pfb = fb;
273 return 0;
274 }
275 disp->fb_dtor(&fb->base);
276 drm_framebuffer_cleanup(&fb->base);
277 }
278
279 kfree(fb);
280 return ret; 267 return ret;
281} 268}
282 269
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
index ecdc0a3a8d32..330fe0fc5c11 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -40,9 +40,6 @@ struct nouveau_display {
40 int (*init)(struct drm_device *); 40 int (*init)(struct drm_device *);
41 void (*fini)(struct drm_device *); 41 void (*fini)(struct drm_device *);
42 42
43 int (*fb_ctor)(struct drm_framebuffer *);
44 void (*fb_dtor)(struct drm_framebuffer *);
45
46 struct nvif_object disp; 43 struct nvif_object disp;
47 44
48 struct drm_property *dithering_mode; 45 struct drm_property *dithering_mode;
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 4b195cc32ec4..b47130eda521 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -418,12 +418,12 @@ nv50_dmac_ctxdma_del(struct nv50_dmac_ctxdma *ctxdma)
418} 418}
419 419
420static struct nv50_dmac_ctxdma * 420static struct nv50_dmac_ctxdma *
421nv50_dmac_ctxdma_new(struct nv50_dmac *dmac, u32 handle, 421nv50_dmac_ctxdma_new(struct nv50_dmac *dmac, struct nouveau_framebuffer *fb)
422 struct nouveau_framebuffer *fb)
423{ 422{
424 struct nouveau_drm *drm = nouveau_drm(fb->base.dev); 423 struct nouveau_drm *drm = nouveau_drm(fb->base.dev);
425 struct nv50_dmac_ctxdma *ctxdma; 424 struct nv50_dmac_ctxdma *ctxdma;
426 const u8 kind = (fb->nvbo->tile_flags & 0x0000ff00) >> 8; 425 const u8 kind = (fb->nvbo->tile_flags & 0x0000ff00) >> 8;
426 const u32 handle = 0xfb000000 | kind;
427 struct { 427 struct {
428 struct nv_dma_v0 base; 428 struct nv_dma_v0 base;
429 union { 429 union {
@@ -951,21 +951,17 @@ nv50_wndw_prepare_fb(struct drm_plane *plane, struct drm_plane_state *state)
951 struct nv50_wndw_atom *asyw = nv50_wndw_atom(state); 951 struct nv50_wndw_atom *asyw = nv50_wndw_atom(state);
952 struct nv50_head_atom *asyh; 952 struct nv50_head_atom *asyh;
953 struct nv50_dmac_ctxdma *ctxdma; 953 struct nv50_dmac_ctxdma *ctxdma;
954 u32 name;
955 u8 kind;
956 int ret; 954 int ret;
957 955
958 NV_ATOMIC(drm, "%s prepare: %p\n", plane->name, state->fb); 956 NV_ATOMIC(drm, "%s prepare: %p\n", plane->name, state->fb);
959 if (!asyw->state.fb) 957 if (!asyw->state.fb)
960 return 0; 958 return 0;
961 kind = (fb->nvbo->tile_flags & 0x0000ff00) >> 8;
962 name = 0xfb000000 | kind;
963 959
964 ret = nouveau_bo_pin(fb->nvbo, TTM_PL_FLAG_VRAM, true); 960 ret = nouveau_bo_pin(fb->nvbo, TTM_PL_FLAG_VRAM, true);
965 if (ret) 961 if (ret)
966 return ret; 962 return ret;
967 963
968 ctxdma = nv50_dmac_ctxdma_new(wndw->dmac, name, fb); 964 ctxdma = nv50_dmac_ctxdma_new(wndw->dmac, fb);
969 if (IS_ERR(ctxdma)) { 965 if (IS_ERR(ctxdma)) {
970 nouveau_bo_unpin(fb->nvbo); 966 nouveau_bo_unpin(fb->nvbo);
971 return PTR_ERR(ctxdma); 967 return PTR_ERR(ctxdma);
@@ -3365,67 +3361,6 @@ nv50_pior_create(struct drm_connector *connector, struct dcb_output *dcbe)
3365} 3361}
3366 3362
3367/****************************************************************************** 3363/******************************************************************************
3368 * Framebuffer
3369 *****************************************************************************/
3370
3371static void
3372nv50_fb_dtor(struct drm_framebuffer *fb)
3373{
3374}
3375
3376static int
3377nv50_fb_ctor(struct drm_framebuffer *fb)
3378{
3379 struct nouveau_framebuffer *nv_fb = nouveau_framebuffer(fb);
3380 struct nouveau_drm *drm = nouveau_drm(fb->dev);
3381 struct nouveau_bo *nvbo = nv_fb->nvbo;
3382 struct nv50_disp *disp = nv50_disp(fb->dev);
3383 u8 kind = nouveau_bo_tile_layout(nvbo) >> 8;
3384 u8 tile = nvbo->tile_mode;
3385 struct drm_crtc *crtc;
3386
3387 if (drm->device.info.chipset >= 0xc0)
3388 tile >>= 4; /* yep.. */
3389
3390 switch (fb->depth) {
3391 case 8: nv_fb->r_format = 0x1e00; break;
3392 case 15: nv_fb->r_format = 0xe900; break;
3393 case 16: nv_fb->r_format = 0xe800; break;
3394 case 24:
3395 case 32: nv_fb->r_format = 0xcf00; break;
3396 case 30: nv_fb->r_format = 0xd100; break;
3397 default:
3398 NV_ERROR(drm, "unknown depth %d\n", fb->depth);
3399 return -EINVAL;
3400 }
3401
3402 if (disp->disp->oclass < G82_DISP) {
3403 nv_fb->r_pitch = kind ? (((fb->pitches[0] / 4) << 4) | tile) :
3404 (fb->pitches[0] | 0x00100000);
3405 nv_fb->r_format |= kind << 16;
3406 } else
3407 if (disp->disp->oclass < GF110_DISP) {
3408 nv_fb->r_pitch = kind ? (((fb->pitches[0] / 4) << 4) | tile) :
3409 (fb->pitches[0] | 0x00100000);
3410 } else {
3411 nv_fb->r_pitch = kind ? (((fb->pitches[0] / 4) << 4) | tile) :
3412 (fb->pitches[0] | 0x01000000);
3413 }
3414 nv_fb->r_handle = 0xffff0000 | kind;
3415
3416 list_for_each_entry(crtc, &drm->dev->mode_config.crtc_list, head) {
3417 struct nv50_wndw *wndw = nv50_wndw(crtc->primary);
3418 struct nv50_dmac_ctxdma *ctxdma;
3419
3420 ctxdma = nv50_dmac_ctxdma_new(wndw->dmac, nv_fb->r_handle, nv_fb);
3421 if (IS_ERR(ctxdma))
3422 return PTR_ERR(ctxdma);
3423 }
3424
3425 return 0;
3426}
3427
3428/******************************************************************************
3429 * Atomic 3364 * Atomic
3430 *****************************************************************************/ 3365 *****************************************************************************/
3431 3366
@@ -3955,8 +3890,6 @@ nv50_display_create(struct drm_device *dev)
3955 nouveau_display(dev)->dtor = nv50_display_destroy; 3890 nouveau_display(dev)->dtor = nv50_display_destroy;
3956 nouveau_display(dev)->init = nv50_display_init; 3891 nouveau_display(dev)->init = nv50_display_init;
3957 nouveau_display(dev)->fini = nv50_display_fini; 3892 nouveau_display(dev)->fini = nv50_display_fini;
3958 nouveau_display(dev)->fb_ctor = nv50_fb_ctor;
3959 nouveau_display(dev)->fb_dtor = nv50_fb_dtor;
3960 disp->disp = &nouveau_display(dev)->disp; 3893 disp->disp = &nouveau_display(dev)->disp;
3961 dev->mode_config.funcs = &nv50_disp_func; 3894 dev->mode_config.funcs = &nv50_disp_func;
3962 if (nouveau_atomic) 3895 if (nouveau_atomic)