diff options
author | Adam Jackson <ajax@redhat.com> | 2016-01-06 08:47:37 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2016-04-18 11:23:06 -0400 |
commit | 7961377567f15dfad9d96c5c0a0992b38013d973 (patch) | |
tree | 28cc2c7b1527069a576b32fd6c4e2fb79fa2e739 | |
parent | 8be83fff04a009109a956837ca983a96fd279711 (diff) |
xfree86: Make xf86SetDDCproperties work more than once (v2)
We can call this more than once via xf86OutputSetEDID since hotplug is
actually a thing in RANDR 1.2, but xf86RegisterRootWindowProperty merely
adds the data to a list to be applied to the root at CreateWindow time,
so calls past the first (for a given screen) would have no effect until
server regen.
Once we've initialised pScrn->pScreen is filled in, so we can just set
the property directly.
v2: Removed pointless version check, deobfuscate math (Walter Harms)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | hw/xfree86/ddc/ddcProperty.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c index c51c3e6d6..e1b37db03 100644 --- a/hw/xfree86/ddc/ddcProperty.c +++ b/hw/xfree86/ddc/ddcProperty.c @@ -27,6 +27,7 @@ #include "xf86.h" #include "xf86DDC.h" +#include "xf86Priv.h" #include <X11/Xatom.h> #include "property.h" #include "propertyst.h" @@ -34,17 +35,39 @@ #define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA" +static int +edidSize(const xf86MonPtr DDC) +{ + int ret = 128; + + if (DDC->flags & EDID_COMPLETE_RAWDATA) + ret += DDC->no_sections * 128; + + return ret; +} + static void -edidMakeAtom(int i, const char *name, CARD8 *data, int size) +setRootWindowEDID(ScreenPtr pScreen, xf86MonPtr DDC) +{ + Atom atom = MakeAtom(EDID1_ATOM_NAME, strlen(EDID1_ATOM_NAME), TRUE); + + dixChangeWindowProperty(serverClient, pScreen->root, atom, XA_INTEGER, + 8, PropModeReplace, edidSize(DDC), DDC->rawData, + FALSE); +} + +static void +edidMakeAtom(int i, const char *name, xf86MonPtr DDC) { Atom atom; unsigned char *atom_data; + int size = edidSize(DDC); if (!(atom_data = malloc(size * sizeof(CARD8)))) return; atom = MakeAtom(name, strlen(name), TRUE); - memcpy(atom_data, data, size); + memcpy(atom_data, DDC->rawData, size); xf86RegisterRootWindowProperty(i, atom, XA_INTEGER, 8, size, atom_data); } @@ -54,10 +77,10 @@ addRootWindowProperties(ScrnInfoPtr pScrn, xf86MonPtr DDC) int scrnIndex = pScrn->scrnIndex; if (DDC->ver.version == 1) { - int size = 128 + - (DDC->flags & EDID_COMPLETE_RAWDATA ? DDC->no_sections * 128 : 0); - - edidMakeAtom(scrnIndex, EDID1_ATOM_NAME, DDC->rawData, size); + if (xf86Initialising) + edidMakeAtom(scrnIndex, EDID1_ATOM_NAME, DDC); + else + setRootWindowEDID(pScrn->pScreen, DDC); } else { xf86DrvMsg(scrnIndex, X_PROBED, "unexpected EDID version %d.%d\n", |