drm: Move encoder->save/restore into nouveau
Nouveau is the only user, and atomic drivers should do state save/restoring differently. So move it into noveau. Saves me typing some kerneldoc, too ;-) v2: Move misplaced hunk into earlier nouveau patch. Cc: Ilia Mirkin <imirkin@alum.mit.edu> Cc: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1449245647-1315-1-git-send-email-daniel.vetter@ffwll.ch Reviewed-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
parent
813b0f3e00
commit
129b782008
|
@ -504,8 +504,6 @@ static void nv04_dac_destroy(struct drm_encoder *encoder)
|
|||
|
||||
static const struct drm_encoder_helper_funcs nv04_dac_helper_funcs = {
|
||||
.dpms = nv04_dac_dpms,
|
||||
.save = nv04_dac_save,
|
||||
.restore = nv04_dac_restore,
|
||||
.mode_fixup = nv04_dac_mode_fixup,
|
||||
.prepare = nv04_dac_prepare,
|
||||
.commit = nv04_dac_commit,
|
||||
|
@ -515,8 +513,6 @@ static const struct drm_encoder_helper_funcs nv04_dac_helper_funcs = {
|
|||
|
||||
static const struct drm_encoder_helper_funcs nv17_dac_helper_funcs = {
|
||||
.dpms = nv04_dac_dpms,
|
||||
.save = nv04_dac_save,
|
||||
.restore = nv04_dac_restore,
|
||||
.mode_fixup = nv04_dac_mode_fixup,
|
||||
.prepare = nv04_dac_prepare,
|
||||
.commit = nv04_dac_commit,
|
||||
|
@ -545,6 +541,9 @@ nv04_dac_create(struct drm_connector *connector, struct dcb_output *entry)
|
|||
nv_encoder->dcb = entry;
|
||||
nv_encoder->or = ffs(entry->or) - 1;
|
||||
|
||||
nv_encoder->enc_save = nv04_dac_save;
|
||||
nv_encoder->enc_restore = nv04_dac_restore;
|
||||
|
||||
if (nv_gf4_disp_arch(dev))
|
||||
helper = &nv17_dac_helper_funcs;
|
||||
else
|
||||
|
|
|
@ -652,8 +652,6 @@ static void nv04_tmds_slave_init(struct drm_encoder *encoder)
|
|||
|
||||
static const struct drm_encoder_helper_funcs nv04_lvds_helper_funcs = {
|
||||
.dpms = nv04_lvds_dpms,
|
||||
.save = nv04_dfp_save,
|
||||
.restore = nv04_dfp_restore,
|
||||
.mode_fixup = nv04_dfp_mode_fixup,
|
||||
.prepare = nv04_dfp_prepare,
|
||||
.commit = nv04_dfp_commit,
|
||||
|
@ -663,8 +661,6 @@ static const struct drm_encoder_helper_funcs nv04_lvds_helper_funcs = {
|
|||
|
||||
static const struct drm_encoder_helper_funcs nv04_tmds_helper_funcs = {
|
||||
.dpms = nv04_tmds_dpms,
|
||||
.save = nv04_dfp_save,
|
||||
.restore = nv04_dfp_restore,
|
||||
.mode_fixup = nv04_dfp_mode_fixup,
|
||||
.prepare = nv04_dfp_prepare,
|
||||
.commit = nv04_dfp_commit,
|
||||
|
@ -701,6 +697,9 @@ nv04_dfp_create(struct drm_connector *connector, struct dcb_output *entry)
|
|||
if (!nv_encoder)
|
||||
return -ENOMEM;
|
||||
|
||||
nv_encoder->enc_save = nv04_dfp_save;
|
||||
nv_encoder->enc_restore = nv04_dfp_restore;
|
||||
|
||||
encoder = to_drm_encoder(nv_encoder);
|
||||
|
||||
nv_encoder->dcb = entry;
|
||||
|
|
|
@ -39,6 +39,7 @@ nv04_display_create(struct drm_device *dev)
|
|||
struct dcb_table *dcb = &drm->vbios.dcb;
|
||||
struct drm_connector *connector, *ct;
|
||||
struct drm_encoder *encoder;
|
||||
struct nouveau_encoder *nv_encoder;
|
||||
struct nouveau_crtc *crtc;
|
||||
struct nv04_display *disp;
|
||||
int i, ret;
|
||||
|
@ -110,11 +111,8 @@ nv04_display_create(struct drm_device *dev)
|
|||
list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head)
|
||||
crtc->save(&crtc->base);
|
||||
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
|
||||
const struct drm_encoder_helper_funcs *func = encoder->helper_private;
|
||||
|
||||
func->save(encoder);
|
||||
}
|
||||
list_for_each_entry(nv_encoder, &dev->mode_config.encoder_list, base.base.head)
|
||||
nv_encoder->enc_save(&nv_encoder->base.base);
|
||||
|
||||
nouveau_overlay_init(dev);
|
||||
|
||||
|
@ -126,7 +124,7 @@ nv04_display_destroy(struct drm_device *dev)
|
|||
{
|
||||
struct nv04_display *disp = nv04_display(dev);
|
||||
struct nouveau_drm *drm = nouveau_drm(dev);
|
||||
struct drm_encoder *encoder;
|
||||
struct nouveau_encoder *encoder;
|
||||
struct drm_crtc *crtc;
|
||||
struct nouveau_crtc *nv_crtc;
|
||||
|
||||
|
@ -140,11 +138,8 @@ nv04_display_destroy(struct drm_device *dev)
|
|||
}
|
||||
|
||||
/* Restore state */
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
|
||||
const struct drm_encoder_helper_funcs *func = encoder->helper_private;
|
||||
|
||||
func->restore(encoder);
|
||||
}
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.base.head)
|
||||
encoder->enc_restore(&encoder->base.base);
|
||||
|
||||
list_for_each_entry(nv_crtc, &dev->mode_config.crtc_list, base.head)
|
||||
nv_crtc->restore(&nv_crtc->base);
|
||||
|
@ -160,8 +155,8 @@ nv04_display_destroy(struct drm_device *dev)
|
|||
int
|
||||
nv04_display_init(struct drm_device *dev)
|
||||
{
|
||||
struct drm_encoder *encoder;
|
||||
struct drm_crtc *crtc;
|
||||
struct nouveau_encoder *encoder;
|
||||
struct nouveau_crtc *crtc;
|
||||
|
||||
/* meh.. modeset apparently doesn't setup all the regs and depends
|
||||
* on pre-existing state, for now load the state of the card *before*
|
||||
|
@ -171,14 +166,11 @@ nv04_display_init(struct drm_device *dev)
|
|||
* save/restore "pre-load" state, but more general so we can save
|
||||
* on suspend too.
|
||||
*/
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
|
||||
const struct drm_encoder_helper_funcs *func = encoder->helper_private;
|
||||
list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head)
|
||||
crtc->save(&crtc->base);
|
||||
|
||||
func->restore(encoder);
|
||||
}
|
||||
|
||||
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
|
||||
crtc->funcs->restore(crtc);
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.base.head)
|
||||
encoder->enc_save(&encoder->base.base);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -192,8 +192,6 @@ static const struct drm_encoder_funcs nv04_tv_funcs = {
|
|||
|
||||
static const struct drm_encoder_helper_funcs nv04_tv_helper_funcs = {
|
||||
.dpms = nv04_tv_dpms,
|
||||
.save = drm_i2c_encoder_save,
|
||||
.restore = drm_i2c_encoder_restore,
|
||||
.mode_fixup = drm_i2c_encoder_mode_fixup,
|
||||
.prepare = nv04_tv_prepare,
|
||||
.commit = nv04_tv_commit,
|
||||
|
@ -228,6 +226,9 @@ nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry)
|
|||
drm_encoder_init(dev, encoder, &nv04_tv_funcs, DRM_MODE_ENCODER_TVDAC);
|
||||
drm_encoder_helper_add(encoder, &nv04_tv_helper_funcs);
|
||||
|
||||
nv_encoder->enc_save = drm_i2c_encoder_save;
|
||||
nv_encoder->enc_restore = drm_i2c_encoder_restore;
|
||||
|
||||
encoder->possible_crtcs = entry->heads;
|
||||
encoder->possible_clones = 0;
|
||||
nv_encoder->dcb = entry;
|
||||
|
|
|
@ -771,8 +771,6 @@ static void nv17_tv_destroy(struct drm_encoder *encoder)
|
|||
|
||||
static struct drm_encoder_helper_funcs nv17_tv_helper_funcs = {
|
||||
.dpms = nv17_tv_dpms,
|
||||
.save = nv17_tv_save,
|
||||
.restore = nv17_tv_restore,
|
||||
.mode_fixup = nv17_tv_mode_fixup,
|
||||
.prepare = nv17_tv_prepare,
|
||||
.commit = nv17_tv_commit,
|
||||
|
@ -820,6 +818,9 @@ nv17_tv_create(struct drm_connector *connector, struct dcb_output *entry)
|
|||
drm_encoder_helper_add(encoder, &nv17_tv_helper_funcs);
|
||||
to_encoder_slave(encoder)->slave_funcs = &nv17_tv_slave_funcs;
|
||||
|
||||
tv_enc->base.enc_save = nv17_tv_save;
|
||||
tv_enc->base.enc_restore = nv17_tv_restore;
|
||||
|
||||
encoder->possible_crtcs = entry->heads;
|
||||
encoder->possible_clones = 0;
|
||||
|
||||
|
|
|
@ -63,6 +63,9 @@ struct nouveau_encoder {
|
|||
u32 datarate;
|
||||
} dp;
|
||||
};
|
||||
|
||||
void (*enc_save)(struct drm_encoder *encoder);
|
||||
void (*enc_restore)(struct drm_encoder *encoder);
|
||||
};
|
||||
|
||||
struct nouveau_encoder *
|
||||
|
|
|
@ -131,8 +131,6 @@ static inline void drm_crtc_helper_add(struct drm_crtc *crtc,
|
|||
/**
|
||||
* struct drm_encoder_helper_funcs - helper operations for encoders
|
||||
* @dpms: set power state
|
||||
* @save: save connector state
|
||||
* @restore: restore connector state
|
||||
* @mode_fixup: try to fixup proposed mode for this connector
|
||||
* @prepare: part of the disable sequence, called before the CRTC modeset
|
||||
* @commit: called after the CRTC modeset
|
||||
|
@ -154,8 +152,6 @@ static inline void drm_crtc_helper_add(struct drm_crtc *crtc,
|
|||
*/
|
||||
struct drm_encoder_helper_funcs {
|
||||
void (*dpms)(struct drm_encoder *encoder, int mode);
|
||||
void (*save)(struct drm_encoder *encoder);
|
||||
void (*restore)(struct drm_encoder *encoder);
|
||||
|
||||
bool (*mode_fixup)(struct drm_encoder *encoder,
|
||||
const struct drm_display_mode *mode,
|
||||
|
|
Loading…
Reference in New Issue