#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 )
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 );
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 );
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;
}
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;
OUT_BATCH((y2 << 16) | x2);
OUT_RELOC(surface->bo,
BRW_USAGE_BLIT_DEST,
- surface->draw_offset);
+ surface->base.offset);
OUT_BATCH(value);
ADVANCE_BATCH();
#include "pipe/p_screen.h"
#include "brw_screen.h"
#include "brw_defines.h"
+#include "brw_winsys.h"
enum {
BRW_VIEW_LINEAR,
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 );
}
-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);
}