i965g: plumb in some surface state
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include "brw_state.h"
|
||||
#include "brw_batchbuffer.h"
|
||||
#include "brw_winsys.h"
|
||||
#include "brw_screen.h"
|
||||
|
||||
|
||||
static void brw_destroy_context( struct pipe_context *pipe )
|
||||
@@ -46,6 +47,8 @@ static void brw_destroy_context( struct pipe_context *pipe )
|
||||
struct brw_context *brw = brw_context(pipe);
|
||||
int i;
|
||||
|
||||
brw_context_flush( brw );
|
||||
brw_batchbuffer_free( brw->batch );
|
||||
brw_destroy_state(brw);
|
||||
|
||||
brw_draw_cleanup( brw );
|
||||
@@ -101,15 +104,12 @@ struct pipe_context *brw_create_context(struct pipe_screen *screen)
|
||||
|
||||
if (!brw) {
|
||||
debug_printf("%s: failed to alloc context\n", __FUNCTION__);
|
||||
return GL_FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* We want the GLSL compiler to emit code that uses condition codes */
|
||||
//ctx->Shader.EmitCondCodes = GL_TRUE;
|
||||
//ctx->Shader.EmitNVTempInitialization = GL_TRUE;
|
||||
|
||||
brw->base.screen = screen;
|
||||
brw->base.destroy = brw_destroy_context;
|
||||
brw->sws = brw_screen(screen)->sws;
|
||||
|
||||
brw_pipe_blend_init( brw );
|
||||
brw_pipe_depth_stencil_init( brw );
|
||||
@@ -133,7 +133,15 @@ struct pipe_context *brw_create_context(struct pipe_screen *screen)
|
||||
|
||||
make_empty_list(&brw->query.active_head);
|
||||
|
||||
brw->batch = brw_batchbuffer_alloc( brw->sws );
|
||||
if (brw->batch == NULL)
|
||||
goto fail;
|
||||
|
||||
return &brw->base;
|
||||
|
||||
fail:
|
||||
if (brw->batch)
|
||||
brw_batchbuffer_free( brw->batch );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ try_clear( struct brw_context *brw,
|
||||
debug_printf("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
|
||||
__FUNCTION__,
|
||||
(void *)surface->bo, pitch * cpp,
|
||||
surface->draw_offset,
|
||||
surface->base.offset,
|
||||
x1, y1, x2 - x1, y2 - y1);
|
||||
|
||||
BR13 = 0xf0 << 16;
|
||||
@@ -96,7 +96,7 @@ try_clear( struct brw_context *brw,
|
||||
OUT_BATCH((y2 << 16) | x2);
|
||||
OUT_RELOC(surface->bo,
|
||||
BRW_USAGE_BLIT_DEST,
|
||||
surface->draw_offset);
|
||||
surface->base.offset);
|
||||
OUT_BATCH(value);
|
||||
ADVANCE_BATCH();
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "pipe/p_screen.h"
|
||||
#include "brw_screen.h"
|
||||
#include "brw_defines.h"
|
||||
#include "brw_winsys.h"
|
||||
|
||||
enum {
|
||||
BRW_VIEW_LINEAR,
|
||||
@@ -145,6 +146,12 @@ static struct brw_surface *create_in_place_view( struct brw_screen *brw_screen,
|
||||
surface->base.face = id.bits.face;
|
||||
surface->base.level = id.bits.level;
|
||||
surface->id = id;
|
||||
surface->cpp = tex->cpp;
|
||||
surface->pitch = tex->pitch;
|
||||
surface->tiling = tex->tiling;
|
||||
|
||||
surface->bo = tex->bo;
|
||||
brw_screen->sws->bo_reference(surface->bo);
|
||||
|
||||
pipe_texture_reference( &surface->base.texture, &tex->base );
|
||||
|
||||
@@ -234,10 +241,16 @@ static struct pipe_surface *brw_get_tex_surface(struct pipe_screen *screen,
|
||||
}
|
||||
|
||||
|
||||
static void brw_tex_surface_destroy( struct pipe_surface *surface )
|
||||
static void brw_tex_surface_destroy( struct pipe_surface *surf )
|
||||
{
|
||||
struct brw_surface *surface = brw_surface(surf);
|
||||
struct brw_screen *screen = brw_screen(surf->texture->screen);
|
||||
|
||||
/* Unreference texture, shared buffer:
|
||||
*/
|
||||
screen->sws->bo_unreference(surface->bo);
|
||||
pipe_texture_reference( &surface->base.texture, NULL );
|
||||
|
||||
|
||||
FREE(surface);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user