Revert "WIP 965 conversion to dri_bufmgr."
This reverts commit b2f1aa2389
.
Somehow I ended up with my branch's save-this-while-I-work-on-master commit
actually on master.
This commit is contained in:
@@ -66,7 +66,6 @@ DRIVER_DEFINES = -I../intel $(shell pkg-config libdrm --atleast-version=2.3.1 \
|
|||||||
|
|
||||||
include ../Makefile.template
|
include ../Makefile.template
|
||||||
|
|
||||||
intel_batchbuffer.o: ../intel/intel_batchbuffer.o
|
|
||||||
intel_tex_layout.o: ../intel/intel_tex_layout.c
|
intel_tex_layout.o: ../intel/intel_tex_layout.c
|
||||||
|
|
||||||
symlinks:
|
symlinks:
|
||||||
|
@@ -5,6 +5,7 @@ include $(TOP)/configs/current
|
|||||||
LIBNAME = i965_dri.so
|
LIBNAME = i965_dri.so
|
||||||
|
|
||||||
DRIVER_SOURCES = \
|
DRIVER_SOURCES = \
|
||||||
|
bufmgr_fake.c \
|
||||||
intel_batchbuffer.c \
|
intel_batchbuffer.c \
|
||||||
intel_blit.c \
|
intel_blit.c \
|
||||||
intel_buffer_objects.c \
|
intel_buffer_objects.c \
|
||||||
@@ -91,7 +92,6 @@ DRIVER_DEFINES = -I../intel
|
|||||||
|
|
||||||
include ../Makefile.template
|
include ../Makefile.template
|
||||||
|
|
||||||
intel_batchbuffer.o: ../intel/intel_batchbuffer.o
|
|
||||||
intel_tex_layout.o: ../intel/intel_tex_layout.c
|
intel_tex_layout.o: ../intel/intel_tex_layout.c
|
||||||
|
|
||||||
server:
|
server:
|
||||||
|
@@ -242,7 +242,7 @@ struct brw_surface_binding_table {
|
|||||||
struct brw_cache;
|
struct brw_cache;
|
||||||
|
|
||||||
struct brw_mem_pool {
|
struct brw_mem_pool {
|
||||||
dri_bo *buffer;
|
struct buffer *buffer;
|
||||||
|
|
||||||
GLuint size;
|
GLuint size;
|
||||||
GLuint offset; /* offset of first free byte */
|
GLuint offset; /* offset of first free byte */
|
||||||
@@ -605,7 +605,7 @@ struct brw_context
|
|||||||
GLuint nr_surfaces;
|
GLuint nr_surfaces;
|
||||||
|
|
||||||
GLuint max_threads;
|
GLuint max_threads;
|
||||||
dri_bo *scratch_buffer;
|
struct buffer *scratch_buffer;
|
||||||
GLuint scratch_buffer_size;
|
GLuint scratch_buffer_size;
|
||||||
|
|
||||||
GLuint sampler_count;
|
GLuint sampler_count;
|
||||||
|
@@ -58,7 +58,7 @@ struct brw_array_state {
|
|||||||
GLuint dword;
|
GLuint dword;
|
||||||
} vb0;
|
} vb0;
|
||||||
|
|
||||||
dri_bo *buffer;
|
struct buffer *buffer;
|
||||||
GLuint offset;
|
GLuint offset;
|
||||||
|
|
||||||
GLuint max_index;
|
GLuint max_index;
|
||||||
@@ -68,7 +68,7 @@ struct brw_array_state {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static dri_bo *array_buffer( const struct gl_client_array *array )
|
static struct buffer *array_buffer( const struct gl_client_array *array )
|
||||||
{
|
{
|
||||||
return intel_bufferobj_buffer(intel_buffer_object(array->BufferObj));
|
return intel_bufferobj_buffer(intel_buffer_object(array->BufferObj));
|
||||||
}
|
}
|
||||||
@@ -620,7 +620,7 @@ void brw_upload_indices( struct brw_context *brw,
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
struct brw_indexbuffer ib;
|
struct brw_indexbuffer ib;
|
||||||
dri_bo *buffer = intel_bufferobj_buffer(intel_buffer_object(bufferobj));
|
struct buffer *buffer = intel_bufferobj_buffer(intel_buffer_object(bufferobj));
|
||||||
|
|
||||||
memset(&ib, 0, sizeof(ib));
|
memset(&ib, 0, sizeof(ib));
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
#include "imports.h"
|
#include "imports.h"
|
||||||
|
|
||||||
#include "intel_ioctl.h"
|
#include "intel_ioctl.h"
|
||||||
#include "dri_bufmgr.h"
|
#include "bufmgr.h"
|
||||||
|
|
||||||
GLboolean brw_pool_alloc( struct brw_mem_pool *pool,
|
GLboolean brw_pool_alloc( struct brw_mem_pool *pool,
|
||||||
GLuint size,
|
GLuint size,
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "brw_context.h"
|
#include "brw_context.h"
|
||||||
#include "brw_state.h"
|
#include "brw_state.h"
|
||||||
#include "dri_bufmgr.h"
|
#include "bufmgr.h"
|
||||||
#include "intel_batchbuffer.h"
|
#include "intel_batchbuffer.h"
|
||||||
|
|
||||||
/* This is used to initialize brw->state.atoms[]. We could use this
|
/* This is used to initialize brw->state.atoms[]. We could use this
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
#include "brw_context.h"
|
#include "brw_context.h"
|
||||||
#include "brw_state.h"
|
#include "brw_state.h"
|
||||||
#include "brw_defines.h"
|
#include "brw_defines.h"
|
||||||
#include "dri_bufmgr.h"
|
#include "bufmgr.h"
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* WM unit - fragment programs and rasterization
|
* WM unit - fragment programs and rasterization
|
||||||
|
191
src/mesa/drivers/dri/i965/bufmgr.h
Normal file
191
src/mesa/drivers/dri/i965/bufmgr.h
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sub license, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
* the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice (including the
|
||||||
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
|
* of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||||
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef BUFMGR_H
|
||||||
|
#define BUFMGR_H
|
||||||
|
|
||||||
|
#include "intel_context.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* The buffer manager context. Opaque.
|
||||||
|
*/
|
||||||
|
struct bufmgr;
|
||||||
|
struct buffer;
|
||||||
|
|
||||||
|
|
||||||
|
struct bufmgr *bm_fake_intel_Attach( struct intel_context *intel );
|
||||||
|
|
||||||
|
/* Flags for validate and other calls. If both NO_UPLOAD and NO_EVICT
|
||||||
|
* are specified, ValidateBuffers is essentially a query.
|
||||||
|
*/
|
||||||
|
#define BM_MEM_LOCAL 0x1
|
||||||
|
#define BM_MEM_AGP 0x2
|
||||||
|
#define BM_MEM_VRAM 0x4 /* not yet used */
|
||||||
|
#define BM_WRITE 0x8 /* not yet used */
|
||||||
|
#define BM_READ 0x10 /* not yet used */
|
||||||
|
#define BM_NO_UPLOAD 0x20
|
||||||
|
#define BM_NO_EVICT 0x40
|
||||||
|
#define BM_NO_MOVE 0x80 /* not yet used */
|
||||||
|
#define BM_NO_ALLOC 0x100 /* legacy "fixed" buffers only */
|
||||||
|
#define BM_CLIENT 0x200 /* for map - pointer will be accessed
|
||||||
|
* without dri lock */
|
||||||
|
|
||||||
|
#define BM_MEM_MASK (BM_MEM_LOCAL|BM_MEM_AGP|BM_MEM_VRAM)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create a pool of a given memory type, from a certain offset and a
|
||||||
|
* certain size.
|
||||||
|
*
|
||||||
|
* Also passed in is a virtual pointer to the start of the pool. This
|
||||||
|
* is useful in the faked-out version in i915 so that MapBuffer can
|
||||||
|
* return a pointer to a buffer residing in AGP space.
|
||||||
|
*
|
||||||
|
* Flags passed into a pool are inherited by all buffers allocated in
|
||||||
|
* that pool. So pools representing the static front,back,depth
|
||||||
|
* buffer allocations should have MEM_AGP|NO_UPLOAD|NO_EVICT|NO_MOVE to match
|
||||||
|
* the behaviour of the legacy allocations.
|
||||||
|
*
|
||||||
|
* Returns -1 for failure, pool number for success.
|
||||||
|
*/
|
||||||
|
int bmInitPool( struct intel_context *,
|
||||||
|
unsigned long low_offset,
|
||||||
|
void *low_virtual,
|
||||||
|
unsigned long size,
|
||||||
|
unsigned flags);
|
||||||
|
|
||||||
|
|
||||||
|
/* Stick closely to ARB_vbo semantics - they're well defined and
|
||||||
|
* understood, and drivers can just pass the calls through without too
|
||||||
|
* much thunking.
|
||||||
|
*/
|
||||||
|
void bmGenBuffers(struct intel_context *, const char *, unsigned n, struct buffer **buffers,
|
||||||
|
int align );
|
||||||
|
void bmDeleteBuffers(struct intel_context *, unsigned n, struct buffer **buffers);
|
||||||
|
|
||||||
|
|
||||||
|
/* Hook to inform faked buffer manager about fixed-position
|
||||||
|
* front,depth,back buffers. These may move to a fully memory-managed
|
||||||
|
* scheme, or they may continue to be managed as is.
|
||||||
|
*/
|
||||||
|
struct buffer *bmGenBufferStatic(struct intel_context *,
|
||||||
|
unsigned pool);
|
||||||
|
|
||||||
|
/* On evict, buffer manager will call invalidate_cb() to note that the
|
||||||
|
* buffer needs to be reloaded.
|
||||||
|
*
|
||||||
|
* Buffer is uploaded by calling bmMapBuffer() and copying data into
|
||||||
|
* the returned pointer.
|
||||||
|
*
|
||||||
|
* This is basically a big hack to get some more performance by
|
||||||
|
* turning off backing store for buffers where we either have it
|
||||||
|
* already (textures) or don't need it (batch buffers, temporary
|
||||||
|
* vbo's).
|
||||||
|
*/
|
||||||
|
void bmBufferSetInvalidateCB(struct intel_context *,
|
||||||
|
struct buffer *buf,
|
||||||
|
void (*invalidate_cb)( struct intel_context *, void *ptr ),
|
||||||
|
void *ptr,
|
||||||
|
GLboolean dont_fence_subdata);
|
||||||
|
|
||||||
|
|
||||||
|
/* The driver has more intimate knowledge of the hardare than a GL
|
||||||
|
* client would, so flags here is more proscriptive than the usage
|
||||||
|
* values in the ARB_vbo interface:
|
||||||
|
*/
|
||||||
|
int bmBufferData(struct intel_context *,
|
||||||
|
struct buffer *buf,
|
||||||
|
unsigned size,
|
||||||
|
const void *data,
|
||||||
|
unsigned flags );
|
||||||
|
|
||||||
|
int bmBufferSubData(struct intel_context *,
|
||||||
|
struct buffer *buf,
|
||||||
|
unsigned offset,
|
||||||
|
unsigned size,
|
||||||
|
const void *data );
|
||||||
|
|
||||||
|
/* In this version, taking the offset will provoke an upload on
|
||||||
|
* buffers not already resident in AGP:
|
||||||
|
*/
|
||||||
|
unsigned bmBufferOffset(struct intel_context *,
|
||||||
|
struct buffer *buf);
|
||||||
|
|
||||||
|
|
||||||
|
/* Extract data from the buffer:
|
||||||
|
*/
|
||||||
|
void bmBufferGetSubData(struct intel_context *,
|
||||||
|
struct buffer *buf,
|
||||||
|
unsigned offset,
|
||||||
|
unsigned size,
|
||||||
|
void *data );
|
||||||
|
|
||||||
|
void *bmMapBuffer( struct intel_context *,
|
||||||
|
struct buffer *buf,
|
||||||
|
unsigned access );
|
||||||
|
|
||||||
|
void bmUnmapBuffer( struct intel_context *,
|
||||||
|
struct buffer *buf );
|
||||||
|
|
||||||
|
/* Pertains to all buffers who's offset has been taken since the last
|
||||||
|
* fence or release.
|
||||||
|
*/
|
||||||
|
int bmValidateBuffers( struct intel_context * );
|
||||||
|
void bmReleaseBuffers( struct intel_context * );
|
||||||
|
|
||||||
|
GLuint bmCtxId( struct intel_context *intel );
|
||||||
|
|
||||||
|
|
||||||
|
GLboolean bmError( struct intel_context * );
|
||||||
|
void bmEvictAll( struct intel_context * );
|
||||||
|
|
||||||
|
void *bmFindVirtual( struct intel_context *intel,
|
||||||
|
unsigned int offset,
|
||||||
|
size_t sz );
|
||||||
|
|
||||||
|
/* This functionality is used by the buffer manager, not really sure
|
||||||
|
* if we need to be exposing it in this way, probably libdrm will
|
||||||
|
* offer equivalent calls.
|
||||||
|
*
|
||||||
|
* For now they can stay, but will likely change/move before final:
|
||||||
|
*/
|
||||||
|
unsigned bmSetFence( struct intel_context * );
|
||||||
|
unsigned bmSetFenceLock( struct intel_context * );
|
||||||
|
unsigned bmLockAndFence( struct intel_context *intel );
|
||||||
|
int bmTestFence( struct intel_context *, unsigned fence );
|
||||||
|
void bmFinishFence( struct intel_context *, unsigned fence );
|
||||||
|
void bmFinishFenceLock( struct intel_context *, unsigned fence );
|
||||||
|
|
||||||
|
void bm_fake_NotifyContendedLockTake( struct intel_context * );
|
||||||
|
|
||||||
|
extern int INTEL_DEBUG;
|
||||||
|
#define DEBUG_BUFMGR 0x10000000
|
||||||
|
|
||||||
|
#define DBG(...) do { if (INTEL_DEBUG & DEBUG_BUFMGR) _mesa_printf(__VA_ARGS__); } while(0)
|
||||||
|
|
||||||
|
#endif
|
1360
src/mesa/drivers/dri/i965/bufmgr_fake.c
Normal file
1360
src/mesa/drivers/dri/i965/bufmgr_fake.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -28,24 +28,13 @@
|
|||||||
#include "imports.h"
|
#include "imports.h"
|
||||||
#include "intel_batchbuffer.h"
|
#include "intel_batchbuffer.h"
|
||||||
#include "intel_ioctl.h"
|
#include "intel_ioctl.h"
|
||||||
#include "dri_bufmgr.h"
|
#include "bufmgr.h"
|
||||||
|
|
||||||
|
|
||||||
static void intel_batchbuffer_reset( struct intel_batchbuffer *batch )
|
static void intel_batchbuffer_reset( struct intel_batchbuffer *batch )
|
||||||
{
|
{
|
||||||
assert(batch->map == NULL);
|
assert(batch->map == NULL);
|
||||||
|
|
||||||
if (batch->buf != NULL) {
|
|
||||||
dri_bo_unreference(batch->buf);
|
|
||||||
batch->buf = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
batch->buf = dri_bo_alloc(intel->intelScreen->bufmgr, "batchbuffer",
|
|
||||||
intel->intelScreen->maxBatchSize, 4096,
|
|
||||||
DRM_BO_FLAG_MEM_TT);
|
|
||||||
dri_bo_map(batch->buf, GL_TRUE);
|
|
||||||
batch->map = batch->buf->virtual;
|
|
||||||
|
|
||||||
batch->offset = (unsigned long)batch->ptr;
|
batch->offset = (unsigned long)batch->ptr;
|
||||||
batch->offset = (batch->offset + 63) & ~63;
|
batch->offset = (batch->offset + 63) & ~63;
|
||||||
batch->ptr = (unsigned char *) batch->offset;
|
batch->ptr = (unsigned char *) batch->offset;
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#define INTEL_BATCHBUFFER_H
|
#define INTEL_BATCHBUFFER_H
|
||||||
|
|
||||||
#include "mtypes.h"
|
#include "mtypes.h"
|
||||||
#include "dri_bufmgr.h"
|
#include "bufmgr.h"
|
||||||
|
|
||||||
struct intel_context;
|
struct intel_context;
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ struct intel_context;
|
|||||||
struct intel_batchbuffer {
|
struct intel_batchbuffer {
|
||||||
struct intel_context *intel;
|
struct intel_context *intel;
|
||||||
|
|
||||||
dri_bo *buffer;
|
struct buffer *buffer;
|
||||||
|
|
||||||
GLuint flags;
|
GLuint flags;
|
||||||
unsigned long offset;
|
unsigned long offset;
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
#include "intel_regions.h"
|
#include "intel_regions.h"
|
||||||
#include "intel_structs.h"
|
#include "intel_structs.h"
|
||||||
|
|
||||||
#include "dri_bufmgr.h"
|
#include "bufmgr.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv,
|
|||||||
intelFlush( &intel->ctx );
|
intelFlush( &intel->ctx );
|
||||||
|
|
||||||
|
|
||||||
dri_fence_wait(intel, intel->last_swap_fence);
|
bmFinishFenceLock(intel, intel->last_swap_fence);
|
||||||
|
|
||||||
/* The LOCK_HARDWARE is required for the cliprects. Buffer offsets
|
/* The LOCK_HARDWARE is required for the cliprects. Buffer offsets
|
||||||
* should work regardless.
|
* should work regardless.
|
||||||
@@ -154,10 +154,8 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
intel_batchbuffer_flush( intel->batch );
|
intel_batchbuffer_flush( intel->batch );
|
||||||
|
|
||||||
dri_fence_unreference(intel->second_last_swap_fence);
|
|
||||||
intel->second_last_swap_fence = intel->last_swap_fence;
|
intel->second_last_swap_fence = intel->last_swap_fence;
|
||||||
intel->last_swap_fence = dri_fence_reference(intel->bmbmSetFenceLock( intel );
|
intel->last_swap_fence = bmSetFenceLock( intel );
|
||||||
UNLOCK_HARDWARE( intel );
|
UNLOCK_HARDWARE( intel );
|
||||||
|
|
||||||
if (!rect)
|
if (!rect)
|
||||||
@@ -180,7 +178,7 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv,
|
|||||||
void intelEmitFillBlit( struct intel_context *intel,
|
void intelEmitFillBlit( struct intel_context *intel,
|
||||||
GLuint cpp,
|
GLuint cpp,
|
||||||
GLshort dst_pitch,
|
GLshort dst_pitch,
|
||||||
dri_bo *dst_buffer,
|
struct buffer *dst_buffer,
|
||||||
GLuint dst_offset,
|
GLuint dst_offset,
|
||||||
GLboolean dst_tiled,
|
GLboolean dst_tiled,
|
||||||
GLshort x, GLshort y,
|
GLshort x, GLshort y,
|
||||||
@@ -252,11 +250,11 @@ static GLuint translate_raster_op(GLenum logicop)
|
|||||||
void intelEmitCopyBlit( struct intel_context *intel,
|
void intelEmitCopyBlit( struct intel_context *intel,
|
||||||
GLuint cpp,
|
GLuint cpp,
|
||||||
GLshort src_pitch,
|
GLshort src_pitch,
|
||||||
dri_bo *src_buffer,
|
struct buffer *src_buffer,
|
||||||
GLuint src_offset,
|
GLuint src_offset,
|
||||||
GLboolean src_tiled,
|
GLboolean src_tiled,
|
||||||
GLshort dst_pitch,
|
GLshort dst_pitch,
|
||||||
dri_bo *dst_buffer,
|
struct buffer *dst_buffer,
|
||||||
GLuint dst_offset,
|
GLuint dst_offset,
|
||||||
GLboolean dst_tiled,
|
GLboolean dst_tiled,
|
||||||
GLshort src_x, GLshort src_y,
|
GLshort src_x, GLshort src_y,
|
||||||
@@ -530,7 +528,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
|
|||||||
GLubyte *src_bits, GLuint src_size,
|
GLubyte *src_bits, GLuint src_size,
|
||||||
GLuint fg_color,
|
GLuint fg_color,
|
||||||
GLshort dst_pitch,
|
GLshort dst_pitch,
|
||||||
dri_bo *dst_buffer,
|
struct buffer *dst_buffer,
|
||||||
GLuint dst_offset,
|
GLuint dst_offset,
|
||||||
GLboolean dst_tiled,
|
GLboolean dst_tiled,
|
||||||
GLshort x, GLshort y,
|
GLshort x, GLshort y,
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
#include "intel_context.h"
|
#include "intel_context.h"
|
||||||
#include "intel_ioctl.h"
|
#include "intel_ioctl.h"
|
||||||
|
|
||||||
dri_bo;
|
struct buffer;
|
||||||
|
|
||||||
extern void intelCopyBuffer( const __DRIdrawablePrivate *dpriv,
|
extern void intelCopyBuffer( const __DRIdrawablePrivate *dpriv,
|
||||||
const drm_clip_rect_t *rect );
|
const drm_clip_rect_t *rect );
|
||||||
@@ -40,11 +40,11 @@ extern void intelClearWithBlit(GLcontext *ctx, GLbitfield mask);
|
|||||||
extern void intelEmitCopyBlit( struct intel_context *intel,
|
extern void intelEmitCopyBlit( struct intel_context *intel,
|
||||||
GLuint cpp,
|
GLuint cpp,
|
||||||
GLshort src_pitch,
|
GLshort src_pitch,
|
||||||
dri_bo *src_buffer,
|
struct buffer *src_buffer,
|
||||||
GLuint src_offset,
|
GLuint src_offset,
|
||||||
GLboolean src_tiled,
|
GLboolean src_tiled,
|
||||||
GLshort dst_pitch,
|
GLshort dst_pitch,
|
||||||
dri_bo *dst_buffer,
|
struct buffer *dst_buffer,
|
||||||
GLuint dst_offset,
|
GLuint dst_offset,
|
||||||
GLboolean dst_tiled,
|
GLboolean dst_tiled,
|
||||||
GLshort srcx, GLshort srcy,
|
GLshort srcx, GLshort srcy,
|
||||||
@@ -55,7 +55,7 @@ extern void intelEmitCopyBlit( struct intel_context *intel,
|
|||||||
extern void intelEmitFillBlit( struct intel_context *intel,
|
extern void intelEmitFillBlit( struct intel_context *intel,
|
||||||
GLuint cpp,
|
GLuint cpp,
|
||||||
GLshort dst_pitch,
|
GLshort dst_pitch,
|
||||||
dri_bo *dst_buffer,
|
struct buffer *dst_buffer,
|
||||||
GLuint dst_offset,
|
GLuint dst_offset,
|
||||||
GLboolean dst_tiled,
|
GLboolean dst_tiled,
|
||||||
GLshort x, GLshort y,
|
GLshort x, GLshort y,
|
||||||
@@ -68,7 +68,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
|
|||||||
GLubyte *src_bits, GLuint src_size,
|
GLubyte *src_bits, GLuint src_size,
|
||||||
GLuint fg_color,
|
GLuint fg_color,
|
||||||
GLshort dst_pitch,
|
GLshort dst_pitch,
|
||||||
dri_bo *dst_buffer,
|
struct buffer *dst_buffer,
|
||||||
GLuint dst_offset,
|
GLuint dst_offset,
|
||||||
GLboolean dst_tiled,
|
GLboolean dst_tiled,
|
||||||
GLshort dst_x, GLshort dst_y,
|
GLshort dst_x, GLshort dst_y,
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "intel_context.h"
|
#include "intel_context.h"
|
||||||
#include "intel_buffer_objects.h"
|
#include "intel_buffer_objects.h"
|
||||||
#include "dri_bufmgr.h"
|
#include "bufmgr.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -185,7 +185,7 @@ static GLboolean intel_bufferobj_unmap( GLcontext *ctx,
|
|||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dri_bo *intel_bufferobj_buffer( const struct intel_buffer_object *intel_obj )
|
struct buffer *intel_bufferobj_buffer( const struct intel_buffer_object *intel_obj )
|
||||||
{
|
{
|
||||||
assert(intel_obj->Base.Name);
|
assert(intel_obj->Base.Name);
|
||||||
assert(intel_obj->buffer);
|
assert(intel_obj->buffer);
|
||||||
|
@@ -39,13 +39,13 @@ struct gl_buffer_object;
|
|||||||
*/
|
*/
|
||||||
struct intel_buffer_object {
|
struct intel_buffer_object {
|
||||||
struct gl_buffer_object Base;
|
struct gl_buffer_object Base;
|
||||||
dri_bo *buffer; /* the low-level buffer manager's buffer handle */
|
struct buffer *buffer; /* the low-level buffer manager's buffer handle */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Get the bm buffer associated with a GL bufferobject:
|
/* Get the bm buffer associated with a GL bufferobject:
|
||||||
*/
|
*/
|
||||||
dri_bo *intel_bufferobj_buffer( const struct intel_buffer_object *obj );
|
struct buffer *intel_bufferobj_buffer( const struct intel_buffer_object *obj );
|
||||||
|
|
||||||
/* Hook the bufferobject implementation into mesa:
|
/* Hook the bufferobject implementation into mesa:
|
||||||
*/
|
*/
|
||||||
|
@@ -58,7 +58,7 @@
|
|||||||
#include "intel_regions.h"
|
#include "intel_regions.h"
|
||||||
#include "intel_buffer_objects.h"
|
#include "intel_buffer_objects.h"
|
||||||
|
|
||||||
#include "dri_bufmgr.h"
|
#include "bufmgr.h"
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "vblank.h"
|
#include "vblank.h"
|
||||||
@@ -635,10 +635,10 @@ static void intelContendedLock( struct intel_context *intel, GLuint flags )
|
|||||||
/* As above, but don't evict the texture data on transitions
|
/* As above, but don't evict the texture data on transitions
|
||||||
* between contexts which all share a local buffer manager.
|
* between contexts which all share a local buffer manager.
|
||||||
*/
|
*/
|
||||||
if (sarea->texAge != intel->hHWContext) {
|
if (sarea->texAge != my_bufmgr) {
|
||||||
DBG("Lost Textures: sarea->texAge %x my_bufmgr %x\n", sarea->ctxOwner, my_bufmgr);
|
DBG("Lost Textures: sarea->texAge %x my_bufmgr %x\n", sarea->ctxOwner, my_bufmgr);
|
||||||
sarea->texAge = intel->hHWContext;
|
sarea->texAge = my_bufmgr;
|
||||||
dri_bufmgr_fake_contended_lock_take(intel->intelScreen->bufmgr);
|
bm_fake_NotifyContendedLockTake( intel );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Drawable changed?
|
/* Drawable changed?
|
||||||
@@ -668,6 +668,11 @@ void LOCK_HARDWARE( struct intel_context *intel )
|
|||||||
|
|
||||||
intel->locked = 1;
|
intel->locked = 1;
|
||||||
|
|
||||||
|
if (bmError(intel)) {
|
||||||
|
bmEvictAll(intel);
|
||||||
|
intel->vtbl.lost_hardware( intel );
|
||||||
|
}
|
||||||
|
|
||||||
/* Make sure nothing has been emitted prior to getting the lock:
|
/* Make sure nothing has been emitted prior to getting the lock:
|
||||||
*/
|
*/
|
||||||
assert(intel->batch->map == 0);
|
assert(intel->batch->map == 0);
|
||||||
@@ -675,8 +680,16 @@ void LOCK_HARDWARE( struct intel_context *intel )
|
|||||||
/* XXX: postpone, may not be needed:
|
/* XXX: postpone, may not be needed:
|
||||||
*/
|
*/
|
||||||
if (!intel_batchbuffer_map(intel->batch)) {
|
if (!intel_batchbuffer_map(intel->batch)) {
|
||||||
_mesa_printf("failure to map batchbuffer\n");
|
bmEvictAll(intel);
|
||||||
assert(0);
|
intel->vtbl.lost_hardware( intel );
|
||||||
|
|
||||||
|
/* This could only fail if the batchbuffer was greater in size
|
||||||
|
* than the available texture memory:
|
||||||
|
*/
|
||||||
|
if (!intel_batchbuffer_map(intel->batch)) {
|
||||||
|
_mesa_printf("double failure to map batchbuffer\n");
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
#include "intel_blit.h"
|
#include "intel_blit.h"
|
||||||
#include "intel_regions.h"
|
#include "intel_regions.h"
|
||||||
#include "drm.h"
|
#include "drm.h"
|
||||||
#include "dri_bufmgr.h"
|
#include "bufmgr.h"
|
||||||
|
|
||||||
static int intelWaitIdleLocked( struct intel_context *intel )
|
static int intelWaitIdleLocked( struct intel_context *intel )
|
||||||
{
|
{
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "intel_context.h"
|
#include "intel_context.h"
|
||||||
#include "intel_mipmap_tree.h"
|
#include "intel_mipmap_tree.h"
|
||||||
#include "intel_regions.h"
|
#include "intel_regions.h"
|
||||||
#include "dri_bufmgr.h"
|
#include "bufmgr.h"
|
||||||
#include "enums.h"
|
#include "enums.h"
|
||||||
#include "imports.h"
|
#include "imports.h"
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@
|
|||||||
#include "intel_context.h"
|
#include "intel_context.h"
|
||||||
#include "intel_regions.h"
|
#include "intel_regions.h"
|
||||||
#include "intel_blit.h"
|
#include "intel_blit.h"
|
||||||
#include "dri_bufmgr.h"
|
#include "bufmgr.h"
|
||||||
#include "imports.h"
|
#include "imports.h"
|
||||||
|
|
||||||
/* XXX: Thread safety?
|
/* XXX: Thread safety?
|
||||||
@@ -51,7 +51,7 @@ GLubyte *intel_region_map(struct intel_context *intel, struct intel_region *regi
|
|||||||
{
|
{
|
||||||
DBG("%s\n", __FUNCTION__);
|
DBG("%s\n", __FUNCTION__);
|
||||||
if (!region->map_refcount++) {
|
if (!region->map_refcount++) {
|
||||||
region->map = dri_bo_map(region->buffer, GL_TRUE);
|
region->map = bmMapBuffer(intel, region->buffer, 0);
|
||||||
if (!region->map)
|
if (!region->map)
|
||||||
region->map_refcount--;
|
region->map_refcount--;
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ void intel_region_unmap(struct intel_context *intel,
|
|||||||
{
|
{
|
||||||
DBG("%s\n", __FUNCTION__);
|
DBG("%s\n", __FUNCTION__);
|
||||||
if (!--region->map_refcount) {
|
if (!--region->map_refcount) {
|
||||||
dri_bo_unmap(region->buffer);
|
bmUnmapBuffer(intel, region->buffer);
|
||||||
region->map = NULL;
|
region->map = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,8 +84,8 @@ struct intel_region *intel_region_alloc( struct intel_context *intel,
|
|||||||
region->height = height; /* needed? */
|
region->height = height; /* needed? */
|
||||||
region->refcount = 1;
|
region->refcount = 1;
|
||||||
|
|
||||||
region->buffer = dri_bo_alloc(intelScreen->bufmgr, "region",
|
bmGenBuffers(intel, "tex", 1, ®ion->buffer, 6);
|
||||||
pitch * cpp * height, 64, DRM_BO_FLAG_MEM_TT);
|
bmBufferData(intel, region->buffer, pitch * cpp * height, NULL, 0);
|
||||||
|
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,7 @@ void intel_region_release( struct intel_context *intel,
|
|||||||
|
|
||||||
if (--(*region)->refcount == 0) {
|
if (--(*region)->refcount == 0) {
|
||||||
assert((*region)->map_refcount == 0);
|
assert((*region)->map_refcount == 0);
|
||||||
dri_bo_unreference((*region)->buffer);
|
bmDeleteBuffers(intel, 1, &(*region)->buffer);
|
||||||
free(*region);
|
free(*region);
|
||||||
}
|
}
|
||||||
*region = NULL;
|
*region = NULL;
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#define INTEL_REGIONS_H
|
#define INTEL_REGIONS_H
|
||||||
|
|
||||||
#include "mtypes.h"
|
#include "mtypes.h"
|
||||||
#include "dri_bufmgr.h" /* for DBG! */
|
#include "bufmgr.h" /* for DBG! */
|
||||||
struct intel_context;
|
struct intel_context;
|
||||||
|
|
||||||
/* A layer on top of the bufmgr buffers that adds a few useful things:
|
/* A layer on top of the bufmgr buffers that adds a few useful things:
|
||||||
@@ -40,7 +40,7 @@ struct intel_context;
|
|||||||
* - Blitter commands for copying 2D regions between buffers.
|
* - Blitter commands for copying 2D regions between buffers.
|
||||||
*/
|
*/
|
||||||
struct intel_region {
|
struct intel_region {
|
||||||
dri_bo *buffer;
|
struct buffer *buffer;
|
||||||
GLuint refcount;
|
GLuint refcount;
|
||||||
GLuint cpp;
|
GLuint cpp;
|
||||||
GLuint pitch;
|
GLuint pitch;
|
||||||
|
@@ -109,18 +109,12 @@ intelMapScreenRegions(__DRIscreenPrivate *sPriv)
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intelScreen->tex.size != 0) {
|
if (drmMap(sPriv->fd,
|
||||||
intelScreen->ttm = GL_FALSE;
|
intelScreen->tex.handle,
|
||||||
|
intelScreen->tex.size,
|
||||||
if (drmMap(sPriv->fd,
|
(drmAddress *)&intelScreen->tex.map) != 0) {
|
||||||
intelScreen->tex.handle,
|
intelUnmapScreenRegions(intelScreen);
|
||||||
intelScreen->tex.size,
|
return GL_FALSE;
|
||||||
(drmAddress *)&intelScreen->tex.map) != 0) {
|
|
||||||
intelUnmapScreenRegions(intelScreen);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
intelScreen->ttm = GL_TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0)
|
if (0)
|
||||||
@@ -169,32 +163,6 @@ intelUnmapScreenRegions(intelScreenPrivate *intelScreen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Driver-specific fence emit implementation for the fake memory manager. */
|
|
||||||
static unsigned int
|
|
||||||
intel_fence_emit(void *private)
|
|
||||||
{
|
|
||||||
intelScreenPrivate *intelScreen = (intelScreenPrivate *)private;
|
|
||||||
unsigned int fence;
|
|
||||||
|
|
||||||
/* XXX: Need to emit a flush, if we haven't already (at least with the
|
|
||||||
* current batchbuffer implementation, we have).
|
|
||||||
*/
|
|
||||||
|
|
||||||
fence = intelEmitIrqLocked(intelScreen);
|
|
||||||
|
|
||||||
return fence;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Driver-specific fence wait implementation for the fake memory manager. */
|
|
||||||
static int
|
|
||||||
intel_fence_wait(void *private, unsigned int cookie)
|
|
||||||
{
|
|
||||||
intelScreenPrivate *intelScreen = (intelScreenPrivate *)private;
|
|
||||||
|
|
||||||
intelWaitIrq(intelScreen, cookie);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
intelPrintDRIInfo(intelScreenPrivate *intelScreen,
|
intelPrintDRIInfo(intelScreenPrivate *intelScreen,
|
||||||
@@ -391,19 +359,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
|
|||||||
(*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
|
(*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
|
||||||
(*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" );
|
(*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" );
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!intelScreen->ttm);
|
|
||||||
intelScreen->bufmgr = dri_bufmgr_fake_init(intelScreen->tex.offset,
|
|
||||||
intelScreen->tex.map,
|
|
||||||
intelScreen->tex.size,
|
|
||||||
intel_fence_emit,
|
|
||||||
intel_fence_wait,
|
|
||||||
intelScreen);
|
|
||||||
if (intelScreen->bufmgr == FALSE) {
|
|
||||||
fprintf(stderr, "Couldn't initialize buffer manager\n");
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,7 +369,6 @@ static void intelDestroyScreen(__DRIscreenPrivate *sPriv)
|
|||||||
intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private;
|
intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private;
|
||||||
|
|
||||||
intelUnmapScreenRegions(intelScreen);
|
intelUnmapScreenRegions(intelScreen);
|
||||||
dri_bufmgr_destroy(intelScreen->bufmgr);
|
|
||||||
FREE(intelScreen);
|
FREE(intelScreen);
|
||||||
sPriv->private = NULL;
|
sPriv->private = NULL;
|
||||||
}
|
}
|
||||||
|
@@ -80,13 +80,6 @@ typedef struct
|
|||||||
* Configuration cache with default values for all contexts
|
* Configuration cache with default values for all contexts
|
||||||
*/
|
*/
|
||||||
driOptionCache optionCache;
|
driOptionCache optionCache;
|
||||||
|
|
||||||
/**
|
|
||||||
* This value indicates that the kernel memory manager is being used
|
|
||||||
* instead of the fake client-side memory manager.
|
|
||||||
*/
|
|
||||||
GLboolean ttm;
|
|
||||||
dri_bufmgr *bufmgr;
|
|
||||||
} intelScreenPrivate;
|
} intelScreenPrivate;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,102 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the
|
|
||||||
* "Software"), to deal in the Software without restriction, including
|
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice (including the
|
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
|
||||||
* of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
|
||||||
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
|
|
||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
/*
|
|
||||||
* Authors:
|
|
||||||
* Keith Whitwell <keith@tungstengraphics.com>
|
|
||||||
* Michel Dänzer <michel@tungstengraphics.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "intel_mipmap_tree.h"
|
|
||||||
#include "intel_tex_layout.h"
|
|
||||||
#include "macros.h"
|
|
||||||
|
|
||||||
|
|
||||||
static int align(int value, int alignment)
|
|
||||||
{
|
|
||||||
return (value + alignment - 1) & ~(alignment - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void i945_miptree_layout_2d( struct intel_mipmap_tree *mt )
|
|
||||||
{
|
|
||||||
GLint align_h = 2, align_w = 4;
|
|
||||||
GLuint level;
|
|
||||||
GLuint x = 0;
|
|
||||||
GLuint y = 0;
|
|
||||||
GLuint width = mt->width0;
|
|
||||||
GLuint height = mt->height0;
|
|
||||||
|
|
||||||
mt->pitch = mt->width0;
|
|
||||||
|
|
||||||
/* May need to adjust pitch to accomodate the placement of
|
|
||||||
* the 2nd mipmap. This occurs when the alignment
|
|
||||||
* constraints of mipmap placement push the right edge of the
|
|
||||||
* 2nd mipmap out past the width of its parent.
|
|
||||||
*/
|
|
||||||
if (mt->first_level != mt->last_level) {
|
|
||||||
GLuint mip1_width = align(minify(mt->width0), align_w)
|
|
||||||
+ minify(minify(mt->width0));
|
|
||||||
|
|
||||||
if (mip1_width > mt->width0)
|
|
||||||
mt->pitch = mip1_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Pitch must be a whole number of dwords, even though we
|
|
||||||
* express it in texels.
|
|
||||||
*/
|
|
||||||
mt->pitch = align(mt->pitch * mt->cpp, 4) / mt->cpp;
|
|
||||||
mt->total_height = 0;
|
|
||||||
|
|
||||||
for ( level = mt->first_level ; level <= mt->last_level ; level++ ) {
|
|
||||||
GLuint img_height;
|
|
||||||
|
|
||||||
intel_miptree_set_level_info(mt, level, 1, x, y, width,
|
|
||||||
height, 1);
|
|
||||||
|
|
||||||
if (mt->compressed)
|
|
||||||
img_height = MAX2(1, height/4);
|
|
||||||
else
|
|
||||||
img_height = align(height, align_h);
|
|
||||||
|
|
||||||
|
|
||||||
/* Because the images are packed better, the final offset
|
|
||||||
* might not be the maximal one:
|
|
||||||
*/
|
|
||||||
mt->total_height = MAX2(mt->total_height, y + img_height);
|
|
||||||
|
|
||||||
/* Layout_below: step right after second mipmap.
|
|
||||||
*/
|
|
||||||
if (level == mt->first_level + 1) {
|
|
||||||
x += align(width, align_w);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
y += img_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
width = minify(width);
|
|
||||||
height = minify(height);
|
|
||||||
}
|
|
||||||
}
|
|
1
src/mesa/drivers/dri/i965/intel_tex_layout.c
Symbolic link
1
src/mesa/drivers/dri/i965/intel_tex_layout.c
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../intel/intel_tex_layout.c
|
@@ -31,7 +31,7 @@
|
|||||||
#include "intel_context.h"
|
#include "intel_context.h"
|
||||||
#include "intel_mipmap_tree.h"
|
#include "intel_mipmap_tree.h"
|
||||||
#include "intel_tex.h"
|
#include "intel_tex.h"
|
||||||
#include "dri_bufmgr.h"
|
#include "bufmgr.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute which mipmap levels that really need to be sent to the hardware.
|
* Compute which mipmap levels that really need to be sent to the hardware.
|
||||||
|
Reference in New Issue
Block a user