Commit f00f0e21 authored by Ben Skeggs's avatar Ben Skeggs

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: default avatarBen Skeggs <bskeggs@redhat.com>
parent e1ef6b42
...@@ -223,10 +223,6 @@ static void ...@@ -223,10 +223,6 @@ static void
nouveau_user_framebuffer_destroy(struct drm_framebuffer *drm_fb) nouveau_user_framebuffer_destroy(struct drm_framebuffer *drm_fb)
{ {
struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb); struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb);
struct nouveau_display *disp = nouveau_display(drm_fb->dev);
if (disp->fb_dtor)
disp->fb_dtor(drm_fb);
if (fb->nvbo) if (fb->nvbo)
drm_gem_object_unreference_unlocked(&fb->nvbo->gem); drm_gem_object_unreference_unlocked(&fb->nvbo->gem);
...@@ -256,27 +252,18 @@ nouveau_framebuffer_new(struct drm_device *dev, ...@@ -256,27 +252,18 @@ nouveau_framebuffer_new(struct drm_device *dev,
struct nouveau_bo *nvbo, struct nouveau_bo *nvbo,
struct nouveau_framebuffer **pfb) struct nouveau_framebuffer **pfb)
{ {
struct nouveau_display *disp = nouveau_display(dev);
struct nouveau_framebuffer *fb; struct nouveau_framebuffer *fb;
int ret; int ret;
if (!(fb = kzalloc(sizeof(*fb), GFP_KERNEL))) if (!(fb = *pfb = kzalloc(sizeof(*fb), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
drm_helper_mode_fill_fb_struct(&fb->base, mode_cmd); drm_helper_mode_fill_fb_struct(&fb->base, mode_cmd);
fb->nvbo = nvbo; fb->nvbo = nvbo;
ret = drm_framebuffer_init(dev, &fb->base, &nouveau_framebuffer_funcs); ret = drm_framebuffer_init(dev, &fb->base, &nouveau_framebuffer_funcs);
if (ret == 0) { if (ret)
if (!disp->fb_ctor || !(ret = disp->fb_ctor(&fb->base))) { kfree(fb);
*pfb = fb;
return 0;
}
disp->fb_dtor(&fb->base);
drm_framebuffer_cleanup(&fb->base);
}
kfree(fb);
return ret; return ret;
} }
......
...@@ -40,9 +40,6 @@ struct nouveau_display { ...@@ -40,9 +40,6 @@ struct nouveau_display {
int (*init)(struct drm_device *); int (*init)(struct drm_device *);
void (*fini)(struct drm_device *); void (*fini)(struct drm_device *);
int (*fb_ctor)(struct drm_framebuffer *);
void (*fb_dtor)(struct drm_framebuffer *);
struct nvif_object disp; struct nvif_object disp;
struct drm_property *dithering_mode; struct drm_property *dithering_mode;
......
...@@ -418,12 +418,12 @@ nv50_dmac_ctxdma_del(struct nv50_dmac_ctxdma *ctxdma) ...@@ -418,12 +418,12 @@ nv50_dmac_ctxdma_del(struct nv50_dmac_ctxdma *ctxdma)
} }
static struct nv50_dmac_ctxdma * static struct nv50_dmac_ctxdma *
nv50_dmac_ctxdma_new(struct nv50_dmac *dmac, u32 handle, nv50_dmac_ctxdma_new(struct nv50_dmac *dmac, struct nouveau_framebuffer *fb)
struct nouveau_framebuffer *fb)
{ {
struct nouveau_drm *drm = nouveau_drm(fb->base.dev); struct nouveau_drm *drm = nouveau_drm(fb->base.dev);
struct nv50_dmac_ctxdma *ctxdma; struct nv50_dmac_ctxdma *ctxdma;
const u8 kind = (fb->nvbo->tile_flags & 0x0000ff00) >> 8; const u8 kind = (fb->nvbo->tile_flags & 0x0000ff00) >> 8;
const u32 handle = 0xfb000000 | kind;
struct { struct {
struct nv_dma_v0 base; struct nv_dma_v0 base;
union { union {
...@@ -951,21 +951,17 @@ nv50_wndw_prepare_fb(struct drm_plane *plane, struct drm_plane_state *state) ...@@ -951,21 +951,17 @@ nv50_wndw_prepare_fb(struct drm_plane *plane, struct drm_plane_state *state)
struct nv50_wndw_atom *asyw = nv50_wndw_atom(state); struct nv50_wndw_atom *asyw = nv50_wndw_atom(state);
struct nv50_head_atom *asyh; struct nv50_head_atom *asyh;
struct nv50_dmac_ctxdma *ctxdma; struct nv50_dmac_ctxdma *ctxdma;
u32 name;
u8 kind;
int ret; int ret;
NV_ATOMIC(drm, "%s prepare: %p\n", plane->name, state->fb); NV_ATOMIC(drm, "%s prepare: %p\n", plane->name, state->fb);
if (!asyw->state.fb) if (!asyw->state.fb)
return 0; return 0;
kind = (fb->nvbo->tile_flags & 0x0000ff00) >> 8;
name = 0xfb000000 | kind;
ret = nouveau_bo_pin(fb->nvbo, TTM_PL_FLAG_VRAM, true); ret = nouveau_bo_pin(fb->nvbo, TTM_PL_FLAG_VRAM, true);
if (ret) if (ret)
return ret; return ret;
ctxdma = nv50_dmac_ctxdma_new(wndw->dmac, name, fb); ctxdma = nv50_dmac_ctxdma_new(wndw->dmac, fb);
if (IS_ERR(ctxdma)) { if (IS_ERR(ctxdma)) {
nouveau_bo_unpin(fb->nvbo); nouveau_bo_unpin(fb->nvbo);
return PTR_ERR(ctxdma); return PTR_ERR(ctxdma);
...@@ -3364,67 +3360,6 @@ nv50_pior_create(struct drm_connector *connector, struct dcb_output *dcbe) ...@@ -3364,67 +3360,6 @@ nv50_pior_create(struct drm_connector *connector, struct dcb_output *dcbe)
return 0; return 0;
} }
/******************************************************************************
* Framebuffer
*****************************************************************************/
static void
nv50_fb_dtor(struct drm_framebuffer *fb)
{
}
static int
nv50_fb_ctor(struct drm_framebuffer *fb)
{
struct nouveau_framebuffer *nv_fb = nouveau_framebuffer(fb);
struct nouveau_drm *drm = nouveau_drm(fb->dev);
struct nouveau_bo *nvbo = nv_fb->nvbo;
struct nv50_disp *disp = nv50_disp(fb->dev);
u8 kind = nouveau_bo_tile_layout(nvbo) >> 8;
u8 tile = nvbo->tile_mode;
struct drm_crtc *crtc;
if (drm->device.info.chipset >= 0xc0)
tile >>= 4; /* yep.. */
switch (fb->depth) {
case 8: nv_fb->r_format = 0x1e00; break;
case 15: nv_fb->r_format = 0xe900; break;
case 16: nv_fb->r_format = 0xe800; break;
case 24:
case 32: nv_fb->r_format = 0xcf00; break;
case 30: nv_fb->r_format = 0xd100; break;
default:
NV_ERROR(drm, "unknown depth %d\n", fb->depth);
return -EINVAL;
}
if (disp->disp->oclass < G82_DISP) {
nv_fb->r_pitch = kind ? (((fb->pitches[0] / 4) << 4) | tile) :
(fb->pitches[0] | 0x00100000);
nv_fb->r_format |= kind << 16;
} else
if (disp->disp->oclass < GF110_DISP) {
nv_fb->r_pitch = kind ? (((fb->pitches[0] / 4) << 4) | tile) :
(fb->pitches[0] | 0x00100000);
} else {
nv_fb->r_pitch = kind ? (((fb->pitches[0] / 4) << 4) | tile) :
(fb->pitches[0] | 0x01000000);
}
nv_fb->r_handle = 0xffff0000 | kind;
list_for_each_entry(crtc, &drm->dev->mode_config.crtc_list, head) {
struct nv50_wndw *wndw = nv50_wndw(crtc->primary);
struct nv50_dmac_ctxdma *ctxdma;
ctxdma = nv50_dmac_ctxdma_new(wndw->dmac, nv_fb->r_handle, nv_fb);
if (IS_ERR(ctxdma))
return PTR_ERR(ctxdma);
}
return 0;
}
/****************************************************************************** /******************************************************************************
* Atomic * Atomic
*****************************************************************************/ *****************************************************************************/
...@@ -3955,8 +3890,6 @@ nv50_display_create(struct drm_device *dev) ...@@ -3955,8 +3890,6 @@ nv50_display_create(struct drm_device *dev)
nouveau_display(dev)->dtor = nv50_display_destroy; nouveau_display(dev)->dtor = nv50_display_destroy;
nouveau_display(dev)->init = nv50_display_init; nouveau_display(dev)->init = nv50_display_init;
nouveau_display(dev)->fini = nv50_display_fini; nouveau_display(dev)->fini = nv50_display_fini;
nouveau_display(dev)->fb_ctor = nv50_fb_ctor;
nouveau_display(dev)->fb_dtor = nv50_fb_dtor;
disp->disp = &nouveau_display(dev)->disp; disp->disp = &nouveau_display(dev)->disp;
dev->mode_config.funcs = &nv50_disp_func; dev->mode_config.funcs = &nv50_disp_func;
if (nouveau_atomic) if (nouveau_atomic)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment