From patchwork Mon Jan 19 11:00:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 5657451 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2A260C058D for ; Mon, 19 Jan 2015 11:17:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B84520131 for ; Mon, 19 Jan 2015 11:17:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 26F3E20353 for ; Mon, 19 Jan 2015 11:17:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B31996E538; Mon, 19 Jan 2015 03:17:17 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from relay.fireflyinternet.com (hostedrelay.fireflyinternet.com [109.228.30.76]) by gabe.freedesktop.org (Postfix) with ESMTP id 0AF056E53C; Mon, 19 Jan 2015 03:17:15 -0800 (PST) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by relay.fireflyinternet.com (FireflyRelay1) with ESMTP id 12848042-1305619 for multiple; Mon, 19 Jan 2015 11:00:54 +0000 From: Chris Wilson To: xorg-devel@lists.x.org, dri-devel@lists.freedesktop.org, mesa-dev@lists.freedesktop.org Subject: [mesa 7/9] glx/dri2: Add DRI2GetParam() Date: Mon, 19 Jan 2015 11:00:43 +0000 Message-Id: <1421665245-5994-8-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1421665245-5994-1-git-send-email-chris@chris-wilson.co.uk> References: <1421665245-5994-1-git-send-email-chris@chris-wilson.co.uk> X-Authenticated-User: chris.alporthouse@surfanytime.net X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Available since the inclusion of dri2proto 1.4 is a DRI2 request to query and set certain parameters about the X/DDX configuration. This implements the getter request. Signed-off-by: Chris Wilson Reviewed-by: Ian Romanick --- src/glx/dri2.c | 29 +++++++++++++++++++++++++++++ src/glx/dri2.h | 4 ++++ 2 files changed, 33 insertions(+) diff --git a/src/glx/dri2.c b/src/glx/dri2.c index cc6c164..6d9403e 100644 --- a/src/glx/dri2.c +++ b/src/glx/dri2.c @@ -546,4 +546,33 @@ DRI2CopyRegion(Display * dpy, XID drawable, XserverRegion region, SyncHandle(); } +Bool +DRI2GetParam(Display * dpy, XID drawable, CARD32 param, CARD64 *value) +{ + XExtDisplayInfo *info = DRI2FindDisplay(dpy); + xDRI2GetParamReply rep; + xDRI2GetParamReq *req; + + XextCheckExtension(dpy, info, dri2ExtensionName, False); + + LockDisplay(dpy); + GetReq(DRI2GetParam, req); + req->reqType = info->codes->major_opcode; + req->dri2ReqType = X_DRI2GetParam; + req->drawable = drawable; + req->param = param; + + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + + *value = (CARD64)rep.value_hi << 32 | rep.value_lo; + UnlockDisplay(dpy); + SyncHandle(); + + return rep.is_param_recognized; +} + #endif /* GLX_DIRECT_RENDERING */ diff --git a/src/glx/dri2.h b/src/glx/dri2.h index 4be5bf8..a5b23f0 100644 --- a/src/glx/dri2.h +++ b/src/glx/dri2.h @@ -88,4 +88,8 @@ DRI2CopyRegion(Display * dpy, XID drawable, XserverRegion region, CARD32 dest, CARD32 src); +extern Bool +DRI2GetParam(Display * dpy, XID drawable, + CARD32 param, CARD64 *value); + #endif