aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nv50_display.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2014-08-09 14:10:27 -0400
committerBen Skeggs <bskeggs@redhat.com>2014-08-09 15:28:09 -0400
commita3761fa2483f48d158234760d5e25e5071e41537 (patch)
treeba1568228d397d0682296188e586fb12aaffa71d /drivers/gpu/drm/nouveau/nv50_display.c
parente00f2235386484cc1920dd99d17beac2a8dc4a95 (diff)
drm/nv50-/disp: audit and version LVDS_SCRIPT 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.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index e83ed52da239..ac80bdc7cbbf 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1882,15 +1882,24 @@ static void
1882nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode, 1882nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode,
1883 struct drm_display_mode *mode) 1883 struct drm_display_mode *mode)
1884{ 1884{
1885 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
1886 struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
1887 struct {
1888 struct nv50_disp_mthd_v1 base;
1889 struct nv50_disp_sor_lvds_script_v0 lvds;
1890 } lvds = {
1891 .base.version = 1,
1892 .base.method = NV50_DISP_MTHD_V1_SOR_LVDS_SCRIPT,
1893 .base.hasht = nv_encoder->dcb->hasht,
1894 .base.hashm = nv_encoder->dcb->hashm,
1895 };
1885 struct nv50_disp *disp = nv50_disp(encoder->dev); 1896 struct nv50_disp *disp = nv50_disp(encoder->dev);
1886 struct nv50_mast *mast = nv50_mast(encoder->dev); 1897 struct nv50_mast *mast = nv50_mast(encoder->dev);
1887 struct drm_device *dev = encoder->dev; 1898 struct drm_device *dev = encoder->dev;
1888 struct nouveau_drm *drm = nouveau_drm(dev); 1899 struct nouveau_drm *drm = nouveau_drm(dev);
1889 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
1890 struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
1891 struct nouveau_connector *nv_connector; 1900 struct nouveau_connector *nv_connector;
1892 struct nvbios *bios = &drm->vbios; 1901 struct nvbios *bios = &drm->vbios;
1893 u32 lvds = 0, mask, ctrl; 1902 u32 mask, ctrl;
1894 u8 owner = 1 << nv_crtc->index; 1903 u8 owner = 1 << nv_crtc->index;
1895 u8 proto = 0xf; 1904 u8 proto = 0xf;
1896 u8 depth = 0x0; 1905 u8 depth = 0x0;
@@ -1916,31 +1925,31 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode,
1916 1925
1917 if (bios->fp_no_ddc) { 1926 if (bios->fp_no_ddc) {
1918 if (bios->fp.dual_link) 1927 if (bios->fp.dual_link)
1919 lvds |= 0x0100; 1928 lvds.lvds.script |= 0x0100;
1920 if (bios->fp.if_is_24bit) 1929 if (bios->fp.if_is_24bit)
1921 lvds |= 0x0200; 1930 lvds.lvds.script |= 0x0200;
1922 } else { 1931 } else {
1923 if (nv_connector->type == DCB_CONNECTOR_LVDS_SPWG) { 1932 if (nv_connector->type == DCB_CONNECTOR_LVDS_SPWG) {
1924 if (((u8 *)nv_connector->edid)[121] == 2) 1933 if (((u8 *)nv_connector->edid)[121] == 2)
1925 lvds |= 0x0100; 1934 lvds.lvds.script |= 0x0100;
1926 } else 1935 } else
1927 if (mode->clock >= bios->fp.duallink_transition_clk) { 1936 if (mode->clock >= bios->fp.duallink_transition_clk) {
1928 lvds |= 0x0100; 1937 lvds.lvds.script |= 0x0100;
1929 } 1938 }
1930 1939
1931 if (lvds & 0x0100) { 1940 if (lvds.lvds.script & 0x0100) {
1932 if (bios->fp.strapless_is_24bit & 2) 1941 if (bios->fp.strapless_is_24bit & 2)
1933 lvds |= 0x0200; 1942 lvds.lvds.script |= 0x0200;
1934 } else { 1943 } else {
1935 if (bios->fp.strapless_is_24bit & 1) 1944 if (bios->fp.strapless_is_24bit & 1)
1936 lvds |= 0x0200; 1945 lvds.lvds.script |= 0x0200;
1937 } 1946 }
1938 1947
1939 if (nv_connector->base.display_info.bpc == 8) 1948 if (nv_connector->base.display_info.bpc == 8)
1940 lvds |= 0x0200; 1949 lvds.lvds.script |= 0x0200;
1941 } 1950 }
1942 1951
1943 nvif_exec(disp->disp, NV50_DISP_SOR_LVDS_SCRIPT + nv_encoder->or, &lvds, sizeof(lvds)); 1952 nvif_mthd(disp->disp, 0, &lvds, sizeof(lvds));
1944 break; 1953 break;
1945 case DCB_OUTPUT_DP: 1954 case DCB_OUTPUT_DP:
1946 if (nv_connector->base.display_info.bpc == 6) { 1955 if (nv_connector->base.display_info.bpc == 6) {