summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2013-03-25 14:59:15 +1000
committerBen Skeggs <bskeggs@redhat.com>2013-03-29 15:57:07 +1000
commitc91bde8d5c75cac13553be97a03f7123bfc9f7a7 (patch)
tree7619e16aefd0c95849b8bbace52ac64ce30fa22c
parentcbd5d38fddb81ba0b1c78e5b06fa9333eb64df48 (diff)
kms/nv50: remove direct dependency on nvbios.fp.*devel-olddisp
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drm/nouveau_connector.c64
-rw-r--r--drm/nouveau_connector.h1
-rw-r--r--drm/nv50_display.c32
3 files changed, 41 insertions, 56 deletions
diff --git a/drm/nouveau_connector.c b/drm/nouveau_connector.c
index 3aa9af2a..1a2c3e69 100644
--- a/drm/nouveau_connector.c
+++ b/drm/nouveau_connector.c
@@ -672,7 +672,40 @@ nouveau_connector_detect_depth(struct drm_connector *connector)
struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
struct nvbios *bios = &drm->vbios;
struct drm_display_mode *mode = nv_connector->native_mode;
- bool duallink;
+ bool dual;
+
+ if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS) {
+ /* LVDS: straps panel */
+ if (bios->fp_no_ddc) {
+ if (bios->fp.if_is_24bit)
+ connector->display_info.bpc = 8;
+ else
+ connector->display_info.bpc = 6;
+ nv_connector->links = bios->fp.dual_link;
+ return;
+ }
+
+ /* LVDS: DDC panel, need to first determine the number of
+ * links to know which if_is_24bit flag to check...
+ */
+ if (nv_connector->edid &&
+ nv_connector->type == DCB_CONNECTOR_LVDS_SPWG)
+ dual = ((u8 *)nv_connector->edid)[121] == 2;
+ else
+ dual = mode->clock >= bios->fp.duallink_transition_clk;
+ nv_connector->links = dual ? 2 : 1;
+
+ if (!nv_connector->edid ||
+ !nv_connector->base.display_info.bpc) {
+ if ((!dual && (bios->fp.strapless_is_24bit & 1)) ||
+ ( dual && (bios->fp.strapless_is_24bit & 2)))
+ connector->display_info.bpc = 8;
+ else
+ connector->display_info.bpc = 6;
+ }
+
+ return;
+ }
/* if the edid is feeling nice enough to provide this info, use it */
if (nv_connector->edid && connector->display_info.bpc)
@@ -684,33 +717,8 @@ nouveau_connector_detect_depth(struct drm_connector *connector)
return;
}
- /* we're out of options unless we're LVDS, default to 8bpc */
- if (nv_encoder->dcb->type != DCB_OUTPUT_LVDS) {
- connector->display_info.bpc = 8;
- return;
- }
-
- connector->display_info.bpc = 6;
-
- /* LVDS: panel straps */
- if (bios->fp_no_ddc) {
- if (bios->fp.if_is_24bit)
- connector->display_info.bpc = 8;
- return;
- }
-
- /* LVDS: DDC panel, need to first determine the number of links to
- * know which if_is_24bit flag to check...
- */
- if (nv_connector->edid &&
- nv_connector->type == DCB_CONNECTOR_LVDS_SPWG)
- duallink = ((u8 *)nv_connector->edid)[121] == 2;
- else
- duallink = mode->clock >= bios->fp.duallink_transition_clk;
-
- if ((!duallink && (bios->fp.strapless_is_24bit & 1)) ||
- ( duallink && (bios->fp.strapless_is_24bit & 2)))
- connector->display_info.bpc = 8;
+ /* we're out of options, default to 8bpc */
+ connector->display_info.bpc = 8;
}
static int
diff --git a/drm/nouveau_connector.h b/drm/nouveau_connector.h
index d27f27a1..59cf235d 100644
--- a/drm/nouveau_connector.h
+++ b/drm/nouveau_connector.h
@@ -80,6 +80,7 @@ struct nouveau_connector {
struct nouveau_encoder *detected_encoder;
struct edid *edid;
struct drm_display_mode *native_mode;
+ u8 links;
};
static inline struct nouveau_connector *nouveau_connector(
diff --git a/drm/nv50_display.c b/drm/nv50_display.c
index 487bb7ec..07ea2212 100644
--- a/drm/nv50_display.c
+++ b/drm/nv50_display.c
@@ -1777,11 +1777,9 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode,
struct nv50_disp *disp = nv50_disp(encoder->dev);
struct nv50_mast *mast = nv50_mast(encoder->dev);
struct drm_device *dev = encoder->dev;
- struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
struct nouveau_connector *nv_connector;
- struct nvbios *bios = &drm->vbios;
u32 *push, lvds = 0;
u8 owner = 1 << nv_crtc->index;
u8 proto = 0xf;
@@ -1803,32 +1801,10 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode,
break;
case DCB_OUTPUT_LVDS:
proto = 0x0;
-
- if (bios->fp_no_ddc) {
- if (bios->fp.dual_link)
- lvds |= 0x0100;
- if (bios->fp.if_is_24bit)
- lvds |= 0x0200;
- } else {
- if (nv_connector->type == DCB_CONNECTOR_LVDS_SPWG) {
- if (((u8 *)nv_connector->edid)[121] == 2)
- lvds |= 0x0100;
- } else
- if (mode->clock >= bios->fp.duallink_transition_clk) {
- lvds |= 0x0100;
- }
-
- if (lvds & 0x0100) {
- if (bios->fp.strapless_is_24bit & 2)
- lvds |= 0x0200;
- } else {
- if (bios->fp.strapless_is_24bit & 1)
- lvds |= 0x0200;
- }
-
- if (nv_connector->base.display_info.bpc == 8)
- lvds |= 0x0200;
- }
+ if (nv_connector->base.display_info.bpc >= 8)
+ lvds |= 0x0200;
+ if (nv_connector->links > 1)
+ lvds |= 0x0100;
nv_call(disp->core, NV50_DISP_SOR_LVDS_SCRIPT + nv_encoder->or, lvds);
break;