[PATCH 1/2] radeon: split out radeon_create_ranged_atom for now
Dave Airlie
airlied at gmail.com
Wed Jun 5 18:08:54 PDT 2013
From: Dave Airlie <airlied at redhat.com>
I want to use this to add randr backlight support.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/drmmode_display.c | 54 ++++++++++++++++++++++++++++++++-------------------
1 file changed, 34 insertions(+), 20 deletions(-)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index cd276f3..6874ede 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -912,6 +912,33 @@ drmmode_property_ignore(drmModePropertyPtr prop)
}
static void
+radeon_create_ranged_atom(xf86OutputPtr output, Atom *atom,
+ const char *name, INT32 min, INT32 max,
+ uint64_t value, Bool immutable)
+{
+ int err;
+ INT32 atom_range[2];
+
+ atom_range[0] = min;
+ atom_range[1] = max;
+
+ *atom = MakeAtom(name, strlen(name), TRUE);
+ err = RRConfigureOutputProperty(output->randr_output, *atom,
+ FALSE, TRUE, immutable,
+ 2, atom_range);
+ if (err != 0) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+ "RRConfigureOutputProperty error, %d\n", err);
+ }
+ err = RRChangeOutputProperty(output->randr_output, *atom,
+ XA_INTEGER, 32, PropModeReplace, 1, &value, FALSE, TRUE);
+ if (err != 0) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+ "RRChangeOutputProperty error, %d\n", err);
+ }
+}
+
+static void
drmmode_output_create_resources(xf86OutputPtr output)
{
drmmode_output_private_ptr drmmode_output = output->driver_private;
@@ -942,30 +969,17 @@ drmmode_output_create_resources(xf86OutputPtr output)
drmmode_prop = p->mode_prop;
if (drmmode_prop->flags & DRM_MODE_PROP_RANGE) {
- INT32 range[2];
- INT32 value = p->value;
-
p->num_atoms = 1;
p->atoms = calloc(p->num_atoms, sizeof(Atom));
if (!p->atoms)
continue;
- p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE);
- range[0] = drmmode_prop->values[0];
- range[1] = drmmode_prop->values[1];
- err = RRConfigureOutputProperty(output->randr_output, p->atoms[0],
- FALSE, TRUE,
- drmmode_prop->flags & DRM_MODE_PROP_IMMUTABLE ? TRUE : FALSE,
- 2, range);
- if (err != 0) {
- xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
- "RRConfigureOutputProperty error, %d\n", err);
- }
- err = RRChangeOutputProperty(output->randr_output, p->atoms[0],
- XA_INTEGER, 32, PropModeReplace, 1, &value, FALSE, TRUE);
- if (err != 0) {
- xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
- "RRChangeOutputProperty error, %d\n", err);
- }
+
+ radeon_create_ranged_atom(output, &p->atoms[0],
+ drmmode_prop->name,
+ drmmode_prop->values[0],
+ drmmode_prop->values[1],
+ p->value,
+ drmmode_prop->flags & DRM_MODE_PROP_IMMUTABLE ? TRUE : FALSE);
} else if (drmmode_prop->flags & DRM_MODE_PROP_ENUM) {
p->num_atoms = drmmode_prop->count_enums + 1;
p->atoms = calloc(p->num_atoms, sizeof(Atom));
--
1.8.2.1
More information about the xorg-driver-ati
mailing list