Factor out code to do the DRM_I830_GETPARAM ioctl.
This commit is contained in:
@@ -295,6 +295,23 @@ static const __DRIextension *intelExtensions[] = {
|
|||||||
NULL
|
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)
|
static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
|
||||||
{
|
{
|
||||||
@@ -358,36 +375,14 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
|
|||||||
intelScreen->drmMinor = sPriv->drm_version.minor;
|
intelScreen->drmMinor = sPriv->drm_version.minor;
|
||||||
|
|
||||||
/* Determine if IRQs are active? */
|
/* Determine if IRQs are active? */
|
||||||
{
|
if (!intel_get_param(sPriv, I830_PARAM_IRQ_ACTIVE,
|
||||||
int ret;
|
&intelScreen->irq_active))
|
||||||
drmI830GetParam gp;
|
return GL_FALSE;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Determine if batchbuffers are allowed */
|
/* Determine if batchbuffers are allowed */
|
||||||
{
|
if (!intel_get_param(sPriv, I830_PARAM_ALLOW_BATCHBUFFER,
|
||||||
int ret;
|
&intelScreen->allow_batchbuffer))
|
||||||
drmI830GetParam gp;
|
return GL_FALSE;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sPriv->extensions = intelExtensions;
|
sPriv->extensions = intelExtensions;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user