Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358282
b: refs/heads/master
c: 1d7c71a
h: refs/heads/master
v: v3
  • Loading branch information
Ben Skeggs committed Feb 20, 2013
1 parent 407dbb8 commit 938fbc2
Show file tree
Hide file tree
Showing 20 changed files with 227 additions and 217 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 21a5ace0bfb737d65e6d345ccf3d63fdee141f98
refs/heads/master: 1d7c71a3e2f77336df536855b0efd2dc5bdeb41b
1 change: 1 addition & 0 deletions trunk/drivers/gpu/drm/nouveau/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ nouveau-y += core/engine/copy/nvc0.o
nouveau-y += core/engine/copy/nve0.o
nouveau-y += core/engine/crypt/nv84.o
nouveau-y += core/engine/crypt/nv98.o
nouveau-y += core/engine/disp/base.o
nouveau-y += core/engine/disp/nv04.o
nouveau-y += core/engine/disp/nv50.o
nouveau-y += core/engine/disp/nv84.o
Expand Down
52 changes: 52 additions & 0 deletions trunk/drivers/gpu/drm/nouveau/core/engine/disp/base.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright 2013 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs
*/

#include <engine/disp.h>

void
_nouveau_disp_dtor(struct nouveau_object *object)
{
struct nouveau_disp *disp = (void *)object;
nouveau_event_destroy(&disp->vblank);
nouveau_engine_destroy(&disp->base);
}

int
nouveau_disp_create_(struct nouveau_object *parent,
struct nouveau_object *engine,
struct nouveau_oclass *oclass, int heads,
const char *intname, const char *extname,
int length, void **pobject)
{
struct nouveau_disp *disp;
int ret;

ret = nouveau_engine_create_(parent, engine, oclass, true,
intname, extname, length, pobject);
disp = *pobject;
if (ret)
return ret;

return nouveau_event_create(heads, &disp->vblank);
}
31 changes: 22 additions & 9 deletions trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv04.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
*/

#include <engine/disp.h>

#include <core/event.h>
#include <core/class.h>

struct nv04_disp_priv {
Expand All @@ -35,12 +37,20 @@ nv04_disp_sclass[] = {
{},
};

/*******************************************************************************
* Display engine implementation
******************************************************************************/

static void
nv04_disp_vblank_enable(struct nouveau_event *event, int head)
{
nv_wr32(event->priv, 0x600140 + (head * 0x2000) , 0x00000001);
}

static void
nv04_disp_intr_vblank(struct nv04_disp_priv *priv, int crtc)
nv04_disp_vblank_disable(struct nouveau_event *event, int head)
{
struct nouveau_disp *disp = &priv->base;
if (disp->vblank.notify)
disp->vblank.notify(disp->vblank.data, crtc);
nv_wr32(event->priv, 0x600140 + (head * 0x2000) , 0x00000000);
}

static void
Expand All @@ -51,32 +61,35 @@ nv04_disp_intr(struct nouveau_subdev *subdev)
u32 crtc1 = nv_rd32(priv, 0x602100);

if (crtc0 & 0x00000001) {
nv04_disp_intr_vblank(priv, 0);
nouveau_event_trigger(priv->base.vblank, 0);
nv_wr32(priv, 0x600100, 0x00000001);
}

if (crtc1 & 0x00000001) {
nv04_disp_intr_vblank(priv, 1);
nouveau_event_trigger(priv->base.vblank, 1);
nv_wr32(priv, 0x602100, 0x00000001);
}
}

static int
nv04_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
struct nouveau_oclass *oclass, void *data, u32 size,
struct nouveau_object **pobject)
struct nouveau_oclass *oclass, void *data, u32 size,
struct nouveau_object **pobject)
{
struct nv04_disp_priv *priv;
int ret;

ret = nouveau_disp_create(parent, engine, oclass, "DISPLAY",
ret = nouveau_disp_create(parent, engine, oclass, 2, "DISPLAY",
"display", &priv);
*pobject = nv_object(priv);
if (ret)
return ret;

nv_engine(priv)->sclass = nv04_disp_sclass;
nv_subdev(priv)->intr = nv04_disp_intr;
priv->base.vblank->priv = priv;
priv->base.vblank->enable = nv04_disp_vblank_enable;
priv->base.vblank->disable = nv04_disp_vblank_disable;
return 0;
}

Expand Down
70 changes: 18 additions & 52 deletions trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <core/handle.h>
#include <core/class.h>

#include <engine/software.h>
#include <engine/disp.h>

#include <subdev/bios.h>
Expand All @@ -37,7 +36,6 @@
#include <subdev/bios/pll.h>
#include <subdev/timer.h>
#include <subdev/fb.h>
#include <subdev/bar.h>
#include <subdev/clock.h>

#include "nv50.h"
Expand Down Expand Up @@ -543,6 +541,18 @@ nv50_disp_curs_ofuncs = {
* Base display object
******************************************************************************/

static void
nv50_disp_base_vblank_enable(struct nouveau_event *event, int head)
{
nv_mask(event->priv, 0x61002c, (1 << head), (1 << head));
}

static void
nv50_disp_base_vblank_disable(struct nouveau_event *event, int head)
{
nv_mask(event->priv, 0x61002c, (1 << head), (0 << head));
}

static int
nv50_disp_base_ctor(struct nouveau_object *parent,
struct nouveau_object *engine,
Expand All @@ -559,6 +569,9 @@ nv50_disp_base_ctor(struct nouveau_object *parent,
if (ret)
return ret;

priv->base.vblank->priv = priv;
priv->base.vblank->enable = nv50_disp_base_vblank_enable;
priv->base.vblank->disable = nv50_disp_base_vblank_disable;
return nouveau_ramht_new(parent, parent, 0x1000, 0, &base->ramht);
}

Expand Down Expand Up @@ -756,50 +769,6 @@ nv50_disp_intr_error(struct nv50_disp_priv *priv)
}
}

static void
nv50_disp_intr_vblank(struct nv50_disp_priv *priv, int crtc)
{
struct nouveau_bar *bar = nouveau_bar(priv);
struct nouveau_disp *disp = &priv->base;
struct nouveau_software_chan *chan, *temp;
unsigned long flags;

spin_lock_irqsave(&disp->vblank.lock, flags);
list_for_each_entry_safe(chan, temp, &disp->vblank.list, vblank.head) {
if (chan->vblank.crtc != crtc)
continue;

if (nv_device(priv)->chipset >= 0xc0) {
nv_wr32(priv, 0x001718, 0x80000000 | chan->vblank.channel);
bar->flush(bar);
nv_wr32(priv, 0x06000c,
upper_32_bits(chan->vblank.offset));
nv_wr32(priv, 0x060010,
lower_32_bits(chan->vblank.offset));
nv_wr32(priv, 0x060014, chan->vblank.value);
} else {
nv_wr32(priv, 0x001704, chan->vblank.channel);
nv_wr32(priv, 0x001710, 0x80000000 | chan->vblank.ctxdma);
bar->flush(bar);
if (nv_device(priv)->chipset == 0x50) {
nv_wr32(priv, 0x001570, chan->vblank.offset);
nv_wr32(priv, 0x001574, chan->vblank.value);
} else {
nv_wr32(priv, 0x060010, chan->vblank.offset);
nv_wr32(priv, 0x060014, chan->vblank.value);
}
}

list_del(&chan->vblank.head);
if (disp->vblank.put)
disp->vblank.put(disp->vblank.data, crtc);
}
spin_unlock_irqrestore(&disp->vblank.lock, flags);

if (disp->vblank.notify)
disp->vblank.notify(disp->vblank.data, crtc);
}

static u16
exec_lookup(struct nv50_disp_priv *priv, int head, int outp, u32 ctrl,
struct dcb_output *dcb, u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
Expand Down Expand Up @@ -1201,13 +1170,13 @@ nv50_disp_intr(struct nouveau_subdev *subdev)
}

if (intr1 & 0x00000004) {
nv50_disp_intr_vblank(priv, 0);
nouveau_event_trigger(priv->base.vblank, 0);
nv_wr32(priv, 0x610024, 0x00000004);
intr1 &= ~0x00000004;
}

if (intr1 & 0x00000008) {
nv50_disp_intr_vblank(priv, 1);
nouveau_event_trigger(priv->base.vblank, 1);
nv_wr32(priv, 0x610024, 0x00000008);
intr1 &= ~0x00000008;
}
Expand All @@ -1226,7 +1195,7 @@ nv50_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
struct nv50_disp_priv *priv;
int ret;

ret = nouveau_disp_create(parent, engine, oclass, "PDISP",
ret = nouveau_disp_create(parent, engine, oclass, 2, "PDISP",
"display", &priv);
*pobject = nv_object(priv);
if (ret)
Expand All @@ -1242,9 +1211,6 @@ nv50_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
priv->dac.power = nv50_dac_power;
priv->dac.sense = nv50_dac_sense;
priv->sor.power = nv50_sor_power;

INIT_LIST_HEAD(&priv->base.vblank.list);
spin_lock_init(&priv->base.vblank.lock);
return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv50.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

#include <core/parent.h>
#include <core/namedb.h>
#include <core/engctx.h>
#include <core/ramht.h>
#include <core/event.h>

#include <engine/dmaobj.h>
#include <engine/disp.h>
Expand Down
5 changes: 1 addition & 4 deletions trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv84.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ nv84_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
struct nv50_disp_priv *priv;
int ret;

ret = nouveau_disp_create(parent, engine, oclass, "PDISP",
ret = nouveau_disp_create(parent, engine, oclass, 2, "PDISP",
"display", &priv);
*pobject = nv_object(priv);
if (ret)
Expand All @@ -80,9 +80,6 @@ nv84_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
priv->dac.sense = nv50_dac_sense;
priv->sor.power = nv50_sor_power;
priv->sor.hdmi = nv84_hdmi_ctrl;

INIT_LIST_HEAD(&priv->base.vblank.list);
spin_lock_init(&priv->base.vblank.lock);
return 0;
}

Expand Down
5 changes: 1 addition & 4 deletions trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv94.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ nv94_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
struct nv50_disp_priv *priv;
int ret;

ret = nouveau_disp_create(parent, engine, oclass, "PDISP",
ret = nouveau_disp_create(parent, engine, oclass, 2, "PDISP",
"display", &priv);
*pobject = nv_object(priv);
if (ret)
Expand All @@ -91,9 +91,6 @@ nv94_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
priv->sor.dp_train_fini = nv94_sor_dp_train_fini;
priv->sor.dp_lnkctl = nv94_sor_dp_lnkctl;
priv->sor.dp_drvctl = nv94_sor_dp_drvctl;

INIT_LIST_HEAD(&priv->base.vblank.list);
spin_lock_init(&priv->base.vblank.lock);
return 0;
}

Expand Down
5 changes: 1 addition & 4 deletions trunk/drivers/gpu/drm/nouveau/core/engine/disp/nva0.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ nva0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
struct nv50_disp_priv *priv;
int ret;

ret = nouveau_disp_create(parent, engine, oclass, "PDISP",
ret = nouveau_disp_create(parent, engine, oclass, 2, "PDISP",
"display", &priv);
*pobject = nv_object(priv);
if (ret)
Expand All @@ -70,9 +70,6 @@ nva0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
priv->dac.sense = nv50_dac_sense;
priv->sor.power = nv50_sor_power;
priv->sor.hdmi = nv84_hdmi_ctrl;

INIT_LIST_HEAD(&priv->base.vblank.list);
spin_lock_init(&priv->base.vblank.lock);
return 0;
}

Expand Down
5 changes: 1 addition & 4 deletions trunk/drivers/gpu/drm/nouveau/core/engine/disp/nva3.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ nva3_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
struct nv50_disp_priv *priv;
int ret;

ret = nouveau_disp_create(parent, engine, oclass, "PDISP",
ret = nouveau_disp_create(parent, engine, oclass, 2, "PDISP",
"display", &priv);
*pobject = nv_object(priv);
if (ret)
Expand All @@ -93,9 +93,6 @@ nva3_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
priv->sor.dp_train_fini = nv94_sor_dp_train_fini;
priv->sor.dp_lnkctl = nv94_sor_dp_lnkctl;
priv->sor.dp_drvctl = nv94_sor_dp_drvctl;

INIT_LIST_HEAD(&priv->base.vblank.list);
spin_lock_init(&priv->base.vblank.lock);
return 0;
}

Expand Down
Loading

0 comments on commit 938fbc2

Please sign in to comment.