If we do E_Randr_Output *out2 = _e_randr_output_find(output->xid), then
output should be equal to out2, else we have several output variables per
output xid which should be fixed correctly.
This does not change any behaviour, just moves code:
1. We only try to locate a crtc for an output in _e_randr_output_active_set
And we only do this when we set active.
2. We only search for a crtc in _e_randr_output_crtc_find
This includes looping known crtcs without querying X if it matches.
Please don't revert, but help cleaning. As the current code does not
work for me...
This reverts commit 4aef218d28.
Revert "randr: remember crtcid for fast lookup on reconnect"
This reverts commit 55b4ad41d1.
Revert "randr: further cleanup"
This reverts commit 3e02824663.
these make nvidia randr resolution changing work again. sorry seb.
even though cleanups might be nice... this code is FIDDLY and every
driver seems to work differently, so take it easy and be very careful
- make no assumptions. i know it works on my intel desktop and nvidia
deskop atm. once i get a vga cable i'll fix up intel laptop with
external display that has problems. i can try radeon too later. but
right now - this stuff needs to work. being clean is far less
important than working. :)
When an output is set inactive, it is disconnected from a crtc. Now we
remember the id of the last crtc it was connected to, so we get a faster
lookup on reconnect.
the dp checks were looking for edp stuff. but due to naming they appeard as
eDP or maybe edp or EDP - thus were simplified to dp. put more explicit
checks there.
Primarly two things removed:
1. crtc->outputs should only contain outputs which should be enabled
So looping them twice in e_randr_apply is definitly wrong.
2. _e_randr_crtc_find should find a crtc for an output
So looping our crtcs again in _active_set is definitly wrong. If
_e_randr_crtc_find does not find us a crtc, it should be fixed there.
i've spent a while testing randr on my nvidia box and drviers. it now
works - i can turn screens on and off. i couldn't before. e_randr was
trying to be too smart for its own good. it wasnt matching up outputs
to crtcs, was thinking outputs active when they were not, etc. etc.
etc. - reality is e_randr could do witha lot of simplification, but
at this stage i'm just going to hammer it into shape to work across as
many drivers and setups as i can test against.
so e was storing randr config using XIDs to match outputs etc. this is
all kinds of wrong. XIDs are NOT STATIC. they change from xserver to
xserver and from run to run. they MAY be the same. they may not. so
this was just broken.
use output name + edid as a big "string" (name.edid) as a way ofr
identifying config for a specific combination of output plus monitor
and to find/identify the corrent output+monitor to apply it to (of
course missing edid gets replaced with ??? and missing output name is
??? too - i have never seen a missing output name so you get this at
least).
so this FIXES "restore" of screen mode on login for starters. this
does nothing to "fix" the screen setup dialog in any way. there are
separate issues there.
this also breaks e_randr config compat so i bumped epoch so your old
config is rejected. i don't see a sensible way of porting the config
forward.