mir/xrandr compatibility lib

Robert Ancell robert.ancell at canonical.com
Tue Apr 9 23:12:32 UTC 2013

On 09/04/13 07:20, Bryce Harrington wrote:
> I'm looking into making a wrapper lib for mir that provides a few basic
> xrandr operations via mir.  I think I understand what's needed but want
> to get your sanity check before I get too far into it.
> This mir/randr compatibility library ("mirandr?") will provide the
> header file X11/extensions/Xrandr.h, but stripped down to only the RANDR
> 1.0 routines and structure definitions.  That should be adequate for
> applications and is a reasonably achievable subset (i.e. no multi-head
> layout operations, properties, or other advanced stuff).  Since
> libXrandr is in C, this will need to be in C as well.
> The library will provide mir implementations of these commonly needed
> RANDR 1.0 calls:
>   XRRGetScreenInfo()
>   XRRSetScreenConfig()
>   XRRQueryVersion()    // Just returns 1.0
>   XRRQueryExtension()  // Stub; just return true
> The getter call (retrieving read-only information) is the immediate
> priority.  The setter routine may be more involved to get right so
> implementaton will be left to phase 2.
> There are also a number of accessors and constructor/destructor routines
> for the various structs.  These are entirely local (they don't make any
> server calls) so will be reused as-is.
> The implementation of XRRGetScreenInfo() will essentially just set up a
> mir connection, grab the display info, and reformat it into the Xrandr
> structures.  So, borrowing logic from the demo client, it'd look
> something like:
>     MirConnection* connection{nullptr};
>     mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__,
>                  connection_callback, &connection));
>     MirDisplayInfo info;
>     mir_connection_get_display_info(connection, &info);
>     // Create XRRScreenConfiguration structure
>     // Copy info.width, info.height to structure
>     mir_connection_release(connection);
>     // return structure
> How's this all sound so far?
> Bryce
This sounds good - this is a stepping stone before apps/toolkits become
Mir aware right?

Will this still require a recompile of the application using xrandr or
is there some linking magic to make this a drop in replacement when
running under Mir?


More information about the Mir-devel mailing list