Commit Graph

82 Commits

Author SHA1 Message Date
Keith Packard
e2e7c47a52 RandR 1.2 spec says CRTC info contains screen-relative geometry.
Was reporting mode size instead of adjusting for rotation.
2007-04-15 22:59:19 -03:00
Keith Packard
efcec7dbd3 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.
2007-04-09 14:29:46 -07:00
Keith Packard
57e87e0d00 Make pending properties force mode set. And, remove AttachScreen calls.
Yes, two changes in one commit. Sorry 'bout that.

The first change ensures that when pending property values have been
changed, a mode set to the current mode will actually do something, rather
than being identified as a no-op. In addition, the driver no longer needs to
manage the migration of pending to current values, that is handled both
within the xf86 mode setting code (to deal with non-RandR changes) as well
as within the RandR extension itself.

The second change eliminates the two-call Create/AttachScreen stuff that was
done in a failed attempt to create RandR resources before the screen
structures were allocated. Merging these back into the Create function is
cleaner.
2007-03-23 23:41:36 -07:00
Keith Packard
945aa0aa55 Incorrect extra memory copy in RRChangeOutputProperty.
Left over from previous version of the code, this memmove will break when
the mode is not Replace.
2007-03-23 01:17:14 -07:00
Keith Packard
8eb288fbd6 Fix Pending property API, adding RRPostPendingProperty.
Pending Properties take effect when the driver says they do, so provide an
API to tell DIX when a property effect is made. Also, allow driver
to reject property values in RRChangeOutputProperty.
2007-03-23 01:05:55 -07:00
Keith Packard
9ca7ba5d60 Make sure RandR events are delivered from RRCrtcSet.
Some paths were skipping the event delivery stage.
2007-03-23 01:03:40 -07:00
Keith Packard
16f4c0c175 Clear allocated RandR screen private structure.
Use xcalloc instead of xalloc when allocating this structure to ensure
consistent contents at startup.
2007-03-23 00:57:18 -07:00
Keith Packard
f521308ad2 Correct ref counting of RRMode structures
RRModes are referenced by the resource db, RROutput and RRCrtc structures.
Ensure that the mode reference count is decremented each time a reference is
lost from one of these sources. The missing destroys were in
RRCrtcDestroyResource and RROutputDestroyResource, which only happen at
server reset time, so modes would be unavailable in subsequent server
generations.
2007-03-15 20:26:07 -07:00
Aaron Plattner
8a0a0d7db0 Don't crash setting a NULL mode with a randr classic DDX. Also remember to update the screen size during modesets. 2007-03-03 22:21:44 -08:00
Aaron Plattner
0104f5737b Return BadMatch if a client tries to clone non-cloneable outputs.
(cherry picked from commit 8b24575884)
2007-03-03 22:21:32 -08:00
Keith Packard
3506b9376c Eliminate RRModeRec devPrivate field.
The xf86 mode setting code was mis-using this field to try and store a
pointer to a DisplayModeRec, however, each output has its own copy of every
DisplayModeRec leaving the one in in the RRModeRec devPrivate field pointing
at a random DisplayModeRec.

Instead of attempting to rectify this, eliminating the devPrivate entirely
turned out to be very easy; the DDX code now accepts an arbitrary RRModeRec
structure and set that to the hardware, converting it on the fly to a
DisplayModeRec as needed.
2007-02-20 23:04:26 -08:00
Keith Packard
63cc2a51ef 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.
2007-02-18 23:49:38 -08:00
Keith Packard
eabeede693 RRConfigureOutputProperty is a variable length request.
Replace REQUEST_SIZE_MATCH with REQUEST_AT_LEAST_SIZE
2007-02-15 22:23:16 -08:00
Keith Packard
3eebfb0a99 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:13:15 -08:00
Eric Anholt
fe13ebbe69 Fix the size expectations of xRRSetCrtcGamma.
It was using REQUEST_SIZE_MATCH (client request length must equal request size)
rather than REQUEST_AT_LEAST_SIZE (client request length must be at least
big enough for request size), and this request has data following the request
structure.
(cherry picked from commit 4f2f3233c8)
2007-02-02 12:14:40 -08:00
Keith Packard
8798c8cfa8 Allow DDX to not supply a property set notification function.
Check rrOutputSetProperty and only call if it isn't NULL.
2007-01-30 19:05:20 -08:00
Keith Packard
f993e142d2 Make Xinearama screen information reflect CRTC rotation.
(cherry picked from commit b6b8559321)
2007-01-29 23:04:17 -08:00
Eric Anholt
1225a49da2 Account for CRTC rotation in the cursor containment code. 2007-01-29 23:01:51 -08:00
Eric Anholt
364fb547d4 When changing a non-pending property, call the screen rrOutputSetProperty hook. 2007-01-29 23:01:51 -08:00
Eric Anholt
11307c4b88 Don't forget to add the property we configure to the properties list. 2007-01-29 23:01:50 -08:00
Keith Packard
1a34f1966c Export API for setting allowed CRTC rotations 2007-01-29 22:04:07 -08:00
Keith Packard
f05dd384d3 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.
2006-12-30 21:52:22 -08:00
Keith Packard
f42e3cea23 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.
2006-12-21 23:50:39 -08:00
Keith Packard
91396f1430 Merge branch 'randr-1.2-for-server-1.2-origin' into randr-1.2-for-server-1.2 2006-12-13 01:21:53 -08:00
Keith Packard
612a8e6180 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.
2006-12-13 01:21:32 -08:00
Keith Packard
6dc711833d 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.
2006-12-13 00:58:54 -08:00
Keith Packard
98d18a6578 RandR: config time updates when hardware config changes.
The config time in the RandR protocol reflects when the hardware state has
changed. It was getting changed anytime the driver changed the usage
of the hardware as well.
2006-12-12 22:59:03 -08:00
Keith Packard
78689d0d66 RandR mode list needs both output and crtc modes.
When an output no longer reports the current mode, it must still be included
in the list advertised by the X server. Walk the crtcs to ensure it is
included.
2006-12-12 20:16:49 -08:00
Keith Packard
66b6358a39 RandR ListOutputProperties has nAtoms element, not nProperties
Earlier RandR 1.2 encoding revisions used 8-bit nProperties field.
Final RandR 1.2 spec uses 16-bit nAtoms field instead.
2006-11-30 23:16:42 -08:00
Keith Packard
4202b23ed8 Destroying RandR crtc or output overwrites memory.
RRCrtcDestroyResource and RROutputDestroyResource had matching
bugs that would overwrite memory past the end of the storage
of the crtc or output arrays. Oops.
2006-11-27 21:40:24 -08:00
Keith Packard
ec83d67416 Ensure RandR resource types are registered before resources are created.
Now that resources can be created during server initialization, make sure
the crtc, output and mode resource types are created before attempting to
create associated resources.
2006-11-26 19:31:48 -08:00
Keith Packard
0626eb8e5c Allocate correct size for RRPropertyRec (oops).
Neglected to change the allocation size from sizeof (PropertyRec) to
sizeof (RRPropertyRec). Lots of fun crashes this way.
2006-11-21 16:52:28 -08:00
Keith Packard
af55c65bea Change RandR property datatype to include pending/valid values.
This patch tracks the protocol changes which introduce more complex
semantics for RandR output properties including pending and valid value
information.
2006-11-21 01:15:26 -08:00
Keith Packard
b5aa9eb8e6 Reduce calls to RRGetInfo.
RRGetInfo can be expensive. Don't invoke it when quering Xinerama
information or setting a new CRTC configuration.
2006-11-16 13:50:48 -08:00
Keith Packard
8b2a7e94a1 Remove RandR output options.
RandR output options are now expected to be handled by properties instead.
2006-11-16 10:15:30 -08:00
Keith Packard
ae9375ed6b Add RRInit function to create resource types for RR objects.
To allow RandR objects to be created before the screen object exists,
the resource types must be registered with the resource database.
A driver wishing to create RandR objects must call RRInit before doing so.

Also, fix a segfault when setting Output data before it is associated with a
screen.
2006-11-16 10:15:30 -08:00
Keith Packard
8d0ac835bc 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-16 10:15:29 -08:00
Eric Anholt
45621bd215 Don't bump the refcnt if the new mode is NULL. 2006-11-16 10:15:28 -08:00
Keith Packard
354603f509 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-16 10:15:28 -08:00
Keith Packard
368cf03d33 Merge master back in and clean up some unfinished code (closes 8745) 2006-11-16 10:15:27 -08:00
Keith Packard
a153871447 Byte swap RRSelectInput enable flags. 2006-11-16 10:15:15 -08:00
Keith Packard
39ecb2b109 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-11-16 10:03:01 -08:00
Keith Packard
a9fb37ffde Add preferred modes for each output. Round vrefresh. Deliver crtc events. 2006-11-16 10:03:01 -08:00
Keith Packard
0f37ee35a8 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-11-16 10:03:00 -08:00
Keith Packard
f7dcf3a6d4 When no mode is specified, don't validate mode-specific parameters. 2006-11-16 10:02:59 -08:00
Keith Packard
817a82faaf 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-11-16 10:02:59 -08:00
Keith Packard
3516e85b45 RRSetCrtcConfig status fix. RRGetScreenResources timestamp fix.
RRSetCrtcConfig was returning the wrong status values.
RRGetScreenResources was always returning currentTime.
2006-11-16 10:02:58 -08:00
Keith Packard
a0f59b5379 typo 2006-11-16 10:02:58 -08:00
Keith Packard
b851c3e35e When setting output state, leave output unchanged when setting to current. 2006-11-16 10:02:57 -08:00
Keith Packard
f133e72d82 Avoid calling xalloc(0). Change rrScreenSizeSet to rrScreenSetSize. 2006-11-16 10:02:56 -08:00