All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nouveau/mode: split out create_ranged_atom
@ 2013-06-06  1:35 Dave Airlie
       [not found] ` <1370482501-14023-1-git-send-email-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Airlie @ 2013-06-06  1:35 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

This is preperation for the backlight support code.

Signed-off-by: Dave Airlie <airlied-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 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 6033a6d..ad7bc1f 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -767,6 +767,33 @@ drmmode_property_ignore(drmModePropertyPtr prop)
 }
 
 static void
+nouveau_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;
@@ -800,30 +827,17 @@ drmmode_output_create_resources(xf86OutputPtr output)
 		value = drmmode_output->mode_output->prop_values[p->index];
 
 		if (drmmode_prop->flags & DRM_MODE_PROP_RANGE) {
-			INT32 range[2];
-
 			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, FALSE);
-			if (err != 0) {
-				xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
-					   "RRChangeOutputProperty error, %d\n", err);
-			}
+
+			nouveau_create_ranged_atom(output, &p->atoms[0],
+						  drmmode_prop->name,
+						  drmmode_prop->values[0],
+						  drmmode_prop->values[1],
+						  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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-06  1:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-06  1:35 [PATCH 1/2] nouveau/mode: split out create_ranged_atom Dave Airlie
     [not found] ` <1370482501-14023-1-git-send-email-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-06-06  1:35   ` [PATCH 2/2] nouveau: add libbacklight and randr property support Dave Airlie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.