diff mbox

[mesa,7/9] glx/dri2: Add DRI2GetParam()

Message ID 1421665245-5994-8-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Jan. 19, 2015, 11 a.m. UTC
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 <chris@chris-wilson.co.uk>
---
 src/glx/dri2.c | 29 +++++++++++++++++++++++++++++
 src/glx/dri2.h |  4 ++++
 2 files changed, 33 insertions(+)

Comments

Ian Romanick Jan. 20, 2015, 7:11 p.m. UTC | #1
On 01/19/2015 03:00 AM, Chris Wilson wrote:
> 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 <chris@chris-wilson.co.uk>

This patch is

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>

> ---
>  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
>
diff mbox

Patch

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