summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/intel
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@temari.boston.redhat.com>2008-01-09 18:04:19 -0500
committerKristian Høgsberg <krh@temari.boston.redhat.com>2008-01-09 19:08:55 -0500
commit24e7e457680d700e986fd0b0e0f046fadf67caf4 (patch)
treefe8858b957a17d066a129a98d88177e2f04ba014 /src/mesa/drivers/dri/intel
parentf1139e4c662c47357ee054c2e004b13c9f74ffe1 (diff)
Factor out code to do the DRM_I830_GETPARAM ioctl.
Diffstat (limited to 'src/mesa/drivers/dri/intel')
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c51
1 files changed, 23 insertions, 28 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index cd72a4b122..abeb0f9b9f 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -295,6 +295,23 @@ static const __DRIextension *intelExtensions[] = {
NULL
};
+static GLboolean
+intel_get_param(__DRIscreenPrivate *psp, int param, int *value)
+{
+ int ret;
+ drmI830GetParam gp;
+
+ gp.param = param;
+ gp.value = value;
+
+ ret = drmCommandWriteRead(psp->fd, DRM_I830_GETPARAM, &gp, sizeof(gp));
+ if (ret) {
+ fprintf(stderr, "drmI830GetParam: %d\n", ret);
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
{
@@ -358,36 +375,14 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
intelScreen->drmMinor = sPriv->drm_version.minor;
/* Determine if IRQs are active? */
- {
- int ret;
- drmI830GetParam gp;
-
- gp.param = I830_PARAM_IRQ_ACTIVE;
- gp.value = &intelScreen->irq_active;
-
- ret = drmCommandWriteRead(sPriv->fd, DRM_I830_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmI830GetParam: %d\n", ret);
- return GL_FALSE;
- }
- }
+ if (!intel_get_param(sPriv, I830_PARAM_IRQ_ACTIVE,
+ &intelScreen->irq_active))
+ return GL_FALSE;
/* Determine if batchbuffers are allowed */
- {
- int ret;
- drmI830GetParam gp;
-
- gp.param = I830_PARAM_ALLOW_BATCHBUFFER;
- gp.value = &intelScreen->allow_batchbuffer;
-
- ret = drmCommandWriteRead(sPriv->fd, DRM_I830_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmI830GetParam: (%d) %d\n", gp.param, ret);
- return GL_FALSE;
- }
- }
+ if (!intel_get_param(sPriv, I830_PARAM_ALLOW_BATCHBUFFER,
+ &intelScreen->allow_batchbuffer))
+ return GL_FALSE;
sPriv->extensions = intelExtensions;