DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
+ /* Options correspond to DRI_CONF_BO_REUSE_DISABLED,
+ * DRI_CONF_BO_REUSE_ALL
+ */
+ DRI_CONF_OPT_BEGIN_V(bo_reuse, enum, 0, "0:1")
+ DRI_CONF_DESC_BEGIN(en, "Buffer object reuse")
+ DRI_CONF_ENUM(0, "Disable buffer object reuse")
+ DRI_CONF_ENUM(1, "Enable reuse of all sizes of buffer objects")
+ DRI_CONF_DESC_END
+ DRI_CONF_OPT_END
DRI_CONF_SECTION_END
DRI_CONF_SECTION_QUALITY
DRI_CONF_FORCE_S3TC_ENABLE(false)
DRI_CONF_SECTION_END
DRI_CONF_END;
-const GLuint __driNConfigOptions = 5;
+const GLuint __driNConfigOptions = 6;
#ifdef USE_NEW_INTERFACE
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
#endif /*USE_NEW_INTERFACE */
-extern const struct dri_extension card_extensions[];
-extern const struct dri_extension ttm_extensions[];
-#ifndef I915
-extern const struct dri_extension arb_oc_extensions[];
-#endif
-
/**
* Map all the memory regions described by the screen.
* \return GL_TRUE if success, GL_FALSE if error.
static void
-intelPrintSAREA(const drmI830Sarea * sarea)
+intelPrintSAREA(const struct drm_i915_sarea * sarea)
{
fprintf(stderr, "SAREA: sarea width %d height %d\n", sarea->width,
sarea->height);
*/
void
intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen,
- drmI830Sarea * sarea)
+ struct drm_i915_sarea * sarea)
{
intelScreen->width = sarea->width;
intelScreen->height = sarea->height;
static void
intelHandleDrawableConfig(__DRIdrawablePrivate *dPriv,
+ __DRIcontextPrivate *pcp,
__DRIDrawableConfigEvent *event)
{
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
- struct intel_region *region;
+ struct intel_region *region = NULL;
struct intel_renderbuffer *rb, *depth_rb, *stencil_rb;
- struct intel_context *intel = dPriv->driContextPriv->driverPrivate;
- int cpp = intel->ctx.Visual.rgbBits / 8;
- GLuint pitch = ((cpp * dPriv->w + 63) & ~63) / cpp;
+ struct intel_context *intel = pcp->driverPrivate;
+ int cpp, pitch;
+
+ cpp = intel->ctx.Visual.rgbBits / 8;
+ pitch = ((cpp * dPriv->w + 63) & ~63) / cpp;
rb = intel_fb->color_rb[1];
if (rb) {
static void
intelHandleBufferAttach(__DRIdrawablePrivate *dPriv,
+ __DRIcontextPrivate *pcp,
__DRIBufferAttachEvent *ba)
{
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
struct intel_renderbuffer *rb;
struct intel_region *region;
- struct intel_context *intel = dPriv->driContextPriv->driverPrivate;
+ struct intel_context *intel = pcp->driverPrivate;
GLuint tiled;
switch (ba->buffer.attachment) {
intel_renderbuffer_set_region(rb, region);
}
-static void
-intelUpdateBuffer(__DRIdrawablePrivate *dPriv, unsigned int *event)
-{
- switch (DRI2_EVENT_TYPE(*event)) {
- case DRI2_EVENT_DRAWABLE_CONFIG:
- /* flush all current regions, allocate new ones, except front buffer */
- intelHandleDrawableConfig(dPriv, (__DRIDrawableConfigEvent *) event);
- break;
-
- case DRI2_EVENT_BUFFER_ATTACH:
- /* attach buffer if different from what we have */
- intelHandleBufferAttach(dPriv, (__DRIBufferAttachEvent *) event);
- break;
- }
-}
-
static const __DRItexOffsetExtension intelTexOffsetExtension = {
{ __DRI_TEX_OFFSET },
intelSetTexOffset,
intelSetTexBuffer,
};
-static const __DRIextension *intelExtensions[] = {
+static const __DRIextension *intelScreenExtensions[] = {
&driReadDrawableExtension,
&driCopySubBufferExtension.base,
&driSwapControlExtension.base,
intel_get_param(__DRIscreenPrivate *psp, int param, int *value)
{
int ret;
- drmI830GetParam gp;
+ struct drm_i915_getparam gp;
gp.param = param;
gp.value = value;
- ret = drmCommandWriteRead(psp->fd, DRM_I830_GETPARAM, &gp, sizeof(gp));
+ ret = drmCommandWriteRead(psp->fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
if (ret) {
- fprintf(stderr, "drmI830GetParam: %d\n", ret);
+ fprintf(stderr, "drm_i915_getparam: %d\n", ret);
return GL_FALSE;
}
{
intelScreenPrivate *intelScreen;
I830DRIPtr gDRIPriv = (I830DRIPtr) sPriv->pDevPriv;
- drmI830Sarea *sarea;
+ struct drm_i915_sarea *sarea;
if (sPriv->devPrivSize != sizeof(I830DRIRec)) {
fprintf(stderr,
intelScreen->driScrnPriv = sPriv;
sPriv->private = (void *) intelScreen;
intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
- sarea = (drmI830Sarea *)
+ sarea = (struct drm_i915_sarea *)
(((GLubyte *) sPriv->pSAREA) + intelScreen->sarea_priv_offset);
intelScreen->deviceID = gDRIPriv->deviceID;
intelScreen->drmMinor = sPriv->drm_version.minor;
/* Determine if IRQs are active? */
- if (!intel_get_param(sPriv, I830_PARAM_IRQ_ACTIVE,
+ if (!intel_get_param(sPriv, I915_PARAM_IRQ_ACTIVE,
&intelScreen->irq_active))
return GL_FALSE;
/* Determine if batchbuffers are allowed */
- if (!intel_get_param(sPriv, I830_PARAM_ALLOW_BATCHBUFFER,
+ if (!intel_get_param(sPriv, I915_PARAM_ALLOW_BATCHBUFFER,
&intelScreen->allow_batchbuffer))
return GL_FALSE;
- sPriv->extensions = intelExtensions;
+ sPriv->extensions = intelScreenExtensions;
return GL_TRUE;
}
}
-static const struct __DriverAPIRec intelAPI = {
- .DestroyScreen = intelDestroyScreen,
- .CreateContext = intelCreateContext,
- .DestroyContext = intelDestroyContext,
- .CreateBuffer = intelCreateBuffer,
- .DestroyBuffer = intelDestroyBuffer,
- .SwapBuffers = intelSwapBuffers,
- .MakeCurrent = intelMakeCurrent,
- .UnbindContext = intelUnbindContext,
- .GetSwapInfo = intelGetSwapInfo,
- .GetMSC = driGetMSC32,
- .GetDrawableMSC = driDrawableGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL,
- .CopySubBuffer = intelCopySubBuffer,
-#ifdef I915
- .setTexOffset = intelSetTexOffset,
-#endif
- .UpdateBuffer = intelUpdateBuffer,
-};
-
-
-static __GLcontextModes *
-intelFillInModes(unsigned pixel_bits, unsigned depth_bits,
+static __DRIconfig **
+intelFillInModes(__DRIscreenPrivate *psp,
+ unsigned pixel_bits, unsigned depth_bits,
unsigned stencil_bits, GLboolean have_back_buffer)
{
- __GLcontextModes *modes;
+ __DRIconfig **configs;
__GLcontextModes *m;
- unsigned num_modes;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
GLenum fb_format;
GLenum fb_type;
+ int i;
/* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
* support pageflipping at all.
u_int8_t depth_bits_array[3];
u_int8_t stencil_bits_array[3];
-
depth_bits_array[0] = 0;
depth_bits_array[1] = depth_bits;
depth_bits_array[2] = depth_bits;
depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1;
back_buffer_factor = (have_back_buffer) ? 3 : 1;
- num_modes = depth_buffer_factor * back_buffer_factor * 4;
-
if (pixel_bits == 16) {
fb_format = GL_RGB;
fb_type = GL_UNSIGNED_SHORT_5_6_5;
fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
- modes =
- (*dri_interface->createContextModes) (num_modes,
- sizeof(__GLcontextModes));
- m = modes;
- if (!driFillInModes(&m, fb_format, fb_type,
- depth_bits_array, stencil_bits_array,
- depth_buffer_factor, back_buffer_modes,
- back_buffer_factor, GLX_TRUE_COLOR)) {
- fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
- __LINE__);
- return NULL;
- }
- if (!driFillInModes(&m, fb_format, fb_type,
- depth_bits_array, stencil_bits_array,
- depth_buffer_factor, back_buffer_modes,
- back_buffer_factor, GLX_DIRECT_COLOR)) {
- fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
+ configs = driCreateConfigs(fb_format, fb_type,
+ depth_bits_array, stencil_bits_array,
+ depth_buffer_factor, back_buffer_modes,
+ back_buffer_factor);
+ if (configs == NULL) {
+ fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
__LINE__);
return NULL;
}
/* Mark the visual as slow if there are "fake" stencil bits.
*/
- for (m = modes; m != NULL; m = m->next) {
+ for (i = 0; configs[i]; i++) {
+ m = &configs[i]->modes;
if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) {
m->visualRating = GLX_SLOW_CONFIG;
}
}
- return modes;
+ return configs;
}
*
* \return the __GLcontextModes supported by this driver
*/
-PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
+static const __DRIconfig **intelInitScreen(__DRIscreenPrivate *psp)
{
#ifdef I915
static const __DRIversion ddx_expected = { 1, 5, 0 };
static const __DRIversion drm_expected = { 1, 5, 0 };
I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv;
- psp->DriverAPI = intelAPI;
-
if (!driCheckDriDdxDrmVersions2("i915",
&psp->dri_version, &dri_expected,
&psp->ddx_version, &ddx_expected,
*
* Hello chicken. Hello egg. How are you two today?
*/
- driInitExtensions(NULL, card_extensions, GL_FALSE);
- driInitExtensions(NULL, ttm_extensions, GL_FALSE);
-#ifndef I915
- driInitExtensions(NULL, arb_oc_extensions, GL_FALSE);
-#endif
-
+ intelInitExtensions(NULL, GL_TRUE);
+
if (!intelInitDriver(psp))
return NULL;
- return intelFillInModes(dri_priv->cpp * 8,
- (dri_priv->cpp == 2) ? 16 : 24,
- (dri_priv->cpp == 2) ? 0 : 8, 1);
+ psp->extensions = intelScreenExtensions;
+
+ return (const __DRIconfig **)
+ intelFillInModes(psp, dri_priv->cpp * 8,
+ (dri_priv->cpp == 2) ? 16 : 24,
+ (dri_priv->cpp == 2) ? 0 : 8, 1);
}
struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen)
*
* \return the __GLcontextModes supported by this driver
*/
-PUBLIC __GLcontextModes *__dri2DriverInitScreen(__DRIscreenPrivate *psp)
+static const
+__DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp)
{
- static const __DRIversion ddx_expected = { 1, 9, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 1, 5, 0 };
intelScreenPrivate *intelScreen;
- __GLcontextModes *modes, *m;
-
- psp->DriverAPI = intelAPI;
-
- if (!driCheckDriDdxDrmVersions2("i915",
- &psp->dri_version, &dri_expected,
- &psp->ddx_version, &ddx_expected,
- &psp->drm_version, &drm_expected)) {
- fprintf(stderr, "bad version voodoo\n");
- return NULL;
- }
/* Calling driInitExtensions here, with a NULL context pointer,
* does not actually enable the extensions. It just makes sure
*
* Hello chicken. Hello egg. How are you two today?
*/
- driInitExtensions(NULL, card_extensions, GL_FALSE);
- driInitExtensions(NULL, ttm_extensions, GL_FALSE);
+ intelInitExtensions(NULL, GL_TRUE);
/* Allocate the private area */
intelScreen = (intelScreenPrivate *) CALLOC(sizeof(intelScreenPrivate));
return GL_FALSE;
/* Determine if IRQs are active? */
- if (!intel_get_param(psp, I830_PARAM_IRQ_ACTIVE,
+ if (!intel_get_param(psp, I915_PARAM_IRQ_ACTIVE,
&intelScreen->irq_active))
return GL_FALSE;
/* Determine if batchbuffers are allowed */
- if (!intel_get_param(psp, I830_PARAM_ALLOW_BATCHBUFFER,
+ if (!intel_get_param(psp, I915_PARAM_ALLOW_BATCHBUFFER,
&intelScreen->allow_batchbuffer))
return GL_FALSE;
return GL_FALSE;
}
- psp->extensions = intelExtensions;
-
- modes = intelFillInModes(16, 16, 0, 1);
- for (m = modes; m->next != NULL; m = m->next)
- ;
- m->next = intelFillInModes(32, 24, 8, 1);
+ psp->extensions = intelScreenExtensions;
- return modes;
+ return driConcatConfigs(intelFillInModes(psp, 16, 16, 0, 1),
+ intelFillInModes(psp, 32, 24, 8, 1));
}
+
+const struct __DriverAPIRec driDriverAPI = {
+ .InitScreen = intelInitScreen,
+ .DestroyScreen = intelDestroyScreen,
+ .CreateContext = intelCreateContext,
+ .DestroyContext = intelDestroyContext,
+ .CreateBuffer = intelCreateBuffer,
+ .DestroyBuffer = intelDestroyBuffer,
+ .SwapBuffers = intelSwapBuffers,
+ .MakeCurrent = intelMakeCurrent,
+ .UnbindContext = intelUnbindContext,
+ .GetSwapInfo = intelGetSwapInfo,
+ .GetDrawableMSC = driDrawableGetMSC32,
+ .WaitForMSC = driWaitForMSC32,
+ .CopySubBuffer = intelCopySubBuffer,
+
+ .InitScreen2 = intelInitScreen2,
+ .HandleDrawableConfig = intelHandleDrawableConfig,
+ .HandleBufferAttach = intelHandleBufferAttach,
+};