xf86Crtc: add tile prop setting

Add support for drivers to set the tiling
property. This is used by clients to
work out the monitor tiles for DisplayID
monitors.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2015-03-31 11:18:44 +10:00
parent 7088816fee
commit 9c2b4f8e0e
2 changed files with 77 additions and 2 deletions

View File

@ -3026,6 +3026,27 @@ xf86OutputSetEDIDProperty(xf86OutputPtr output, void *data, int data_len)
}
}
#define TILE_ATOM_NAME "TILE"
/* changing this in the future could be tricky as people may hardcode 8 */
#define TILE_PROP_NUM_ITEMS 8
static void
xf86OutputSetTileProperty(xf86OutputPtr output)
{
Atom tile_atom = MakeAtom(TILE_ATOM_NAME, sizeof(TILE_ATOM_NAME) - 1, TRUE);
/* This may get called before the RandR resources have been created */
if (output->randr_output == NULL)
return;
if (output->tile_info.group_id != 0) {
RRChangeOutputProperty(output->randr_output, tile_atom, XA_INTEGER, 32,
PropModeReplace, TILE_PROP_NUM_ITEMS, (uint32_t *)&output->tile_info, FALSE, TRUE);
}
else {
RRDeleteOutputProperty(output->randr_output, tile_atom);
}
}
#endif
/* Pull out a phyiscal size from a detailed timing if available. */
@ -3071,6 +3092,38 @@ handle_detailed_physical_size(struct detailed_monitor_section
}
}
Bool
xf86OutputParseKMSTile(const char *tile_data, int tile_length,
struct xf86CrtcTileInfo *tile_info)
{
int ret;
ret = sscanf(tile_data, "%d:%d:%d:%d:%d:%d:%d:%d",
&tile_info->group_id,
&tile_info->flags,
&tile_info->num_h_tile,
&tile_info->num_v_tile,
&tile_info->tile_h_loc,
&tile_info->tile_v_loc,
&tile_info->tile_h_size,
&tile_info->tile_v_size);
if (ret != 8)
return FALSE;
return TRUE;
}
void
xf86OutputSetTile(xf86OutputPtr output, struct xf86CrtcTileInfo *tile_info)
{
if (tile_info)
output->tile_info = *tile_info;
else
memset(&output->tile_info, 0, sizeof(output->tile_info));
#ifdef RANDR_12_INTERFACE
xf86OutputSetTileProperty(output);
#endif
}
/**
* Set the EDID information for the specified output
*/

View File

@ -70,6 +70,17 @@ typedef enum _xf86OutputStatus {
XF86OutputStatusUnknown
} xf86OutputStatus;
struct xf86CrtcTileInfo {
uint32_t group_id;
uint32_t flags;
uint32_t num_h_tile;
uint32_t num_v_tile;
uint32_t tile_h_loc;
uint32_t tile_v_loc;
uint32_t tile_h_size;
uint32_t tile_v_size;
};
typedef struct _xf86CrtcFuncs {
/**
* Turns the crtc on/off, or sets intermediate power levels if available.
@ -226,7 +237,7 @@ typedef struct _xf86CrtcFuncs {
} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
#define XF86_CRTC_VERSION 5
#define XF86_CRTC_VERSION 6
struct _xf86Crtc {
/**
@ -500,7 +511,7 @@ typedef struct _xf86OutputFuncs {
(*destroy) (xf86OutputPtr output);
} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
#define XF86_OUTPUT_VERSION 2
#define XF86_OUTPUT_VERSION 3
struct _xf86Output {
/**
@ -615,6 +626,8 @@ struct _xf86Output {
BoxRec initialTotalArea;
BoxRec initialTrackingArea;
INT16 initialBorder[4];
struct xf86CrtcTileInfo tile_info;
};
typedef struct _xf86ProviderFuncs {
@ -880,6 +893,15 @@ xf86SetSingleMode(ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation);
extern _X_EXPORT void
xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon);
/**
* Set the TILE information for the specified output
*/
extern _X_EXPORT void
xf86OutputSetTile(xf86OutputPtr output, struct xf86CrtcTileInfo *tile_info);
extern _X_EXPORT Bool
xf86OutputParseKMSTile(const char *tile_data, int tile_length, struct xf86CrtcTileInfo *tile_info);
/**
* Return the list of modes supported by the EDID information
* stored in 'output'