From patchwork Tue Aug 18 17:07:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Hopf X-Patchwork-Id: 42381 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7IH7VQp031942 for ; Tue, 18 Aug 2009 17:07:31 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 916D99EFE4; Tue, 18 Aug 2009 10:07:30 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) by gabe.freedesktop.org (Postfix) with ESMTP id 861179EF75 for ; Tue, 18 Aug 2009 10:07:28 -0700 (PDT) Received: from relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 420438E8CC for ; Tue, 18 Aug 2009 19:07:27 +0200 (CEST) From: Matthias Hopf To: intel-gfx@lists.freedesktop.org Date: Tue, 18 Aug 2009 19:07:25 +0200 Message-Id: <1250615246-26111-3-git-send-email-mhopf@suse.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1250615246-26111-2-git-send-email-mhopf@suse.de> References: <1250615246-26111-1-git-send-email-mhopf@suse.de> <1250615246-26111-2-git-send-email-mhopf@suse.de> Subject: [Intel-gfx] [PATCH] Add get_property support. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org So far only BACKLIGHT is changed. --- src/drmmode_display.c | 36 ++++++++++++++++++++++++++++++++---- 1 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 64b28ef..ab73b4f 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -1048,10 +1048,7 @@ drmmode_output_create_resources(xf86OutputPtr output) if (drmmode_output->backlight_iface) { INT32 data, backlight_range[2]; /* Set up the backlight property, which takes effect immediately - * and accepts values only within the backlight_range. - * - * FIXME: there is no get_property yet. - */ + * and accepts values only within the backlight_range. */ backlight_atom = MakeAtom(BACKLIGHT_NAME, sizeof(BACKLIGHT_NAME) - 1, TRUE); @@ -1143,10 +1140,41 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property, return TRUE; } +static Bool +drmmode_output_get_property(xf86OutputPtr output, Atom property) +{ + drmmode_output_private_ptr drmmode_output = output->driver_private; + int err; + + if (property == backlight_atom) { + INT32 val; + + if (! drmmode_output->backlight_iface) + return FALSE; + + val = drmmode_backlight_get(output); + if (val < 0) + return FALSE; + err = RRChangeOutputProperty(output->randr_output, backlight_atom, + XA_INTEGER, 32, PropModeReplace, 1, &val, + FALSE, TRUE); + if (err != 0) { + xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, + "RRChangeOutputProperty error, %d\n", err); + return FALSE; + } + + return TRUE; + } + + return TRUE; +} + static const xf86OutputFuncsRec drmmode_output_funcs = { .create_resources = drmmode_output_create_resources, #ifdef RANDR_12_INTERFACE .set_property = drmmode_output_set_property, + .get_property = drmmode_output_get_property, #endif .dpms = drmmode_output_dpms, #if 0