Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 293750
b: refs/heads/master
c: 25c53c1
h: refs/heads/master
v: v3
  • Loading branch information
Ben Skeggs committed Mar 13, 2012
1 parent 8af5f36 commit ba802c9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8d7bb400638906075c38cb07891993cf95076aa7
refs/heads/master: 25c53c1068a804c6b51f86e937cebab6274dc056
4 changes: 4 additions & 0 deletions trunk/drivers/gpu/drm/nouveau/nouveau_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,9 @@ struct nouveau_pm_tbl_entry {

struct nouveau_pm_profile;
struct nouveau_pm_profile_func {
void (*destroy)(struct nouveau_pm_profile *);
void (*init)(struct nouveau_pm_profile *);
void (*fini)(struct nouveau_pm_profile *);
struct nouveau_pm_level *(*select)(struct nouveau_pm_profile *);
};

Expand Down Expand Up @@ -556,6 +559,7 @@ struct nouveau_pm_engine {

struct nouveau_pm_profile *profile_ac;
struct nouveau_pm_profile *profile_dc;
struct nouveau_pm_profile *profile;
struct list_head profiles;

struct nouveau_pm_level boot;
Expand Down
21 changes: 21 additions & 0 deletions trunk/drivers/gpu/drm/nouveau/nouveau_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ nouveau_pm_trigger(struct drm_device *dev)
else
profile = pm->profile_dc;

if (profile != pm->profile) {
pm->profile->func->fini(pm->profile);
pm->profile = profile;
pm->profile->func->init(pm->profile);
}

/* select performance level based on profile */
perflvl = profile->func->select(profile);

Expand Down Expand Up @@ -251,13 +257,21 @@ nouveau_pm_profile_set(struct drm_device *dev, const char *profile)
return 0;
}

static void
nouveau_pm_static_dummy(struct nouveau_pm_profile *profile)
{
}

static struct nouveau_pm_level *
nouveau_pm_static_select(struct nouveau_pm_profile *profile)
{
return container_of(profile, struct nouveau_pm_level, profile);
}

const struct nouveau_pm_profile_func nouveau_pm_static_profile_func = {
.destroy = nouveau_pm_static_dummy,
.init = nouveau_pm_static_dummy,
.fini = nouveau_pm_static_dummy,
.select = nouveau_pm_static_select,
};

Expand Down Expand Up @@ -856,6 +870,7 @@ nouveau_pm_init(struct drm_device *dev)

pm->profile_ac = &pm->boot.profile;
pm->profile_dc = &pm->boot.profile;
pm->profile = &pm->boot.profile;
pm->cur = &pm->boot;

/* add performance levels from vbios */
Expand Down Expand Up @@ -893,6 +908,12 @@ nouveau_pm_fini(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
struct nouveau_pm_profile *profile, *tmp;

list_for_each_entry_safe(profile, tmp, &pm->profiles, head) {
list_del(&profile->head);
profile->func->destroy(profile);
}

if (pm->cur != &pm->boot)
nouveau_pm_perflvl_set(dev, &pm->boot);
Expand Down

0 comments on commit ba802c9

Please sign in to comment.