summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-03-23 11:33:23 +1000
committerDave Airlie <airlied@redhat.com>2015-04-27 13:40:41 +1000
commit8fb8bbb3062f1a06621ab7030a9e89d5e8367b35 (patch)
treed2f530bfe1a96299add784eed7c61a1e46398618
parent9257b1252da9092ddc676fec9aabe2b33dfad272 (diff)
modesetting: add tile property support (v2.1)
This adds tiling support to the server modesetting driver, it retrieves the tile info from the kernel and translates it into the server format and exposes the property. v2.1: fix resetting tile property (Chris) Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--hw/xfree86/drivers/modesetting/drmmode_display.c42
-rw-r--r--hw/xfree86/drivers/modesetting/drmmode_display.h1
2 files changed, 43 insertions, 0 deletions
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 7f7b56065..cae057cc1 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -749,6 +749,46 @@ drmmode_output_mode_valid(xf86OutputPtr output, DisplayModePtr pModes)
return MODE_OK;
}
+static void
+drmmode_output_attach_tile(xf86OutputPtr output)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmModeConnectorPtr koutput = drmmode_output->mode_output;
+ drmmode_ptr drmmode = drmmode_output->drmmode;
+ int i;
+ struct xf86CrtcTileInfo tile_info, *set = NULL;
+
+ if (!koutput) {
+ xf86OutputSetTile(output, NULL);
+ return;
+ }
+
+ /* look for a TILE property */
+ for (i = 0; i < koutput->count_props; i++) {
+ drmModePropertyPtr props;
+ props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
+ if (!props)
+ continue;
+
+ if (!(props->flags & DRM_MODE_PROP_BLOB)) {
+ drmModeFreeProperty(props);
+ continue;
+ }
+
+ if (!strcmp(props->name, "TILE")) {
+ drmModeFreePropertyBlob(drmmode_output->tile_blob);
+ drmmode_output->tile_blob =
+ drmModeGetPropertyBlob(drmmode->fd, koutput->prop_values[i]);
+ }
+ drmModeFreeProperty(props);
+ }
+ if (drmmode_output->tile_blob) {
+ if (xf86OutputParseKMSTile(drmmode_output->tile_blob->data, drmmode_output->tile_blob->length, &tile_info) == TRUE)
+ set = &tile_info;
+ }
+ xf86OutputSetTile(output, set);
+}
+
static Bool
has_panel_fitter(xf86OutputPtr output)
{
@@ -857,6 +897,8 @@ drmmode_output_get_modes(xf86OutputPtr output)
}
xf86OutputSetEDID(output, mon);
+ drmmode_output_attach_tile(output);
+
/* modes should already be available */
for (i = 0; i < koutput->count_modes; i++) {
Mode = xnfalloc(sizeof(DisplayModeRec));
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h
index f4989b81d..b0e45b6e0 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.h
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h
@@ -120,6 +120,7 @@ typedef struct {
drmModeConnectorPtr mode_output;
drmModeEncoderPtr *mode_encoders;
drmModePropertyBlobPtr edid_blob;
+ drmModePropertyBlobPtr tile_blob;
int dpms_enum_id;
int num_props;
drmmode_prop_ptr props;