summaryrefslogtreecommitdiff
path: root/sys/src/cmd/aux/vga/edid.c
diff options
context:
space:
mode:
authorRomano <unobe@cpan.org>2023-04-09 06:31:09 +0000
committerqwx <qwx@sciops.net>2023-04-09 06:31:09 +0000
commit101b3c2724779fcb0e503ae274abd7b751a3a48f (patch)
tree3d0651a32925618ca4f7afb99ba5d7f8758ed443 /sys/src/cmd/aux/vga/edid.c
parent83b569cbc7e772ec454f87ccd71104b23faebbc8 (diff)
DP 1.2 on igfx; EDID wrapping; VGA display connections
This patch more fully implements the training patterns for DP 1.2 per the spec, which then allows more monitors to successfully train and therefore connect. In my case it was an LG 34UM68-P. Secondly, this fixes EDID shifting to work with a wider range of values, notably ones which wrap. Lastly, a small correction in vesa.c as to which bits are used to determine available connections.
Diffstat (limited to 'sys/src/cmd/aux/vga/edid.c')
-rw-r--r--sys/src/cmd/aux/vga/edid.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/sys/src/cmd/aux/vga/edid.c b/sys/src/cmd/aux/vga/edid.c
index 09a0acbbc..ea1bb970a 100644
--- a/sys/src/cmd/aux/vga/edid.c
+++ b/sys/src/cmd/aux/vga/edid.c
@@ -6,6 +6,8 @@
#include "pci.h"
#include "vga.h"
+static uchar magic[8] = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 };
+
static void
addmode(Modelist **l, Mode m)
{
@@ -180,10 +182,42 @@ decodesti(Mode *m, uchar *p)
return vesalookup(m, str);
}
+uchar*
+edidshift(uchar buf[256])
+{
+ uchar tmp[263];
+ int i = 256;
+ if(memcmp(buf, magic, 8) == 0)
+ return buf;
+
+ /*
+ * Some devices (e.g., igfx) access address space which has
+ * wrapped values, so shift if needed. Comparing and copying is
+ * easier by extending temp buffer slightly.
+ */
+ memcpy(tmp, buf, 256);
+ memcpy(tmp+256, buf, 7);
+ while(--i > 0)
+ if(memcmp(tmp+i, magic, 8) == 0){
+ trace("magic begins at index %d, shifting\n", i);
+ memcpy(buf, tmp+i, 256-i);
+ memcpy(buf+(256-i), tmp, i);
+ break;
+ }
+
+ trace("edid:\n");
+ for(i=0; i<256; i++){
+ trace("\t%x", buf[i]);
+ if ( (i+1) % 16 == 0)
+ trace("\n");
+ }
+
+ return buf;
+}
+
Edid*
parseedid128(void *v)
{
- static uchar magic[8] = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 };
uchar *p, *q, sum;
int dpms, estab, i, m, vid;
Mode mode;