Merge commit 'origin/gallium-winsys-handle-rebased'
[mesa.git] / src / mesa / drivers / dri / radeon / radeon_common_context.h
index 5c4b4abaca42601553ed4fe212c93e35093ace3d..d1a24e265f2e14ba1561fe211ea9df3186c073eb 100644 (file)
@@ -8,6 +8,7 @@
 #include "tnl/t_context.h"
 #include "main/colormac.h"
 
+#include "radeon_debug.h"
 #include "radeon_screen.h"
 #include "radeon_drm.h"
 #include "dri_util.h"
@@ -18,22 +19,6 @@ struct radeon_context;
 
 #include "radeon_bocs_wrapper.h"
 
-/* From http://gcc. gnu.org/onlinedocs/gcc-3.2.3/gcc/Variadic-Macros.html .
-   I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble
-   with other compilers ... GLUE!
-*/
-#define WARN_ONCE(a, ...)      { \
-       static int warn##__LINE__=1; \
-       if(warn##__LINE__){ \
-               fprintf(stderr, "*********************************WARN_ONCE*********************************\n"); \
-               fprintf(stderr, "File %s function %s line %d\n", \
-                       __FILE__, __FUNCTION__, __LINE__); \
-               fprintf(stderr,  a, ## __VA_ARGS__);\
-               fprintf(stderr, "***************************************************************************\n"); \
-               warn##__LINE__=0;\
-               } \
-       }
-
 /* This union is used to avoid warnings/miscompilation
    with float to uint32_t casts due to strict-aliasing */
 typedef union { GLfloat f; uint32_t ui32; } float_ui32_type;
@@ -107,7 +92,7 @@ struct radeon_renderbuffer
 
        GLuint pf_pending;  /**< sequence number of pending flip */
        GLuint vbl_pending;   /**< vblank sequence number of pending flip */
-       __DRIdrawablePrivate *dPriv;
+       __DRIdrawable *dPriv;
 };
 
 struct radeon_framebuffer
@@ -158,10 +143,6 @@ struct radeon_stencilbuffer_state {
        GLuint clear;           /* rb3d_stencilrefmask value */
 };
 
-struct radeon_stipple_state {
-       GLuint mask[32];
-};
-
 struct radeon_state_atom {
        struct radeon_state_atom *next, *prev;
        const char *name;       /* for debug */
@@ -227,6 +208,10 @@ struct radeon_tex_obj {
         * and so on.
         */
        GLboolean validated;
+       /* Minimum LOD to be used during rendering */
+       unsigned minLod;
+       /* Miximum LOD to be used during rendering */
+       unsigned maxLod;
 
        GLuint override_offset;
        GLboolean image_override; /* Image overridden by GLX_EXT_tfp */
@@ -342,7 +327,8 @@ struct radeon_swtcl_info {
        struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
        GLuint vertex_attr_count;
 
-       GLuint primitive_counter;
+       GLuint emit_prediction;
+        struct radeon_bo *bo;
 };
 
 #define RADEON_MAX_AOS_ARRAYS          16
@@ -355,7 +341,8 @@ struct radeon_tcl_info {
 
 struct radeon_ioctl {
        GLuint vertex_offset;
-        struct radeon_bo *bo;
+       GLuint vertex_max;
+       struct radeon_bo *bo;
        GLuint vertex_size;
 };
 
@@ -394,8 +381,8 @@ struct radeon_store {
 };
 
 struct radeon_dri_mirror {
-       __DRIcontextPrivate *context;   /* DRI context */
-       __DRIscreenPrivate *screen;     /* DRI screen */
+       __DRIcontext *context;  /* DRI context */
+       __DRIscreen *screen;    /* DRI screen */
 
        drm_context_t hwContext;
        drm_hw_lock_t *hwLock;
@@ -404,23 +391,6 @@ struct radeon_dri_mirror {
        int drmMinor;
 };
 
-#define DEBUG_TEXTURE  0x001
-#define DEBUG_STATE    0x002
-#define DEBUG_IOCTL    0x004
-#define DEBUG_PRIMS    0x008
-#define DEBUG_VERTS    0x010
-#define DEBUG_FALLBACKS        0x020
-#define DEBUG_VFMT     0x040
-#define DEBUG_CODEGEN  0x080
-#define DEBUG_VERBOSE  0x100
-#define DEBUG_DRI       0x200
-#define DEBUG_DMA       0x400
-#define DEBUG_SANITY    0x800
-#define DEBUG_SYNC      0x1000
-#define DEBUG_PIXEL     0x2000
-#define DEBUG_MEMORY    0x4000
-
-
 typedef void (*radeon_tri_func) (radeonContextPtr,
                                 radeonVertex *,
                                 radeonVertex *, radeonVertex *);
@@ -436,9 +406,6 @@ struct radeon_state {
        struct radeon_depthbuffer_state depth;
        struct radeon_scissor_state scissor;
        struct radeon_stencilbuffer_state stencil;
-
-       struct radeon_cs_space_check bos[RADEON_MAX_BOS];
-       int validated_bo_count;
 };
 
 /**
@@ -502,6 +469,8 @@ struct radeon_context {
 
    struct radeon_cmdbuf cmdbuf;
 
+   struct radeon_debug debug;
+
   drm_clip_rect_t fboRect;
   GLboolean constant_cliprect; /* use for FBO or DRI2 rendering */
   GLboolean front_cliprects;
@@ -535,7 +504,6 @@ struct radeon_context {
 
    struct {
        struct radeon_query_object *current;
-       struct radeon_query_object not_flushed_head;
        struct radeon_state_atom queryobj;
    } query;
 
@@ -550,17 +518,38 @@ struct radeon_context {
           void (*free_context)(GLcontext *ctx);
           void (*emit_query_finish)(radeonContextPtr radeon);
           void (*update_scissor)(GLcontext *ctx);
+          unsigned (*check_blit)(gl_format mesa_format);
+          unsigned (*blit)(GLcontext *ctx,
+                        struct radeon_bo *src_bo,
+                        intptr_t src_offset,
+                        gl_format src_mesaformat,
+                        unsigned src_pitch,
+                        unsigned src_width,
+                        unsigned src_height,
+                        unsigned src_x_offset,
+                        unsigned src_y_offset,
+                        struct radeon_bo *dst_bo,
+                        intptr_t dst_offset,
+                        gl_format dst_mesaformat,
+                        unsigned dst_pitch,
+                        unsigned dst_width,
+                        unsigned dst_height,
+                        unsigned dst_x_offset,
+                        unsigned dst_y_offset,
+                        unsigned reg_width,
+                        unsigned reg_height,
+                        unsigned flip_y);
    } vtbl;
 };
 
 #define RADEON_CONTEXT(glctx) ((radeonContextPtr)(ctx->DriverCtx))
 
-static inline __DRIdrawablePrivate* radeon_get_drawable(radeonContextPtr radeon)
+static inline __DRIdrawable* radeon_get_drawable(radeonContextPtr radeon)
 {
        return radeon->dri.context->driDrawablePriv;
 }
 
-static inline __DRIdrawablePrivate* radeon_get_readable(radeonContextPtr radeon)
+static inline __DRIdrawable* radeon_get_readable(radeonContextPtr radeon)
 {
        return radeon->dri.context->driReadablePriv;
 }
@@ -613,26 +602,16 @@ static INLINE uint32_t radeonPackFloat24(float f)
 GLboolean radeonInitContext(radeonContextPtr radeon,
                            struct dd_function_table* functions,
                            const __GLcontextModes * glVisual,
-                           __DRIcontextPrivate * driContextPriv,
+                           __DRIcontext * driContextPriv,
                            void *sharedContextPrivate);
 
 void radeonCleanupContext(radeonContextPtr radeon);
-GLboolean radeonUnbindContext(__DRIcontextPrivate * driContextPriv);
-void radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable);
-GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
-                           __DRIdrawablePrivate * driDrawPriv,
-                           __DRIdrawablePrivate * driReadPriv);
-extern void radeonDestroyContext(__DRIcontextPrivate * driContextPriv);
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG               1
-
-#if DO_DEBUG
-extern int RADEON_DEBUG;
-#else
-#define RADEON_DEBUG           0
-#endif
+GLboolean radeonUnbindContext(__DRIcontext * driContextPriv);
+void radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
+                                GLboolean front_only);
+GLboolean radeonMakeCurrent(__DRIcontext * driContextPriv,
+                           __DRIdrawable * driDrawPriv,
+                           __DRIdrawable * driReadPriv);
+extern void radeonDestroyContext(__DRIcontext * driContextPriv);
 
 #endif