Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 348647
b: refs/heads/master
c: ff4bd08
h: refs/heads/master
i:
  348645: 7b321b4
  348643: 8e9c469
  348639: c54a33e
v: v3
  • Loading branch information
Ilija Hadzic authored and Alex Deucher committed Jan 10, 2013
1 parent cf76514 commit 72253d2
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 117 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: 94bc70a8e7ed734c201a4d7b0607619372f4b724
refs/heads/master: ff4bd0827764e10a428a9d39e6814c5478863f94
4 changes: 3 additions & 1 deletion trunk/drivers/gpu/drm/nouveau/core/core/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ nouveau_client_create_(const char *name, u64 devname, const char *cfg,

ret = nouveau_handle_create(nv_object(client), ~0, ~0,
nv_object(client), &client->root);
if (ret)
if (ret) {
nouveau_namedb_destroy(&client->base);
return ret;
}

/* prevent init/fini being called, os in in charge of this */
atomic_set(&nv_object(client)->usecount, 2);
Expand Down
5 changes: 1 addition & 4 deletions trunk/drivers/gpu/drm/nouveau/core/core/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ nouveau_handle_create(struct nouveau_object *parent, u32 _parent, u32 _handle,
while (!nv_iclass(namedb, NV_NAMEDB_CLASS))
namedb = namedb->parent;

handle = kzalloc(sizeof(*handle), GFP_KERNEL);
handle = *phandle = kzalloc(sizeof(*handle), GFP_KERNEL);
if (!handle)
return -ENOMEM;

Expand Down Expand Up @@ -146,9 +146,6 @@ nouveau_handle_create(struct nouveau_object *parent, u32 _parent, u32 _handle,
}

hprintk(handle, TRACE, "created\n");

*phandle = handle;

return 0;
}

Expand Down
46 changes: 20 additions & 26 deletions trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,23 +851,20 @@ exec_script(struct nv50_disp_priv *priv, int head, int id)
for (i = 0; !(ctrl & (1 << head)) && i < 3; i++)
ctrl = nv_rd32(priv, 0x610b5c + (i * 8));

if (!(ctrl & (1 << head))) {
if (nv_device(priv)->chipset < 0x90 ||
nv_device(priv)->chipset == 0x92 ||
nv_device(priv)->chipset == 0xa0) {
for (i = 0; !(ctrl & (1 << head)) && i < 2; i++)
ctrl = nv_rd32(priv, 0x610b74 + (i * 8));
i += 4;
} else {
for (i = 0; !(ctrl & (1 << head)) && i < 4; i++)
ctrl = nv_rd32(priv, 0x610798 + (i * 8));
i += 4;
}
if (nv_device(priv)->chipset < 0x90 ||
nv_device(priv)->chipset == 0x92 ||
nv_device(priv)->chipset == 0xa0) {
for (i = 0; !(ctrl & (1 << head)) && i < 2; i++)
ctrl = nv_rd32(priv, 0x610b74 + (i * 8));
i += 3;
} else {
for (i = 0; !(ctrl & (1 << head)) && i < 4; i++)
ctrl = nv_rd32(priv, 0x610798 + (i * 8));
i += 3;
}

if (!(ctrl & (1 << head)))
return false;
i--;

data = exec_lookup(priv, head, i, ctrl, &dcb, &ver, &hdr, &cnt, &len, &info);
if (data) {
Expand Down Expand Up @@ -901,23 +898,20 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int id, u32 pclk,
for (i = 0; !(ctrl & (1 << head)) && i < 3; i++)
ctrl = nv_rd32(priv, 0x610b58 + (i * 8));

if (!(ctrl & (1 << head))) {
if (nv_device(priv)->chipset < 0x90 ||
nv_device(priv)->chipset == 0x92 ||
nv_device(priv)->chipset == 0xa0) {
for (i = 0; !(ctrl & (1 << head)) && i < 2; i++)
ctrl = nv_rd32(priv, 0x610b70 + (i * 8));
i += 4;
} else {
for (i = 0; !(ctrl & (1 << head)) && i < 4; i++)
ctrl = nv_rd32(priv, 0x610794 + (i * 8));
i += 4;
}
if (nv_device(priv)->chipset < 0x90 ||
nv_device(priv)->chipset == 0x92 ||
nv_device(priv)->chipset == 0xa0) {
for (i = 0; !(ctrl & (1 << head)) && i < 2; i++)
ctrl = nv_rd32(priv, 0x610b70 + (i * 8));
i += 3;
} else {
for (i = 0; !(ctrl & (1 << head)) && i < 4; i++)
ctrl = nv_rd32(priv, 0x610794 + (i * 8));
i += 3;
}

if (!(ctrl & (1 << head)))
return 0x0000;
i--;

data = exec_lookup(priv, head, i, ctrl, outp, &ver, &hdr, &cnt, &len, &info1);
if (!data)
Expand Down
3 changes: 0 additions & 3 deletions trunk/drivers/gpu/drm/nouveau/core/include/core/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ nouveau_client(void *obj)

int nouveau_client_create_(const char *name, u64 device, const char *cfg,
const char *dbg, int, void **);
#define nouveau_client_destroy(p) \
nouveau_namedb_destroy(&(p)->base)

int nouveau_client_init(struct nouveau_client *);
int nouveau_client_fini(struct nouveau_client *, bool suspend);

Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/pll.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ enum nvbios_pll_type {
PLL_UNK42 = 0x42,
PLL_VPLL0 = 0x80,
PLL_VPLL1 = 0x81,
PLL_VPLL2 = 0x82,
PLL_VPLL3 = 0x83,
PLL_MAX = 0xff
};

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,7 @@ init_io(struct nvbios_init *init)
mdelay(10);
init_wr32(init, 0x614100, 0x10000018);
init_wr32(init, 0x614900, 0x10000018);
return;
}

value = init_rdport(init, port) & mask;
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ nvc0_clock_pll_set(struct nouveau_clock *clk, u32 type, u32 freq)
switch (info.type) {
case PLL_VPLL0:
case PLL_VPLL1:
case PLL_VPLL2:
case PLL_VPLL3:
nv_mask(priv, info.reg + 0x0c, 0x00000000, 0x00000100);
nv_wr32(priv, info.reg + 0x04, (P << 16) | (N << 8) | M);
nv_wr32(priv, info.reg + 0x10, fN << 16);
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,22 @@ nvc0_fb_vram_new(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin,
mem->memtype = type;
mem->size = size;

mutex_lock(&pfb->base.mutex);
mutex_lock(&mm->mutex);
do {
if (back)
ret = nouveau_mm_tail(mm, 1, size, ncmin, align, &r);
else
ret = nouveau_mm_head(mm, 1, size, ncmin, align, &r);
if (ret) {
mutex_unlock(&pfb->base.mutex);
mutex_unlock(&mm->mutex);
pfb->ram.put(pfb, &mem);
return ret;
}

list_add_tail(&r->rl_entry, &mem->regions);
size -= r->length;
} while (size);
mutex_unlock(&pfb->base.mutex);
mutex_unlock(&mm->mutex);

r = list_first_entry(&mem->regions, struct nouveau_mm_node, rl_entry);
mem->offset = (u64)r->offset << 12;
Expand Down
35 changes: 8 additions & 27 deletions trunk/drivers/gpu/drm/nouveau/core/subdev/instmem/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,15 @@ nouveau_instobj_create_(struct nouveau_object *parent,
if (ret)
return ret;

mutex_lock(&imem->base.mutex);
list_add(&iobj->head, &imem->list);
mutex_unlock(&imem->base.mutex);
return 0;
}

void
nouveau_instobj_destroy(struct nouveau_instobj *iobj)
{
struct nouveau_subdev *subdev = nv_subdev(iobj->base.engine);

mutex_lock(&subdev->mutex);
list_del(&iobj->head);
mutex_unlock(&subdev->mutex);

if (iobj->head.prev)
list_del(&iobj->head);
return nouveau_object_destroy(&iobj->base);
}

Expand Down Expand Up @@ -94,8 +88,6 @@ nouveau_instmem_init(struct nouveau_instmem *imem)
if (ret)
return ret;

mutex_lock(&imem->base.mutex);

list_for_each_entry(iobj, &imem->list, head) {
if (iobj->suspend) {
for (i = 0; i < iobj->size; i += 4)
Expand All @@ -105,35 +97,24 @@ nouveau_instmem_init(struct nouveau_instmem *imem)
}
}

mutex_unlock(&imem->base.mutex);

return 0;
}

int
nouveau_instmem_fini(struct nouveau_instmem *imem, bool suspend)
{
struct nouveau_instobj *iobj;
int i, ret = 0;
int i;

if (suspend) {
mutex_lock(&imem->base.mutex);

list_for_each_entry(iobj, &imem->list, head) {
iobj->suspend = vmalloc(iobj->size);
if (!iobj->suspend) {
ret = -ENOMEM;
break;
}

for (i = 0; i < iobj->size; i += 4)
iobj->suspend[i / 4] = nv_ro32(iobj, i);
if (iobj->suspend) {
for (i = 0; i < iobj->size; i += 4)
iobj->suspend[i / 4] = nv_ro32(iobj, i);
} else
return -ENOMEM;
}

mutex_unlock(&imem->base.mutex);

if (ret)
return ret;
}

return nouveau_subdev_fini(&imem->base, suspend);
Expand Down
4 changes: 1 addition & 3 deletions trunk/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
u64 mm_length = (offset + length) - mm_offset;
int ret;

vm = kzalloc(sizeof(*vm), GFP_KERNEL);
vm = *pvm = kzalloc(sizeof(*vm), GFP_KERNEL);
if (!vm)
return -ENOMEM;

Expand All @@ -376,8 +376,6 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
return ret;
}

*pvm = vm;

return 0;
}

Expand Down
30 changes: 4 additions & 26 deletions trunk/drivers/gpu/drm/nouveau/nouveau_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,26 +127,12 @@ nouveau_connector_ddc_detect(struct drm_connector *connector,
struct nouveau_encoder **pnv_encoder)
{
struct drm_device *dev = connector->dev;
struct nouveau_connector *nv_connector = nouveau_connector(connector);
struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_gpio *gpio = nouveau_gpio(drm->device);
struct nouveau_i2c *i2c = nouveau_i2c(drm->device);
struct nouveau_i2c_port *port = NULL;
int i, panel = -ENODEV;

/* eDP panels need powering on by us (if the VBIOS doesn't default it
* to on) before doing any AUX channel transactions. LVDS panel power
* is handled by the SOR itself, and not required for LVDS DDC.
*/
if (nv_connector->type == DCB_CONNECTOR_eDP) {
panel = gpio->get(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff);
if (panel == 0) {
gpio->set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, 1);
msleep(300);
}
}
int i;

for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
struct nouveau_i2c_port *port = NULL;
struct nouveau_encoder *nv_encoder;
struct drm_mode_object *obj;
int id;
Expand All @@ -164,19 +150,11 @@ nouveau_connector_ddc_detect(struct drm_connector *connector,
port = i2c->find(i2c, nv_encoder->dcb->i2c_index);
if (port && nv_probe_i2c(port, 0x50)) {
*pnv_encoder = nv_encoder;
break;
return port;
}

port = NULL;
}

/* eDP panel not detected, restore panel power GPIO to previous
* state to avoid confusing the SOR for other output types.
*/
if (!port && panel == 0)
gpio->set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, panel);

return port;
return NULL;
}

static struct nouveau_encoder *
Expand Down
9 changes: 9 additions & 0 deletions trunk/drivers/gpu/drm/nouveau/nouveau_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,15 @@ nouveau_display_init(struct drm_device *dev)
if (ret)
return ret;

/* power on internal panel if it's not already. the init tables of
* some vbios default this to off for some reason, causing the
* panel to not work after resume
*/
if (gpio && gpio->get(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff) == 0) {
gpio->set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, 1);
msleep(300);
}

/* enable polling for external displays */
drm_kms_helper_poll_enable(dev);

Expand Down
7 changes: 1 addition & 6 deletions trunk/drivers/gpu/drm/nouveau/nouveau_drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,11 @@ nouveau_cli_create(struct pci_dev *pdev, const char *name,
struct nouveau_cli *cli;
int ret;

*pcli = NULL;
ret = nouveau_client_create_(name, nouveau_name(pdev), nouveau_config,
nouveau_debug, size, pcli);
cli = *pcli;
if (ret) {
if (cli)
nouveau_client_destroy(&cli->base);
*pcli = NULL;
if (ret)
return ret;
}

mutex_init(&cli->mutex);
return 0;
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/gpu/drm/nouveau/nouveau_fence.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ u32 nv10_fence_read(struct nouveau_channel *);
void nv10_fence_context_del(struct nouveau_channel *);
void nv10_fence_destroy(struct nouveau_drm *);
int nv10_fence_create(struct nouveau_drm *);
void nv17_fence_resume(struct nouveau_drm *drm);

int nv50_fence_create(struct nouveau_drm *);
int nv84_fence_create(struct nouveau_drm *);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/gpu/drm/nouveau/nv04_dfp.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode)

static inline bool is_powersaving_dpms(int mode)
{
return mode != DRM_MODE_DPMS_ON && mode != NV_DPMS_CLEARED;
return (mode != DRM_MODE_DPMS_ON);
}

static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode)
Expand Down
8 changes: 0 additions & 8 deletions trunk/drivers/gpu/drm/nouveau/nv10_fence.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,6 @@ nv10_fence_destroy(struct nouveau_drm *drm)
kfree(priv);
}

void nv17_fence_resume(struct nouveau_drm *drm)
{
struct nv10_fence_priv *priv = drm->fence;

nouveau_bo_wr32(priv->bo, 0, priv->sequence);
}

int
nv10_fence_create(struct nouveau_drm *drm)
{
Expand Down Expand Up @@ -204,7 +197,6 @@ nv10_fence_create(struct nouveau_drm *drm)
if (ret == 0) {
nouveau_bo_wr32(priv->bo, 0x000, 0x00000000);
priv->base.sync = nv17_fence_sync;
priv->base.resume = nv17_fence_resume;
}
}

Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/gpu/drm/nouveau/nv50_fence.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ nv50_fence_create(struct nouveau_drm *drm)
if (ret == 0) {
nouveau_bo_wr32(priv->bo, 0x000, 0x00000000);
priv->base.sync = nv17_fence_sync;
priv->base.resume = nv17_fence_resume;
}

if (ret)
Expand Down
Loading

0 comments on commit 72253d2

Please sign in to comment.