|
|
a37264 |
From 2e4fe1cc22c0d681ad3d37cddee09a1b7700101d Mon Sep 17 00:00:00 2001
|
|
|
a37264 |
From: Jonathon Jongsma <jjongsma@redhat.com>
|
|
|
a37264 |
Date: Thu, 6 Nov 2014 15:40:59 -0600
|
|
|
a37264 |
Subject: [PATCH] Update drm properties correctly
|
|
|
a37264 |
|
|
|
a37264 |
When connector properties got changed, those changes were not being
|
|
|
a37264 |
propagated to user-space. This pushes those changes up so that e.g. new
|
|
|
a37264 |
"suggested X|Y" properties can be used to help lay out multiple displays
|
|
|
a37264 |
properly. This code is based on similar code from the nouveau driver.
|
|
|
a37264 |
---
|
|
|
a37264 |
src/qxl_drmmode.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
|
|
|
a37264 |
src/qxl_drmmode.h | 1 +
|
|
|
a37264 |
2 files changed, 48 insertions(+), 1 deletion(-)
|
|
|
a37264 |
|
|
|
a37264 |
diff --git a/src/qxl_drmmode.c b/src/qxl_drmmode.c
|
|
|
a37264 |
index 2ef6ba1..43708de 100644
|
|
|
a37264 |
--- a/src/qxl_drmmode.c
|
|
|
a37264 |
+++ b/src/qxl_drmmode.c
|
|
|
a37264 |
@@ -520,6 +520,7 @@ drmmode_output_create_resources(xf86OutputPtr output)
|
|
|
a37264 |
drmModeFreeProperty(drmmode_prop);
|
|
|
a37264 |
continue;
|
|
|
a37264 |
}
|
|
|
a37264 |
+ drmmode_output->props[j].index = i;
|
|
|
a37264 |
drmmode_output->props[j].mode_prop = drmmode_prop;
|
|
|
a37264 |
drmmode_output->props[j].value = mode_output->prop_values[i];
|
|
|
a37264 |
drmmode_output->num_props++;
|
|
|
a37264 |
@@ -639,7 +640,52 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property,
|
|
|
a37264 |
static Bool
|
|
|
a37264 |
drmmode_output_get_property(xf86OutputPtr output, Atom property)
|
|
|
a37264 |
{
|
|
|
a37264 |
- return TRUE;
|
|
|
a37264 |
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
|
|
|
a37264 |
+ drmmode_ptr drmmode = drmmode_output->drmmode;
|
|
|
a37264 |
+ uint32_t value;
|
|
|
a37264 |
+ int err, i;
|
|
|
a37264 |
+
|
|
|
a37264 |
+ if (output->scrn->vtSema) {
|
|
|
a37264 |
+ drmModeFreeConnector(drmmode_output->mode_output);
|
|
|
a37264 |
+ drmmode_output->mode_output =
|
|
|
a37264 |
+ drmModeGetConnector(drmmode->fd, drmmode_output->output_id);
|
|
|
a37264 |
+ }
|
|
|
a37264 |
+
|
|
|
a37264 |
+ if (!drmmode_output->mode_output)
|
|
|
a37264 |
+ return FALSE;
|
|
|
a37264 |
+
|
|
|
a37264 |
+ for (i = 0; i < drmmode_output->num_props; i++) {
|
|
|
a37264 |
+ drmmode_prop_ptr p = &drmmode_output->props[i];
|
|
|
a37264 |
+ if (p->atoms[0] != property)
|
|
|
a37264 |
+ continue;
|
|
|
a37264 |
+
|
|
|
a37264 |
+ value = drmmode_output->mode_output->prop_values[p->index];
|
|
|
a37264 |
+
|
|
|
a37264 |
+ if (p->mode_prop->flags & DRM_MODE_PROP_RANGE) {
|
|
|
a37264 |
+ err = RRChangeOutputProperty(output->randr_output,
|
|
|
a37264 |
+ property, XA_INTEGER, 32,
|
|
|
a37264 |
+ PropModeReplace, 1, &value,
|
|
|
a37264 |
+ FALSE, FALSE);
|
|
|
a37264 |
+
|
|
|
a37264 |
+ return !err;
|
|
|
a37264 |
+ } else if (p->mode_prop->flags & DRM_MODE_PROP_ENUM) {
|
|
|
a37264 |
+ int j;
|
|
|
a37264 |
+
|
|
|
a37264 |
+ /* search for matching name string, then set its value down */
|
|
|
a37264 |
+ for (j = 0; j < p->mode_prop->count_enums; j++) {
|
|
|
a37264 |
+ if (p->mode_prop->enums[j].value == value)
|
|
|
a37264 |
+ break;
|
|
|
a37264 |
+ }
|
|
|
a37264 |
+
|
|
|
a37264 |
+ err = RRChangeOutputProperty(output->randr_output, property,
|
|
|
a37264 |
+ XA_ATOM, 32, PropModeReplace, 1,
|
|
|
a37264 |
+ &p->atoms[j+1], FALSE, FALSE);
|
|
|
a37264 |
+
|
|
|
a37264 |
+ return !err;
|
|
|
a37264 |
+ }
|
|
|
a37264 |
+ }
|
|
|
a37264 |
+
|
|
|
a37264 |
+ return FALSE;
|
|
|
a37264 |
}
|
|
|
a37264 |
|
|
|
a37264 |
static const xf86OutputFuncsRec drmmode_output_funcs = {
|
|
|
a37264 |
diff --git a/src/qxl_drmmode.h b/src/qxl_drmmode.h
|
|
|
a37264 |
index 04752ec..392b1e2 100644
|
|
|
a37264 |
--- a/src/qxl_drmmode.h
|
|
|
a37264 |
+++ b/src/qxl_drmmode.h
|
|
|
a37264 |
@@ -69,6 +69,7 @@ typedef struct {
|
|
|
a37264 |
uint64_t value;
|
|
|
a37264 |
int num_atoms; /* if range prop, num_atoms == 1; if enum prop, num_atoms == num_enums + 1 */
|
|
|
a37264 |
Atom *atoms;
|
|
|
a37264 |
+ int index; /* index within the kernel-size property array */
|
|
|
a37264 |
} drmmode_prop_rec, *drmmode_prop_ptr;
|
|
|
a37264 |
|
|
|
a37264 |
typedef struct {
|
|
|
a37264 |
--
|
|
|
a37264 |
2.1.0
|
|
|
a37264 |
|