From 02128c448d1f4eedf70b3bdb4ec187cf405c530e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 3 Jul 2013 14:55:19 -0700 Subject: [PATCH] i965: Move intel_context::intelScreen to brw_context. Signed-off-by: Kenneth Graunke Acked-by: Chris Forbes Acked-by: Paul Berry Acked-by: Anuj Phogat --- src/mesa/drivers/dri/i965/brw_context.h | 1 + src/mesa/drivers/dri/i965/brw_program.c | 8 +++---- src/mesa/drivers/dri/i965/intel_batchbuffer.c | 5 ++--- src/mesa/drivers/dri/i965/intel_context.c | 22 +++++++++---------- src/mesa/drivers/dri/i965/intel_context.h | 2 -- src/mesa/drivers/dri/i965/intel_fbo.c | 5 ++--- src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 4 ++-- src/mesa/drivers/dri/i965/intel_tex.c | 3 +-- src/mesa/drivers/dri/i965/intel_tex_image.c | 4 ++-- 9 files changed, 24 insertions(+), 30 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 69a3e03dbaf..659f7bf3a52 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1225,6 +1225,7 @@ struct brw_context } shader_time; __DRIcontext *driContext; + struct intel_screen *intelScreen; }; /*====================================================================== diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 2993f1bcf04..97d23b3ace3 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -78,7 +78,7 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx, case GL_VERTEX_PROGRAM_ARB: { struct brw_vertex_program *prog = CALLOC_STRUCT(brw_vertex_program); if (prog) { - prog->id = get_new_program_id(brw->intel.intelScreen); + prog->id = get_new_program_id(brw->intelScreen); return _mesa_init_vertex_program( ctx, &prog->program, target, id ); @@ -90,7 +90,7 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx, case GL_FRAGMENT_PROGRAM_ARB: { struct brw_fragment_program *prog = CALLOC_STRUCT(brw_fragment_program); if (prog) { - prog->id = get_new_program_id(brw->intel.intelScreen); + prog->id = get_new_program_id(brw->intelScreen); return _mesa_init_fragment_program( ctx, &prog->program, target, id ); @@ -135,7 +135,7 @@ brwProgramStringNotify(struct gl_context *ctx, if (newFP == curFP) brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM; - newFP->id = get_new_program_id(brw->intel.intelScreen); + newFP->id = get_new_program_id(brw->intelScreen); break; } case GL_VERTEX_PROGRAM_ARB: { @@ -149,7 +149,7 @@ brwProgramStringNotify(struct gl_context *ctx, if (newVP->program.IsPositionInvariant) { _mesa_insert_mvp_code(ctx, &newVP->program); } - newVP->id = get_new_program_id(brw->intel.intelScreen); + newVP->id = get_new_program_id(brw->intelScreen); /* Also tell tnl about it: */ diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c index df83e3d6954..ea85066fdff 100644 --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c @@ -136,12 +136,11 @@ intel_batchbuffer_free(struct brw_context *brw) static void do_batch_dump(struct brw_context *brw) { - struct intel_context *intel = &brw->intel; struct drm_intel_decode *decode; struct intel_batchbuffer *batch = &brw->batch; int ret; - decode = drm_intel_decode_context_alloc(intel->intelScreen->deviceID); + decode = drm_intel_decode_context_alloc(brw->intelScreen->deviceID); if (!decode) return; @@ -194,7 +193,7 @@ do_flush_locked(struct brw_context *brw) } } - if (!intel->intelScreen->no_hw) { + if (!brw->intelScreen->no_hw) { int flags; if (intel->gen < 6 || !batch->is_blit) { diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index bf803c5f66f..626eab723d2 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -63,7 +63,7 @@ int INTEL_DEBUG = (0); static const GLubyte * intelGetString(struct gl_context * ctx, GLenum name) { - const struct intel_context *const intel = intel_context(ctx); + const struct brw_context *const brw = brw_context(ctx); const char *chipset; static char buffer[128]; @@ -73,7 +73,7 @@ intelGetString(struct gl_context * ctx, GLenum name) break; case GL_RENDERER: - switch (intel->intelScreen->deviceID) { + switch (brw->intelScreen->deviceID) { #undef CHIPSET #define CHIPSET(id, symbol, str) case id: chipset = str; break; #include "pci_ids/i965_pci_ids.h" @@ -128,10 +128,9 @@ static void intel_flush_front(struct gl_context *ctx) { struct brw_context *brw = brw_context(ctx); - struct intel_context *intel = intel_context(ctx); __DRIcontext *driContext = brw->driContext; __DRIdrawable *driDrawable = driContext->driDrawablePriv; - __DRIscreen *const screen = intel->intelScreen->driScrnPriv; + __DRIscreen *const screen = brw->intelScreen->driScrnPriv; if (brw->front_buffer_dirty && _mesa_is_winsys_fbo(ctx->DrawBuffer)) { if (screen->dri2.loader->flushFrontBuffer != NULL && @@ -463,7 +462,7 @@ intelInitContext(struct brw_context *brw, mesaVis = &visual; } - intel->intelScreen = intelScreen; + brw->intelScreen = intelScreen; if (!_mesa_initialize_context(&intel->ctx, api, mesaVis, shareCtx, functions)) { @@ -496,11 +495,11 @@ intelInitContext(struct brw_context *brw, intel->is_g4x = true; } - intel->has_separate_stencil = intel->intelScreen->hw_has_separate_stencil; - intel->must_use_separate_stencil = intel->intelScreen->hw_must_use_separate_stencil; + intel->has_separate_stencil = brw->intelScreen->hw_has_separate_stencil; + intel->must_use_separate_stencil = brw->intelScreen->hw_must_use_separate_stencil; intel->has_hiz = intel->gen >= 6; - intel->has_llc = intel->intelScreen->hw_has_llc; - intel->has_swizzling = intel->intelScreen->hw_has_swizzling; + intel->has_llc = brw->intelScreen->hw_has_llc; + intel->has_swizzling = brw->intelScreen->hw_has_swizzling; memset(&ctx->TextureFormatSupported, 0, sizeof(ctx->TextureFormatSupported)); @@ -778,7 +777,7 @@ intel_query_dri2_buffers(struct brw_context *brw, int *buffer_count) { struct intel_context *intel = &brw->intel; - __DRIscreen *screen = intel->intelScreen->driScrnPriv; + __DRIscreen *screen = brw->intelScreen->driScrnPriv; struct gl_framebuffer *fb = drawable->driverPrivate; int i = 0; unsigned attachments[8]; @@ -852,7 +851,6 @@ intel_process_dri2_buffer(struct brw_context *brw, struct intel_renderbuffer *rb, const char *buffer_name) { - struct intel_context *intel = &brw->intel; struct intel_region *region = NULL; if (!rb) @@ -885,7 +883,7 @@ intel_process_dri2_buffer(struct brw_context *brw, } intel_miptree_release(&rb->mt); - region = intel_region_alloc_for_handle(intel->intelScreen, + region = intel_region_alloc_for_handle(brw->intelScreen, buffer->cpp, drawable->w, drawable->h, diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h index 7bfb983a931..406f3f566c9 100644 --- a/src/mesa/drivers/dri/i965/intel_context.h +++ b/src/mesa/drivers/dri/i965/intel_context.h @@ -126,8 +126,6 @@ struct intel_context bool has_hiz; bool has_llc; bool has_swizzling; - - struct intel_screen *intelScreen; }; /** diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c index 89ee59e8e5f..44f692099b3 100644 --- a/src/mesa/drivers/dri/i965/intel_fbo.c +++ b/src/mesa/drivers/dri/i965/intel_fbo.c @@ -193,7 +193,7 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer { struct brw_context *brw = brw_context(ctx); struct intel_context *intel = intel_context(ctx); - struct intel_screen *screen = intel->intelScreen; + struct intel_screen *screen = brw->intelScreen; struct intel_renderbuffer *irb = intel_renderbuffer(rb); rb->NumSamples = intel_quantize_num_samples(screen, rb->NumSamples); @@ -252,12 +252,11 @@ intel_image_target_renderbuffer_storage(struct gl_context *ctx, void *image_handle) { struct brw_context *brw = brw_context(ctx); - struct intel_context *intel = intel_context(ctx); struct intel_renderbuffer *irb; __DRIscreen *screen; __DRIimage *image; - screen = intel->intelScreen->driScrnPriv; + screen = brw->intelScreen->driScrnPriv; image = screen->dri2.image->lookupEGLImage(screen, image_handle, screen->loaderPrivate); if (image == NULL) diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index cc3145c7580..c361914fa13 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -560,7 +560,7 @@ intel_miptree_create(struct brw_context *brw, bool y_or_x = tiling == (I915_TILING_Y | I915_TILING_X); mt->etc_format = etc_format; - mt->region = intel_region_alloc(intel->intelScreen, + mt->region = intel_region_alloc(brw->intelScreen, y_or_x ? I915_TILING_Y : tiling, mt->cpp, total_width, @@ -576,7 +576,7 @@ intel_miptree_create(struct brw_context *brw, mt->total_width, mt->total_height); intel_region_release(&mt->region); - mt->region = intel_region_alloc(intel->intelScreen, + mt->region = intel_region_alloc(brw->intelScreen, I915_TILING_X, mt->cpp, total_width, diff --git a/src/mesa/drivers/dri/i965/intel_tex.c b/src/mesa/drivers/dri/i965/intel_tex.c index df128e7a759..175387d54bd 100644 --- a/src/mesa/drivers/dri/i965/intel_tex.c +++ b/src/mesa/drivers/dri/i965/intel_tex.c @@ -61,7 +61,6 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx, struct gl_texture_image *image) { struct brw_context *brw = brw_context(ctx); - struct intel_context *intel = intel_context(ctx); struct intel_texture_image *intel_image = intel_texture_image(image); struct gl_texture_object *texobj = image->TexObject; struct intel_texture_object *intel_texobj = intel_texture_object(texobj); @@ -70,7 +69,7 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx, /* Quantize sample count */ if (image->NumSamples) { - image->NumSamples = intel_quantize_num_samples(intel->intelScreen, image->NumSamples); + image->NumSamples = intel_quantize_num_samples(brw->intelScreen, image->NumSamples); if (!image->NumSamples) return false; } diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c index 9e3f02c7497..15015dd6d06 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_image.c +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c @@ -361,11 +361,11 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target, struct gl_texture_image *texImage, GLeglImageOES image_handle) { - struct intel_context *intel = intel_context(ctx); + struct brw_context *brw = brw_context(ctx); __DRIscreen *screen; __DRIimage *image; - screen = intel->intelScreen->driScrnPriv; + screen = brw->intelScreen->driScrnPriv; image = screen->dri2.image->lookupEGLImage(screen, image_handle, screen->loaderPrivate); if (image == NULL) -- 2.30.2