diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-08-10 04:10:26 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-08-10 05:28:08 +1000 |
commit | d55b4af909bc16f7982c2b8b8656f0898158627b (patch) | |
tree | 7003ab49c8aa9ac1733f0e1f9f2c283129ce50cf /drivers/gpu/drm/nouveau/nv50_display.c | |
parent | c4abd3178e117d3ca15a40d76df2dbb135f33d78 (diff) | |
download | op-kernel-dev-d55b4af909bc16f7982c2b8b8656f0898158627b.zip op-kernel-dev-d55b4af909bc16f7982c2b8b8656f0898158627b.tar.gz |
drm/nv50-/disp: audit and version SOR_PWR method
The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv50_display.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_display.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index bb96307..dc7f63f 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -1482,7 +1482,6 @@ nv50_dac_dpms(struct drm_encoder *encoder, int mode) mode != DRM_MODE_DPMS_OFF), }; - nvif_mthd(disp->disp, 0, &args, sizeof(args)); } @@ -1742,8 +1741,18 @@ static void nv50_sor_dpms(struct drm_encoder *encoder, int mode) { struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); + struct nv50_disp *disp = nv50_disp(encoder->dev); + struct { + struct nv50_disp_mthd_v1 base; + struct nv50_disp_sor_pwr_v0 pwr; + } args = { + .base.version = 1, + .base.method = NV50_DISP_MTHD_V1_SOR_PWR, + .base.hasht = nv_encoder->dcb->hasht, + .base.hashm = nv_encoder->dcb->hashm, + .pwr.state = mode == DRM_MODE_DPMS_ON, + }; struct drm_device *dev = encoder->dev; - struct nv50_disp *disp = nv50_disp(dev); struct drm_encoder *partner; u32 mthd, data; @@ -1768,15 +1777,14 @@ nv50_sor_dpms(struct drm_encoder *encoder, int mode) mthd |= nv_encoder->or; if (nv_encoder->dcb->type == DCB_OUTPUT_DP) { - data = 1; - nvif_exec(disp->disp, NV50_DISP_SOR_PWR | mthd, &data, sizeof(data)); + args.pwr.state = 1; + nvif_mthd(disp->disp, 0, &args, sizeof(args)); + data = (mode == DRM_MODE_DPMS_ON); mthd |= NV94_DISP_SOR_DP_PWR; + nvif_exec(disp->disp, mthd, &data, sizeof(data)); } else { - mthd |= NV50_DISP_SOR_PWR; + nvif_mthd(disp->disp, 0, &args, sizeof(args)); } - - data = (mode == DRM_MODE_DPMS_ON); - nvif_exec(disp->disp, mthd, &data, sizeof(data)); } static bool |