* Kevin E. Martin <kem@users.sourceforge.net>
* Gareth Hughes <gareth@nvidia.com>
*/
-/* $XFree86:$ */
/** \file texmem.h
* Public interface to the DRI texture memory management routines.
#ifndef DRI_TEXMEM_H
#define DRI_TEXMEM_H
-#include "mtypes.h"
-#include "mm.h"
+#include "main/mtypes.h"
+#include "main/mm.h"
#include "xf86drm.h"
struct dri_tex_heap;
* texture memory in use by another context.
* A placeholder should have a heap and a memBlock.
*/
- PMemBlock memBlock; /**< Memory block containing texture */
- unsigned bound; /**< Texture unit currently bound to */
+ struct mem_block *memBlock; /**< Memory block containing texture */
+
+ unsigned reserved; /**< Cannot be swapped out by user contexts. */
+
+ unsigned bound; /**< Bitmask indicating which tex units
+ * this texture object is bound to.
+ * Bit 0 = unit 0, Bit 1 = unit 1, etc
+ */
unsigned totalSize; /**< Total size of the texture,
* including all mipmap levels
* the framebuffer.
*/
- unsigned firstLevel; /**< Image in \c tObj->Image that
+ unsigned firstLevel; /**< Image in \c tObj->Image[0] that
* corresponds to the base-level of
* this texture object.
*/
- unsigned lastLevel; /**< Last image in \c tObj->Image used
- * by the current LOD settings of this
- * texture object. This value must be
- * greater than or equal to
- * \c firstLevel.
+ unsigned lastLevel; /**< Last image in \c tObj->Image[0]
+ * used by the
+ * current LOD settings of
+ * this texture object. This
+ * value must be greater than
+ * or equal to \c firstLevel.
*/
};
/** Memory heap used to manage texture memory represented by
* this texture heap.
*/
- memHeap_t * memory_heap;
+ struct mem_block * memory_heap;
/** List of objects that we currently believe to be in texture
* memory.
* framebuffer.
*/
unsigned timestamp;
+
+ /** \brief Kick/upload weight
+ *
+ * When not enough free space is available this weight
+ * influences the choice of the heap from which textures are
+ * kicked. By default the weight is equal to the heap size.
+ */
+ double weight;
+
+ /** \brief Kick/upload duty
+ *
+ * The heap with the highest duty will be chosen for kicking
+ * textures if not enough free space is available. The duty is
+ * reduced by the amount of data kicked. Rebalancing of
+ * negative duties takes the weights into account.
+ */
+ int duty;
};
driCalculateMaxTextureLevels( driTexHeap * const * heaps,
unsigned nr_heaps,
struct gl_constants * limits,
- unsigned max_bytes_per_texel,
+ unsigned max_bytes_per_texel,
unsigned max_2D_size,
unsigned max_3D_size,
unsigned max_cube_size,
unsigned max_rect_size,
unsigned mipmaps_at_once,
- int all_textures_one_heap );
+ int all_textures_one_heap,
+ int allow_larger_textures );
void
driSetTextureSwapCounterLocation( driTexHeap * heap, unsigned * counter );
GLboolean driValidateTextureHeaps( driTexHeap * const * texture_heaps,
unsigned nr_heaps, const driTextureObject * swapped );
+extern void driCalculateTextureFirstLastLevel( driTextureObject * t );
+
+
+extern const struct gl_texture_format *_dri_texformat_rgba8888;
+extern const struct gl_texture_format *_dri_texformat_argb8888;
+extern const struct gl_texture_format *_dri_texformat_rgb565;
+extern const struct gl_texture_format *_dri_texformat_argb4444;
+extern const struct gl_texture_format *_dri_texformat_argb1555;
+extern const struct gl_texture_format *_dri_texformat_al88;
+extern const struct gl_texture_format *_dri_texformat_a8;
+extern const struct gl_texture_format *_dri_texformat_ci8;
+extern const struct gl_texture_format *_dri_texformat_i8;
+extern const struct gl_texture_format *_dri_texformat_l8;
+
+extern void driInitTextureFormats( void );
+
#endif /* DRI_TEXMEM_H */