intel_context.c File Reference

Include dependency graph for intel_context.c:

Go to the source code of this file.

Defines

#define need_GL_ARB_multisample
#define need_GL_ARB_point_parameters
#define need_GL_ARB_texture_compression
#define need_GL_ARB_vertex_buffer_object
#define need_GL_ARB_vertex_program
#define need_GL_ARB_window_pos
#define need_GL_EXT_blend_color
#define need_GL_EXT_blend_equation_separate
#define need_GL_EXT_blend_func_separate
#define need_GL_EXT_blend_minmax
#define need_GL_EXT_cull_vertex
#define need_GL_EXT_fog_coord
#define need_GL_EXT_framebuffer_object
#define need_GL_EXT_multi_draw_arrays
#define need_GL_EXT_secondary_color
#define need_GL_NV_vertex_program

Functions

static void intel_lock_hardware (struct intel_be_context *context)
static void intel_unlock_hardware (struct intel_be_context *context)
static boolean intel_locked_hardware (struct intel_be_context *context)
GLboolean intelCreateContext (const __GLcontextModes *visual, __DRIcontextPrivate *driContextPriv, void *sharedContextPrivate)
void intelDestroyContext (__DRIcontextPrivate *driContextPriv)
GLboolean intelUnbindContext (__DRIcontextPrivate *driContextPriv)
GLboolean intelMakeCurrent (__DRIcontextPrivate *driContextPriv, __DRIdrawablePrivate *driDrawPriv, __DRIdrawablePrivate *driReadPriv)

Variables

struct dri_extension card_extensions []
 Extension strings exported by the intel driver.


Define Documentation

#define need_GL_ARB_multisample

Definition at line 52 of file intel_context.c.

#define need_GL_ARB_point_parameters

Definition at line 53 of file intel_context.c.

#define need_GL_ARB_texture_compression

Definition at line 54 of file intel_context.c.

#define need_GL_ARB_vertex_buffer_object

Definition at line 55 of file intel_context.c.

#define need_GL_ARB_vertex_program

Definition at line 56 of file intel_context.c.

#define need_GL_ARB_window_pos

Definition at line 57 of file intel_context.c.

#define need_GL_EXT_blend_color

Definition at line 58 of file intel_context.c.

#define need_GL_EXT_blend_equation_separate

Definition at line 59 of file intel_context.c.

#define need_GL_EXT_blend_func_separate

Definition at line 60 of file intel_context.c.

#define need_GL_EXT_blend_minmax

Definition at line 61 of file intel_context.c.

#define need_GL_EXT_cull_vertex

Definition at line 62 of file intel_context.c.

#define need_GL_EXT_fog_coord

Definition at line 63 of file intel_context.c.

#define need_GL_EXT_framebuffer_object

Definition at line 64 of file intel_context.c.

#define need_GL_EXT_multi_draw_arrays

Definition at line 65 of file intel_context.c.

#define need_GL_EXT_secondary_color

Definition at line 66 of file intel_context.c.

#define need_GL_NV_vertex_program

Definition at line 67 of file intel_context.c.


Function Documentation

static void intel_lock_hardware ( struct intel_be_context context  )  [static]

Definition at line 138 of file intel_context.c.

References LOCK_HARDWARE().

00139 {
00140    struct intel_context *intel = (struct intel_context *)context;
00141    LOCK_HARDWARE(intel);
00142 }

static boolean intel_locked_hardware ( struct intel_be_context context  )  [static]

Definition at line 152 of file intel_context.c.

References FALSE, intel_context::locked, and TRUE.

00153 {
00154    struct intel_context *intel = (struct intel_context *)context;
00155    return intel->locked ? TRUE : FALSE;
00156 }

static void intel_unlock_hardware ( struct intel_be_context context  )  [static]

Definition at line 145 of file intel_context.c.

References UNLOCK_HARDWARE().

00146 {
00147    struct intel_context *intel = (struct intel_context *)context;
00148    UNLOCK_HARDWARE(intel);
00149 }

GLboolean intelCreateContext ( const __GLcontextModes *  visual,
__DRIcontextPrivate *  driContextPriv,
void *  sharedContextPrivate 
)

Definition at line 159 of file intel_context.c.

References intel_be_context::base, intel_be_device::base, intel_screen::base, intel_context::base, CALLOC_STRUCT, card_extensions, st_context::ctx, intel_screen::deviceID, intel_context::driFd, intel_context::driHwLock, intel_context::driScreen, intel_context::first_swap_fence, intel_be_context::hardware_lock, intel_be_context::hardware_locked, intel_be_context::hardware_unlock, intel_screen::havePools, intel_context::hHWContext, i915_create_context(), intel_be_init_context(), intel_create_softpipe(), intel_lock_hardware(), intel_locked_hardware(), intel_screen(), intel_unlock_hardware(), intelCreatePools(), intel_context::intelScreen, intel_context::irqsEmitted, intel_context::iw, intel_context::last_swap_fence, intel_screen::optionCache, intel_context::optionCache, PCI_CHIP_G33_G, PCI_CHIP_I915_G, PCI_CHIP_I915_GM, PCI_CHIP_I945_G, PCI_CHIP_I945_GM, PCI_CHIP_I945_GME, PCI_CHIP_Q33_G, PCI_CHIP_Q35_G, pipe_context::priv, intel_context::sarea, intel_screen::sarea, intel_be_device::screen, intel_context::st, and st_create_context().

00162 {
00163    struct intel_context *intel = CALLOC_STRUCT(intel_context);
00164    __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
00165    struct intel_screen *intelScreen = intel_screen(sPriv);
00166    drmI830Sarea *saPriv = intelScreen->sarea;
00167    int fthrottle_mode;
00168    GLboolean havePools;
00169    struct pipe_context *pipe;
00170    struct st_context *st_share = NULL;
00171 
00172    if (sharedContextPrivate) {
00173       st_share = ((struct intel_context *) sharedContextPrivate)->st;
00174    }
00175 
00176    driContextPriv->driverPrivate = intel;
00177    intel->intelScreen = intelScreen;
00178    intel->driScreen = sPriv;
00179    intel->sarea = saPriv;
00180 
00181    driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache,
00182                        intel->driScreen->myNum, "i915");
00183 
00184 
00185    /*
00186     * memory pools
00187     */
00188    DRM_LIGHT_LOCK(sPriv->fd, &sPriv->pSAREA->lock, driContextPriv->hHWContext);
00189    // ZZZ JB should be per screen and not be done per context
00190    havePools = intelCreatePools(sPriv);
00191    DRM_UNLOCK(sPriv->fd, &sPriv->pSAREA->lock, driContextPriv->hHWContext);
00192    if (!havePools)
00193       return GL_FALSE;
00194 
00195 
00196    /* Dri stuff */
00197    intel->hHWContext = driContextPriv->hHWContext;
00198    intel->driFd = sPriv->fd;
00199    intel->driHwLock = (drmLock *) & sPriv->pSAREA->lock;
00200 
00201    fthrottle_mode = driQueryOptioni(&intel->optionCache, "fthrottle_mode");
00202    intel->iw.irq_seq = -1;
00203    intel->irqsEmitted = 0;
00204 
00205    intel->last_swap_fence = NULL;
00206    intel->first_swap_fence = NULL;
00207 
00208 #ifdef DEBUG
00209    __intel_debug = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
00210 #endif
00211    intel->base.hardware_lock = intel_lock_hardware;
00212    intel->base.hardware_unlock = intel_unlock_hardware;
00213    intel->base.hardware_locked = intel_locked_hardware;
00214 
00215    intel_be_init_context(&intel->base, &intelScreen->base);
00216 
00217    /*
00218     * Pipe-related setup
00219     */
00220    if (getenv("INTEL_SP")) {
00221       /* use softpipe driver instead of hw */
00222       pipe = intel_create_softpipe( intel, &intelScreen->base.base );
00223    }
00224    else {
00225       switch (intel->intelScreen->deviceID) {
00226       case PCI_CHIP_I945_G:
00227       case PCI_CHIP_I945_GM:
00228       case PCI_CHIP_I945_GME:
00229       case PCI_CHIP_G33_G:
00230       case PCI_CHIP_Q33_G:
00231       case PCI_CHIP_Q35_G:
00232       case PCI_CHIP_I915_G:
00233       case PCI_CHIP_I915_GM:
00234          pipe = i915_create_context(intelScreen->base.screen,
00235                                     &intelScreen->base.base,
00236                                     &intel->base.base);
00237          break;
00238       default:
00239          fprintf(stderr, "Unknown PCIID %x in %s, using software driver\n",
00240                  intel->intelScreen->deviceID, __FUNCTION__);
00241 
00242          pipe = intel_create_softpipe( intel, &intelScreen->base.base );
00243          break;
00244       }
00245    }
00246 
00247    pipe->priv = intel;
00248 
00249    intel->st = st_create_context(pipe, visual, st_share);
00250 
00251    driInitExtensions( intel->st->ctx, card_extensions, GL_TRUE );
00252 
00253    return GL_TRUE;
00254 }

void intelDestroyContext ( __DRIcontextPrivate *  driContextPriv  ) 

Definition at line 258 of file intel_context.c.

References assert, intel_context::base, driFenceFinish(), driFenceUnReference(), intel_screen::dummyContext, intel_context::first_swap_fence, intel_be_destroy_context(), intel_context(), intel_context::intelScreen, intel_context::last_swap_fence, intel_context::st, st_destroy_context(), and st_finish().

00259 {
00260    struct intel_context *intel = intel_context(driContextPriv);
00261 
00262    assert(intel);               /* should never be null */
00263    if (intel) {
00264       st_finish(intel->st);
00265 
00266       if (intel->last_swap_fence) {
00267          driFenceFinish(intel->last_swap_fence, DRM_FENCE_TYPE_EXE, GL_TRUE);
00268          driFenceUnReference(&intel->last_swap_fence);
00269          intel->last_swap_fence = NULL;
00270       }
00271       if (intel->first_swap_fence) {
00272          driFenceFinish(intel->first_swap_fence, DRM_FENCE_TYPE_EXE, GL_TRUE);
00273          driFenceUnReference(&intel->first_swap_fence);
00274          intel->first_swap_fence = NULL;
00275       }
00276 
00277       if (intel->intelScreen->dummyContext == intel)
00278          intel->intelScreen->dummyContext = NULL;
00279 
00280       st_destroy_context(intel->st);
00281       intel_be_destroy_context(&intel->base);
00282       free(intel);
00283    }
00284 }

GLboolean intelMakeCurrent ( __DRIcontextPrivate *  driContextPriv,
__DRIdrawablePrivate *  driDrawPriv,
__DRIdrawablePrivate *  driReadPriv 
)

Definition at line 298 of file intel_context.c.

References assert, intel_context::driDrawable, intel_screen::dummyContext, intel_context(), intel_framebuffer(), intel_context::intelScreen, intelUpdateWindowSize(), intel_context::lastStamp, intel_context::st, st_make_current(), and intel_framebuffer::stfb.

00301 {
00302    if (driContextPriv) {
00303       struct intel_context *intel = intel_context(driContextPriv);
00304       struct intel_framebuffer *draw_fb = intel_framebuffer(driDrawPriv);
00305       struct intel_framebuffer *read_fb = intel_framebuffer(driReadPriv);
00306 
00307       assert(draw_fb->stfb);
00308       assert(read_fb->stfb);
00309 
00310       /* This is for situations in which we need a rendering context but
00311        * there may not be any currently bound.
00312        */
00313       intel->intelScreen->dummyContext = intel;
00314 
00315       st_make_current(intel->st, draw_fb->stfb, read_fb->stfb);
00316 
00317       if ((intel->driDrawable != driDrawPriv) ||
00318           (intel->lastStamp != driDrawPriv->lastStamp)) {
00319          intel->driDrawable = driDrawPriv;
00320          intelUpdateWindowSize(driDrawPriv);
00321          intel->lastStamp = driDrawPriv->lastStamp;
00322       }
00323 
00324       /* The size of the draw buffer will have been updated above.
00325        * If the readbuffer is a different window, check/update its size now.
00326        */
00327       if (driReadPriv != driDrawPriv) {
00328          intelUpdateWindowSize(driReadPriv);
00329       }
00330 
00331    }
00332    else {
00333       st_make_current(NULL, NULL, NULL);
00334    }
00335 
00336    return GL_TRUE;
00337 }

GLboolean intelUnbindContext ( __DRIcontextPrivate *  driContextPriv  ) 

Definition at line 288 of file intel_context.c.

References intel_context(), PIPE_FLUSH_RENDER_CACHE, intel_context::st, and st_flush().

00289 {
00290    struct intel_context *intel = intel_context(driContextPriv);
00291    st_flush(intel->st, PIPE_FLUSH_RENDER_CACHE, NULL);
00292    /* XXX make_current(NULL)? */
00293    return GL_TRUE;
00294 }


Variable Documentation

struct dri_extension card_extensions[]

Extension strings exported by the intel driver.

Note:
It appears that ARB_texture_env_crossbar has "disappeared" compared to the old i830-specific driver.

Definition at line 78 of file intel_context.c.


Generated on Tue Sep 29 06:25:46 2009 for Gallium3D by  doxygen 1.5.4