Commit Graph

74 Commits

Author SHA1 Message Date
Marius Gedminas
0dc2bb6101 [RANDR] Compare only milliseconds of config time. (Bug #6502)
The timestamp transferred in the X protocol is a 32-bit number of
milliseconds.

The timestamp stored in the server is a structure that contains two fields:
months (!) and milliseconds.

When the server passes the config timestamp to the client, it discards the
months part and sends only the milliseconds part.

When the server receives the config timestamp from the client, it tries to
guess the "months" part by looking at the current time and then maybe adding
or
subtracting one.  The guess is wrong after the server has been running long
enough (several hours).

I have added two ErrorF calls around the 'if' statement that returns
RRSetConfigInvalidConfigTimestamp in randr/randr.c and my Xorg.0.log has
this:

  randr request got good config time: 0:-2103495671

for the first few successful xrandr calls, and

  randr request failed with RRSetConfigInvalidConfigTime: client passed
  1:-2103495671, server has 0:-2103495671

when it fails.  The server has been running for 8 and a half hours.

The obvious fix would be to ignore the months field and only compare the
milliseconds.
2007-08-31 21:36:37 -07:00
Aaron Plattner
aec0d06469 Fix a crash when rotating the screen.
Remember output->crtc before setting a NULL mode because RRCrtcNotify now sets
output->crtc to NULL.  Use the saved crtc to set the new mode.
2007-07-31 16:33:37 -07:00
Keith Packard
f77a8ea849 Rotate screen size as needed from RandR 1.1 change requests.
Screen size must reflect rotated mode size when setting rotated mode using
RandR 1.1 SetScreenConfig request.
(cherry picked from commit efcec7dbd3)
2007-04-10 12:36:50 -07:00
Aaron Plattner
c10df5b967 Swap RRScreenChangeNotifyEvent dimensions when the screen has one crtc and it's rotated.
RandR 1.1 clients expect the size fields in this event to be the unrotated
dimensions of the screen.  This behavior is "weird", but that's the way the old
code worked so we need to be bug-compatible with it.
2007-04-03 16:09:04 -07:00
Keith Packard
2c93083edd Add support for user-defined modelines in RandR.
The RandR protocol spec has several requests in support of user-defined
modes, but the implementation was stubbed out inside the X server. Fill out
the DIX portion and start on the xf86 DDX portion. It might be necessary to
add more code to the DDX to insert the user-defined modes into the output
mode list.
(cherry picked from commit 63cc2a51ef)

Conflicts:

	randr/randrstr.h

Updated code to work in master with recent security API changes.
2007-03-17 23:20:07 -07:00
Keith Packard
258beebc77 Report correct RandR 1.0 sizeID. Report correct subpixel order.
RandR 1.0 sizeID must be computed the same way every time, so when reporting
it in the ScreenChangeNotify event, just construct the usual 1.0 data block
and use that.

subpixel geometry information can be computed by looking at the connected
outputs and finding any with subpixel geometry and using one of those for
the global screen subpixel geometry. This might be improved by reporting
None if more than one screen has information and they conflict.
2007-02-15 20:37:44 -08:00
Keith Packard
953a9ef949 Track physical screen size and send out updates when that changes.
Events and internal data structures need to be updated whenever the physical
or pixel size of the screen changes. The code was ignoring the physical
size, so changing only that would not be registered anywhere.
(cherry picked from f42e3cea23 commit)
2007-01-02 09:18:50 +11:00
Keith Packard
e79602fca2 Use RRScreenSetSizeRange in 1.0 compat. Check RRGetInfo for error.
The RRScreenSizeSetRange function is used externally for 1.2 API drivers,
but can also be used in the 1.0 compatibility code. This also ensures that
the right changed bits are set so that clients are correctly notified when
the range changes.

RRGetInfo can return an error, use that to return BadAlloc to clients
instead of blindly going on with various requests.
(cherry picked from f05dd384d3 commit)
2007-01-02 09:13:39 +11:00
Eamon Walsh
25d5e0a629 Convert callers of SecurityLookupWindow() to dixLookupWindow(). 2006-12-15 15:50:46 -05:00
Keith Packard
670bbb8731 RandR 1.2 rotation code must adjust width/height.
Mode lines reflect the monitor mode, not the projected size into the frame
buffer. Flip width/height around so that the dimensions are oriented
correctly.
(cherry picked from 612a8e6180 commit)
2006-12-15 18:32:32 +11:00
Keith Packard
6c6901434a RandR 1.0 refresh rates unscrambled. SetScreenConfig uses RRCrtcSet right.
RandR 1.0 refresh rates were scrambled when working with a 1.2 driver that
returned sizes in a mixed order. SetScreenConfig was treating RRCrtcSet as
returning an RandR status instead of a Bool.
(cherry picked from 6dc711833d commit)
2006-12-15 18:32:25 +11:00
Eamon Walsh
51b69ff499 Remove instances of macro SECURITY_VERIFY_DRAWABLE. 2006-12-14 17:53:43 -05:00
Eamon Walsh
6c46645cfc Naming change: Security*Access -> Dix*Access 2006-12-14 14:45:42 -05:00
Keith Packard
07b26e690c Remove RandR output options.
RandR output options are now expected to be handled by properties instead.
(cherry picked from commit 8b2a7e94a1)
2006-11-16 17:39:21 -08:00
Keith Packard
ec77a95a02 Allow RandR objects to be created before the associated ScreenRec.
xf86 drivers need to create RandR object in the PreInit stage,
before the ScreenRec is allocated. Changing the RandR DIX code
to permit this required the addition of functions that later associate the
objects with the related screen.

An additional change is that modes are now global, and no longer associated
with a specific screen. This change actually makes mode management cleaner
as there is no more per-screen list of modes to deal with.

This changes the RandR 1.2 ABI/API for drivers.
2006-11-08 21:36:35 -08:00
Keith Packard
4056e6e79a Move physical size from mode to output.
Modes can be shared across different sized monitors this way.

Also caught some missing byteswapping and an incorrect return type.
2006-11-01 00:29:46 -08:00
Keith Packard
e21604914d Merge master back in and clean up some unfinished code (closes 8745) 2006-10-25 09:48:23 -07:00
Keith Packard
054f8cd267 Limit pointer to valid crtc areas. Add event swapping. Fix change tracking.
Add function to keep pointer within valid crtc areas.
Finish event delivery and swapping code.
Separate configuration from layout changes to send correct events.
2006-10-13 17:34:53 -07:00
Keith Packard
c4f30c6353 Add mode origins and output options. Fix memmoves in resource free funcs.
Output options and mode origins both affected driver ABI.  memmove mistakes
were causing 'Freeing resource which isn't there' messages.

Prune unused non-user defined modes from available list now.
2006-10-03 21:06:11 -07:00
Keith Packard
219546fd76 Steal Xinerama code from SiS driver. Add missing files.
Provide a Xinerama implementation when DIX version isn't enabled. This
version exposes each crtc as a separate 'screen' and reports the size of
that patch. The extension also sends ConfigureNotify events to the root
window whenever crtcs change so that applications will re-fetch xinerama
information. This actually works for metacity.
2006-09-20 22:43:05 -07:00
Keith Packard
bde0a4c12c RRSetCrtcConfig status fix. RRGetScreenResources timestamp fix.
RRSetCrtcConfig was returning the wrong status values.
RRGetScreenResources was always returning currentTime.
2006-09-20 19:42:34 -07:00
Keith Packard
d08718d8fd Avoid calling xalloc(0). Change rrScreenSizeSet to rrScreenSetSize. 2006-09-20 12:05:52 -07:00
Keith Packard
ef1f3248cb Split out 1.0-style info and new property routines to their own files. 2006-09-19 22:48:54 -07:00
Keith Packard
3e745745fe Split RandR implementation into separate files.
RandR is getting too big to live in one file; split into one file per object
type (crtc, mode, screen), leaving the rest of the code in randr.c.

Code is slowly approaching the point where it will drop-in as a replacement
for the old 1.0 implementation.
2006-09-17 23:08:12 -07:00