Browse Source

Merge branch 'remove-intel-dri1'

* remove-intel-dri1:
  intel: intelScreenContext() is no longer used
  intel: Remove remaining dri2.enabled tests
  intel: Drop more cliprect bookkeeping
  intel: Remove struct intel_framebuffer
  intel: Remove client-side vblank code
  intel: Drop intelWindowMoved()
  intel: Drop batchbuffer cliprect_mode tracking
  intel: Drop DRI1 static regions
  intel: Use depth buffer from ctx.DrawBuffer in copypix_src_region()
  intel: Drop LOCK/UNLOCK_HARDWARE()
  intel: Drop DRI1 SwapBuffer implementation
  intel: Drop DRI1 CopySubBuffer implementation
  intel: Drop DRI1 support
  Push __driDriverExtensions out of dri_util.c and into the drivers
  Remove leftover __DRI{screen,drawable,context}Private references
  Check for libdrm_$chipset.pc when needed
tags/7.8-rc1
Kristian Høgsberg 16 years ago
parent
commit
ae44b92f61
100 changed files with 578 additions and 1954 deletions
  1. 2
    0
      configs/autoconf.in
  2. 21
    9
      configure.ac
  3. 13
    13
      src/egl/drivers/dri/egldri.c
  4. 7
    7
      src/gallium/state_trackers/dri/dri_context.c
  5. 11
    11
      src/gallium/state_trackers/dri/dri_context.h
  6. 12
    12
      src/gallium/state_trackers/dri/dri_drawable.c
  7. 9
    9
      src/gallium/state_trackers/dri/dri_drawable.h
  8. 12
    4
      src/gallium/state_trackers/dri/dri_screen.c
  9. 2
    2
      src/gallium/state_trackers/dri/dri_screen.h
  10. 6
    6
      src/glx/mini/miniglx.c
  11. 1
    1
      src/glx/x11/dri_glx.c
  12. 13
    21
      src/mesa/drivers/dri/common/dri_util.c
  13. 1
    5
      src/mesa/drivers/dri/common/dri_util.h
  14. 2
    2
      src/mesa/drivers/dri/common/drirenderbuffer.c
  15. 4
    4
      src/mesa/drivers/dri/common/drirenderbuffer.h
  16. 10
    10
      src/mesa/drivers/dri/common/vblank.c
  17. 8
    8
      src/mesa/drivers/dri/common/vblank.h
  18. 25
    18
      src/mesa/drivers/dri/fb/fb_dri.c
  19. 3
    3
      src/mesa/drivers/dri/fb/fb_egl.c
  20. 1
    1
      src/mesa/drivers/dri/ffb/ffb_bitmap.c
  21. 2
    2
      src/mesa/drivers/dri/ffb/ffb_clear.c
  22. 2
    2
      src/mesa/drivers/dri/ffb/ffb_context.h
  23. 4
    4
      src/mesa/drivers/dri/ffb/ffb_depth.c
  24. 1
    1
      src/mesa/drivers/dri/ffb/ffb_span.c
  25. 3
    3
      src/mesa/drivers/dri/ffb/ffb_state.c
  26. 4
    4
      src/mesa/drivers/dri/ffb/ffb_stencil.c
  27. 1
    1
      src/mesa/drivers/dri/ffb/ffb_tris.c
  28. 23
    16
      src/mesa/drivers/dri/ffb/ffb_xmesa.c
  29. 1
    1
      src/mesa/drivers/dri/ffb/ffb_xmesa.h
  30. 2
    2
      src/mesa/drivers/dri/gamma/gamma_context.c
  31. 6
    6
      src/mesa/drivers/dri/gamma/gamma_context.h
  32. 2
    2
      src/mesa/drivers/dri/gamma/gamma_lock.c
  33. 3
    3
      src/mesa/drivers/dri/gamma/gamma_macros.h
  34. 2
    2
      src/mesa/drivers/dri/gamma/gamma_screen.c
  35. 1
    1
      src/mesa/drivers/dri/gamma/gamma_screen.h
  36. 4
    4
      src/mesa/drivers/dri/gamma/gamma_span.c
  37. 2
    2
      src/mesa/drivers/dri/gamma/gamma_state.c
  38. 21
    14
      src/mesa/drivers/dri/gamma/gamma_xmesa.c
  39. 12
    12
      src/mesa/drivers/dri/i810/i810context.c
  40. 2
    2
      src/mesa/drivers/dri/i810/i810context.h
  41. 3
    3
      src/mesa/drivers/dri/i810/i810ioctl.c
  42. 2
    2
      src/mesa/drivers/dri/i810/i810ioctl.h
  43. 12
    5
      src/mesa/drivers/dri/i810/i810screen.c
  44. 8
    8
      src/mesa/drivers/dri/i810/i810screen.h
  45. 2
    2
      src/mesa/drivers/dri/i810/i810span.c
  46. 1
    1
      src/mesa/drivers/dri/i810/i810state.c
  47. 2
    2
      src/mesa/drivers/dri/i915/Makefile
  48. 1
    1
      src/mesa/drivers/dri/i915/i830_context.c
  49. 1
    1
      src/mesa/drivers/dri/i915/i830_context.h
  50. 21
    39
      src/mesa/drivers/dri/i915/i830_vtbl.c
  51. 1
    1
      src/mesa/drivers/dri/i915/i915_context.c
  52. 1
    1
      src/mesa/drivers/dri/i915/i915_context.h
  53. 22
    40
      src/mesa/drivers/dri/i915/i915_vtbl.c
  54. 3
    4
      src/mesa/drivers/dri/i915/intel_tris.c
  55. 2
    2
      src/mesa/drivers/dri/i965/Makefile
  56. 1
    1
      src/mesa/drivers/dri/i965/brw_context.c
  57. 1
    1
      src/mesa/drivers/dri/i965/brw_context.h
  58. 1
    1
      src/mesa/drivers/dri/i965/brw_curbe.c
  59. 2
    11
      src/mesa/drivers/dri/i965/brw_draw.c
  60. 4
    4
      src/mesa/drivers/dri/i965/brw_draw_upload.c
  61. 8
    11
      src/mesa/drivers/dri/i965/brw_misc_state.c
  62. 2
    2
      src/mesa/drivers/dri/i965/brw_queryobj.c
  63. 1
    1
      src/mesa/drivers/dri/i965/brw_state.h
  64. 2
    2
      src/mesa/drivers/dri/i965/brw_state_batch.c
  65. 8
    42
      src/mesa/drivers/dri/intel/intel_batchbuffer.c
  66. 4
    53
      src/mesa/drivers/dri/intel/intel_batchbuffer.h
  67. 6
    142
      src/mesa/drivers/dri/intel/intel_blit.c
  68. 1
    1
      src/mesa/drivers/dri/intel/intel_blit.h
  69. 12
    42
      src/mesa/drivers/dri/intel/intel_buffers.c
  70. 38
    292
      src/mesa/drivers/dri/intel/intel_context.c
  71. 5
    40
      src/mesa/drivers/dri/intel/intel_context.h
  72. 3
    3
      src/mesa/drivers/dri/intel/intel_fbo.c
  73. 1
    24
      src/mesa/drivers/dri/intel/intel_fbo.h
  74. 0
    3
      src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
  75. 12
    11
      src/mesa/drivers/dri/intel/intel_pixel_copy.c
  76. 2
    9
      src/mesa/drivers/dri/intel/intel_pixel_read.c
  77. 0
    89
      src/mesa/drivers/dri/intel/intel_regions.c
  78. 37
    437
      src/mesa/drivers/dri/intel/intel_screen.c
  79. 7
    7
      src/mesa/drivers/dri/intel/intel_screen.h
  80. 0
    3
      src/mesa/drivers/dri/intel/intel_span.c
  81. 0
    248
      src/mesa/drivers/dri/intel/intel_swapbuffers.c
  82. 0
    52
      src/mesa/drivers/dri/intel/intel_swapbuffers.h
  83. 1
    6
      src/mesa/drivers/dri/intel/intel_tex_copy.c
  84. 2
    9
      src/mesa/drivers/dri/intel/intel_tex_image.c
  85. 0
    4
      src/mesa/drivers/dri/intel/intel_tex_subimage.c
  86. 7
    7
      src/mesa/drivers/dri/mach64/mach64_context.c
  87. 9
    9
      src/mesa/drivers/dri/mach64/mach64_context.h
  88. 2
    2
      src/mesa/drivers/dri/mach64/mach64_ioctl.c
  89. 1
    1
      src/mesa/drivers/dri/mach64/mach64_ioctl.h
  90. 2
    2
      src/mesa/drivers/dri/mach64/mach64_lock.c
  91. 15
    9
      src/mesa/drivers/dri/mach64/mach64_screen.c
  92. 1
    1
      src/mesa/drivers/dri/mach64/mach64_screen.h
  93. 4
    4
      src/mesa/drivers/dri/mach64/mach64_span.c
  94. 2
    2
      src/mesa/drivers/dri/mach64/mach64_state.c
  95. 23
    16
      src/mesa/drivers/dri/mga/mga_xmesa.c
  96. 1
    1
      src/mesa/drivers/dri/mga/mga_xmesa.h
  97. 3
    3
      src/mesa/drivers/dri/mga/mgacontext.h
  98. 3
    3
      src/mesa/drivers/dri/mga/mgaioctl.c
  99. 1
    1
      src/mesa/drivers/dri/mga/mgaioctl.h
  100. 0
    0
      src/mesa/drivers/dri/mga/mgapixel.c

+ 2
- 0
configs/autoconf.in View File

@@ -22,6 +22,8 @@ LDFLAGS = @LDFLAGS@
EXTRA_LIB_PATH = @EXTRA_LIB_PATH@
RADEON_CFLAGS = @RADEON_CFLAGS@
RADEON_LDFLAGS = @RADEON_LDFLAGS@
INTEL_LIBS = @INTEL_LIBS@
INTEL_CFLAGS = @INTEL_CFLAGS@

# Assembler
MESA_ASM_SOURCES = @MESA_ASM_SOURCES@

+ 21
- 9
configure.ac View File

@@ -447,8 +447,6 @@ AC_SUBST([GALLIUM_WINSYS_DIRS])
AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
AC_SUBST([GALLIUM_DRIVERS_DIRS])
AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
AC_SUBST([RADEON_CFLAGS])
AC_SUBST([RADEON_LDFLAGS])

dnl
dnl User supplied program configuration
@@ -576,13 +574,6 @@ dri)
GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"

PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no)

if test "$HAVE_LIBDRM_RADEON" = yes; then
RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
fi

# find the DRI deps for libGL
if test "$x11_pkgconfig" = yes; then
# add xcb modules if necessary
@@ -802,6 +793,27 @@ AC_SUBST([DRI_DIRS])
AC_SUBST([EXPAT_INCLUDES])
AC_SUBST([DRI_LIB_DEPS])

case $DRI_DIRS in
*i915*|*i965*)
PKG_CHECK_MODULES([INTEL], [libdrm_intel])
;;

*radeon*|*r200*|*r300*|*r600*)
PKG_CHECK_MODULES([LIBDRM_RADEON],
[libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
HAVE_LIBDRM_RADEON=yes,
HAVE_LIBDRM_RADEON=no)

if test "$HAVE_LIBDRM_RADEON" = yes; then
RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
fi
;;
esac
AC_SUBST([RADEON_CFLAGS])
AC_SUBST([RADEON_LDFLAGS])


dnl
dnl OSMesa configuration
dnl

+ 13
- 13
src/egl/drivers/dri/egldri.c View File

@@ -675,13 +675,13 @@ __eglCreateContextWithConfig(__DRInativeDisplay* ndpy, int screen,
drm_context_t * hHWContext)
{
__DRIscreen *pDRIScreen;
__DRIscreenPrivate *psp;
__DRIscreen *psp;

pDRIScreen = __eglFindDRIScreen(ndpy, screen);
if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
return GL_FALSE;
}
psp = (__DRIscreenPrivate *) pDRIScreen->private;
psp = (__DRIscreen *) pDRIScreen->private;
if (psp->fd) {
if (drmCreateContext(psp->fd, hHWContext)) {
_eglLog(_EGL_WARNING, "drmCreateContext failed.");
@@ -691,14 +691,14 @@ __eglCreateContextWithConfig(__DRInativeDisplay* ndpy, int screen,
}
#if 0
__DRIscreen *pDRIScreen;
__DRIscreenPrivate *psp;
__DRIscreen *psp;

pDRIScreen = __glXFindDRIScreen(dpy, screen);
if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
return GL_FALSE;
}

psp = (__DRIscreenPrivate *) pDRIScreen->private;
psp = (__DRIscreen *) pDRIScreen->private;

if (psp->fd) {
if (drmCreateContext(psp->fd, hHWContext)) {
@@ -716,13 +716,13 @@ static GLboolean
__eglDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context )
{
__DRIscreen *pDRIScreen;
__DRIscreenPrivate *psp;
__DRIscreen *psp;

pDRIScreen = __eglFindDRIScreen(ndpy, screen);
if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
return GL_FALSE;
}
psp = (__DRIscreenPrivate *) pDRIScreen->private;
psp = (__DRIscreen *) pDRIScreen->private;
if (psp->fd)
drmDestroyContext(psp->fd, context);

@@ -735,13 +735,13 @@ __eglCreateDrawable(__DRInativeDisplay * ndpy, int screen,
__DRIid drawable, drm_drawable_t * hHWDrawable)
{
__DRIscreen *pDRIScreen;
__DRIscreenPrivate *psp;
__DRIscreen *psp;

pDRIScreen = __eglFindDRIScreen(ndpy, screen);
if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
return GL_FALSE;
}
psp = (__DRIscreenPrivate *) pDRIScreen->private;
psp = (__DRIscreen *) pDRIScreen->private;
if (psp->fd) {
if (drmCreateDrawable(psp->fd, hHWDrawable)) {
_eglLog(_EGL_WARNING, "drmCreateDrawable failed.");
@@ -756,13 +756,13 @@ static GLboolean
__eglDestroyDrawable( __DRInativeDisplay * ndpy, int screen, __DRIid drawable )
{
__DRIscreen *pDRIScreen;
__DRIscreenPrivate *psp;
__DRIscreen *psp;

pDRIScreen = __eglFindDRIScreen(ndpy, screen);
if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
return GL_FALSE;
}
psp = (__DRIscreenPrivate *) pDRIScreen->private;
psp = (__DRIscreen *) pDRIScreen->private;
if (psp->fd)
drmDestroyDrawable(psp->fd, drawable);

@@ -778,7 +778,7 @@ __eglGetDrawableInfo(__DRInativeDisplay * ndpy, int screen, __DRIid drawable,
int* numBackClipRects, drm_clip_rect_t ** pBackClipRects )
{
__DRIscreen *pDRIScreen;
__DRIscreenPrivate *psp;
__DRIscreen *psp;
driSurface *surf = Lookup_driSurface((EGLSurface) drawable);

pDRIScreen = __eglFindDRIScreen(ndpy, screen);
@@ -786,7 +786,7 @@ __eglGetDrawableInfo(__DRInativeDisplay * ndpy, int screen, __DRIid drawable,
if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
return GL_FALSE;
}
psp = (__DRIscreenPrivate *) pDRIScreen->private;
psp = (__DRIscreen *) pDRIScreen->private;
*X = 0;
*Y = 0;
*W = surf->Base.Width;
@@ -807,7 +807,7 @@ __eglGetDrawableInfo(__DRInativeDisplay * ndpy, int screen, __DRIid drawable,
GLXDrawable drawable = (GLXDrawable) draw;
drm_clip_rect_t * cliprect;
Display* display = (Display*)dpy;
__DRIcontextPrivate *pcp = (__DRIcontextPrivate *)CurrentContext->driContext.private;
__DRIcontext *pcp = (__DRIcontext *)CurrentContext->driContext.private;
if (drawable == 0) {
return GL_FALSE;
}

+ 7
- 7
src/gallium/state_trackers/dri/dri_context.c View File

@@ -44,9 +44,9 @@

GLboolean
dri_create_context(const __GLcontextModes * visual,
__DRIcontextPrivate * cPriv, void *sharedContextPrivate)
__DRIcontext * cPriv, void *sharedContextPrivate)
{
__DRIscreenPrivate *sPriv = cPriv->driScreenPriv;
__DRIscreen *sPriv = cPriv->driScreenPriv;
struct dri_screen *screen = dri_screen(sPriv);
struct dri_context *ctx = NULL;
struct st_context *st_share = NULL;
@@ -97,7 +97,7 @@ dri_create_context(const __GLcontextModes * visual,
}

void
dri_destroy_context(__DRIcontextPrivate * cPriv)
dri_destroy_context(__DRIcontext * cPriv)
{
struct dri_context *ctx = dri_context(cPriv);

@@ -116,7 +116,7 @@ dri_destroy_context(__DRIcontextPrivate * cPriv)
}

GLboolean
dri_unbind_context(__DRIcontextPrivate * cPriv)
dri_unbind_context(__DRIcontext * cPriv)
{
if (cPriv) {
struct dri_context *ctx = dri_context(cPriv);
@@ -133,9 +133,9 @@ dri_unbind_context(__DRIcontextPrivate * cPriv)
}

GLboolean
dri_make_current(__DRIcontextPrivate * cPriv,
__DRIdrawablePrivate * driDrawPriv,
__DRIdrawablePrivate * driReadPriv)
dri_make_current(__DRIcontext * cPriv,
__DRIdrawable * driDrawPriv,
__DRIdrawable * driReadPriv)
{
if (cPriv) {
struct dri_context *ctx = dri_context(cPriv);

+ 11
- 11
src/gallium/state_trackers/dri/dri_context.h View File

@@ -44,10 +44,10 @@ struct dri_drawable;
struct dri_context
{
/* dri */
__DRIscreenPrivate *sPriv;
__DRIcontextPrivate *cPriv;
__DRIdrawablePrivate *dPriv;
__DRIdrawablePrivate *rPriv;
__DRIscreen *sPriv;
__DRIcontext *cPriv;
__DRIdrawable *dPriv;
__DRIdrawable *rPriv;

driOptionCache optionCache;

@@ -67,7 +67,7 @@ struct dri_context
};

static INLINE struct dri_context *
dri_context(__DRIcontextPrivate * driContextPriv)
dri_context(__DRIcontext * driContextPriv)
{
return (struct dri_context *)driContextPriv->driverPrivate;
}
@@ -99,18 +99,18 @@ dri_unlock(struct dri_context *ctx)
*/
extern struct dri1_api_lock_funcs dri1_lf;

void dri_destroy_context(__DRIcontextPrivate * driContextPriv);
void dri_destroy_context(__DRIcontext * driContextPriv);

boolean dri_unbind_context(__DRIcontextPrivate * driContextPriv);
boolean dri_unbind_context(__DRIcontext * driContextPriv);

boolean
dri_make_current(__DRIcontextPrivate * driContextPriv,
__DRIdrawablePrivate * driDrawPriv,
__DRIdrawablePrivate * driReadPriv);
dri_make_current(__DRIcontext * driContextPriv,
__DRIdrawable * driDrawPriv,
__DRIdrawable * driReadPriv);

boolean
dri_create_context(const __GLcontextModes * visual,
__DRIcontextPrivate * driContextPriv,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);

/***********************************************************************

+ 12
- 12
src/gallium/state_trackers/dri/dri_drawable.c View File

@@ -118,7 +118,7 @@ dri2_check_if_pixmap(__DRIbuffer *buffers, int count)
* This will be called a drawable is known to have been resized.
*/
void
dri_get_buffers(__DRIdrawablePrivate * dPriv)
dri_get_buffers(__DRIdrawable * dPriv)
{

struct dri_drawable *drawable = dri_drawable(dPriv);
@@ -299,8 +299,8 @@ dri_flush_frontbuffer(struct pipe_screen *screen,
* This is called when we need to set up GL rendering to a new X window.
*/
boolean
dri_create_buffer(__DRIscreenPrivate * sPriv,
__DRIdrawablePrivate * dPriv,
dri_create_buffer(__DRIscreen * sPriv,
__DRIdrawable * dPriv,
const __GLcontextModes * visual, boolean isPixmap)
{
struct dri_screen *screen = sPriv->private;
@@ -416,7 +416,7 @@ dri_swap_fences_push_back(struct dri_drawable *draw,
}

void
dri_destroy_buffer(__DRIdrawablePrivate * dPriv)
dri_destroy_buffer(__DRIdrawable * dPriv)
{
struct dri_drawable *drawable = dri_drawable(dPriv);
struct pipe_fence_handle *fence;
@@ -434,8 +434,8 @@ dri_destroy_buffer(__DRIdrawablePrivate * dPriv)

static void
dri1_update_drawables_locked(struct dri_context *ctx,
__DRIdrawablePrivate * driDrawPriv,
__DRIdrawablePrivate * driReadPriv)
__DRIdrawable * driDrawPriv,
__DRIdrawable * driReadPriv)
{
if (ctx->stLostLock) {
ctx->stLostLock = FALSE;
@@ -458,8 +458,8 @@ dri1_update_drawables_locked(struct dri_context *ctx,
static void
dri1_propagate_drawable_change(struct dri_context *ctx)
{
__DRIdrawablePrivate *dPriv = ctx->dPriv;
__DRIdrawablePrivate *rPriv = ctx->rPriv;
__DRIdrawable *dPriv = ctx->dPriv;
__DRIdrawable *rPriv = ctx->rPriv;
boolean flushed = FALSE;

if (dPriv && ctx->d_stamp != dPriv->lastStamp) {
@@ -532,7 +532,7 @@ static void
dri1_swap_copy(struct dri_context *ctx,
struct pipe_surface *dst,
struct pipe_surface *src,
__DRIdrawablePrivate * dPriv, const struct drm_clip_rect *bbox)
__DRIdrawable * dPriv, const struct drm_clip_rect *bbox)
{
struct pipe_context *pipe = ctx->pipe;
struct drm_clip_rect clip;
@@ -563,7 +563,7 @@ dri1_swap_copy(struct dri_context *ctx,
static void
dri1_copy_to_front(struct dri_context *ctx,
struct pipe_surface *surf,
__DRIdrawablePrivate * dPriv,
__DRIdrawable * dPriv,
const struct drm_clip_rect *sub_box,
struct pipe_fence_handle **fence)
{
@@ -636,7 +636,7 @@ dri1_flush_frontbuffer(struct pipe_screen *screen,
}

void
dri_swap_buffers(__DRIdrawablePrivate * dPriv)
dri_swap_buffers(__DRIdrawable * dPriv)
{
struct dri_context *ctx;
struct pipe_surface *back_surf;
@@ -668,7 +668,7 @@ dri_swap_buffers(__DRIdrawablePrivate * dPriv)
}

void
dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
dri_copy_sub_buffer(__DRIdrawable * dPriv, int x, int y, int w, int h)
{
struct pipe_screen *screen = dri_screen(dPriv->driScreenPriv)->pipe_screen;
struct drm_clip_rect sub_bbox;

+ 9
- 9
src/gallium/state_trackers/dri/dri_drawable.h View File

@@ -41,8 +41,8 @@ struct dri_context;
struct dri_drawable
{
/* dri */
__DRIdrawablePrivate *dPriv;
__DRIscreenPrivate *sPriv;
__DRIdrawable *dPriv;
__DRIscreen *sPriv;

unsigned attachments[8];
unsigned num_attachments;
@@ -67,7 +67,7 @@ struct dri_drawable
};

static INLINE struct dri_drawable *
dri_drawable(__DRIdrawablePrivate * driDrawPriv)
dri_drawable(__DRIdrawable * driDrawPriv)
{
return (struct dri_drawable *)driDrawPriv->driverPrivate;
}
@@ -76,22 +76,22 @@ dri_drawable(__DRIdrawablePrivate * driDrawPriv)
* dri_drawable.c
*/
boolean
dri_create_buffer(__DRIscreenPrivate * sPriv,
__DRIdrawablePrivate * dPriv,
dri_create_buffer(__DRIscreen * sPriv,
__DRIdrawable * dPriv,
const __GLcontextModes * visual, boolean isPixmap);

void
dri_flush_frontbuffer(struct pipe_screen *screen,
struct pipe_surface *surf, void *context_private);

void dri_swap_buffers(__DRIdrawablePrivate * dPriv);
void dri_swap_buffers(__DRIdrawable * dPriv);

void
dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h);
dri_copy_sub_buffer(__DRIdrawable * dPriv, int x, int y, int w, int h);

void dri_get_buffers(__DRIdrawablePrivate * dPriv);
void dri_get_buffers(__DRIdrawable * dPriv);

void dri_destroy_buffer(__DRIdrawablePrivate * dPriv);
void dri_destroy_buffer(__DRIdrawable * dPriv);

void dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
GLint glx_texture_format, __DRIdrawable *dPriv);

+ 12
- 4
src/gallium/state_trackers/dri/dri_screen.c View File

@@ -202,7 +202,7 @@ dri_fill_in_modes(struct dri_screen *screen,
* Get information about previous buffer swaps.
*/
static int
dri_get_swap_info(__DRIdrawablePrivate * dPriv, __DRIswapInfo * sInfo)
dri_get_swap_info(__DRIdrawable * dPriv, __DRIswapInfo * sInfo)
{
if (dPriv == NULL || dPriv->driverPrivate == NULL || sInfo == NULL)
return -1;
@@ -220,7 +220,7 @@ dri_copy_version(struct dri1_api_version *dst,
}

static const __DRIconfig **
dri_init_screen(__DRIscreenPrivate * sPriv)
dri_init_screen(__DRIscreen * sPriv)
{
struct dri_screen *screen;
const __DRIconfig **configs;
@@ -285,7 +285,7 @@ dri_init_screen(__DRIscreenPrivate * sPriv)
* Returns the __GLcontextModes supported by this driver.
*/
static const __DRIconfig **
dri_init_screen2(__DRIscreenPrivate * sPriv)
dri_init_screen2(__DRIscreen * sPriv)
{
struct dri_screen *screen;
struct drm_create_screen_arg arg;
@@ -319,7 +319,7 @@ dri_init_screen2(__DRIscreenPrivate * sPriv)
}

static void
dri_destroy_screen(__DRIscreenPrivate * sPriv)
dri_destroy_screen(__DRIscreen * sPriv)
{
struct dri_screen *screen = dri_screen(sPriv);

@@ -346,4 +346,12 @@ PUBLIC const struct __DriverAPIRec driDriverAPI = {
.InitScreen2 = dri_init_screen2,
};

/* This is the table of extensions that the loader will dlsym() for. */
PUBLIC const __DRIextension *__driDriverExtensions[] = {
&driCoreExtension.base,
&driLegacyExtension.base,
&driDRI2Extension.base,
NULL
};

/* vim: set sw=3 ts=8 sts=3 expandtab: */

+ 2
- 2
src/gallium/state_trackers/dri/dri_screen.h View File

@@ -42,7 +42,7 @@
struct dri_screen
{
/* dri */
__DRIscreenPrivate *sPriv;
__DRIscreen *sPriv;

/**
* Configuration cache with default values for all contexts
@@ -63,7 +63,7 @@ struct dri_screen

/** cast wrapper */
static INLINE struct dri_screen *
dri_screen(__DRIscreenPrivate * sPriv)
dri_screen(__DRIscreen * sPriv)
{
return (struct dri_screen *)sPriv->private;
}

+ 6
- 6
src/glx/mini/miniglx.c View File

@@ -2278,14 +2278,14 @@ __glXCreateContextWithConfig(__DRInativeDisplay *dpy, int screen,
int fbconfigID, void *contextID, drm_context_t *hHWContext)
{
__DRIscreen *pDRIScreen;
__DRIscreenPrivate *psp;
__DRIscreen *psp;

pDRIScreen = __glXFindDRIScreen(dpy, screen);
if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
return GL_FALSE;
}

psp = (__DRIscreenPrivate *) pDRIScreen->private;
psp = (__DRIscreen *) pDRIScreen->private;

if (psp->fd) {
if (drmCreateContext(psp->fd, hHWContext)) {
@@ -2310,9 +2310,9 @@ __glXGetDrawableInfo(__DRInativeDisplay *dpy, int scrn,
GLXDrawable drawable = (GLXDrawable) draw;
drm_clip_rect_t * cliprect;
Display* display = (Display*)dpy;
__DRIscreenPrivate *psp = display->driScreen.private;
__DRIcontextPrivate *pcp = (__DRIcontextPrivate *)CurrentContext->driContext.private;
__DRIdrawablePrivate *pdp = pcp->driDrawablePriv;
__DRIscreen *psp = display->driScreen.private;
__DRIcontext *pcp = (__DRIcontext *)CurrentContext->driContext.private;
__DRIdrawable *pdp = pcp->driDrawablePriv;
if (drawable == 0) {
return GL_FALSE;
}
@@ -2357,7 +2357,7 @@ xf86DRI_CreateDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable,
{

Display *display = (Display *)dpy;
__DRIscreenPrivate *psp = display->driScreen.private;
__DRIscreen *psp = display->driScreen.private;
int ret;
ret = drmCreateDrawable(psp->fd, hHWDrawable);

+ 1
- 1
src/glx/x11/dri_glx.c View File

@@ -290,7 +290,7 @@ static const __DRIextension *loader_extensions[] = {
* \param driDpy DRI display information.
* \param createNewScreen Pointer to the client-side driver's
* \c __driCreateNewScreen function.
* \returns A pointer to the \c __DRIscreenPrivate structure returned by
* \returns A pointer to the \c __DRIscreen structure returned by
* the client-side driver on success, or \c NULL on failure.
*/
static void *

+ 13
- 21
src/mesa/drivers/dri/common/dri_util.c View File

@@ -97,7 +97,7 @@ driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 )
*
* \internal
* This function calls __DriverAPIRec::UnbindContext, and then decrements
* __DRIdrawablePrivateRec::refcount which must be non-zero for a successful
* __DRIdrawableRec::refcount which must be non-zero for a successful
* return.
*
* While casting the opaque private pointers associated with the parameters
@@ -167,7 +167,7 @@ static int driBindContext(__DRIcontext *pcp,
__DRIdrawable *pdp,
__DRIdrawable *prp)
{
__DRIscreenPrivate *psp = NULL;
__DRIscreen *psp = NULL;

/* Bind the drawable to the context */

@@ -220,7 +220,7 @@ static int driBindContext(__DRIcontext *pcp,
*
* \param pdp pointer to the private drawable information to update.
*
* This function basically updates the __DRIdrawablePrivate struct's
* This function basically updates the __DRIdrawable struct's
* cliprect information by calling \c __DRIinterfaceMethods::getDrawableInfo.
* This is usually called by the DRI_VALIDATE_DRAWABLE_INFO macro which
* compares the __DRIdrwablePrivate pStamp and lastStamp values. If
@@ -228,10 +228,10 @@ static int driBindContext(__DRIcontext *pcp,
* info.
*/
void
__driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
__driUtilUpdateDrawableInfo(__DRIdrawable *pdp)
{
__DRIscreenPrivate *psp = pdp->driScreenPriv;
__DRIcontextPrivate *pcp = pdp->driContextPriv;
__DRIscreen *psp = pdp->driScreenPriv;
__DRIcontext *pcp = pdp->driContextPriv;
if (!pcp
|| ((pdp != pcp->driDrawablePriv) && (pdp != pcp->driReadablePriv))) {
@@ -309,7 +309,7 @@ static void driReportDamage(__DRIdrawable *pdp,
* \param drawablePrivate opaque pointer to the per-drawable private info.
*
* \internal
* This function calls __DRIdrawablePrivate::swapBuffers.
* This function calls __DRIdrawable::swapBuffers.
*
* Is called directly from glXSwapBuffers().
*/
@@ -497,7 +497,7 @@ static void dri_get_drawable(__DRIdrawable *pdp)
static void dri_put_drawable(__DRIdrawable *pdp)
{
__DRIscreenPrivate *psp;
__DRIscreen *psp;

if (pdp) {
pdp->refcount--;
@@ -560,7 +560,7 @@ driDestroyContext(__DRIcontext *pcp)
* success, or \c NULL on failure.
*
* \internal
* This function allocates and fills a __DRIcontextPrivateRec structure. It
* This function allocates and fills a __DRIcontextRec structure. It
* performs some device independent initialization and passes all the
* relevent information to __DriverAPIRec::CreateContext to create the
* context.
@@ -841,7 +841,7 @@ const __DRIlegacyExtension driLegacyExtension = {
driCreateNewContext,
};

/** Legacy DRI interface */
/** DRI2 interface */
const __DRIdri2Extension driDRI2Extension = {
{ __DRI_DRI2, __DRI_DRI2_VERSION },
dri2CreateNewScreen,
@@ -849,14 +849,6 @@ const __DRIdri2Extension driDRI2Extension = {
dri2CreateNewContext,
};

/* This is the table of extensions that the loader will dlsym() for. */
PUBLIC const __DRIextension *__driDriverExtensions[] = {
&driCoreExtension.base,
&driLegacyExtension.base,
&driDRI2Extension.base,
NULL
};

static int
driFrameTracking(__DRIdrawable *drawable, GLboolean enable)
{
@@ -871,7 +863,7 @@ driQueryFrameTracking(__DRIdrawable *dpriv,
__DRIswapInfo sInfo;
int status;
int64_t ust;
__DRIscreenPrivate *psp = dpriv->driScreenPriv;
__DRIscreen *psp = dpriv->driScreenPriv;

status = dpriv->driScreenPriv->DriverAPI.GetSwapInfo( dpriv, & sInfo );
if ( status == 0 ) {
@@ -921,14 +913,14 @@ const __DRIframeTrackingExtension driFrameTrackingExtension = {
* be possible to cache the sync rate?
*/
float
driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust,
driCalculateSwapUsage( __DRIdrawable *dPriv, int64_t last_swap_ust,
int64_t current_ust )
{
int32_t n;
int32_t d;
int interval;
float usage = 1.0;
__DRIscreenPrivate *psp = dPriv->driScreenPriv;
__DRIscreen *psp = dPriv->driScreenPriv;

if ( (*psp->systemTime->getMSCRate)(dPriv, &n, &d, dPriv->loaderPrivate) ) {
interval = (dPriv->swap_interval != 0) ? dPriv->swap_interval : 1;

+ 1
- 5
src/mesa/drivers/dri/common/dri_util.h View File

@@ -59,16 +59,12 @@

typedef struct __DRIswapInfoRec __DRIswapInfo;

/* Typedefs to avoid rewriting the world. */
typedef struct __DRIscreenRec __DRIscreenPrivate;
typedef struct __DRIdrawableRec __DRIdrawablePrivate;
typedef struct __DRIcontextRec __DRIcontextPrivate;

/**
* Extensions.
*/
extern const __DRIlegacyExtension driLegacyExtension;
extern const __DRIcoreExtension driCoreExtension;
extern const __DRIdri2Extension driDRI2Extension;
extern const __DRIextension driReadDrawableExtension;
extern const __DRIcopySubBufferExtension driCopySubBufferExtension;
extern const __DRIswapControlExtension driSwapControlExtension;

+ 2
- 2
src/mesa/drivers/dri/common/drirenderbuffer.c View File

@@ -56,7 +56,7 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb)
driRenderbuffer *
driNewRenderbuffer(gl_format format, GLvoid *addr,
GLint cpp, GLint offset, GLint pitch,
__DRIdrawablePrivate *dPriv)
__DRIdrawable *dPriv)
{
driRenderbuffer *drb;

@@ -196,7 +196,7 @@ driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped)
* gl_framebuffer object.
*/
void
driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv)
driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawable *dPriv)
{
struct gl_framebuffer *fb = (struct gl_framebuffer *) dPriv->driverPrivate;
if (fb && (dPriv->w != fb->Width || dPriv->h != fb->Height)) {

+ 4
- 4
src/mesa/drivers/dri/common/drirenderbuffer.h View File

@@ -43,10 +43,10 @@ typedef struct {
GLint flippedPitch;
GLvoid *flippedData; /* mmap'd address of buffer memory, if used */

/* Pointer to corresponding __DRIdrawablePrivate. This is used to compute
/* Pointer to corresponding __DRIdrawable. This is used to compute
* the window's position within the framebuffer.
*/
__DRIdrawablePrivate *dPriv;
__DRIdrawable *dPriv;

/* XXX this is for radeon/r200 only. We should really create a new
* r200Renderbuffer class, derived from this class... not a huge deal.
@@ -66,14 +66,14 @@ typedef struct {
extern driRenderbuffer *
driNewRenderbuffer(gl_format format, GLvoid *addr,
GLint cpp, GLint offset, GLint pitch,
__DRIdrawablePrivate *dPriv);
__DRIdrawable *dPriv);

extern void
driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped);


extern void
driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv);
driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawable *dPriv);


#endif /* DRIRENDERBUFFER_H */

+ 10
- 10
src/mesa/drivers/dri/common/vblank.c View File

@@ -34,12 +34,12 @@
#include "vblank.h"
#include "xmlpool.h"

static unsigned int msc_to_vblank(__DRIdrawablePrivate * dPriv, int64_t msc)
static unsigned int msc_to_vblank(__DRIdrawable * dPriv, int64_t msc)
{
return (unsigned int)(msc - dPriv->msc_base + dPriv->vblank_base);
}

static int64_t vblank_to_msc(__DRIdrawablePrivate * dPriv, unsigned int vblank)
static int64_t vblank_to_msc(__DRIdrawable * dPriv, unsigned int vblank)
{
return (int64_t)(vblank - dPriv->vblank_base + dPriv->msc_base);
}
@@ -64,8 +64,8 @@ static int64_t vblank_to_msc(__DRIdrawablePrivate * dPriv, unsigned int vblank)
* \return Zero is returned on success. A negative errno value
* is returned on failure.
*/
int driDrawableGetMSC32( __DRIscreenPrivate * priv,
__DRIdrawablePrivate * dPriv,
int driDrawableGetMSC32( __DRIscreen * priv,
__DRIdrawable * dPriv,
int64_t * count)
{
drmVBlank vbl;
@@ -122,7 +122,7 @@ int driDrawableGetMSC32( __DRIscreenPrivate * priv,
* \return Zero on success or \c GLX_BAD_CONTEXT on failure.
*/

int driWaitForMSC32( __DRIdrawablePrivate *priv,
int driWaitForMSC32( __DRIdrawable *priv,
int64_t target_msc, int64_t divisor, int64_t remainder,
int64_t * msc )
{
@@ -278,7 +278,7 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd )
*/

static unsigned
driGetDefaultVBlankInterval( const __DRIdrawablePrivate *priv )
driGetDefaultVBlankInterval( const __DRIdrawable *priv )
{
if ( (priv->vblFlags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) {
return 1;
@@ -295,7 +295,7 @@ driGetDefaultVBlankInterval( const __DRIdrawablePrivate *priv )
* direct rendering context.
*/

void driDrawableInitVBlank( __DRIdrawablePrivate *priv )
void driDrawableInitVBlank( __DRIdrawable *priv )
{
if ( priv->swap_interval == (unsigned)-1 &&
!( priv->vblFlags & VBLANK_FLAG_NO_IRQ ) ) {
@@ -320,7 +320,7 @@ void driDrawableInitVBlank( __DRIdrawablePrivate *priv )
*/

unsigned
driGetVBlankInterval( const __DRIdrawablePrivate *priv )
driGetVBlankInterval( const __DRIdrawable *priv )
{
if ( (priv->vblFlags & VBLANK_FLAG_INTERVAL) != 0 ) {
/* this must have been initialized when the drawable was first bound
@@ -340,7 +340,7 @@ driGetVBlankInterval( const __DRIdrawablePrivate *priv )
*/

void
driGetCurrentVBlank( __DRIdrawablePrivate *priv )
driGetCurrentVBlank( __DRIdrawable *priv )
{
drmVBlank vbl;

@@ -366,7 +366,7 @@ driGetCurrentVBlank( __DRIdrawablePrivate *priv )
*/

int
driWaitForVBlank( __DRIdrawablePrivate *priv, GLboolean * missed_deadline )
driWaitForVBlank( __DRIdrawable *priv, GLboolean * missed_deadline )
{
drmVBlank vbl;
unsigned original_seq;

+ 8
- 8
src/mesa/drivers/dri/common/vblank.h View File

@@ -44,17 +44,17 @@
#define VBLANK_FLAG_SECONDARY (1U << 8) /* Wait for secondary vblank.
*/

extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count );
extern int driDrawableGetMSC32( __DRIscreenPrivate * priv,
__DRIdrawablePrivate * drawablePrivate,
extern int driGetMSC32( __DRIscreen * priv, int64_t * count );
extern int driDrawableGetMSC32( __DRIscreen * priv,
__DRIdrawable * drawablePrivate,
int64_t * count);
extern int driWaitForMSC32( __DRIdrawablePrivate *priv,
extern int driWaitForMSC32( __DRIdrawable *priv,
int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc );
extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache );
extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv );
extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv );
extern void driGetCurrentVBlank( __DRIdrawablePrivate *priv );
extern int driWaitForVBlank( __DRIdrawablePrivate *priv,
extern void driDrawableInitVBlank ( __DRIdrawable *priv );
extern unsigned driGetVBlankInterval( const __DRIdrawable *priv );
extern void driGetCurrentVBlank( __DRIdrawable *priv );
extern int driWaitForVBlank( __DRIdrawable *priv,
GLboolean * missed_deadline );

#undef usleep

+ 25
- 18
src/mesa/drivers/dri/fb/fb_dri.c View File

@@ -64,9 +64,9 @@ typedef struct {
GLcontext *glCtx; /* Mesa context */

struct {
__DRIcontextPrivate *context;
__DRIscreenPrivate *screen;
__DRIdrawablePrivate *drawable; /* drawable bound to this ctx */
__DRIcontext *context;
__DRIscreen *screen;
__DRIdrawable *drawable; /* drawable bound to this ctx */
} dri;
} fbContext, *fbContextPtr;
@@ -313,14 +313,14 @@ fbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
/* Initialize the driver specific screen private data.
*/
static GLboolean
fbInitDriver( __DRIscreenPrivate *sPriv )
fbInitDriver( __DRIscreen *sPriv )
{
sPriv->private = NULL;
return GL_TRUE;
}

static void
fbDestroyScreen( __DRIscreenPrivate *sPriv )
fbDestroyScreen( __DRIscreen *sPriv )
{
}

@@ -329,7 +329,7 @@ fbDestroyScreen( __DRIscreenPrivate *sPriv )
*/
static GLboolean
fbCreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{
fbContextPtr fbmesa;
@@ -384,7 +384,7 @@ fbCreateContext( const __GLcontextModes *glVisual,


static void
fbDestroyContext( __DRIcontextPrivate *driContextPriv )
fbDestroyContext( __DRIcontext *driContextPriv )
{
GET_CURRENT_CONTEXT(ctx);
fbContextPtr fbmesa = (fbContextPtr) driContextPriv->driverPrivate;
@@ -415,8 +415,8 @@ fbDestroyContext( __DRIcontextPrivate *driContextPriv )
* data.
*/
static GLboolean
fbCreateBuffer( __DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
fbCreateBuffer( __DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
{
@@ -478,7 +478,7 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv,


static void
fbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
fbDestroyBuffer(__DRIdrawable *driDrawPriv)
{
_mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
@@ -488,7 +488,7 @@ fbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
/* If the backbuffer is on a videocard, this is extraordinarily slow!
*/
static void
fbSwapBuffers( __DRIdrawablePrivate *dPriv )
fbSwapBuffers( __DRIdrawable *dPriv )
{
struct gl_framebuffer *mesa_framebuffer = (struct gl_framebuffer *)dPriv->driverPrivate;
struct gl_renderbuffer * front_renderbuffer = mesa_framebuffer->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
@@ -532,9 +532,9 @@ fbSwapBuffers( __DRIdrawablePrivate *dPriv )
* buffer `b'.
*/
static GLboolean
fbMakeCurrent( __DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv )
fbMakeCurrent( __DRIcontext *driContextPriv,
__DRIdrawable *driDrawPriv,
__DRIdrawable *driReadPriv )
{
if ( driContextPriv ) {
fbContextPtr newFbCtx =
@@ -556,7 +556,7 @@ fbMakeCurrent( __DRIcontextPrivate *driContextPriv,
/* Force the context `c' to be unbound from its buffer.
*/
static GLboolean
fbUnbindContext( __DRIcontextPrivate *driContextPriv )
fbUnbindContext( __DRIcontext *driContextPriv )
{
return GL_TRUE;
}
@@ -657,7 +657,7 @@ struct DRIDriverRec __driDriver = {
};

static __GLcontextModes *
fbFillInModes( __DRIscreenPrivate *psp,
fbFillInModes( __DRIscreen *psp,
unsigned pixel_bits, unsigned depth_bits,
unsigned stencil_bits, GLboolean have_back_buffer )
{
@@ -745,7 +745,7 @@ fbFillInModes( __DRIscreenPrivate *psp,
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
*
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
* \return A pointer to a \c __DRIscreen on success, or \c NULL on
* failure.
*/
PUBLIC
@@ -759,7 +759,7 @@ void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc
int internal_api_version,
__GLcontextModes ** driver_modes )
{
__DRIscreenPrivate *psp;
__DRIscreen *psp;
static const __DRIversion ddx_expected = { 4, 0, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 1, 5, 0 };
@@ -785,3 +785,10 @@ void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc

return (void *) psp;
}

/* This is the table of extensions that the loader will dlsym() for. */
PUBLIC const __DRIextension *__driDriverExtensions[] = {
&driCoreExtension.base,
&driLegacyExtension.base,
NULL
};

+ 3
- 3
src/mesa/drivers/dri/fb/fb_egl.c View File

@@ -84,9 +84,9 @@ typedef struct fb_context
_EGLContext Base; /* base class/object */
GLcontext *glCtx;
struct {
__DRIcontextPrivate *context;
__DRIscreenPrivate *screen;
__DRIdrawablePrivate *drawable; /* drawable bound to this ctx */
__DRIcontext *context;
__DRIscreen *screen;
__DRIdrawable *drawable; /* drawable bound to this ctx */
} dri;
} fbContext, *fbContextPtr;


+ 1
- 1
src/mesa/drivers/dri/ffb/ffb_bitmap.c View File

@@ -46,7 +46,7 @@ ffb_bitmap(GLcontext *ctx, GLint px, GLint py,
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
ffb_fbcPtr ffb = fmesa->regs;
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIdrawable *dPriv = fmesa->driDrawable;
unsigned int ppc, pixel;
GLint row, col, row_stride;
const GLubyte *src;

+ 2
- 2
src/mesa/drivers/dri/ffb/ffb_clear.c View File

@@ -123,7 +123,7 @@ CreatorComputePageFillFixups(struct ff_fixups *fixups,
}

static void
ffb_do_clear(GLcontext *ctx, __DRIdrawablePrivate *dPriv)
ffb_do_clear(GLcontext *ctx, __DRIdrawable *dPriv)
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
FFBDRIPtr gDRIPriv = (FFBDRIPtr) fmesa->driScreen->pDevPriv;
@@ -252,7 +252,7 @@ ffb_do_clear(GLcontext *ctx, __DRIdrawablePrivate *dPriv)
void ffbDDClear(GLcontext *ctx, GLbitfield mask)
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIdrawable *dPriv = fmesa->driDrawable;
unsigned int stcmask = BUFFER_BIT_STENCIL;

#ifdef CLEAR_TRACE

+ 2
- 2
src/mesa/drivers/dri/ffb/ffb_context.h View File

@@ -273,8 +273,8 @@ do { if ((STATE_MASK) & ~((FMESA)->state_dirty)) { \
unsigned int setupnewinputs;
unsigned int new_gl_state;

__DRIdrawablePrivate *driDrawable;
__DRIscreenPrivate *driScreen;
__DRIdrawable *driDrawable;
__DRIscreen *driScreen;
ffbScreenPrivate *ffbScreen;
ffb_dri_state_t *ffb_sarea;
} ffbContextRec, *ffbContextPtr;

+ 4
- 4
src/mesa/drivers/dri/ffb/ffb_depth.c View File

@@ -49,7 +49,7 @@ static void FFBWriteDepthSpan( GLcontext *ctx,
#endif
if (ctx->Depth.Mask) {
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIdrawable *dPriv = fmesa->driDrawable;
GLuint *zptr;
GLuint i;

@@ -110,7 +110,7 @@ static void FFBWriteDepthPixels( GLcontext *ctx,
#endif
if (ctx->Depth.Mask) {
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIdrawable *dPriv = fmesa->driDrawable;
char *zbase;
GLuint i;

@@ -153,7 +153,7 @@ static void FFBReadDepthSpan( GLcontext *ctx,
{
GLuint *depth = (GLuint *) values;
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIdrawable *dPriv = fmesa->driDrawable;
GLuint *zptr;
GLuint i;

@@ -194,7 +194,7 @@ static void FFBReadDepthPixels( GLcontext *ctx,
{
GLuint *depth = (GLuint *) values;
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIdrawable *dPriv = fmesa->driDrawable;
char *zbase;
GLuint i;


+ 1
- 1
src/mesa/drivers/dri/ffb/ffb_span.c View File

@@ -45,7 +45,7 @@
UNLOCK_HARDWARE(fmesa); \

#define LOCAL_VARS \
__DRIdrawablePrivate *dPriv = fmesa->driDrawable; \
__DRIdrawable *dPriv = fmesa->driDrawable; \
GLuint height = dPriv->h; \
GLuint p; \
char *buf; \

+ 3
- 3
src/mesa/drivers/dri/ffb/ffb_state.c View File

@@ -384,7 +384,7 @@ ffbDDStencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail,
static void ffbCalcViewportRegs(GLcontext *ctx)
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIdrawable *dPriv = fmesa->driDrawable;
GLuint xmin, xmax, ymin, ymax, zmin, zmax;
unsigned int vcmin, vcmax;

@@ -430,7 +430,7 @@ void ffbCalcViewport(GLcontext *ctx)
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
const GLfloat *v = ctx->Viewport._WindowMap.m;
GLfloat *m = fmesa->hw_viewport;
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIdrawable *dPriv = fmesa->driDrawable;

m[MAT_SX] = v[MAT_SX];
m[MAT_TX] = v[MAT_TX] + dPriv->x + SUBPIXEL_X;
@@ -762,7 +762,7 @@ static void ffbDDLineStipple(GLcontext *ctx, GLint factor, GLushort pattern)

void ffbXformAreaPattern(ffbContextPtr fmesa, const GLubyte *mask)
{
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIdrawable *dPriv = fmesa->driDrawable;
int i, lines, xoff;

lines = 0;

+ 4
- 4
src/mesa/drivers/dri/ffb/ffb_stencil.c View File

@@ -48,7 +48,7 @@ static void FFBWriteStencilSpan( GLcontext *ctx,
#endif
if (ctx->Depth.Mask) {
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIdrawable *dPriv = fmesa->driDrawable;
GLuint *zptr;
GLuint i;

@@ -93,7 +93,7 @@ static void FFBWriteStencilPixels( GLcontext *ctx,
#endif
if (ctx->Depth.Mask) {
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIdrawable *dPriv = fmesa->driDrawable;
char *zbase;
GLuint i;

@@ -136,7 +136,7 @@ static void FFBReadStencilSpan( GLcontext *ctx,
{
GLubyte *stencil = (GLubyte *) values;
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIdrawable *dPriv = fmesa->driDrawable;
GLuint *zptr;
GLuint i;

@@ -176,7 +176,7 @@ static void FFBReadStencilPixels( GLcontext *ctx,
{
GLubyte *stencil = (GLubyte *) values;
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIdrawable *dPriv = fmesa->driDrawable;
char *zbase;
GLuint i;


+ 1
- 1
src/mesa/drivers/dri/ffb/ffb_tris.c View File

@@ -351,7 +351,7 @@ static struct {

#define LOCAL_VARS(n) \
ffbContextPtr fmesa = FFB_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = fmesa->driDrawable; \
__DRIdrawable *dPriv = fmesa->driDrawable; \
ffb_color color[n] = { { 0 } }; \
(void) color; (void) dPriv;


+ 23
- 16
src/mesa/drivers/dri/ffb/ffb_xmesa.c View File

@@ -62,7 +62,7 @@
#include "drirenderbuffer.h"

static GLboolean
ffbInitDriver(__DRIscreenPrivate *sPriv)
ffbInitDriver(__DRIscreen *sPriv)
{
ffbScreenPrivate *ffbScreen;
FFBDRIPtr gDRIPriv = (FFBDRIPtr) sPriv->pDevPriv;
@@ -154,7 +154,7 @@ ffbInitDriver(__DRIscreenPrivate *sPriv)


static void
ffbDestroyScreen(__DRIscreenPrivate *sPriv)
ffbDestroyScreen(__DRIscreen *sPriv)
{
ffbScreenPrivate *ffbScreen = sPriv->private;
FFBDRIPtr gDRIPriv = (FFBDRIPtr) sPriv->pDevPriv;
@@ -183,12 +183,12 @@ static const struct tnl_pipeline_stage *ffb_pipeline[] = {
/* Create and initialize the Mesa and driver specific context data */
static GLboolean
ffbCreateContext(const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{
ffbContextPtr fmesa;
GLcontext *ctx, *shareCtx;
__DRIscreenPrivate *sPriv;
__DRIscreen *sPriv;
ffbScreenPrivate *ffbScreen;
char *debug;
struct dd_function_table functions;
@@ -306,7 +306,7 @@ ffbCreateContext(const __GLcontextModes *mesaVis,
}

static void
ffbDestroyContext(__DRIcontextPrivate *driContextPriv)
ffbDestroyContext(__DRIcontext *driContextPriv)
{
ffbContextPtr fmesa = (ffbContextPtr) driContextPriv->driverPrivate;

@@ -328,8 +328,8 @@ ffbDestroyContext(__DRIcontextPrivate *driContextPriv)

/* Create and initialize the Mesa and driver specific pixmap buffer data */
static GLboolean
ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
ffbCreateBuffer(__DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
{
@@ -392,7 +392,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv,


static void
ffbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
ffbDestroyBuffer(__DRIdrawable *driDrawPriv)
{
_mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
@@ -401,7 +401,7 @@ ffbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
#define USE_FAST_SWAP

static void
ffbSwapBuffers( __DRIdrawablePrivate *dPriv )
ffbSwapBuffers( __DRIdrawable *dPriv )
{
ffbContextPtr fmesa = (ffbContextPtr) dPriv->driContextPriv->driverPrivate;
unsigned int fbc, wid, wid_reg_val, dac_db_bit;
@@ -532,9 +532,9 @@ static void ffb_init_wid(ffbContextPtr fmesa, unsigned int wid)
/* Force the context `c' to be the current context and associate with it
buffer `b' */
static GLboolean
ffbMakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv)
ffbMakeCurrent(__DRIcontext *driContextPriv,
__DRIdrawable *driDrawPriv,
__DRIdrawable *driReadPriv)
{
if (driContextPriv) {
ffbContextPtr fmesa = (ffbContextPtr) driContextPriv->driverPrivate;
@@ -581,15 +581,15 @@ ffbMakeCurrent(__DRIcontextPrivate *driContextPriv,

/* Force the context `c' to be unbound from its buffer */
static GLboolean
ffbUnbindContext(__DRIcontextPrivate *driContextPriv)
ffbUnbindContext(__DRIcontext *driContextPriv)
{
return GL_TRUE;
}

void ffbXMesaUpdateState(ffbContextPtr fmesa)
{
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
__DRIscreenPrivate *sPriv = fmesa->driScreen;
__DRIdrawable *dPriv = fmesa->driDrawable;
__DRIscreen *sPriv = fmesa->driScreen;
int stamp = dPriv->lastStamp;

DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
@@ -607,7 +607,7 @@ void ffbXMesaUpdateState(ffbContextPtr fmesa)
}

static const __DRIconfig **
ffbFillInModes( __DRIscreenPrivate *psp,
ffbFillInModes( __DRIscreen *psp,
unsigned pixel_bits, unsigned depth_bits,
unsigned stencil_bits, GLboolean have_back_buffer )
{
@@ -722,3 +722,10 @@ const struct __DriverAPIRec driDriverAPI = {
.WaitForSBC = NULL,
.SwapBuffersMSC = NULL
};

/* This is the table of extensions that the loader will dlsym() for. */
PUBLIC const __DRIextension *__driDriverExtensions[] = {
&driCoreExtension.base,
&driLegacyExtension.base,
NULL
};

+ 1
- 1
src/mesa/drivers/dri/ffb/ffb_xmesa.h View File

@@ -11,7 +11,7 @@
#include "ffb_fifo.h"

typedef struct {
__DRIscreenPrivate *sPriv;
__DRIscreen *sPriv;
ffb_fbcPtr regs;
ffb_dacPtr dac;
volatile char *sfb8r;

+ 2
- 2
src/mesa/drivers/dri/gamma/gamma_context.c View File

@@ -68,11 +68,11 @@ static const struct tnl_pipeline_stage *gamma_pipeline[] = {
};

GLboolean gammaCreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{
GLcontext *ctx, *shareCtx;
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
gammaContextPtr gmesa;
gammaScreenPtr gammascrn;
GLINTSAREADRIPtr saPriv=(GLINTSAREADRIPtr)(((char*)sPriv->pSAREA)+

+ 6
- 6
src/mesa/drivers/dri/gamma/gamma_context.h View File

@@ -58,10 +58,10 @@ typedef union {
#define MAX_TEXTURE_STACK 2

extern void gammaDDUpdateHWState(GLcontext *ctx);
extern gammaScreenPtr gammaCreateScreen(__DRIscreenPrivate *sPriv);
extern void gammaDestroyScreen(__DRIscreenPrivate *sPriv);
extern gammaScreenPtr gammaCreateScreen(__DRIscreen *sPriv);
extern void gammaDestroyScreen(__DRIscreen *sPriv);
extern GLboolean gammaCreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
__DRIcontext *driContextPriv,
void *sharedContextPrivate);

#define GAMMA_UPLOAD_ALL 0xffffffff
@@ -230,9 +230,9 @@ typedef void (*gamma_point_func)( gammaContextPtr,
struct gamma_context {
GLcontext *glCtx; /* Mesa context */

__DRIcontextPrivate *driContext;
__DRIscreenPrivate *driScreen;
__DRIdrawablePrivate *driDrawable;
__DRIcontext *driContext;
__DRIscreen *driScreen;
__DRIdrawable *driDrawable;

GLuint new_gl_state;
GLuint new_state;

+ 2
- 2
src/mesa/drivers/dri/gamma/gamma_lock.c View File

@@ -19,8 +19,8 @@ int prevLockLine = 0;
*/
void gammaGetLock( gammaContextPtr gmesa, GLuint flags )
{
__DRIdrawablePrivate *dPriv = gmesa->driDrawable;
__DRIscreenPrivate *sPriv = gmesa->driScreen;
__DRIdrawable *dPriv = gmesa->driDrawable;
__DRIscreen *sPriv = gmesa->driScreen;

drmGetLock( gmesa->driFd, gmesa->hHWContext, flags );


+ 3
- 3
src/mesa/drivers/dri/gamma/gamma_macros.h View File

@@ -245,8 +245,8 @@ do { \
#ifdef DO_VALIDATE
#define VALIDATE_DRAWABLE_INFO_NO_LOCK(gcp) \
do { \
/*__DRIscreenPrivate *psp = gcp->driScreen;*/ \
__DRIdrawablePrivate *pdp = gcp->driDrawable; \
/*__DRIscreen *psp = gcp->driScreen;*/ \
__DRIdrawable *pdp = gcp->driDrawable; \
\
if (*(pdp->pStamp) != pdp->lastStamp) { \
int old_index = pdp->index; \
@@ -301,7 +301,7 @@ do { \

#define VALIDATE_DRAWABLE_INFO(gcp) \
do { \
__DRIscreenPrivate *psp = gcp->driScreen; \
__DRIscreen *psp = gcp->driScreen; \
if (gcp->driDrawable) { \
DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \
VALIDATE_DRAWABLE_INFO_NO_LOCK(gcp); \

+ 2
- 2
src/mesa/drivers/dri/gamma/gamma_screen.c View File

@@ -29,7 +29,7 @@

#include "main/imports.h"

gammaScreenPtr gammaCreateScreen( __DRIscreenPrivate *sPriv )
gammaScreenPtr gammaCreateScreen( __DRIscreen *sPriv )
{
gammaScreenPtr gammaScreen;
GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)sPriv->pDevPriv;
@@ -129,7 +129,7 @@ gammaScreenPtr gammaCreateScreen( __DRIscreenPrivate *sPriv )

/* Destroy the device specific screen private data struct.
*/
void gammaDestroyScreen( __DRIscreenPrivate *sPriv )
void gammaDestroyScreen( __DRIscreen *sPriv )
{
gammaScreenPtr gammaScreen = (gammaScreenPtr)sPriv->private;


+ 1
- 1
src/mesa/drivers/dri/gamma/gamma_screen.h View File

@@ -11,7 +11,7 @@ typedef struct {

drmBufMapPtr bufs; /* Map of DMA buffers */

__DRIscreenPrivate *driScreen; /* Back pointer to DRI screen */
__DRIscreen *driScreen; /* Back pointer to DRI screen */

int cpp;
int frontPitch;

+ 4
- 4
src/mesa/drivers/dri/gamma/gamma_span.c View File

@@ -10,8 +10,8 @@
#define LOCAL_VARS \
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx); \
gammaScreenPtr gammascrn = gmesa->gammaScreen; \
__DRIscreenPrivate *sPriv = gmesa->driScreen; \
__DRIdrawablePrivate *dPriv = gmesa->driDrawable; \
__DRIscreen *sPriv = gmesa->driScreen; \
__DRIdrawable *dPriv = gmesa->driDrawable; \
GLuint pitch = sPriv->fbWidth * gammascrn->cpp; \
GLuint height = dPriv->h; \
char *buf = (char *)(sPriv->pFB + \
@@ -24,8 +24,8 @@
/* FIXME! Depth/Stencil read/writes don't work ! */
#define LOCAL_DEPTH_VARS \
gammaScreenPtr gammascrn = gmesa->gammaScreen; \
__DRIdrawablePrivate *dPriv = gmesa->driDrawable; \
__DRIscreenPrivate *sPriv = gmesa->driScreen; \
__DRIdrawable *dPriv = gmesa->driDrawable; \
__DRIscreen *sPriv = gmesa->driScreen; \
GLuint pitch = gammascrn->depthPitch; \
GLuint height = dPriv->h; \
char *buf = (char *)(sPriv->pFB + \

+ 2
- 2
src/mesa/drivers/dri/gamma/gamma_state.c View File

@@ -1070,7 +1070,7 @@ static void gammaDDReadBuffer( GLcontext *ctx, GLenum mode )
void gammaUpdateWindow( GLcontext *ctx )
{
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = gmesa->driDrawable;
__DRIdrawable *dPriv = gmesa->driDrawable;
GLfloat xoffset = (GLfloat)dPriv->x;
GLfloat yoffset = gmesa->driScreen->fbHeight - (GLfloat)dPriv->y - dPriv->h;
const GLfloat *v = ctx->Viewport._WindowMap.m;
@@ -1109,7 +1109,7 @@ static void gammaDDDepthRange( GLcontext *ctx, GLclampd nearval,
void gammaUpdateViewportOffset( GLcontext *ctx )
{
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = gmesa->driDrawable;
__DRIdrawable *dPriv = gmesa->driDrawable;
GLfloat xoffset = (GLfloat)dPriv->x;
GLfloat yoffset = gmesa->driScreen->fbHeight - (GLfloat)dPriv->y - dPriv->h;
const GLfloat *v = ctx->Viewport._WindowMap.m;

+ 21
- 14
src/mesa/drivers/dri/gamma/gamma_xmesa.c View File

@@ -36,7 +36,7 @@
#include "vbo/vbo.h"

static GLboolean
gammaInitDriver(__DRIscreenPrivate *sPriv)
gammaInitDriver(__DRIscreen *sPriv)
{
sPriv->private = (void *) gammaCreateScreen( sPriv );

@@ -49,7 +49,7 @@ gammaInitDriver(__DRIscreenPrivate *sPriv)
}

static void
gammaDestroyContext(__DRIcontextPrivate *driContextPriv)
gammaDestroyContext(__DRIcontext *driContextPriv)
{
gammaContextPtr gmesa = (gammaContextPtr)driContextPriv->driverPrivate;

@@ -72,8 +72,8 @@ gammaDestroyContext(__DRIcontextPrivate *driContextPriv)


static GLboolean
gammaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
gammaCreateBuffer( __DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
{
@@ -94,17 +94,17 @@ gammaCreateBuffer( __DRIscreenPrivate *driScrnPriv,


static void
gammaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
gammaDestroyBuffer(__DRIdrawable *driDrawPriv)
{
_mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}

static void
gammaSwapBuffers( __DRIdrawablePrivate *dPriv )
gammaSwapBuffers( __DRIdrawable *dPriv )
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
gammaContextPtr gmesa;
__DRIscreenPrivate *driScrnPriv;
__DRIscreen *driScrnPriv;
GLcontext *ctx;

gmesa = (gammaContextPtr) dPriv->driContextPriv->driverPrivate;
@@ -127,7 +127,7 @@ gammaSwapBuffers( __DRIdrawablePrivate *dPriv )
int i;
int nRect = dPriv->numClipRects;
drm_clip_rect_t *pRect = dPriv->pClipRects;
__DRIscreenPrivate *driScrnPriv = gmesa->driScreen;
__DRIscreen *driScrnPriv = gmesa->driScreen;
GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)driScrnPriv->pDevPriv;

CHECK_DMA_BUFFER(gmesa, 2);
@@ -193,9 +193,9 @@ gammaSwapBuffers( __DRIdrawablePrivate *dPriv )
}

static GLboolean
gammaMakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv)
gammaMakeCurrent(__DRIcontext *driContextPriv,
__DRIdrawable *driDrawPriv,
__DRIdrawable *driReadPriv)
{
if (driContextPriv) {
GET_CURRENT_CONTEXT(ctx);
@@ -232,7 +232,7 @@ newGammaCtx->new_state |= GAMMA_NEW_WINDOW; /* FIXME */


static GLboolean
gammaUnbindContext( __DRIcontextPrivate *driContextPriv )
gammaUnbindContext( __DRIcontext *driContextPriv )
{
return GL_TRUE;
}
@@ -254,12 +254,19 @@ const struct __DriverAPIRec driDriverAPI = {
/*
* This is the bootstrap function for the driver.
* The __driCreateScreen name is the symbol that libGL.so fetches.
* Return: pointer to a __DRIscreenPrivate.
* Return: pointer to a __DRIscreen.
*/
void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
int numConfigs, __GLXvisualConfig *config)
{
__DRIscreenPrivate *psp;
__DRIscreen *psp;
psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &gammaAPI);
return (void *) psp;
}

/* This is the table of extensions that the loader will dlsym() for. */
PUBLIC const __DRIextension *__driDriverExtensions[] = {
&driCoreExtension.base,
&driLegacyExtension.base,
NULL
};

+ 12
- 12
src/mesa/drivers/dri/i810/i810context.c View File

@@ -170,12 +170,12 @@ static const struct dri_debug_control debug_control[] =

GLboolean
i810CreateContext( const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{
GLcontext *ctx, *shareCtx;
i810ContextPtr imesa;
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
i810ScreenPrivate *i810Screen = (i810ScreenPrivate *)sPriv->private;
I810SAREAPtr saPriv = (I810SAREAPtr)
(((GLubyte *)sPriv->pSAREA) + i810Screen->sarea_priv_offset);
@@ -337,7 +337,7 @@ i810CreateContext( const __GLcontextModes *mesaVis,
}

void
i810DestroyContext(__DRIcontextPrivate *driContextPriv)
i810DestroyContext(__DRIcontext *driContextPriv)
{
i810ContextPtr imesa = (i810ContextPtr) driContextPriv->driverPrivate;

@@ -378,7 +378,7 @@ i810DestroyContext(__DRIcontextPrivate *driContextPriv)

void i810XMesaSetFrontClipRects( i810ContextPtr imesa )
{
__DRIdrawablePrivate *dPriv = imesa->driDrawable;
__DRIdrawable *dPriv = imesa->driDrawable;

imesa->numClipRects = dPriv->numClipRects;
imesa->pClipRects = dPriv->pClipRects;
@@ -392,7 +392,7 @@ void i810XMesaSetFrontClipRects( i810ContextPtr imesa )

void i810XMesaSetBackClipRects( i810ContextPtr imesa )
{
__DRIdrawablePrivate *dPriv = imesa->driDrawable;
__DRIdrawable *dPriv = imesa->driDrawable;

if (imesa->sarea->pf_enabled == 0 && dPriv->numBackClipRects == 0)
{
@@ -430,7 +430,7 @@ static void i810XMesaWindowMoved( i810ContextPtr imesa )


GLboolean
i810UnbindContext(__DRIcontextPrivate *driContextPriv)
i810UnbindContext(__DRIcontext *driContextPriv)
{
i810ContextPtr imesa = (i810ContextPtr) driContextPriv->driverPrivate;
if (imesa) {
@@ -444,9 +444,9 @@ i810UnbindContext(__DRIcontextPrivate *driContextPriv)


GLboolean
i810MakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv)
i810MakeCurrent(__DRIcontext *driContextPriv,
__DRIdrawable *driDrawPriv,
__DRIdrawable *driReadPriv)
{
if (driContextPriv) {
i810ContextPtr imesa = (i810ContextPtr) driContextPriv->driverPrivate;
@@ -504,8 +504,8 @@ i810UpdatePageFlipping( i810ContextPtr imesa )

void i810GetLock( i810ContextPtr imesa, GLuint flags )
{
__DRIdrawablePrivate *dPriv = imesa->driDrawable;
__DRIscreenPrivate *sPriv = imesa->driScreen;
__DRIdrawable *dPriv = imesa->driDrawable;
__DRIscreen *sPriv = imesa->driScreen;
I810SAREAPtr sarea = imesa->sarea;
int me = imesa->hHWContext;
unsigned i;
@@ -551,7 +551,7 @@ void i810GetLock( i810ContextPtr imesa, GLuint flags )


void
i810SwapBuffers( __DRIdrawablePrivate *dPriv )
i810SwapBuffers( __DRIdrawable *dPriv )
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
i810ContextPtr imesa;

+ 2
- 2
src/mesa/drivers/dri/i810/i810context.h View File

@@ -170,8 +170,8 @@ struct i810_context_t {
drm_hw_lock_t *driHwLock;
int driFd;

__DRIdrawablePrivate *driDrawable;
__DRIscreenPrivate *driScreen;
__DRIdrawable *driDrawable;
__DRIscreen *driScreen;
i810ScreenPrivate *i810Screen;
I810SAREAPtr sarea;
};

+ 3
- 3
src/mesa/drivers/dri/i810/i810ioctl.c View File

@@ -50,7 +50,7 @@ static drmBufPtr i810_get_buffer_ioctl( i810ContextPtr imesa )
static void i810Clear( GLcontext *ctx, GLbitfield mask )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
__DRIdrawablePrivate *dPriv = imesa->driDrawable;
__DRIdrawable *dPriv = imesa->driDrawable;
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
drmI810Clear clear;
unsigned int i;
@@ -149,7 +149,7 @@ static void i810Clear( GLcontext *ctx, GLbitfield mask )
/*
* Copy the back buffer to the front buffer.
*/
void i810CopyBuffer( const __DRIdrawablePrivate *dPriv )
void i810CopyBuffer( const __DRIdrawable *dPriv )
{
i810ContextPtr imesa;
drm_clip_rect_t *pbox;
@@ -197,7 +197,7 @@ void i810CopyBuffer( const __DRIdrawablePrivate *dPriv )
/*
* XXX implement when full-screen extension is done.
*/
void i810PageFlip( const __DRIdrawablePrivate *dPriv )
void i810PageFlip( const __DRIdrawable *dPriv )
{
i810ContextPtr imesa;
int tmp, ret;

+ 2
- 2
src/mesa/drivers/dri/i810/i810ioctl.h View File

@@ -14,8 +14,8 @@ void i810WaitAge( i810ContextPtr imesa, int age );
void i810DmaFinish( i810ContextPtr imesa );
void i810RegetLockQuiescent( i810ContextPtr imesa );
void i810InitIoctlFuncs( struct dd_function_table *functions );
void i810CopyBuffer( const __DRIdrawablePrivate *dpriv );
void i810PageFlip( const __DRIdrawablePrivate *dpriv );
void i810CopyBuffer( const __DRIdrawable *dpriv );
void i810PageFlip( const __DRIdrawable *dpriv );
int i810_check_copy(int fd);

#define I810_STATECHANGE(imesa, flag) \

+ 12
- 5
src/mesa/drivers/dri/i810/i810screen.c View File

@@ -54,7 +54,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "GL/internal/dri_interface.h"

static const __DRIconfig **
i810FillInModes( __DRIscreenPrivate *psp,
i810FillInModes( __DRIscreen *psp,
unsigned pixel_bits, unsigned depth_bits,
unsigned stencil_bits, GLboolean have_back_buffer )
{
@@ -255,7 +255,7 @@ i810InitScreen(__DRIscreen *sPriv)
}

static void
i810DestroyScreen(__DRIscreenPrivate *sPriv)
i810DestroyScreen(__DRIscreen *sPriv)
{
i810ScreenPrivate *i810Screen = (i810ScreenPrivate *)sPriv->private;

@@ -274,8 +274,8 @@ i810DestroyScreen(__DRIscreenPrivate *sPriv)
* Create a buffer which corresponds to the window.
*/
static GLboolean
i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
i810CreateBuffer( __DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
{
@@ -335,7 +335,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,


static void
i810DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
i810DestroyBuffer(__DRIdrawable *driDrawPriv)
{
_mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
@@ -356,3 +356,10 @@ const struct __DriverAPIRec driDriverAPI = {
.WaitForSBC = NULL,
.SwapBuffersMSC = NULL
};

/* This is the table of extensions that the loader will dlsym() for. */
PUBLIC const __DRIextension *__driDriverExtensions[] = {
&driCoreExtension.base,
&driLegacyExtension.base,
NULL
};

+ 8
- 8
src/mesa/drivers/dri/i810/i810screen.h View File

@@ -71,7 +71,7 @@ typedef struct {
int textureSize;
int logTextureGranularity;

__DRIscreenPrivate *driScrnPriv;
__DRIscreen *driScrnPriv;
drmBufMapPtr bufs;
unsigned int sarea_priv_offset;
} i810ScreenPrivate;
@@ -79,21 +79,21 @@ typedef struct {

extern GLboolean
i810CreateContext( const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
__DRIcontext *driContextPriv,
void *sharedContextPrivate );

extern void
i810DestroyContext(__DRIcontextPrivate *driContextPriv);
i810DestroyContext(__DRIcontext *driContextPriv);

extern GLboolean
i810UnbindContext(__DRIcontextPrivate *driContextPriv);
i810UnbindContext(__DRIcontext *driContextPriv);

extern GLboolean
i810MakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv);
i810MakeCurrent(__DRIcontext *driContextPriv,
__DRIdrawable *driDrawPriv,
__DRIdrawable *driReadPriv);

extern void
i810SwapBuffers(__DRIdrawablePrivate *driDrawPriv);
i810SwapBuffers(__DRIdrawable *driDrawPriv);

#endif

+ 2
- 2
src/mesa/drivers/dri/i810/i810span.c View File

@@ -15,7 +15,7 @@

#define LOCAL_VARS \
i810ContextPtr imesa = I810_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = imesa->driDrawable; \
__DRIdrawable *dPriv = imesa->driDrawable; \
driRenderbuffer *drb = (driRenderbuffer *) rb; \
GLuint pitch = drb->pitch; \
GLuint height = dPriv->h; \
@@ -27,7 +27,7 @@

#define LOCAL_DEPTH_VARS \
i810ContextPtr imesa = I810_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = imesa->driDrawable; \
__DRIdrawable *dPriv = imesa->driDrawable; \
driRenderbuffer *drb = (driRenderbuffer *) rb; \
GLuint pitch = drb->pitch; \
GLuint height = dPriv->h; \

+ 1
- 1
src/mesa/drivers/dri/i810/i810state.c View File

@@ -641,7 +641,7 @@ static void i810Enable(GLcontext *ctx, GLenum cap, GLboolean state)

void i810EmitDrawingRectangle( i810ContextPtr imesa )
{
__DRIdrawablePrivate *dPriv = imesa->driDrawable;
__DRIdrawable *dPriv = imesa->driDrawable;
i810ScreenPrivate *i810Screen = imesa->i810Screen;
int x0 = imesa->drawX;
int y0 = imesa->drawY;

+ 2
- 2
src/mesa/drivers/dri/i915/Makefile View File

@@ -34,7 +34,6 @@ DRIVER_SOURCES = \
intel_pixel_read.c \
intel_buffers.c \
intel_blit.c \
intel_swapbuffers.c \
i915_tex_layout.c \
i915_texstate.c \
i915_context.c \
@@ -64,7 +63,8 @@ DRIVER_DEFINES = -I../intel -I../intel/server -DI915 \
$(shell pkg-config libdrm --atleast-version=2.3.1 \
&& echo "-DDRM_VBLANK_FLIP=DRM_VBLANK_FLIP")

DRI_LIB_DEPS += -ldrm_intel
INCLUDES += $(INTEL_CFLAGS)
DRI_LIB_DEPS += $(INTEL_LIBS)

include ../Makefile.template


+ 1
- 1
src/mesa/drivers/dri/i915/i830_context.c View File

@@ -53,7 +53,7 @@ extern const struct tnl_pipeline_stage *intel_pipeline[];

GLboolean
i830CreateContext(const __GLcontextModes * mesaVis,
__DRIcontextPrivate * driContextPriv,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
struct dd_function_table functions;

+ 1
- 1
src/mesa/drivers/dri/i915/i830_context.h View File

@@ -178,7 +178,7 @@ i830_state_draw_region(struct intel_context *intel,
*/
extern GLboolean
i830CreateContext(const __GLcontextModes * mesaVis,
__DRIcontextPrivate * driContextPriv,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);

/* i830_tex.c, i830_texstate.c

+ 21
- 39
src/mesa/drivers/dri/i915/i830_vtbl.c View File

@@ -298,7 +298,7 @@ i830_emit_invarient_state(struct intel_context *intel)
{
BATCH_LOCALS;

BEGIN_BATCH(29, IGNORE_CLIPRECTS);
BEGIN_BATCH(29);

OUT_BATCH(_3DSTATE_DFLT_DIFFUSE_CMD);
OUT_BATCH(0);
@@ -366,7 +366,7 @@ i830_emit_invarient_state(struct intel_context *intel)


#define emit( intel, state, size ) \
intel_batchbuffer_data(intel->batch, state, size, IGNORE_CLIPRECTS )
intel_batchbuffer_data(intel->batch, state, size )

static GLuint
get_dirty(struct i830_hw_state *state)
@@ -429,13 +429,9 @@ i830_emit_state(struct intel_context *intel)
* It might be better to talk about explicit places where
* scheduling is allowed, rather than assume that it is whenever a
* batchbuffer fills up.
*
* Set the space as LOOP_CLIPRECTS now, since that's what our primitives
* will be emitted under.
*/
intel_batchbuffer_require_space(intel->batch,
get_state_size(state) + INTEL_PRIM_EMIT_SIZE,
LOOP_CLIPRECTS);
get_state_size(state) + INTEL_PRIM_EMIT_SIZE);
count = 0;
again:
aper_count = 0;
@@ -491,17 +487,14 @@ i830_emit_state(struct intel_context *intel)
}

if (dirty & I830_UPLOAD_BUFFERS) {
GLuint count = 9;
GLuint count = 15;

DBG("I830_UPLOAD_BUFFERS:\n");

if (state->depth_region)
count += 3;

if (intel->constant_cliprect)
count += 6;

BEGIN_BATCH(count, IGNORE_CLIPRECTS);
BEGIN_BATCH(count);
OUT_BATCH(state->Buffer[I830_DESTREG_CBUFADDR0]);
OUT_BATCH(state->Buffer[I830_DESTREG_CBUFADDR1]);
OUT_RELOC(state->draw_region->buffer,
@@ -523,15 +516,13 @@ i830_emit_state(struct intel_context *intel)
OUT_BATCH(state->Buffer[I830_DESTREG_SR1]);
OUT_BATCH(state->Buffer[I830_DESTREG_SR2]);

if (intel->constant_cliprect) {
assert(state->Buffer[I830_DESTREG_DRAWRECT0] != MI_NOOP);
OUT_BATCH(state->Buffer[I830_DESTREG_DRAWRECT0]);
OUT_BATCH(state->Buffer[I830_DESTREG_DRAWRECT1]);
OUT_BATCH(state->Buffer[I830_DESTREG_DRAWRECT2]);
OUT_BATCH(state->Buffer[I830_DESTREG_DRAWRECT3]);
OUT_BATCH(state->Buffer[I830_DESTREG_DRAWRECT4]);
OUT_BATCH(state->Buffer[I830_DESTREG_DRAWRECT5]);
}
assert(state->Buffer[I830_DESTREG_DRAWRECT0] != MI_NOOP);
OUT_BATCH(state->Buffer[I830_DESTREG_DRAWRECT0]);
OUT_BATCH(state->Buffer[I830_DESTREG_DRAWRECT1]);
OUT_BATCH(state->Buffer[I830_DESTREG_DRAWRECT2]);
OUT_BATCH(state->Buffer[I830_DESTREG_DRAWRECT3]);
OUT_BATCH(state->Buffer[I830_DESTREG_DRAWRECT4]);
OUT_BATCH(state->Buffer[I830_DESTREG_DRAWRECT5]);
ADVANCE_BATCH();
}
@@ -544,7 +535,7 @@ i830_emit_state(struct intel_context *intel)
if ((dirty & I830_UPLOAD_TEX(i))) {
DBG("I830_UPLOAD_TEX(%d):\n", i);

BEGIN_BATCH(I830_TEX_SETUP_SIZE + 1, IGNORE_CLIPRECTS);
BEGIN_BATCH(I830_TEX_SETUP_SIZE + 1);
OUT_BATCH(state->Tex[i][I830_TEXREG_TM0LI]);

if (state->tex_buffer[i]) {
@@ -673,23 +664,14 @@ i830_state_draw_region(struct intel_context *intel,
}
state->Buffer[I830_DESTREG_DV1] = value;

if (intel->constant_cliprect) {
state->Buffer[I830_DESTREG_DRAWRECT0] = _3DSTATE_DRAWRECT_INFO;
state->Buffer[I830_DESTREG_DRAWRECT1] = 0;
state->Buffer[I830_DESTREG_DRAWRECT2] = 0; /* xmin, ymin */
state->Buffer[I830_DESTREG_DRAWRECT3] =
(ctx->DrawBuffer->Width & 0xffff) |
(ctx->DrawBuffer->Height << 16);
state->Buffer[I830_DESTREG_DRAWRECT4] = 0; /* xoff, yoff */
state->Buffer[I830_DESTREG_DRAWRECT5] = 0;
} else {
state->Buffer[I830_DESTREG_DRAWRECT0] = MI_NOOP;
state->Buffer[I830_DESTREG_DRAWRECT1] = MI_NOOP;
state->Buffer[I830_DESTREG_DRAWRECT2] = MI_NOOP;
state->Buffer[I830_DESTREG_DRAWRECT3] = MI_NOOP;
state->Buffer[I830_DESTREG_DRAWRECT4] = MI_NOOP;
state->Buffer[I830_DESTREG_DRAWRECT5] = MI_NOOP;
}
state->Buffer[I830_DESTREG_DRAWRECT0] = _3DSTATE_DRAWRECT_INFO;
state->Buffer[I830_DESTREG_DRAWRECT1] = 0;
state->Buffer[I830_DESTREG_DRAWRECT2] = 0; /* xmin, ymin */
state->Buffer[I830_DESTREG_DRAWRECT3] =
(ctx->DrawBuffer->Width & 0xffff) |
(ctx->DrawBuffer->Height << 16);
state->Buffer[I830_DESTREG_DRAWRECT4] = 0; /* xoff, yoff */
state->Buffer[I830_DESTREG_DRAWRECT5] = 0;

I830_STATECHANGE(i830, I830_UPLOAD_BUFFERS);


+ 1
- 1
src/mesa/drivers/dri/i915/i915_context.c View File

@@ -100,7 +100,7 @@ extern const struct tnl_pipeline_stage *intel_pipeline[];

GLboolean
i915CreateContext(const __GLcontextModes * mesaVis,
__DRIcontextPrivate * driContextPriv,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
struct dd_function_table functions;

+ 1
- 1
src/mesa/drivers/dri/i915/i915_context.h View File

@@ -318,7 +318,7 @@ do { \
* i915_context.c
*/
extern GLboolean i915CreateContext(const __GLcontextModes * mesaVis,
__DRIcontextPrivate * driContextPriv,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);



+ 22
- 40
src/mesa/drivers/dri/i915/i915_vtbl.c View File

@@ -174,7 +174,7 @@ i915_emit_invarient_state(struct intel_context *intel)
{
BATCH_LOCALS;

BEGIN_BATCH(17, IGNORE_CLIPRECTS);
BEGIN_BATCH(17);

OUT_BATCH(_3DSTATE_AA_CMD |
AA_LINE_ECAAR_WIDTH_ENABLE |
@@ -220,7 +220,7 @@ i915_emit_invarient_state(struct intel_context *intel)


#define emit(intel, state, size ) \
intel_batchbuffer_data(intel->batch, state, size, IGNORE_CLIPRECTS )
intel_batchbuffer_data(intel->batch, state, size)

static GLuint
get_dirty(struct i915_hw_state *state)
@@ -301,13 +301,9 @@ i915_emit_state(struct intel_context *intel)
* It might be better to talk about explicit places where
* scheduling is allowed, rather than assume that it is whenever a
* batchbuffer fills up.
*
* Set the space as LOOP_CLIPRECTS now, since that's what our primitives
* will be emitted under.
*/
intel_batchbuffer_require_space(intel->batch,
get_state_size(state) + INTEL_PRIM_EMIT_SIZE,
LOOP_CLIPRECTS);
get_state_size(state) + INTEL_PRIM_EMIT_SIZE);
count = 0;
again:
aper_count = 0;
@@ -373,7 +369,7 @@ i915_emit_state(struct intel_context *intel)
}

if (dirty & I915_UPLOAD_BUFFERS) {
GLuint count = 9;
GLuint count = 15;

if (INTEL_DEBUG & DEBUG_STATE)
fprintf(stderr, "I915_UPLOAD_BUFFERS:\n");
@@ -381,10 +377,7 @@ i915_emit_state(struct intel_context *intel)
if (state->depth_region)
count += 3;

if (intel->constant_cliprect)
count += 6;

BEGIN_BATCH(count, IGNORE_CLIPRECTS);
BEGIN_BATCH(count);
OUT_BATCH(state->Buffer[I915_DESTREG_CBUFADDR0]);
OUT_BATCH(state->Buffer[I915_DESTREG_CBUFADDR1]);
OUT_RELOC(state->draw_region->buffer,
@@ -406,15 +399,13 @@ i915_emit_state(struct intel_context *intel)
OUT_BATCH(state->Buffer[I915_DESTREG_SR1]);
OUT_BATCH(state->Buffer[I915_DESTREG_SR2]);

if (intel->constant_cliprect) {
assert(state->Buffer[I915_DESTREG_DRAWRECT0] != MI_NOOP);
OUT_BATCH(state->Buffer[I915_DESTREG_DRAWRECT0]);
OUT_BATCH(state->Buffer[I915_DESTREG_DRAWRECT1]);
OUT_BATCH(state->Buffer[I915_DESTREG_DRAWRECT2]);
OUT_BATCH(state->Buffer[I915_DESTREG_DRAWRECT3]);
OUT_BATCH(state->Buffer[I915_DESTREG_DRAWRECT4]);
OUT_BATCH(state->Buffer[I915_DESTREG_DRAWRECT5]);
}
assert(state->Buffer[I915_DESTREG_DRAWRECT0] != MI_NOOP);
OUT_BATCH(state->Buffer[I915_DESTREG_DRAWRECT0]);
OUT_BATCH(state->Buffer[I915_DESTREG_DRAWRECT1]);
OUT_BATCH(state->Buffer[I915_DESTREG_DRAWRECT2]);
OUT_BATCH(state->Buffer[I915_DESTREG_DRAWRECT3]);
OUT_BATCH(state->Buffer[I915_DESTREG_DRAWRECT4]);
OUT_BATCH(state->Buffer[I915_DESTREG_DRAWRECT5]);

ADVANCE_BATCH();
}
@@ -441,7 +432,7 @@ i915_emit_state(struct intel_context *intel)
if (dirty & I915_UPLOAD_TEX(i))
nr++;

BEGIN_BATCH(2 + nr * 3, IGNORE_CLIPRECTS);
BEGIN_BATCH(2 + nr * 3);
OUT_BATCH(_3DSTATE_MAP_STATE | (3 * nr));
OUT_BATCH((dirty & I915_UPLOAD_TEX_ALL) >> I915_UPLOAD_TEX_0_SHIFT);
for (i = 0; i < I915_TEX_UNITS; i++)
@@ -465,7 +456,7 @@ i915_emit_state(struct intel_context *intel)
}
ADVANCE_BATCH();

BEGIN_BATCH(2 + nr * 3, IGNORE_CLIPRECTS);
BEGIN_BATCH(2 + nr * 3);
OUT_BATCH(_3DSTATE_SAMPLER_STATE | (3 * nr));
OUT_BATCH((dirty & I915_UPLOAD_TEX_ALL) >> I915_UPLOAD_TEX_0_SHIFT);
for (i = 0; i < I915_TEX_UNITS; i++)
@@ -623,23 +614,14 @@ i915_state_draw_region(struct intel_context *intel,
}
state->Buffer[I915_DESTREG_DV1] = value;

if (intel->constant_cliprect) {
state->Buffer[I915_DESTREG_DRAWRECT0] = _3DSTATE_DRAWRECT_INFO;
state->Buffer[I915_DESTREG_DRAWRECT1] = 0;
state->Buffer[I915_DESTREG_DRAWRECT2] = 0; /* xmin, ymin */
state->Buffer[I915_DESTREG_DRAWRECT3] =
(ctx->DrawBuffer->Width & 0xffff) |
(ctx->DrawBuffer->Height << 16);
state->Buffer[I915_DESTREG_DRAWRECT4] = 0; /* xoff, yoff */
state->Buffer[I915_DESTREG_DRAWRECT5] = 0;
} else {
state->Buffer[I915_DESTREG_DRAWRECT0] = MI_NOOP;
state->Buffer[I915_DESTREG_DRAWRECT1] = MI_NOOP;
state->Buffer[I915_DESTREG_DRAWRECT2] = MI_NOOP;
state->Buffer[I915_DESTREG_DRAWRECT3] = MI_NOOP;
state->Buffer[I915_DESTREG_DRAWRECT4] = MI_NOOP;
state->Buffer[I915_DESTREG_DRAWRECT5] = MI_NOOP;
}
state->Buffer[I915_DESTREG_DRAWRECT0] = _3DSTATE_DRAWRECT_INFO;
state->Buffer[I915_DESTREG_DRAWRECT1] = 0;
state->Buffer[I915_DESTREG_DRAWRECT2] = 0; /* xmin, ymin */
state->Buffer[I915_DESTREG_DRAWRECT3] =
(ctx->DrawBuffer->Width & 0xffff) |
(ctx->DrawBuffer->Height << 16);
state->Buffer[I915_DESTREG_DRAWRECT4] = 0; /* xoff, yoff */
state->Buffer[I915_DESTREG_DRAWRECT5] = 0;

I915_STATECHANGE(i915, I915_UPLOAD_BUFFERS);
}

+ 3
- 4
src/mesa/drivers/dri/i915/intel_tris.c View File

@@ -89,7 +89,6 @@ intel_flush_inline_primitive(struct intel_context *intel)

static void intel_start_inline(struct intel_context *intel, uint32_t prim)
{
uint32_t batch_flags = LOOP_CLIPRECTS;
BATCH_LOCALS;

intel->vtbl.emit_state(intel);
@@ -101,7 +100,7 @@ static void intel_start_inline(struct intel_context *intel, uint32_t prim)
/* Emit a slot which will be filled with the inline primitive
* command later.
*/
BEGIN_BATCH(2, batch_flags);
BEGIN_BATCH(2);
OUT_BATCH(0);

assert((intel->batch->dirty_state & (1<<1)) == 0);
@@ -252,7 +251,7 @@ void intel_flush_prim(struct intel_context *intel)
#endif

if (intel->gen >= 3) {
BEGIN_BATCH(5, LOOP_CLIPRECTS);
BEGIN_BATCH(5);
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
I1_LOAD_S(0) | I1_LOAD_S(1) | 1);
assert((offset & !S0_VB_OFFSET_MASK) == 0);
@@ -270,7 +269,7 @@ void intel_flush_prim(struct intel_context *intel)
} else {
struct i830_context *i830 = i830_context(&intel->ctx);

BEGIN_BATCH(5, LOOP_CLIPRECTS);
BEGIN_BATCH(5);
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
I1_LOAD_S(0) | I1_LOAD_S(2) | 1);
/* S0 */

+ 2
- 2
src/mesa/drivers/dri/i965/Makefile View File

@@ -24,7 +24,6 @@ DRIVER_SOURCES = \
intel_pixel_draw.c \
intel_pixel_read.c \
intel_state.c \
intel_swapbuffers.c \
intel_syncobj.c \
intel_tex.c \
intel_tex_copy.c \
@@ -96,7 +95,8 @@ ASM_SOURCES =

DRIVER_DEFINES = -I../intel -I../intel/server

DRI_LIB_DEPS += -ldrm_intel
INCLUDES += $(INTEL_CFLAGS)
DRI_LIB_DEPS += $(INTEL_LIBS)

include ../Makefile.template


+ 1
- 1
src/mesa/drivers/dri/i965/brw_context.c View File

@@ -77,7 +77,7 @@ static void brwInitDriverFunctions( struct dd_function_table *functions )
}

GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{
struct dd_function_table functions;

+ 1
- 1
src/mesa/drivers/dri/i965/brw_context.h View File

@@ -679,7 +679,7 @@ void brwInitVtbl( struct brw_context *brw );
* brw_context.c
*/
GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
__DRIcontext *driContextPriv,
void *sharedContextPrivate);

/*======================================================================

+ 1
- 1
src/mesa/drivers/dri/i965/brw_curbe.c View File

@@ -340,7 +340,7 @@ static void emit_constant_buffer(struct brw_context *brw)
struct intel_context *intel = &brw->intel;
GLuint sz = brw->curbe.total_size;

BEGIN_BATCH(2, IGNORE_CLIPRECTS);
BEGIN_BATCH(2);
if (sz == 0) {
OUT_BATCH((CMD_CONST_BUFFER << 16) | (2 - 2));
OUT_BATCH(0);

+ 2
- 11
src/mesa/drivers/dri/i965/brw_draw.c View File

@@ -157,7 +157,7 @@ static void brw_emit_prim(struct brw_context *brw,
}
if (prim_packet.verts_per_instance) {
intel_batchbuffer_data( brw->intel.batch, &prim_packet,
sizeof(prim_packet), LOOP_CLIPRECTS);
sizeof(prim_packet));
}
if (intel->always_flush_cache) {
intel_batchbuffer_emit_mi_flush(intel->batch);
@@ -339,13 +339,6 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
* so can't access it earlier.
*/

LOCK_HARDWARE(intel);

if (!intel->constant_cliprect && intel->driDrawable->numClipRects == 0) {
UNLOCK_HARDWARE(intel);
return GL_TRUE;
}

for (i = 0; i < nr_prims; i++) {
uint32_t hw_prim;

@@ -356,8 +349,7 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
* an upper bound of how much we might emit in a single
* brw_try_draw_prims().
*/
intel_batchbuffer_require_space(intel->batch, intel->batch->size / 4,
LOOP_CLIPRECTS);
intel_batchbuffer_require_space(intel->batch, intel->batch->size / 4);

hw_prim = brw_set_prim(brw, prim[i].mode);

@@ -404,7 +396,6 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
if (intel->always_flush_batch)
intel_batchbuffer_flush(intel->batch);
out:
UNLOCK_HARDWARE(intel);

brw_state_cache_check_size(brw);


+ 4
- 4
src/mesa/drivers/dri/i965/brw_draw_upload.c View File

@@ -494,7 +494,7 @@ static void brw_emit_vertices(struct brw_context *brw)
* a VE loads from them.
*/
if (brw->vb.nr_enabled == 0) {
BEGIN_BATCH(3, IGNORE_CLIPRECTS);
BEGIN_BATCH(3);
OUT_BATCH((CMD_VERTEX_ELEMENT << 16) | 1);
OUT_BATCH((0 << BRW_VE0_INDEX_SHIFT) |
BRW_VE0_VALID |
@@ -514,7 +514,7 @@ static void brw_emit_vertices(struct brw_context *brw)
* are interleaved or from the same VBO. TBD if this makes a
* performance difference.
*/
BEGIN_BATCH(1 + brw->vb.nr_enabled * 4, IGNORE_CLIPRECTS);
BEGIN_BATCH(1 + brw->vb.nr_enabled * 4);
OUT_BATCH((CMD_VERTEX_BUFFER << 16) |
((1 + brw->vb.nr_enabled * 4) - 2));

@@ -537,7 +537,7 @@ static void brw_emit_vertices(struct brw_context *brw)
}
ADVANCE_BATCH();

BEGIN_BATCH(1 + brw->vb.nr_enabled * 2, IGNORE_CLIPRECTS);
BEGIN_BATCH(1 + brw->vb.nr_enabled * 2);
OUT_BATCH((CMD_VERTEX_ELEMENT << 16) | ((1 + brw->vb.nr_enabled * 2) - 2));
for (i = 0; i < brw->vb.nr_enabled; i++) {
struct brw_vertex_element *input = brw->vb.enabled[i];
@@ -704,7 +704,7 @@ static void brw_emit_index_buffer(struct brw_context *brw)
ib.header.bits.index_format = get_index_type(index_buffer->type);
ib.header.bits.cut_index_enable = 0;

BEGIN_BATCH(4, IGNORE_CLIPRECTS);
BEGIN_BATCH(4);
OUT_BATCH( ib.header.dword );
OUT_RELOC(brw->ib.bo,
I915_GEM_DOMAIN_VERTEX, 0,

+ 8
- 11
src/mesa/drivers/dri/i965/brw_misc_state.c View File

@@ -78,10 +78,7 @@ static void upload_drawing_rect(struct brw_context *brw)
struct intel_context *intel = &brw->intel;
GLcontext *ctx = &intel->ctx;

if (!intel->constant_cliprect)
return;

BEGIN_BATCH(4, NO_LOOP_CLIPRECTS);
BEGIN_BATCH(4);
OUT_BATCH(_3DSTATE_DRAWRECT_INFO_I965);
OUT_BATCH(0); /* xmin, ymin */
OUT_BATCH(((ctx->DrawBuffer->Width - 1) & 0xffff) |
@@ -116,7 +113,7 @@ static void upload_binding_table_pointers(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;

BEGIN_BATCH(6, IGNORE_CLIPRECTS);
BEGIN_BATCH(6);
OUT_BATCH(CMD_BINDING_TABLE_PTRS << 16 | (6 - 2));
if (brw->vs.bind_bo != NULL)
OUT_RELOC(brw->vs.bind_bo, I915_GEM_DOMAIN_SAMPLER, 0, 0); /* vs */
@@ -150,7 +147,7 @@ static void upload_pipelined_state_pointers(struct brw_context *brw )
{
struct intel_context *intel = &brw->intel;

BEGIN_BATCH(7, IGNORE_CLIPRECTS);
BEGIN_BATCH(7);
OUT_BATCH(CMD_PIPELINED_STATE_POINTERS << 16 | (7 - 2));
OUT_RELOC(brw->vs.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
if (brw->gs.prog_active)
@@ -215,7 +212,7 @@ static void emit_depthbuffer(struct brw_context *brw)
unsigned int len = (intel->is_g4x || intel->is_ironlake) ? 6 : 5;

if (region == NULL) {
BEGIN_BATCH(len, IGNORE_CLIPRECTS);
BEGIN_BATCH(len);
OUT_BATCH(CMD_DEPTH_BUFFER << 16 | (len - 2));
OUT_BATCH((BRW_DEPTHFORMAT_D32_FLOAT << 18) |
(BRW_SURFACE_NULL << 29));
@@ -247,7 +244,7 @@ static void emit_depthbuffer(struct brw_context *brw)

assert(region->tiling != I915_TILING_X);

BEGIN_BATCH(len, IGNORE_CLIPRECTS);
BEGIN_BATCH(len);
OUT_BATCH(CMD_DEPTH_BUFFER << 16 | (len - 2));
OUT_BATCH(((region->pitch * region->cpp) - 1) |
(format << 18) |
@@ -330,7 +327,7 @@ const struct brw_tracked_state brw_polygon_stipple = {

static void upload_polygon_stipple_offset(struct brw_context *brw)
{
__DRIdrawablePrivate *dPriv = brw->intel.driDrawable;
__DRIdrawable *dPriv = brw->intel.driDrawable;
struct brw_polygon_stipple_offset bpso;

memset(&bpso, 0, sizeof(bpso));
@@ -513,7 +510,7 @@ static void upload_state_base_address( struct brw_context *brw )
* batchbuffer, so we can emit relocations inline.
*/
if (intel->is_ironlake) {
BEGIN_BATCH(8, IGNORE_CLIPRECTS);
BEGIN_BATCH(8);
OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (8 - 2));
OUT_BATCH(1); /* General state base address */
OUT_BATCH(1); /* Surface state base address */
@@ -524,7 +521,7 @@ static void upload_state_base_address( struct brw_context *brw )
OUT_BATCH(1); /* Instruction access upper bound */
ADVANCE_BATCH();
} else {
BEGIN_BATCH(6, IGNORE_CLIPRECTS);
BEGIN_BATCH(6);
OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (6 - 2));
OUT_BATCH(1); /* General state base address */
OUT_BATCH(1); /* Surface state base address */

+ 2
- 2
src/mesa/drivers/dri/i965/brw_queryobj.c View File

@@ -188,7 +188,7 @@ brw_emit_query_begin(struct brw_context *brw)
if (brw->query.active || is_empty_list(&brw->query.active_head))
return;

BEGIN_BATCH(4, IGNORE_CLIPRECTS);
BEGIN_BATCH(4);
OUT_BATCH(_3DSTATE_PIPE_CONTROL |
PIPE_CONTROL_DEPTH_STALL |
PIPE_CONTROL_WRITE_DEPTH_COUNT);
@@ -227,7 +227,7 @@ brw_emit_query_end(struct brw_context *brw)
if (!brw->query.active)
return;

BEGIN_BATCH(4, IGNORE_CLIPRECTS);
BEGIN_BATCH(4);
OUT_BATCH(_3DSTATE_PIPE_CONTROL |
PIPE_CONTROL_DEPTH_STALL |
PIPE_CONTROL_WRITE_DEPTH_COUNT);

+ 1
- 1
src/mesa/drivers/dri/i965/brw_state.h View File

@@ -151,7 +151,7 @@ void brw_state_cache_bo_delete(struct brw_cache *cache, dri_bo *bo);
/***********************************************************************
* brw_state_batch.c
*/
#define BRW_BATCH_STRUCT(brw, s) intel_batchbuffer_data( brw->intel.batch, (s), sizeof(*(s)), IGNORE_CLIPRECTS)
#define BRW_BATCH_STRUCT(brw, s) intel_batchbuffer_data( brw->intel.batch, (s), sizeof(*(s)))
#define BRW_CACHED_BATCH_STRUCT(brw, s) brw_cached_batch_struct( brw, (s), sizeof(*(s)) )

GLboolean brw_cached_batch_struct( struct brw_context *brw,

+ 2
- 2
src/mesa/drivers/dri/i965/brw_state_batch.c View File

@@ -48,7 +48,7 @@ GLboolean brw_cached_batch_struct( struct brw_context *brw,
struct header *newheader = (struct header *)data;

if (brw->emit_state_always) {
intel_batchbuffer_data(brw->intel.batch, data, sz, IGNORE_CLIPRECTS);
intel_batchbuffer_data(brw->intel.batch, data, sz);
return GL_TRUE;
}

@@ -75,7 +75,7 @@ GLboolean brw_cached_batch_struct( struct brw_context *brw,

emit:
memcpy(item->header, newheader, sz);
intel_batchbuffer_data(brw->intel.batch, data, sz, IGNORE_CLIPRECTS);
intel_batchbuffer_data(brw->intel.batch, data, sz);
return GL_TRUE;
}


+ 8
- 42
src/mesa/drivers/dri/intel/intel_batchbuffer.c View File

@@ -94,7 +94,6 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch)
batch->size = intel->maxBatchSize;
batch->ptr = batch->map;
batch->dirty_state = ~0;
batch->cliprect_mode = IGNORE_CLIPRECTS;
}

struct intel_batchbuffer *
@@ -129,13 +128,10 @@ intel_batchbuffer_free(struct intel_batchbuffer *batch)
/* TODO: Push this whole function into bufmgr.
*/
static void
do_flush_locked(struct intel_batchbuffer *batch,
GLuint used, GLboolean allow_unlock)
do_flush_locked(struct intel_batchbuffer *batch, GLuint used)
{
struct intel_context *intel = batch->intel;
int ret = 0;
unsigned int num_cliprects = 0;
struct drm_clip_rect *cliprects = NULL;
int x_off = 0, y_off = 0;

if (batch->buffer)
@@ -146,31 +142,7 @@ do_flush_locked(struct intel_batchbuffer *batch,
batch->map = NULL;
batch->ptr = NULL;


if (batch->cliprect_mode == LOOP_CLIPRECTS) {
intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
}
/* Dispatch the batchbuffer, if it has some effect (nonzero cliprects).
* Can't short-circuit like this once we have hardware contexts, but we
* should always be in DRI2 mode by then anyway.
*/
if ((batch->cliprect_mode != LOOP_CLIPRECTS ||
num_cliprects != 0) && !intel->no_hw) {
dri_bo_exec(batch->buf, used, cliprects, num_cliprects,
(x_off & 0xffff) | (y_off << 16));
}

if (batch->cliprect_mode == LOOP_CLIPRECTS && num_cliprects == 0) {
if (allow_unlock) {
/* If we are not doing any actual user-visible rendering,
* do a sched_yield to keep the app from pegging the cpu while
* achieving nothing.
*/
UNLOCK_HARDWARE(intel);
sched_yield();
LOCK_HARDWARE(intel);
}
}
dri_bo_exec(batch->buf, used, NULL, 0, (x_off & 0xffff) | (y_off << 16));

if (INTEL_DEBUG & DEBUG_BATCH) {
dri_bo_map(batch->buf, GL_FALSE);
@@ -183,7 +155,6 @@ do_flush_locked(struct intel_batchbuffer *batch,
}

if (ret != 0) {
UNLOCK_HARDWARE(intel);
exit(1);
}
intel->vtbl.new_batch(intel);
@@ -201,10 +172,8 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
drm_intel_bo_reference(intel->first_post_swapbuffers_batch);
}

if (used == 0) {
batch->cliprect_mode = IGNORE_CLIPRECTS;
if (used == 0)
return;
}

if (INTEL_DEBUG & DEBUG_BATCH)
fprintf(stderr, "%s:%d: Batchbuffer flush with %db used\n", file, line,
@@ -252,9 +221,7 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
/* TODO: Just pass the relocation list and dma buffer up to the
* kernel.
*/
LOCK_HARDWARE(intel);
do_flush_locked(batch, used, GL_FALSE);
UNLOCK_HARDWARE(intel);
do_flush_locked(batch, used);

if (INTEL_DEBUG & DEBUG_SYNC) {
fprintf(stderr, "waiting for idle\n");
@@ -296,11 +263,10 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,

void
intel_batchbuffer_data(struct intel_batchbuffer *batch,
const void *data, GLuint bytes,
enum cliprect_mode cliprect_mode)
const void *data, GLuint bytes)
{
assert((bytes & 3) == 0);
intel_batchbuffer_require_space(batch, bytes, cliprect_mode);
intel_batchbuffer_require_space(batch, bytes);
__memcpy(batch->ptr, data, bytes);
batch->ptr += bytes;
}
@@ -317,7 +283,7 @@ intel_batchbuffer_emit_mi_flush(struct intel_batchbuffer *batch)
struct intel_context *intel = batch->intel;

if (intel->gen >= 4) {
BEGIN_BATCH(4, IGNORE_CLIPRECTS);
BEGIN_BATCH(4);
OUT_BATCH(_3DSTATE_PIPE_CONTROL |
PIPE_CONTROL_INSTRUCTION_FLUSH |
PIPE_CONTROL_WRITE_FLUSH |
@@ -327,7 +293,7 @@ intel_batchbuffer_emit_mi_flush(struct intel_batchbuffer *batch)
OUT_BATCH(0); /* write data */
ADVANCE_BATCH();
} else {
BEGIN_BATCH(1, IGNORE_CLIPRECTS);
BEGIN_BATCH(1);
OUT_BATCH(MI_FLUSH);
ADVANCE_BATCH();
}

+ 4
- 53
src/mesa/drivers/dri/intel/intel_batchbuffer.h View File

@@ -10,35 +10,6 @@
#define BATCH_SZ 16384
#define BATCH_RESERVED 16

enum cliprect_mode {
/**
* Batchbuffer contents may be looped over per cliprect, but do not
* require it.
*/
IGNORE_CLIPRECTS,
/**
* Batchbuffer contents require looping over per cliprect at batch submit
* time.
*
* This will be upgraded to NO_LOOP_CLIPRECTS when there's a single
* constant cliprect, as in DRI2 or FBO rendering.
*/
LOOP_CLIPRECTS,
/**
* Batchbuffer contents contain drawing that should not be executed multiple
* times.
*/
NO_LOOP_CLIPRECTS,
/**
* Batchbuffer contents contain drawing that already handles cliprects, such
* as 2D drawing to front/back/depth that doesn't respect DRAWING_RECTANGLE.
*
* Equivalent behavior to NO_LOOP_CLIPRECTS, but may not persist in batch
* outside of LOCK/UNLOCK. This is upgraded to just NO_LOOP_CLIPRECTS when
* there's a constant cliprect, as in DRI2 or FBO rendering.
*/
REFERENCES_CLIPRECTS
};

struct intel_batchbuffer
{
@@ -51,8 +22,6 @@ struct intel_batchbuffer
GLubyte *map;
GLubyte *ptr;

enum cliprect_mode cliprect_mode;

GLuint size;

/** Tracking of BEGIN_BATCH()/OUT_BATCH()/ADVANCE_BATCH() debugging */
@@ -85,8 +54,7 @@ void intel_batchbuffer_reset(struct intel_batchbuffer *batch);
* intel_buffer_dword() calls.
*/
void intel_batchbuffer_data(struct intel_batchbuffer *batch,
const void *data, GLuint bytes,
enum cliprect_mode cliprect_mode);
const void *data, GLuint bytes);

void intel_batchbuffer_release_space(struct intel_batchbuffer *batch,
GLuint bytes);
@@ -121,36 +89,19 @@ intel_batchbuffer_emit_dword(struct intel_batchbuffer *batch, GLuint dword)

static INLINE void
intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
GLuint sz,
enum cliprect_mode cliprect_mode)
GLuint sz)
{
assert(sz < batch->size - 8);
if (intel_batchbuffer_space(batch) < sz)
intel_batchbuffer_flush(batch);

if ((cliprect_mode == LOOP_CLIPRECTS ||
cliprect_mode == REFERENCES_CLIPRECTS) &&
batch->intel->constant_cliprect)
cliprect_mode = NO_LOOP_CLIPRECTS;

if (cliprect_mode != IGNORE_CLIPRECTS) {
if (batch->cliprect_mode == IGNORE_CLIPRECTS) {
batch->cliprect_mode = cliprect_mode;
} else {
if (batch->cliprect_mode != cliprect_mode) {
intel_batchbuffer_flush(batch);
batch->cliprect_mode = cliprect_mode;
}
}
}
}

/* Here are the crusty old macros, to be removed:
*/
#define BATCH_LOCALS

#define BEGIN_BATCH(n, cliprect_mode) do { \
intel_batchbuffer_require_space(intel->batch, (n)*4, cliprect_mode); \
#define BEGIN_BATCH(n) do { \
intel_batchbuffer_require_space(intel->batch, (n)*4); \
assert(intel->batch->emit.start_ptr == NULL); \
intel->batch->emit.total = (n) * 4; \
intel->batch->emit.start_ptr = intel->batch->ptr; \

+ 6
- 142
src/mesa/drivers/dri/intel/intel_blit.c View File

@@ -42,134 +42,6 @@

#define FILE_DEBUG_FLAG DEBUG_BLIT

/**
* Copy the back color buffer to the front color buffer.
* Used for SwapBuffers().
*/
void
intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
const drm_clip_rect_t * rect)
{

struct intel_context *intel;

DBG("%s\n", __FUNCTION__);

assert(dPriv);

intel = intelScreenContext(dPriv->driScreenPriv->private);
if (!intel)
return;

/* The LOCK_HARDWARE is required for the cliprects. Buffer offsets
* should work regardless.
*/
LOCK_HARDWARE(intel);

if (dPriv && dPriv->numClipRects) {
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
struct intel_region *src, *dst;
int nbox = dPriv->numClipRects;
drm_clip_rect_t *pbox = dPriv->pClipRects;
int cpp;
int src_pitch, dst_pitch;
unsigned short src_x, src_y;
int BR13, CMD;
int i;
dri_bo *aper_array[3];

src = intel_get_rb_region(&intel_fb->Base, BUFFER_BACK_LEFT);
dst = intel_get_rb_region(&intel_fb->Base, BUFFER_FRONT_LEFT);

src_pitch = src->pitch * src->cpp;
dst_pitch = dst->pitch * dst->cpp;

cpp = src->cpp;

ASSERT(intel_fb);
ASSERT(intel_fb->Base.Name == 0); /* Not a user-created FBO */
ASSERT(src);
ASSERT(dst);
ASSERT(src->cpp == dst->cpp);

if (cpp == 2) {
BR13 = (0xCC << 16) | BR13_565;
CMD = XY_SRC_COPY_BLT_CMD;
}
else {
BR13 = (0xCC << 16) | BR13_8888;
CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
}

assert(src->tiling != I915_TILING_Y);
assert(dst->tiling != I915_TILING_Y);
#ifndef I915
if (src->tiling != I915_TILING_NONE) {
CMD |= XY_SRC_TILED;
src_pitch /= 4;
}
if (dst->tiling != I915_TILING_NONE) {
CMD |= XY_DST_TILED;
dst_pitch /= 4;
}
#endif
/* do space/cliprects check before going any further */
intel_batchbuffer_require_space(intel->batch, 8 * 4,
REFERENCES_CLIPRECTS);
again:
aper_array[0] = intel->batch->buf;
aper_array[1] = dst->buffer;
aper_array[2] = src->buffer;

if (dri_bufmgr_check_aperture_space(aper_array, 3) != 0) {
intel_batchbuffer_flush(intel->batch);
goto again;
}

for (i = 0; i < nbox; i++, pbox++) {
drm_clip_rect_t box = *pbox;

if (rect) {
if (!intel_intersect_cliprects(&box, &box, rect))
continue;
}

if (box.x1 >= box.x2 ||
box.y1 >= box.y2)
continue;

assert(box.x1 < box.x2);
assert(box.y1 < box.y2);
src_x = box.x1 - dPriv->x + dPriv->backX;
src_y = box.y1 - dPriv->y + dPriv->backY;

BEGIN_BATCH(8, REFERENCES_CLIPRECTS);
OUT_BATCH(CMD);
OUT_BATCH(BR13 | dst_pitch);
OUT_BATCH((box.y1 << 16) | box.x1);
OUT_BATCH((box.y2 << 16) | box.x2);

OUT_RELOC(dst->buffer,
I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
0);
OUT_BATCH((src_y << 16) | src_x);
OUT_BATCH(src_pitch);
OUT_RELOC(src->buffer,
I915_GEM_DOMAIN_RENDER, 0,
0);
ADVANCE_BATCH();
}

/* Flush the rendering and the batch so that the results all land on the
* screen in a timely fashion.
*/
intel_batchbuffer_emit_mi_flush(intel->batch);
intel_batchbuffer_flush(intel->batch);
}

UNLOCK_HARDWARE(intel);
}

static GLuint translate_raster_op(GLenum logicop)
{
switch(logicop) {
@@ -245,7 +117,6 @@ intelEmitCopyBlit(struct intel_context *intel,
} while (pass < 2);

if (pass >= 2) {
LOCK_HARDWARE(intel);
dri_bo_map(dst_buffer, GL_TRUE);
dri_bo_map(src_buffer, GL_FALSE);
_mesa_copy_rect((GLubyte *)dst_buffer->virtual + dst_offset,
@@ -259,12 +130,11 @@ intelEmitCopyBlit(struct intel_context *intel,
dri_bo_unmap(src_buffer);
dri_bo_unmap(dst_buffer);
UNLOCK_HARDWARE(intel);

return GL_TRUE;
}

intel_batchbuffer_require_space(intel->batch, 8 * 4, NO_LOOP_CLIPRECTS);
intel_batchbuffer_require_space(intel->batch, 8 * 4);
DBG("%s src:buf(%p)/%d+%d %d,%d dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
__FUNCTION__,
src_buffer, src_pitch, src_offset, src_x, src_y,
@@ -309,7 +179,7 @@ intelEmitCopyBlit(struct intel_context *intel,
assert(dst_x < dst_x2);
assert(dst_y < dst_y2);

BEGIN_BATCH(8, NO_LOOP_CLIPRECTS);
BEGIN_BATCH(8);
OUT_BATCH(CMD);
OUT_BATCH(BR13 | (uint16_t)dst_pitch);
OUT_BATCH((dst_y << 16) | dst_x);
@@ -367,8 +237,6 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
skipBuffers = BUFFER_BIT_STENCIL;
}

LOCK_HARDWARE(intel);

intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
if (num_cliprects) {
GLint cx, cy, cw, ch;
@@ -525,7 +393,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
assert(x1 < x2);
assert(y1 < y2);

BEGIN_BATCH(6, REFERENCES_CLIPRECTS);
BEGIN_BATCH(6);
OUT_BATCH(CMD);
OUT_BATCH(BR13);
OUT_BATCH((y1 << 16) | x1);
@@ -540,8 +408,6 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
}
}
}

UNLOCK_HARDWARE(intel);
}

GLboolean
@@ -583,8 +449,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
intel_batchbuffer_require_space( intel->batch,
(8 * 4) +
(3 * 4) +
dwords * 4,
REFERENCES_CLIPRECTS );
dwords * 4 );

opcode = XY_SETUP_BLT_CMD;
if (cpp == 4)
@@ -606,7 +471,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
if (dst_tiling != I915_TILING_NONE)
blit_cmd |= XY_DST_TILED;

BEGIN_BATCH(8 + 3, REFERENCES_CLIPRECTS);
BEGIN_BATCH(8 + 3);
OUT_BATCH(opcode);
OUT_BATCH(br13);
OUT_BATCH((0 << 16) | 0); /* clip x1, y1 */
@@ -625,8 +490,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,

intel_batchbuffer_data( intel->batch,
src_bits,
dwords * 4,
REFERENCES_CLIPRECTS );
dwords * 4 );

intel_batchbuffer_emit_mi_flush(intel->batch);


+ 1
- 1
src/mesa/drivers/dri/intel/intel_blit.h View File

@@ -30,7 +30,7 @@

#include "intel_context.h"

extern void intelCopyBuffer(const __DRIdrawablePrivate * dpriv,
extern void intelCopyBuffer(const __DRIdrawable * dpriv,
const drm_clip_rect_t * rect);

extern void intelClearWithBlit(GLcontext * ctx, GLbitfield mask);

+ 12
- 42
src/mesa/drivers/dri/intel/intel_buffers.c View File

@@ -102,33 +102,15 @@ intel_get_cliprects(struct intel_context *intel,
unsigned int *num_cliprects,
int *x_off, int *y_off)
{
__DRIdrawablePrivate *dPriv = intel->driDrawable;

if (intel->constant_cliprect) {
/* FBO or DRI2 rendering, which can just use the fb's size. */
intel->fboRect.x1 = 0;
intel->fboRect.y1 = 0;
intel->fboRect.x2 = intel->ctx.DrawBuffer->Width;
intel->fboRect.y2 = intel->ctx.DrawBuffer->Height;

*cliprects = &intel->fboRect;
*num_cliprects = 1;
*x_off = 0;
*y_off = 0;
} else if (intel->front_cliprects || dPriv->numBackClipRects == 0) {
/* use the front clip rects */
*cliprects = dPriv->pClipRects;
*num_cliprects = dPriv->numClipRects;
*x_off = dPriv->x;
*y_off = dPriv->y;
}
else {
/* use the back clip rects */
*num_cliprects = dPriv->numBackClipRects;
*cliprects = dPriv->pBackClipRects;
*x_off = dPriv->backX;
*y_off = dPriv->backY;
}
intel->fboRect.x1 = 0;
intel->fboRect.y1 = 0;
intel->fboRect.x2 = intel->ctx.DrawBuffer->Width;
intel->fboRect.y2 = intel->ctx.DrawBuffer->Height;

*cliprects = &intel->fboRect;
*num_cliprects = 1;
*x_off = 0;
*y_off = 0;
}


@@ -202,7 +184,6 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
|| (fb->_NumColorDrawBuffers == 0)) {
/* writing to 0 */
colorRegions[0] = NULL;
intel->constant_cliprect = GL_TRUE;
}
else if (fb->_NumColorDrawBuffers > 1) {
int i;
@@ -212,34 +193,23 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
irb = intel_renderbuffer(fb->_ColorDrawBuffers[i]);
colorRegions[i] = irb ? irb->region : NULL;
}
intel->constant_cliprect = GL_TRUE;
}
else {
/* Get the intel_renderbuffer for the single colorbuffer we're drawing
* into, and set up cliprects if it's a DRI1 window front buffer.
* into.
*/
if (fb->Name == 0) {
intel->constant_cliprect = intel->driScreen->dri2.enabled;
/* drawing to window system buffer */
if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {
if (!intel->constant_cliprect && !intel->front_cliprects)
intel_batchbuffer_flush(intel->batch);
intel->front_cliprects = GL_TRUE;
if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT)
colorRegions[0] = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
}
else {
if (!intel->constant_cliprect && intel->front_cliprects)
intel_batchbuffer_flush(intel->batch);
intel->front_cliprects = GL_FALSE;
else
colorRegions[0] = intel_get_rb_region(fb, BUFFER_BACK_LEFT);
}
}
else {
/* drawing to user-created FBO */
struct intel_renderbuffer *irb;
irb = intel_renderbuffer(fb->_ColorDrawBuffers[0]);
colorRegions[0] = (irb && irb->region) ? irb->region : NULL;
intel->constant_cliprect = GL_TRUE;
}
}


+ 38
- 292
src/mesa/drivers/dri/intel/intel_context.c View File

@@ -55,10 +55,8 @@
#include "intel_decode.h"
#include "intel_bufmgr.h"
#include "intel_screen.h"
#include "intel_swapbuffers.h"

#include "drirenderbuffer.h"
#include "vblank.h"
#include "utils.h"
#include "xmlpool.h" /* for symbolic values of enum-type options */

@@ -193,10 +191,11 @@ intel_bits_per_pixel(const struct intel_renderbuffer *rb)
void
intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
{
struct intel_framebuffer *intel_fb = drawable->driverPrivate;
struct gl_framebuffer *fb = drawable->driverPrivate;
struct intel_renderbuffer *rb;
struct intel_region *region, *depth_region;
struct intel_context *intel = context->driverPrivate;
struct intel_renderbuffer *front_rb, *back_rb, *depth_rb, *stencil_rb;
__DRIbuffer *buffers = NULL;
__DRIscreen *screen;
int i, count;
@@ -212,26 +211,25 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
if (screen->dri2.loader
&& (screen->dri2.loader->base.version > 2)
&& (screen->dri2.loader->getBuffersWithFormat != NULL)) {
struct intel_renderbuffer *depth_rb;
struct intel_renderbuffer *stencil_rb;

front_rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT);
back_rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT);
depth_rb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
stencil_rb = intel_get_renderbuffer(fb, BUFFER_STENCIL);

i = 0;
if ((intel->is_front_buffer_rendering ||
intel->is_front_buffer_reading ||
!intel_fb->color_rb[1])
&& intel_fb->color_rb[0]) {
!back_rb) && front_rb) {
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
attachments[i++] = intel_bits_per_pixel(intel_fb->color_rb[0]);
attachments[i++] = intel_bits_per_pixel(front_rb);
}

if (intel_fb->color_rb[1]) {
if (back_rb) {
attachments[i++] = __DRI_BUFFER_BACK_LEFT;
attachments[i++] = intel_bits_per_pixel(intel_fb->color_rb[1]);
attachments[i++] = intel_bits_per_pixel(back_rb);
}

depth_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
stencil_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);

if ((depth_rb != NULL) && (stencil_rb != NULL)) {
attachments[i++] = __DRI_BUFFER_DEPTH_STENCIL;
attachments[i++] = intel_bits_per_pixel(depth_rb);
@@ -252,13 +250,13 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
drawable->loaderPrivate);
} else if (screen->dri2.loader) {
i = 0;
if (intel_fb->color_rb[0])
if (intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT))
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
if (intel_fb->color_rb[1])
if (intel_get_renderbuffer(fb, BUFFER_BACK_LEFT))
attachments[i++] = __DRI_BUFFER_BACK_LEFT;
if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH))
if (intel_get_renderbuffer(fb, BUFFER_DEPTH))
attachments[i++] = __DRI_BUFFER_DEPTH;
if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL))
if (intel_get_renderbuffer(fb, BUFFER_STENCIL))
attachments[i++] = __DRI_BUFFER_STENCIL;

buffers = (*screen->dri2.loader->getBuffers)(drawable,
@@ -291,32 +289,32 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
for (i = 0; i < count; i++) {
switch (buffers[i].attachment) {
case __DRI_BUFFER_FRONT_LEFT:
rb = intel_fb->color_rb[0];
rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT);
region_name = "dri2 front buffer";
break;

case __DRI_BUFFER_FAKE_FRONT_LEFT:
rb = intel_fb->color_rb[0];
rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT);
region_name = "dri2 fake front buffer";
break;

case __DRI_BUFFER_BACK_LEFT:
rb = intel_fb->color_rb[1];
rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT);
region_name = "dri2 back buffer";
break;

case __DRI_BUFFER_DEPTH:
rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
rb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
region_name = "dri2 depth buffer";
break;

case __DRI_BUFFER_DEPTH_STENCIL:
rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
rb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
region_name = "dri2 depth / stencil buffer";
break;

case __DRI_BUFFER_STENCIL:
rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
rb = intel_get_renderbuffer(fb, BUFFER_STENCIL);
region_name = "dri2 stencil buffer";
break;

@@ -363,7 +361,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
intel_region_release(&region);

if (buffers[i].attachment == __DRI_BUFFER_DEPTH_STENCIL) {
rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
rb = intel_get_renderbuffer(fb, BUFFER_STENCIL);
if (rb != NULL) {
struct intel_region *stencil_region = NULL;

@@ -391,9 +389,6 @@ intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
void (*old_viewport)(GLcontext *ctx, GLint x, GLint y,
GLsizei w, GLsizei h);

if (!driContext->driScreenPriv->dri2.enabled)
return;

if (!intel->meta.internal_viewport_call && ctx->DrawBuffer->Name == 0) {
/* If we're rendering to the fake front buffer, make sure all the pending
* drawing has landed on the real front buffer. Otherwise when we
@@ -412,7 +407,6 @@ intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
old_viewport = ctx->Driver.Viewport;
ctx->Driver.Viewport = NULL;
intel->driDrawable = driContext->driDrawablePriv;
intelWindowMoved(intel);
intel_draw_buffer(ctx, intel->ctx.DrawBuffer);
ctx->Driver.Viewport = old_viewport;
}
@@ -478,13 +472,6 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
if (intel->gen < 4)
INTEL_FIREVERTICES(intel);

/* Emit a flush so that any frontbuffer rendering that might have occurred
* lands onscreen in a timely manner, even if the X Server doesn't trigger
* a flush for us.
*/
if (!intel->driScreen->dri2.enabled && needs_mi_flush)
intel_batchbuffer_emit_mi_flush(intel->batch);

if (intel->batch->map != intel->batch->ptr)
intel_batchbuffer_flush(intel->batch);

@@ -590,13 +577,13 @@ intelInitDriverFunctions(struct dd_function_table *functions)
GLboolean
intelInitContext(struct intel_context *intel,
const __GLcontextModes * mesaVis,
__DRIcontextPrivate * driContextPriv,
__DRIcontext * driContextPriv,
void *sharedContextPrivate,
struct dd_function_table *functions)
{
GLcontext *ctx = &intel->ctx;
GLcontext *shareCtx = (GLcontext *) sharedContextPrivate;
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
int bo_reuse_mode;

@@ -609,8 +596,8 @@ intelInitContext(struct intel_context *intel,
driContextPriv->driverPrivate = intel;
intel->intelScreen = intelScreen;
intel->driScreen = sPriv;
intel->sarea = intelScreen->sarea;
intel->driContext = driContextPriv;
intel->driFd = sPriv->fd;

if (IS_965(intel->intelScreen->deviceID)) {
intel->gen = 4;
@@ -632,11 +619,6 @@ intelInitContext(struct intel_context *intel,
intel->is_g4x = GL_TRUE;
}

/* Dri stuff */
intel->hHWContext = driContextPriv->hHWContext;
intel->driFd = sPriv->fd;
intel->driHwLock = sPriv->lock;

driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache,
intel->driScreen->myNum,
(intel->gen >= 4) ? "i965" : "i915");
@@ -750,9 +732,6 @@ intelInitContext(struct intel_context *intel,
if (INTEL_DEBUG & DEBUG_BUFMGR)
dri_bufmgr_set_debug(intel->bufmgr, GL_TRUE);

if (!sPriv->dri2.enabled)
intel_recreate_static_regions(intel);

intel->batch = intel_batchbuffer_alloc(intel);

intel_fbo_init(intel);
@@ -801,7 +780,7 @@ intelInitContext(struct intel_context *intel,
}

void
intelDestroyContext(__DRIcontextPrivate * driContextPriv)
intelDestroyContext(__DRIcontext * driContextPriv)
{
struct intel_context *intel =
(struct intel_context *) driContextPriv->driverPrivate;
@@ -848,57 +827,6 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
*/
}

/* XXX In intelMakeCurrent() below, the context's static regions are
* referenced inside the frame buffer; it's listed as a hack,
* with a comment of "XXX FBO temporary fix-ups!", but
* as long as it's there, we should release the regions here.
* The do/while loop around the block is used to allow the
* "continue" statements inside the block to exit the block,
* to avoid many layers of "if" constructs.
*/
do {
__DRIdrawablePrivate * driDrawPriv = intel->driDrawable;
struct intel_framebuffer *intel_fb;
struct intel_renderbuffer *irbDepth, *irbStencil;
if (!driDrawPriv) {
/* We're already detached from the drawable; exit this block. */
continue;
}
intel_fb = (struct intel_framebuffer *) driDrawPriv->driverPrivate;
if (!intel_fb) {
/* The frame buffer is already gone; exit this block. */
continue;
}
irbDepth = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
irbStencil = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);

/* If the regions of the frame buffer still match the regions
* of the context, release them. If they've changed somehow,
* leave them alone.
*/
if (intel_fb->color_rb[0] && intel_fb->color_rb[0]->region == intel->front_region) {
intel_renderbuffer_set_region(intel_fb->color_rb[0], NULL);
}
if (intel_fb->color_rb[1] && intel_fb->color_rb[1]->region == intel->back_region) {
intel_renderbuffer_set_region(intel_fb->color_rb[1], NULL);
}

if (irbDepth && irbDepth->region == intel->depth_region) {
intel_renderbuffer_set_region(irbDepth, NULL);
}
/* Usually, the stencil buffer is the same as the depth buffer;
* but they're handled separately in MakeCurrent, so we'll
* handle them separately here.
*/
if (irbStencil && irbStencil->region == intel->depth_region) {
intel_renderbuffer_set_region(irbStencil, NULL);
}
} while (0);

intel_region_release(&intel->front_region);
intel_region_release(&intel->back_region);
intel_region_release(&intel->depth_region);

driDestroyOptionCache(&intel->optionCache);

/* free the Mesa context */
@@ -910,7 +838,7 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
}

GLboolean
intelUnbindContext(__DRIcontextPrivate * driContextPriv)
intelUnbindContext(__DRIcontext * driContextPriv)
{
struct intel_context *intel =
(struct intel_context *) driContextPriv->driverPrivate;
@@ -924,11 +852,10 @@ intelUnbindContext(__DRIcontextPrivate * driContextPriv)
}

GLboolean
intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
__DRIdrawablePrivate * driDrawPriv,
__DRIdrawablePrivate * driReadPriv)
intelMakeCurrent(__DRIcontext * driContextPriv,
__DRIdrawable * driDrawPriv,
__DRIdrawable * driReadPriv)
{
__DRIscreenPrivate *psp = driDrawPriv->driScreenPriv;
struct intel_context *intel;
GET_CURRENT_CONTEXT(curCtx);

@@ -946,41 +873,12 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
}

if (driContextPriv) {
struct intel_framebuffer *intel_fb =
(struct intel_framebuffer *) driDrawPriv->driverPrivate;
GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate;
struct gl_framebuffer *fb = driDrawPriv->driverPrivate;
struct gl_framebuffer *readFb = driReadPriv->driverPrivate;
if (driContextPriv->driScreenPriv->dri2.enabled) {
intel_update_renderbuffers(driContextPriv, driDrawPriv);
if (driDrawPriv != driReadPriv)
intel_update_renderbuffers(driContextPriv, driReadPriv);
} else {
/* XXX FBO temporary fix-ups! These are released in
* intelDextroyContext(), above. Changes here should be
* reflected there.
*/
/* if the renderbuffers don't have regions, init them from the context */
struct intel_renderbuffer *irbDepth
= intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
struct intel_renderbuffer *irbStencil
= intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);

if (intel_fb->color_rb[0]) {
intel_renderbuffer_set_region(intel_fb->color_rb[0],
intel->front_region);
}
if (intel_fb->color_rb[1]) {
intel_renderbuffer_set_region(intel_fb->color_rb[1],
intel->back_region);
}

if (irbDepth) {
intel_renderbuffer_set_region(irbDepth, intel->depth_region);
}
if (irbStencil) {
intel_renderbuffer_set_region(irbStencil, intel->depth_region);
}
}
intel_update_renderbuffers(driContextPriv, driDrawPriv);
if (driDrawPriv != driReadPriv)
intel_update_renderbuffers(driContextPriv, driReadPriv);

/* set GLframebuffer size to match window, if needed */
driUpdateFramebufferSize(&intel->ctx, driDrawPriv);
@@ -989,37 +887,10 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
driUpdateFramebufferSize(&intel->ctx, driReadPriv);
}

_mesa_make_current(&intel->ctx, &intel_fb->Base, readFb);

_mesa_make_current(&intel->ctx, fb, readFb);
intel->driReadDrawable = driReadPriv;

if (intel->driDrawable != driDrawPriv) {
if (driDrawPriv->swap_interval == (unsigned)-1) {
int i;

driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0)
? driGetDefaultVBlankFlags(&intel->optionCache)
: VBLANK_FLAG_NO_IRQ;

/* Prevent error printf if one crtc is disabled, this will
* be properly calculated in intelWindowMoved() next.
*/
driDrawPriv->vblFlags = intelFixupVblank(intel, driDrawPriv);

(*psp->systemTime->getUST) (&intel_fb->swap_ust);
driDrawableInitVBlank(driDrawPriv);
intel_fb->vbl_waited = driDrawPriv->vblSeq;

for (i = 0; i < 2; i++) {
if (intel_fb->color_rb[i])
intel_fb->color_rb[i]->vbl_pending = driDrawPriv->vblSeq;
}
}
intel->driDrawable = driDrawPriv;
intelWindowMoved(intel);
}

intel_draw_buffer(&intel->ctx, &intel_fb->Base);
intel->driDrawable = driDrawPriv;
intel_draw_buffer(&intel->ctx, fb);
}
else {
_mesa_make_current(NULL, NULL, NULL);
@@ -1027,128 +898,3 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,

return GL_TRUE;
}

static void
intelContendedLock(struct intel_context *intel, GLuint flags)
{
__DRIdrawablePrivate *dPriv = intel->driDrawable;
__DRIscreenPrivate *sPriv = intel->driScreen;
volatile drm_i915_sarea_t *sarea = intel->sarea;
int me = intel->hHWContext;

drmGetLock(intel->driFd, intel->hHWContext, flags);

if (INTEL_DEBUG & DEBUG_LOCK)
_mesa_printf("%s - got contended lock\n", __progname);

/* If the window moved, may need to set a new cliprect now.
*
* NOTE: This releases and regains the hw lock, so all state
* checking must be done *after* this call:
*/
if (dPriv)
DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);

if (sarea && sarea->ctxOwner != me) {
if (INTEL_DEBUG & DEBUG_BUFMGR) {
fprintf(stderr, "Lost Context: sarea->ctxOwner %x me %x\n",
sarea->ctxOwner, me);
}
sarea->ctxOwner = me;
}

/* Drawable changed?
*/
if (dPriv && intel->lastStamp != dPriv->lastStamp) {
intelWindowMoved(intel);
intel->lastStamp = dPriv->lastStamp;
}
}


_glthread_DECLARE_STATIC_MUTEX(lockMutex);

/* Lock the hardware and validate our state.
*/
void LOCK_HARDWARE( struct intel_context *intel )
{
__DRIdrawable *dPriv = intel->driDrawable;
__DRIscreen *sPriv = intel->driScreen;
char __ret = 0;
struct intel_framebuffer *intel_fb = NULL;
struct intel_renderbuffer *intel_rb = NULL;

intel->locked++;
if (intel->locked >= 2)
return;

if (!sPriv->dri2.enabled)
_glthread_LOCK_MUTEX(lockMutex);

if (intel->driDrawable) {
intel_fb = intel->driDrawable->driverPrivate;

if (intel_fb)
intel_rb =
intel_get_renderbuffer(&intel_fb->Base,
intel_fb->Base._ColorDrawBufferIndexes[0]);
}

if (intel_rb && dPriv->vblFlags &&
!(dPriv->vblFlags & VBLANK_FLAG_NO_IRQ) &&
(intel_fb->vbl_waited - intel_rb->vbl_pending) > (1<<23)) {
drmVBlank vbl;

vbl.request.type = DRM_VBLANK_ABSOLUTE;

if ( dPriv->vblFlags & VBLANK_FLAG_SECONDARY ) {
vbl.request.type |= DRM_VBLANK_SECONDARY;
}

vbl.request.sequence = intel_rb->vbl_pending;
drmWaitVBlank(intel->driFd, &vbl);
intel_fb->vbl_waited = vbl.reply.sequence;
}

if (!sPriv->dri2.enabled) {
DRM_CAS(intel->driHwLock, intel->hHWContext,
(DRM_LOCK_HELD|intel->hHWContext), __ret);

if (__ret)
intelContendedLock( intel, 0 );
}


if (INTEL_DEBUG & DEBUG_LOCK)
_mesa_printf("%s - locked\n", __progname);
}


/* Unlock the hardware using the global current context
*/
void UNLOCK_HARDWARE( struct intel_context *intel )
{
__DRIscreen *sPriv = intel->driScreen;

intel->locked--;
if (intel->locked > 0)
return;

assert(intel->locked == 0);

if (!sPriv->dri2.enabled) {
DRM_UNLOCK(intel->driFd, intel->driHwLock, intel->hHWContext);
_glthread_UNLOCK_MUTEX(lockMutex);
}

if (INTEL_DEBUG & DEBUG_LOCK)
_mesa_printf("%s - unlocked\n", __progname);

/**
* Nothing should be left in batch outside of LOCK/UNLOCK which references
* cliprects.
*/
if (intel->batch->cliprect_mode == REFERENCES_CLIPRECTS)
intel_batchbuffer_flush(intel->batch);
}


+ 5
- 40
src/mesa/drivers/dri/intel/intel_context.h View File

@@ -184,10 +184,6 @@ struct intel_context

int urb_size;

struct intel_region *front_region;
struct intel_region *back_region;
struct intel_region *depth_region;

struct intel_batchbuffer *batch;
drm_intel_bo *first_post_swapbuffers_batch;
GLboolean no_batch_wrap;
@@ -251,19 +247,6 @@ struct intel_context
intel_line_func draw_line;
intel_tri_func draw_tri;

/**
* Set to true if a single constant cliprect should be used in the
* batchbuffer. Otherwise, cliprects must be calculated at batchbuffer
* flush time while the lock is held.
*/
GLboolean constant_cliprect;

/**
* In !constant_cliprect mode, set to true if the front cliprects should be
* used instead of back.
*/
GLboolean front_cliprects;

/**
* Set if rendering has occured to the drawable's front buffer.
*
@@ -295,36 +278,20 @@ struct intel_context
drm_clip_rect_t draw_rect;
drm_clip_rect_t scissor_rect;

drm_context_t hHWContext;
drmLock *driHwLock;
int driFd;

__DRIcontextPrivate *driContext;
__DRIdrawablePrivate *driDrawable;
__DRIdrawablePrivate *driReadDrawable;
__DRIscreenPrivate *driScreen;
__DRIcontext *driContext;
__DRIdrawable *driDrawable;
__DRIdrawable *driReadDrawable;
__DRIscreen *driScreen;
intelScreenPrivate *intelScreen;
volatile drm_i915_sarea_t *sarea;

GLuint lastStamp;

/**
* Configuration cache
*/
driOptionCache optionCache;

int64_t swap_ust;
int64_t swap_missed_ust;

GLuint swap_count;
GLuint swap_missed_count;
};

/* These are functions now:
*/
void LOCK_HARDWARE( struct intel_context *intel );
void UNLOCK_HARDWARE( struct intel_context *intel );

extern char *__progname;


@@ -439,12 +406,10 @@ extern int INTEL_DEBUG;

extern GLboolean intelInitContext(struct intel_context *intel,
const __GLcontextModes * mesaVis,
__DRIcontextPrivate * driContextPriv,
__DRIcontext * driContextPriv,
void *sharedContextPrivate,
struct dd_function_table *functions);

extern void intelGetLock(struct intel_context *intel, GLuint flags);

extern void intelFinish(GLcontext * ctx);
extern void intelFlush(GLcontext * ctx);


+ 3
- 3
src/mesa/drivers/dri/intel/intel_fbo.c View File

@@ -222,7 +222,6 @@ static void
intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb,
GLuint width, GLuint height)
{
struct intel_framebuffer *intel_fb = (struct intel_framebuffer*)fb;
int i;

_mesa_resize_framebuffer(ctx, fb, width, height);
@@ -233,9 +232,10 @@ intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb,
return;
}


/* Make sure all window system renderbuffers are up to date */
for (i = 0; i < 2; i++) {
struct gl_renderbuffer *rb = &intel_fb->color_rb[i]->Base;
for (i = BUFFER_FRONT_LEFT; i <= BUFFER_BACK_RIGHT; i++) {
struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer;

/* only resize if size is changing */
if (rb && (rb->Width != width || rb->Height != height)) {

+ 1
- 24
src/mesa/drivers/dri/intel/intel_fbo.h View File

@@ -33,27 +33,6 @@

struct intel_context;

/**
* Intel framebuffer, derived from gl_framebuffer.
*/
struct intel_framebuffer
{
struct gl_framebuffer Base;

struct intel_renderbuffer *color_rb[2];

/* VBI
*/
GLuint vbl_waited;

int64_t swap_ust;
int64_t swap_missed_ust;

GLuint swap_count;
GLuint swap_missed_count;
};


/**
* Intel renderbuffer, derived from gl_renderbuffer.
*/
@@ -62,8 +41,6 @@ struct intel_renderbuffer
struct gl_renderbuffer Base;
struct intel_region *region;

GLuint vbl_pending; /**< vblank sequence number of pending flip */

uint8_t *span_cache;
unsigned long span_cache_offset;
};
@@ -121,7 +98,7 @@ intel_fbo_init(struct intel_context *intel);


extern void
intel_flip_renderbuffers(struct intel_framebuffer *intel_fb);
intel_flip_renderbuffers(struct gl_framebuffer *fb);


static INLINE struct intel_region *

+ 0
- 3
src/mesa/drivers/dri/intel/intel_pixel_bitmap.c View File

@@ -236,8 +236,6 @@ do_blit_bitmap( GLcontext *ctx,
if (!intel_check_blit_fragment_ops(ctx, tmpColor[3] == 1.0F))
return GL_FALSE;

LOCK_HARDWARE(intel);

intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
if (num_cliprects != 0) {
GLuint i;
@@ -325,7 +323,6 @@ do_blit_bitmap( GLcontext *ctx,
}
}
out:
UNLOCK_HARDWARE(intel);

if (INTEL_DEBUG & DEBUG_SYNC)
intel_batchbuffer_flush(intel->batch);

+ 12
- 11
src/mesa/drivers/dri/intel/intel_pixel_copy.c View File

@@ -35,28 +35,33 @@
#include "intel_buffers.h"
#include "intel_regions.h"
#include "intel_pixel.h"
#include "intel_fbo.h"

#define FILE_DEBUG_FLAG DEBUG_PIXEL

static struct intel_region *
copypix_src_region(struct intel_context *intel, GLenum type)
{
struct intel_renderbuffer *depth;

depth = (struct intel_renderbuffer *)
&intel->ctx.DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;

switch (type) {
case GL_COLOR:
return intel_readbuf_region(intel);
case GL_DEPTH:
/* Don't think this is really possible execpt at 16bpp, when we have no stencil.
*/
if (intel->depth_region && intel->depth_region->cpp == 2)
return intel->depth_region;
/* Don't think this is really possible execpt at 16bpp, when we
* have no stencil. */
if (depth && depth->region->cpp == 2)
return depth->region;
case GL_STENCIL:
/* Don't think this is really possible.
*/
/* Don't think this is really possible. */
break;
case GL_DEPTH_STENCIL_EXT:
/* Does it matter whether it is stencil/depth or depth/stencil?
*/
return intel->depth_region;
return depth->region;
default:
break;
}
@@ -134,8 +139,6 @@ do_blit_copypixels(GLcontext * ctx,

intelFlush(&intel->ctx);

LOCK_HARDWARE(intel);

intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
if (num_cliprects != 0) {
GLint delta_x;
@@ -214,13 +217,11 @@ do_blit_copypixels(GLcontext * ctx,
ctx->Color.ColorLogicOpEnabled ?
ctx->Color.LogicOp : GL_COPY)) {
DBG("%s: blit failure\n", __FUNCTION__);
UNLOCK_HARDWARE(intel);
return GL_FALSE;
}
}
}
out:
UNLOCK_HARDWARE(intel);

intel_check_front_buffer_rendering(intel);


+ 2
- 9
src/mesa/drivers/dri/intel/intel_pixel_read.c View File

@@ -77,7 +77,7 @@ do_texture_readpixels(GLcontext * ctx,
struct intel_context *intel = intel_context(ctx);
intelScreenPrivate *screen = intel->intelScreen;
GLint pitch = pack->RowLength ? pack->RowLength : width;
__DRIdrawablePrivate *dPriv = intel->driDrawable;
__DRIdrawable *dPriv = intel->driDrawable;
int textureFormat;
GLenum glTextureFormat;
int destFormat, depthFormat, destPitch;
@@ -105,15 +105,12 @@ do_texture_readpixels(GLcontext * ctx,
return GL_FALSE;
}

LOCK_HARDWARE(intel);

if (intel->driDrawable->numClipRects) {
intel->vtbl.install_meta_state(intel);
intel->vtbl.meta_no_depth_write(intel);
intel->vtbl.meta_no_stencil_write(intel);

if (!driClipRectToFramebuffer(ctx->ReadBuffer, &x, &y, &width, &height)) {
UNLOCK_HARDWARE(intel);
SET_STATE(i830, state);
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s: cliprect failed\n", __FUNCTION__);
@@ -150,7 +147,6 @@ do_texture_readpixels(GLcontext * ctx,

intel->vtbl.leave_meta_state(intel);
}
UNLOCK_HARDWARE(intel);

intel_region_wait_fence(ctx, dest_region); /* required by GL */
return GL_TRUE;
@@ -224,7 +220,6 @@ do_blit_readpixels(GLcontext * ctx,
* fire with lock held to guarentee cliprects are correct.
*/
intelFlush(&intel->ctx);
LOCK_HARDWARE(intel);

if (intel->driReadDrawable->numClipRects) {
GLboolean all = (width * height * src->cpp == dst->Base.Size &&
@@ -233,7 +228,7 @@ do_blit_readpixels(GLcontext * ctx,
dri_bo *dst_buffer = intel_bufferobj_buffer(intel, dst,
all ? INTEL_WRITE_FULL :
INTEL_WRITE_PART);
__DRIdrawablePrivate *dPriv = intel->driReadDrawable;
__DRIdrawable *dPriv = intel->driReadDrawable;
int nbox = dPriv->numClipRects;
drm_clip_rect_t *box = dPriv->pClipRects;
drm_clip_rect_t rect;
@@ -261,12 +256,10 @@ do_blit_readpixels(GLcontext * ctx,
rect.y2 - src_rect.y2,
rect.x2 - rect.x1, rect.y2 - rect.y1,
GL_COPY)) {
UNLOCK_HARDWARE(intel);
return GL_FALSE;
}
}
}
UNLOCK_HARDWARE(intel);

if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - DONE\n", __FUNCTION__);

+ 0
- 89
src/mesa/drivers/dri/intel/intel_regions.c View File

@@ -362,14 +362,12 @@ intel_region_data(struct intel_context *intel,
intel_region_cow(intel, dst);
}

LOCK_HARDWARE(intel);
_mesa_copy_rect(intel_region_map(intel, dst) + dst_offset,
dst->cpp,
dst->pitch,
dstx, dsty, width, height, src, src_pitch, srcx, srcy);

intel_region_unmap(intel, dst);
UNLOCK_HARDWARE(intel);
}

/* Copy rectangular sub-regions. Need better logic about when to
@@ -485,7 +483,6 @@ intel_region_cow(struct intel_context *intel, struct intel_region *region)
/* Now blit from the texture buffer to the new buffer:
*/

LOCK_HARDWARE(intel);
ok = intelEmitCopyBlit(intel,
region->cpp,
region->pitch, pbo->buffer, 0, region->tiling,
@@ -494,7 +491,6 @@ intel_region_cow(struct intel_context *intel, struct intel_region *region)
region->pitch, region->height,
GL_COPY);
assert(ok);
UNLOCK_HARDWARE(intel);
}

dri_bo *
@@ -510,88 +506,3 @@ intel_region_buffer(struct intel_context *intel,

return region->buffer;
}

static struct intel_region *
intel_recreate_static(struct intel_context *intel,
const char *name,
struct intel_region *region,
intelRegion *region_desc)
{
intelScreenPrivate *intelScreen = intel->intelScreen;
int ret;

if (region == NULL) {
region = calloc(sizeof(*region), 1);
region->refcount = 1;
_DBG("%s creating new region %p\n", __FUNCTION__, region);
}
else {
_DBG("%s %p\n", __FUNCTION__, region);
}

if (intel->ctx.Visual.rgbBits == 24)
region->cpp = 4;
else
region->cpp = intel->ctx.Visual.rgbBits / 8;
region->pitch = intelScreen->pitch;
region->width = intelScreen->width;
region->height = intelScreen->height;

if (region->buffer != NULL) {
dri_bo_unreference(region->buffer);
region->buffer = NULL;
}

assert(region_desc->bo_handle != -1);
region->buffer = intel_bo_gem_create_from_name(intel->bufmgr,
name,
region_desc->bo_handle);

ret = dri_bo_get_tiling(region->buffer, &region->tiling,
&region->bit_6_swizzle);
if (ret != 0) {
fprintf(stderr, "Couldn't get tiling of buffer %d (%s): %s\n",
region_desc->bo_handle, name, strerror(-ret));
intel_region_release(&region);
return NULL;
}

assert(region->buffer != NULL);

return region;
}

/**
* Create intel_region structs to describe the static front, back, and depth
* buffers created by the xserver.
*
* Although FBO's mean we now no longer use these as render targets in
* all circumstances, they won't go away until the back and depth
* buffers become private, and the front buffer will remain even then.
*
* Note that these don't allocate video memory, just describe
* allocations alread made by the X server.
*/
void
intel_recreate_static_regions(struct intel_context *intel)
{
intelScreenPrivate *intelScreen = intel->intelScreen;

intel->front_region =
intel_recreate_static(intel, "front",
intel->front_region,
&intelScreen->front);

intel->back_region =
intel_recreate_static(intel, "back",
intel->back_region,
&intelScreen->back);

/* Still assumes front.cpp == depth.cpp. We can kill this when we move to
* private buffers.
*/
intel->depth_region =
intel_recreate_static(intel, "depth",
intel->depth_region,
&intelScreen->depth);
}

+ 37
- 437
src/mesa/drivers/dri/intel/intel_screen.c View File

@@ -31,7 +31,6 @@
#include "main/renderbuffer.h"

#include "utils.h"
#include "vblank.h"
#include "xmlpool.h"

#include "intel_batchbuffer.h"
@@ -41,7 +40,6 @@
#include "intel_extensions.h"
#include "intel_fbo.h"
#include "intel_regions.h"
#include "intel_swapbuffers.h"
#include "intel_screen.h"
#include "intel_span.h"
#include "intel_tex.h"
@@ -104,127 +102,6 @@ const GLuint __driNConfigOptions = 11;
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
#endif /*USE_NEW_INTERFACE */

/**
* Map all the memory regions described by the screen.
* \return GL_TRUE if success, GL_FALSE if error.
*/
GLboolean
intelMapScreenRegions(__DRIscreenPrivate * sPriv)
{
intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;

if (0)
_mesa_printf("TEX 0x%08x ", intelScreen->tex.handle);
if (intelScreen->tex.size != 0) {
if (drmMap(sPriv->fd,
intelScreen->tex.handle,
intelScreen->tex.size,
(drmAddress *) & intelScreen->tex.map) != 0) {
intelUnmapScreenRegions(intelScreen);
return GL_FALSE;
}
}

return GL_TRUE;
}

void
intelUnmapScreenRegions(intelScreenPrivate * intelScreen)
{
if (intelScreen->tex.map) {
drmUnmap(intelScreen->tex.map, intelScreen->tex.size);
intelScreen->tex.map = NULL;
}
}


static void
intelPrintDRIInfo(intelScreenPrivate * intelScreen,
__DRIscreenPrivate * sPriv, I830DRIPtr gDRIPriv)
{
fprintf(stderr, "*** Front size: 0x%x offset: 0x%x pitch: %d\n",
intelScreen->front.size, intelScreen->front.offset,
intelScreen->pitch);
fprintf(stderr, "*** Back size: 0x%x offset: 0x%x pitch: %d\n",
intelScreen->back.size, intelScreen->back.offset,
intelScreen->pitch);
fprintf(stderr, "*** Depth size: 0x%x offset: 0x%x pitch: %d\n",
intelScreen->depth.size, intelScreen->depth.offset,
intelScreen->pitch);
fprintf(stderr, "*** Texture size: 0x%x offset: 0x%x\n",
intelScreen->tex.size, intelScreen->tex.offset);
fprintf(stderr, "*** Memory : 0x%x\n", gDRIPriv->mem);
}


static void
intelPrintSAREA(const drm_i915_sarea_t * sarea)
{
fprintf(stderr, "SAREA: sarea width %d height %d\n", sarea->width,
sarea->height);
fprintf(stderr, "SAREA: pitch: %d\n", sarea->pitch);
fprintf(stderr,
"SAREA: front offset: 0x%08x size: 0x%x handle: 0x%x tiled: %d\n",
sarea->front_offset, sarea->front_size,
(unsigned) sarea->front_handle, sarea->front_tiled);
fprintf(stderr,
"SAREA: back offset: 0x%08x size: 0x%x handle: 0x%x tiled: %d\n",
sarea->back_offset, sarea->back_size,
(unsigned) sarea->back_handle, sarea->back_tiled);
fprintf(stderr, "SAREA: depth offset: 0x%08x size: 0x%x handle: 0x%x tiled: %d\n",
sarea->depth_offset, sarea->depth_size,
(unsigned) sarea->depth_handle, sarea->depth_tiled);
fprintf(stderr, "SAREA: tex offset: 0x%08x size: 0x%x handle: 0x%x\n",
sarea->tex_offset, sarea->tex_size, (unsigned) sarea->tex_handle);
}


/**
* A number of the screen parameters are obtained/computed from
* information in the SAREA. This function updates those parameters.
*/
static void
intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen,
drm_i915_sarea_t * sarea)
{
intelScreen->width = sarea->width;
intelScreen->height = sarea->height;
intelScreen->pitch = sarea->pitch;

intelScreen->front.offset = sarea->front_offset;
intelScreen->front.handle = sarea->front_handle;
intelScreen->front.size = sarea->front_size;
intelScreen->front.tiled = sarea->front_tiled;

intelScreen->back.offset = sarea->back_offset;
intelScreen->back.handle = sarea->back_handle;
intelScreen->back.size = sarea->back_size;
intelScreen->back.tiled = sarea->back_tiled;

intelScreen->depth.offset = sarea->depth_offset;
intelScreen->depth.handle = sarea->depth_handle;
intelScreen->depth.size = sarea->depth_size;
intelScreen->depth.tiled = sarea->depth_tiled;

if (intelScreen->driScrnPriv->ddx_version.minor >= 9) {
intelScreen->front.bo_handle = sarea->front_bo_handle;
intelScreen->back.bo_handle = sarea->back_bo_handle;
intelScreen->depth.bo_handle = sarea->depth_bo_handle;
} else {
intelScreen->front.bo_handle = -1;
intelScreen->back.bo_handle = -1;
intelScreen->depth.bo_handle = -1;
}

intelScreen->tex.offset = sarea->tex_offset;
intelScreen->logTextureGranularity = sarea->log_tex_granularity;
intelScreen->tex.handle = sarea->tex_handle;
intelScreen->tex.size = sarea->tex_size;

if (0)
intelPrintSAREA(sarea);
}

static const __DRItexOffsetExtension intelTexOffsetExtension = {
{ __DRI_TEX_OFFSET },
intelSetTexOffset,
@@ -238,17 +115,13 @@ static const __DRItexBufferExtension intelTexBufferExtension = {

static const __DRIextension *intelScreenExtensions[] = {
&driReadDrawableExtension,
&driCopySubBufferExtension.base,
&driSwapControlExtension.base,
&driFrameTrackingExtension.base,
&driMediaStreamCounterExtension.base,
&intelTexOffsetExtension.base,
&intelTexBufferExtension.base,
NULL
};

static GLboolean
intel_get_param(__DRIscreenPrivate *psp, int param, int *value)
intel_get_param(__DRIscreen *psp, int param, int *value)
{
int ret;
struct drm_i915_getparam gp;
@@ -265,68 +138,12 @@ intel_get_param(__DRIscreenPrivate *psp, int param, int *value)
return GL_TRUE;
}

static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
{
intelScreenPrivate *intelScreen;
I830DRIPtr gDRIPriv = (I830DRIPtr) sPriv->pDevPriv;
drm_i915_sarea_t *sarea;

if (sPriv->devPrivSize != sizeof(I830DRIRec)) {
fprintf(stderr,
"\nERROR! sizeof(I830DRIRec) does not match passed size from device driver\n");
return GL_FALSE;
}

/* Allocate the private area */
intelScreen = (intelScreenPrivate *) CALLOC(sizeof(intelScreenPrivate));
if (!intelScreen) {
fprintf(stderr, "\nERROR! Allocating private area failed\n");
return GL_FALSE;
}
/* parse information in __driConfigOptions */
driParseOptionInfo(&intelScreen->optionCache,
__driConfigOptions, __driNConfigOptions);

intelScreen->driScrnPriv = sPriv;
sPriv->private = (void *) intelScreen;
sarea = (drm_i915_sarea_t *)
(((GLubyte *) sPriv->pSAREA) + gDRIPriv->sarea_priv_offset);
intelScreen->sarea = sarea;

intelScreen->deviceID = gDRIPriv->deviceID;

intelUpdateScreenFromSAREA(intelScreen, sarea);

if (!intelMapScreenRegions(sPriv)) {
fprintf(stderr, "\nERROR! mapping regions\n");
_mesa_free(intelScreen);
sPriv->private = NULL;
return GL_FALSE;
}

if (0)
intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv);

intelScreen->drmMinor = sPriv->drm_version.minor;

/* Determine if IRQs are active? */
if (!intel_get_param(sPriv, I915_PARAM_IRQ_ACTIVE,
&intelScreen->irq_active))
return GL_FALSE;

sPriv->extensions = intelScreenExtensions;

return GL_TRUE;
}


static void
intelDestroyScreen(__DRIscreenPrivate * sPriv)
intelDestroyScreen(__DRIscreen * sPriv)
{
intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;

dri_bufmgr_destroy(intelScreen->bufmgr);
intelUnmapScreenRegions(intelScreen);
driDestroyOptionInfo(&intelScreen->optionCache);

FREE(intelScreen);
@@ -338,10 +155,12 @@ intelDestroyScreen(__DRIscreenPrivate * sPriv)
* This is called when we need to set up GL rendering to a new X window.
*/
static GLboolean
intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
__DRIdrawablePrivate * driDrawPriv,
intelCreateBuffer(__DRIscreen * driScrnPriv,
__DRIdrawable * driDrawPriv,
const __GLcontextModes * mesaVis, GLboolean isPixmap)
{
struct intel_renderbuffer *rb;

if (isPixmap) {
return GL_FALSE; /* not implemented */
}
@@ -350,12 +169,12 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
mesaVis->depthBits != 24);
gl_format rgbFormat;

struct intel_framebuffer *intel_fb = CALLOC_STRUCT(intel_framebuffer);
struct gl_framebuffer *fb = CALLOC_STRUCT(gl_framebuffer);

if (!intel_fb)
if (!fb)
return GL_FALSE;

_mesa_initialize_framebuffer(&intel_fb->Base, mesaVis);
_mesa_initialize_framebuffer(fb, mesaVis);

if (mesaVis->redBits == 5)
rgbFormat = MESA_FORMAT_RGB565;
@@ -365,16 +184,12 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
rgbFormat = MESA_FORMAT_ARGB8888;

/* setup the hardware-based renderbuffers */
intel_fb->color_rb[0] = intel_create_renderbuffer(rgbFormat);
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT,
&intel_fb->color_rb[0]->Base);
rb = intel_create_renderbuffer(rgbFormat);
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &rb->Base);

if (mesaVis->doubleBufferMode) {
intel_fb->color_rb[1] = intel_create_renderbuffer(rgbFormat);

_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT,
&intel_fb->color_rb[1]->Base);

rb = intel_create_renderbuffer(rgbFormat);
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &rb->Base);
}

if (mesaVis->depthBits == 24) {
@@ -383,115 +198,63 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
struct intel_renderbuffer *depthStencilRb
= intel_create_renderbuffer(MESA_FORMAT_S8_Z24);
/* note: bind RB to two attachment points */
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH,
&depthStencilRb->Base);
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_STENCIL,
&depthStencilRb->Base);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthStencilRb->Base);
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &depthStencilRb->Base);
} else {
struct intel_renderbuffer *depthRb
= intel_create_renderbuffer(MESA_FORMAT_X8_Z24);
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH,
&depthRb->Base);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
}
}
else if (mesaVis->depthBits == 16) {
/* just 16-bit depth buffer, no hw stencil */
struct intel_renderbuffer *depthRb
= intel_create_renderbuffer(MESA_FORMAT_Z16);
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthRb->Base);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
}

/* now add any/all software-based renderbuffers we may need */
_mesa_add_soft_renderbuffers(&intel_fb->Base,
_mesa_add_soft_renderbuffers(fb,
GL_FALSE, /* never sw color */
GL_FALSE, /* never sw depth */
swStencil, mesaVis->accumRedBits > 0,
GL_FALSE, /* never sw alpha */
GL_FALSE /* never sw aux */ );
driDrawPriv->driverPrivate = (void *) intel_fb;
driDrawPriv->driverPrivate = fb;

return GL_TRUE;
}
}

static void
intelDestroyBuffer(__DRIdrawablePrivate * driDrawPriv)
intelDestroyBuffer(__DRIdrawable * driDrawPriv)
{
struct intel_framebuffer *intel_fb = driDrawPriv->driverPrivate;
struct intel_renderbuffer *depth_rb;
struct intel_renderbuffer *stencil_rb;

if (intel_fb) {
if (intel_fb->color_rb[0]) {
intel_renderbuffer_set_region(intel_fb->color_rb[0], NULL);
}

if (intel_fb->color_rb[1]) {
intel_renderbuffer_set_region(intel_fb->color_rb[1], NULL);
}

depth_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
if (depth_rb) {
intel_renderbuffer_set_region(depth_rb, NULL);
}

stencil_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
if (stencil_rb) {
intel_renderbuffer_set_region(stencil_rb, NULL);
}
}

_mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
struct gl_framebuffer *fb = driDrawPriv->driverPrivate;
_mesa_reference_framebuffer(&fb, NULL);
}


/**
* Get information about previous buffer swaps.
*/
static int
intelGetSwapInfo(__DRIdrawablePrivate * dPriv, __DRIswapInfo * sInfo)
{
struct intel_framebuffer *intel_fb;

if ((dPriv == NULL) || (dPriv->driverPrivate == NULL)
|| (sInfo == NULL)) {
return -1;
}

intel_fb = dPriv->driverPrivate;
sInfo->swap_count = intel_fb->swap_count;
sInfo->swap_ust = intel_fb->swap_ust;
sInfo->swap_missed_count = intel_fb->swap_missed_count;

sInfo->swap_missed_usage = (sInfo->swap_missed_count != 0)
? driCalculateSwapUsage(dPriv, 0, intel_fb->swap_missed_ust)
: 0.0;

return 0;
}


/* There are probably better ways to do this, such as an
* init-designated function to register chipids and createcontext
* functions.
*/
extern GLboolean i830CreateContext(const __GLcontextModes * mesaVis,
__DRIcontextPrivate * driContextPriv,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);

extern GLboolean i915CreateContext(const __GLcontextModes * mesaVis,
__DRIcontextPrivate * driContextPriv,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
extern GLboolean brwCreateContext(const __GLcontextModes * mesaVis,
__DRIcontextPrivate * driContextPriv,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);

static GLboolean
intelCreateContext(const __GLcontextModes * mesaVis,
__DRIcontextPrivate * driContextPriv,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;

#ifdef I915
@@ -512,120 +275,14 @@ intelCreateContext(const __GLcontextModes * mesaVis,
return GL_FALSE;
}


static __DRIconfig **
intelFillInModes(__DRIscreenPrivate *psp,
unsigned pixel_bits, unsigned depth_bits,
unsigned stencil_bits, GLboolean have_back_buffer)
{
__DRIconfig **configs;
__GLcontextModes *m;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
int i;

/* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
* support pageflipping at all.
*/
static const GLenum back_buffer_modes[] = {
GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
};

uint8_t depth_bits_array[3];
uint8_t stencil_bits_array[3];
uint8_t msaa_samples_array[1];

depth_bits_array[0] = 0;
depth_bits_array[1] = depth_bits;
depth_bits_array[2] = depth_bits;

/* Just like with the accumulation buffer, always provide some modes
* with a stencil buffer. It will be a sw fallback, but some apps won't
* care about that.
*/
stencil_bits_array[0] = 0;
stencil_bits_array[1] = 0;
if (depth_bits == 24)
stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;

stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits;

msaa_samples_array[0] = 0;

depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1;
back_buffer_factor = (have_back_buffer) ? 3 : 1;

if (pixel_bits == 16) {
configs = driCreateConfigs(GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
back_buffer_factor,
msaa_samples_array, 1);
}
else {
__DRIconfig **configs_a8r8g8b8;
__DRIconfig **configs_x8r8g8b8;

configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
depth_bits_array,
stencil_bits_array,
depth_buffer_factor,
back_buffer_modes,
back_buffer_factor,
msaa_samples_array, 1);
configs_x8r8g8b8 = driCreateConfigs(GL_BGR, GL_UNSIGNED_INT_8_8_8_8_REV,
depth_bits_array,
stencil_bits_array,
depth_buffer_factor,
back_buffer_modes,
back_buffer_factor,
msaa_samples_array, 1);
configs = driConcatConfigs(configs_a8r8g8b8, configs_x8r8g8b8);
}

if (configs == NULL) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
__LINE__);
return NULL;
}

/* Mark the visual as slow if there are "fake" stencil bits.
*/
for (i = 0; configs[i]; i++) {
m = &configs[i]->modes;
if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) {
m->visualRating = GLX_SLOW_CONFIG;
}
}

return configs;
}

static GLboolean
intel_init_bufmgr(intelScreenPrivate *intelScreen)
{
int gem_kernel = 0;
struct drm_i915_getparam gp;
__DRIscreenPrivate *spriv = intelScreen->driScrnPriv;
__DRIscreen *spriv = intelScreen->driScrnPriv;
int num_fences = 0;

intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL;

gp.param = I915_PARAM_HAS_GEM;
gp.value = &gem_kernel;

(void) drmCommandWriteRead(spriv->fd, DRM_I915_GETPARAM, &gp, sizeof(gp));

/* If we've got a new enough DDX that's initializing GEM and giving us
* object handles for the shared buffers, use that.
*/
if (!intelScreen->driScrnPriv->dri2.enabled &&
intelScreen->driScrnPriv->ddx_version.minor < 9) {
fprintf(stderr, "[%s:%u] Error initializing GEM.\n",
__func__, __LINE__);
return GL_FALSE;
}

intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ);
/* Otherwise, use the classic buffer manager. */
if (intelScreen->bufmgr == NULL) {
@@ -642,63 +299,6 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen)
return GL_TRUE;
}

/**
* This is the driver specific part of the createNewScreen entry point.
* Called when using legacy DRI.
*
* \todo maybe fold this into intelInitDriver
*
* \return the __GLcontextModes supported by this driver
*/
static const __DRIconfig **intelInitScreen(__DRIscreenPrivate *psp)
{
intelScreenPrivate *intelScreen;
#ifdef I915
static const __DRIversion ddx_expected = { 1, 5, 0 };
#else
static const __DRIversion ddx_expected = { 1, 6, 0 };
#endif
static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 1, 5, 0 };
I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv;

if (!driCheckDriDdxDrmVersions2("i915",
&psp->dri_version, &dri_expected,
&psp->ddx_version, &ddx_expected,
&psp->drm_version, &drm_expected)) {
return NULL;
}

if (!intelInitDriver(psp))
return NULL;

psp->extensions = intelScreenExtensions;

intelScreen = psp->private;
if (!intel_init_bufmgr(intelScreen))
return GL_FALSE;

return (const __DRIconfig **)
intelFillInModes(psp, dri_priv->cpp * 8,
(dri_priv->cpp == 2) ? 16 : 24,
(dri_priv->cpp == 2) ? 0 : 8, 1);
}

struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen)
{
/*
* This should probably change to have the screen allocate a dummy
* context at screen creation. For now just use the current context.
*/

GET_CURRENT_CONTEXT(ctx);
if (ctx == NULL) {
_mesa_problem(NULL, "No current context in intelScreenContext\n");
return NULL;
}
return intel_context(ctx);
}

/**
* This is the driver specific part of the createNewScreen entry point.
* Called when using DRI2.
@@ -706,7 +306,7 @@ struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen)
* \return the __GLcontextModes supported by this driver
*/
static const
__DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp)
__DRIconfig **intelInitScreen2(__DRIscreen *psp)
{
intelScreenPrivate *intelScreen;
GLenum fb_format[3];
@@ -815,19 +415,19 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp)
}

const struct __DriverAPIRec driDriverAPI = {
.InitScreen = intelInitScreen,
.DestroyScreen = intelDestroyScreen,
.CreateContext = intelCreateContext,
.DestroyContext = intelDestroyContext,
.CreateBuffer = intelCreateBuffer,
.DestroyBuffer = intelDestroyBuffer,
.SwapBuffers = intelSwapBuffers,
.MakeCurrent = intelMakeCurrent,
.UnbindContext = intelUnbindContext,
.GetSwapInfo = intelGetSwapInfo,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.CopySubBuffer = intelCopySubBuffer,

.InitScreen2 = intelInitScreen2,
};

/* This is the table of extensions that the loader will dlsym() for. */
PUBLIC const __DRIextension *__driDriverExtensions[] = {
&driCoreExtension.base,
&driDRI2Extension.base,
NULL
};

+ 7
- 7
src/mesa/drivers/dri/intel/intel_screen.h View File

@@ -66,7 +66,7 @@ typedef struct

int logTextureGranularity;

__DRIscreenPrivate *driScrnPriv;
__DRIscreen *driScrnPriv;

volatile drm_i915_sarea_t *sarea;

@@ -88,18 +88,18 @@ typedef struct



extern GLboolean intelMapScreenRegions(__DRIscreenPrivate * sPriv);
extern GLboolean intelMapScreenRegions(__DRIscreen * sPriv);

extern void intelUnmapScreenRegions(intelScreenPrivate * intelScreen);

extern void intelDestroyContext(__DRIcontextPrivate * driContextPriv);
extern void intelDestroyContext(__DRIcontext * driContextPriv);

extern GLboolean intelUnbindContext(__DRIcontextPrivate * driContextPriv);
extern GLboolean intelUnbindContext(__DRIcontext * driContextPriv);

extern GLboolean
intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
__DRIdrawablePrivate * driDrawPriv,
__DRIdrawablePrivate * driReadPriv);
intelMakeCurrent(__DRIcontext * driContextPriv,
__DRIdrawable * driDrawPriv,
__DRIdrawable * driReadPriv);

extern struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen);


+ 0
- 3
src/mesa/drivers/dri/intel/intel_span.c View File

@@ -517,7 +517,6 @@ intelSpanRenderStart(GLcontext * ctx)
GLuint i;

intelFlush(&intel->ctx);
LOCK_HARDWARE(intel);

for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
if (ctx->Texture.Unit[i]._ReallyEnabled) {
@@ -553,8 +552,6 @@ intelSpanRenderFinish(GLcontext * ctx)
intel_map_unmap_framebuffer(intel, ctx->DrawBuffer, GL_FALSE);
if (ctx->ReadBuffer != ctx->DrawBuffer)
intel_map_unmap_framebuffer(intel, ctx->ReadBuffer, GL_FALSE);

UNLOCK_HARDWARE(intel);
}



+ 0
- 248
src/mesa/drivers/dri/intel/intel_swapbuffers.c View File

@@ -1,248 +0,0 @@
/**************************************************************************
*
* Copyright 2003 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.
*
**************************************************************************/

#include "intel_blit.h"
#include "intel_buffers.h"
#include "intel_swapbuffers.h"
#include "intel_fbo.h"
#include "intel_batchbuffer.h"
#include "drirenderbuffer.h"
#include "vblank.h"
#include "i915_drm.h"



/*
* Correct a drawablePrivate's set of vblank flags WRT the current context.
* When considering multiple crtcs.
*/
GLuint
intelFixupVblank(struct intel_context *intel, __DRIdrawablePrivate *dPriv)
{
if (!intel->intelScreen->driScrnPriv->dri2.enabled &&
intel->intelScreen->driScrnPriv->ddx_version.minor >= 7) {
volatile drm_i915_sarea_t *sarea = intel->sarea;
drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w,
.y1 = dPriv->y, .y2 = dPriv->y + dPriv->h };
drm_clip_rect_t planeA_rect = { .x1 = sarea->planeA_x, .y1 = sarea->planeA_y,
.x2 = sarea->planeA_x + sarea->planeA_w,
.y2 = sarea->planeA_y + sarea->planeA_h };
drm_clip_rect_t planeB_rect = { .x1 = sarea->planeB_x, .y1 = sarea->planeB_y,
.x2 = sarea->planeB_x + sarea->planeB_w,
.y2 = sarea->planeB_y + sarea->planeB_h };
GLint areaA = driIntersectArea( drw_rect, planeA_rect );
GLint areaB = driIntersectArea( drw_rect, planeB_rect );
GLuint flags;

/* Update vblank info
*/
if (areaB > areaA || (areaA == areaB && areaB > 0)) {
flags = dPriv->vblFlags | VBLANK_FLAG_SECONDARY;
} else {
flags = dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY;
}

/* Do the stupid test: Is one of them actually disabled?
*/
if (sarea->planeA_w == 0 || sarea->planeA_h == 0) {
flags = dPriv->vblFlags | VBLANK_FLAG_SECONDARY;
} else if (sarea->planeB_w == 0 || sarea->planeB_h == 0) {
flags = dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY;
}

return flags;
} else {
return dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY;
}
}


/**
* Called from driSwapBuffers()
*/
void
intelSwapBuffers(__DRIdrawablePrivate * dPriv)
{
__DRIscreenPrivate *psp = dPriv->driScreenPriv;

if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
GET_CURRENT_CONTEXT(ctx);
struct intel_context *intel;

if (ctx == NULL)
return;

intel = intel_context(ctx);

if (ctx->Visual.doubleBufferMode) {
GLboolean missed_target;
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
int64_t ust;
_mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */

/*
* The old swapping ioctl was incredibly racy, just wait for vblank
* and do the swap ourselves.
*/
driWaitForVBlank(dPriv, &missed_target);

/*
* Update each buffer's vbl_pending so we don't get too out of
* sync
*/
intel_get_renderbuffer(&intel_fb->Base,
BUFFER_BACK_LEFT)->vbl_pending = dPriv->vblSeq;
intel_get_renderbuffer(&intel_fb->Base,
BUFFER_FRONT_LEFT)->vbl_pending = dPriv->vblSeq;

intelCopyBuffer(dPriv, NULL);

intel_fb->swap_count++;
(*psp->systemTime->getUST) (&ust);
if (missed_target) {
intel_fb->swap_missed_count++;
intel_fb->swap_missed_ust = ust - intel_fb->swap_ust;
}

intel_fb->swap_ust = ust;
}
drmCommandNone(intel->driFd, DRM_I915_GEM_THROTTLE);
}
else {
/* XXX this shouldn't be an error but we can't handle it for now */
fprintf(stderr, "%s: drawable has no context!\n", __FUNCTION__);
}
}


/**
* Called from driCopySubBuffer()
*/
void
intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
struct intel_context *intel =
(struct intel_context *) dPriv->driContextPriv->driverPrivate;
GLcontext *ctx = &intel->ctx;

if (ctx->Visual.doubleBufferMode) {
drm_clip_rect_t rect;
rect.x1 = x + dPriv->x;
rect.y1 = (dPriv->h - y - h) + dPriv->y;
rect.x2 = rect.x1 + w;
rect.y2 = rect.y1 + h;
_mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
intelCopyBuffer(dPriv, &rect);
}
}
else {
/* XXX this shouldn't be an error but we can't handle it for now */
fprintf(stderr, "%s: drawable has no context!\n", __FUNCTION__);
}
}


/**
* This will be called whenever the currently bound window is moved/resized.
* XXX: actually, it seems to NOT be called when the window is only moved (BP).
*/
void
intelWindowMoved(struct intel_context *intel)
{
GLcontext *ctx = &intel->ctx;
__DRIdrawablePrivate *dPriv = intel->driDrawable;
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;

if (!intel->intelScreen->driScrnPriv->dri2.enabled &&
intel->intelScreen->driScrnPriv->ddx_version.minor >= 7) {
GLuint flags = intelFixupVblank(intel, dPriv);

/* Check to see if we changed pipes */
if (flags != dPriv->vblFlags && dPriv->vblFlags &&
!(dPriv->vblFlags & VBLANK_FLAG_NO_IRQ)) {
int64_t count;
drmVBlank vbl;
int i;

/*
* Deal with page flipping
*/
vbl.request.type = DRM_VBLANK_ABSOLUTE;

if ( dPriv->vblFlags & VBLANK_FLAG_SECONDARY ) {
vbl.request.type |= DRM_VBLANK_SECONDARY;
}

for (i = 0; i < 2; i++) {
if (!intel_fb->color_rb[i] ||
(intel_fb->vbl_waited - intel_fb->color_rb[i]->vbl_pending) <=
(1<<23))
continue;

vbl.request.sequence = intel_fb->color_rb[i]->vbl_pending;
drmWaitVBlank(intel->driFd, &vbl);
}

/*
* Update msc_base from old pipe
*/
driDrawableGetMSC32(dPriv->driScreenPriv, dPriv, &count);
dPriv->msc_base = count;
/*
* Then get new vblank_base and vblSeq values
*/
dPriv->vblFlags = flags;
driGetCurrentVBlank(dPriv);
dPriv->vblank_base = dPriv->vblSeq;

intel_fb->vbl_waited = dPriv->vblSeq;

for (i = 0; i < 2; i++) {
if (intel_fb->color_rb[i])
intel_fb->color_rb[i]->vbl_pending = intel_fb->vbl_waited;
}
}
} else {
dPriv->vblFlags &= ~VBLANK_FLAG_SECONDARY;
}

/* Update Mesa's notion of window size */
driUpdateFramebufferSize(ctx, dPriv);
intel_fb->Base.Initialized = GL_TRUE; /* XXX remove someday */

/* Update hardware scissor */
if (ctx->Driver.Scissor != NULL) {
ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
ctx->Scissor.Width, ctx->Scissor.Height);
}

/* Re-calculate viewport related state */
if (ctx->Driver.DepthRange != NULL)
ctx->Driver.DepthRange( ctx, ctx->Viewport.Near, ctx->Viewport.Far );
}

+ 0
- 52
src/mesa/drivers/dri/intel/intel_swapbuffers.h View File

@@ -1,52 +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.
*
**************************************************************************/

#ifndef INTEL_SWAPBUFFERS_H
#define INTEL_SWAPBUFFERS_H

#include "dri_util.h"
#include "drm.h"

struct intel_context;
struct intel_framebuffer;


extern void
intelSwapBuffers(__DRIdrawablePrivate * dPriv);

extern void
intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h);

extern GLuint
intelFixupVblank(struct intel_context *intel, __DRIdrawablePrivate *dPriv);

extern void
intelWindowMoved(struct intel_context *intel);


#endif /* INTEL_SWAPBUFFERS_H */

+ 1
- 6
src/mesa/drivers/dri/intel/intel_tex_copy.c View File

@@ -110,7 +110,6 @@ do_copy_texsubimage(struct intel_context *intel,
}

/* intelFlush(ctx); */
LOCK_HARDWARE(intel);
{
drm_intel_bo *dst_bo = intel_region_buffer(intel,
intelImage->mt->region,
@@ -132,13 +131,12 @@ do_copy_texsubimage(struct intel_context *intel,

/* Can't blit to tiled buffers with non-tile-aligned offset. */
if (intelImage->mt->region->tiling == I915_TILING_Y) {
UNLOCK_HARDWARE(intel);
return GL_FALSE;
}

if (ctx->ReadBuffer->Name == 0) {
/* reading from a window, adjust x, y */
const __DRIdrawablePrivate *dPriv = intel->driReadDrawable;
const __DRIdrawable *dPriv = intel->driReadDrawable;
y = dPriv->y + (dPriv->h - (y + height));
x += dPriv->x;

@@ -170,13 +168,10 @@ do_copy_texsubimage(struct intel_context *intel,
image_x + dstx, image_y + dsty,
width, height,
GL_COPY)) {
UNLOCK_HARDWARE(intel);
return GL_FALSE;
}
}

UNLOCK_HARDWARE(intel);

return GL_TRUE;
}


+ 2
- 9
src/mesa/drivers/dri/intel/intel_tex_image.c View File

@@ -235,7 +235,6 @@ try_pbo_upload(struct intel_context *intel,

if (drm_intel_bo_references(intel->batch->buf, dst_buffer))
intelFlush(&intel->ctx);
LOCK_HARDWARE(intel);
{
dri_bo *src_buffer = intel_bufferobj_buffer(intel, pbo, INTEL_READ);

@@ -245,11 +244,9 @@ try_pbo_upload(struct intel_context *intel,
dst_stride, dst_buffer, 0, GL_FALSE,
0, 0, dst_x, dst_y, width, height,
GL_COPY)) {
UNLOCK_HARDWARE(intel);
return GL_FALSE;
}
}
UNLOCK_HARDWARE(intel);

return GL_TRUE;
}
@@ -469,8 +466,6 @@ intelTexImage(GLcontext * ctx,
pixels, unpack, "glTexImage");
}

LOCK_HARDWARE(intel);

if (intelImage->mt) {
if (pixels != NULL) {
/* Flush any queued rendering with the texture before mapping. */
@@ -551,8 +546,6 @@ intelTexImage(GLcontext * ctx,
intel_miptree_image_unmap(intel, intelImage->mt);
texImage->Data = NULL;
}

UNLOCK_HARDWARE(intel);
}


@@ -732,7 +725,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
GLint glx_texture_format,
__DRIdrawable *dPriv)
{
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
struct gl_framebuffer *fb = dPriv->driverPrivate;
struct intel_context *intel = pDRICtx->driverPrivate;
GLcontext *ctx = &intel->ctx;
struct intel_texture_object *intelObj;
@@ -751,7 +744,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,

intel_update_renderbuffers(pDRICtx, dPriv);

rb = intel_fb->color_rb[0];
rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT);
/* If the region isn't set, then intel_update_renderbuffers was unable
* to get the buffers for the drawable.
*/

+ 0
- 4
src/mesa/drivers/dri/intel/intel_tex_subimage.c View File

@@ -72,8 +72,6 @@ intelTexSubimage(GLcontext * ctx,
if (!pixels)
return;

LOCK_HARDWARE(intel);

/* Map buffer if necessary. Need to lock to prevent other contexts
* from uploading the buffer under us.
*/
@@ -129,8 +127,6 @@ intelTexSubimage(GLcontext * ctx,
intel_miptree_image_unmap(intel, intelImage->mt);
texImage->Data = NULL;
}

UNLOCK_HARDWARE(intel);
}



+ 7
- 7
src/mesa/drivers/dri/mach64/mach64_context.c View File

@@ -89,11 +89,11 @@ static const struct dri_extension card_extensions[] =
/* Create the device specific context.
*/
GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{
GLcontext *ctx, *shareCtx;
__DRIscreenPrivate *driScreen = driContextPriv->driScreenPriv;
__DRIscreen *driScreen = driContextPriv->driScreenPriv;
struct dd_function_table functions;
mach64ContextPtr mmesa;
mach64ScreenPtr mach64Screen;
@@ -260,7 +260,7 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual,

/* Destroy the device specific context.
*/
void mach64DestroyContext( __DRIcontextPrivate *driContextPriv )
void mach64DestroyContext( __DRIcontext *driContextPriv )
{
mach64ContextPtr mmesa = (mach64ContextPtr) driContextPriv->driverPrivate;

@@ -307,9 +307,9 @@ void mach64DestroyContext( __DRIcontextPrivate *driContextPriv )
* buffer `b'.
*/
GLboolean
mach64MakeCurrent( __DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv )
mach64MakeCurrent( __DRIcontext *driContextPriv,
__DRIdrawable *driDrawPriv,
__DRIdrawable *driReadPriv )
{
if ( driContextPriv ) {
GET_CURRENT_CONTEXT(ctx);
@@ -352,7 +352,7 @@ mach64MakeCurrent( __DRIcontextPrivate *driContextPriv,
/* Force the context `c' to be unbound from its buffer.
*/
GLboolean
mach64UnbindContext( __DRIcontextPrivate *driContextPriv )
mach64UnbindContext( __DRIcontext *driContextPriv )
{
return GL_TRUE;
}

+ 9
- 9
src/mesa/drivers/dri/mach64/mach64_context.h View File

@@ -232,9 +232,9 @@ struct mach64_context {

/* Mirrors of some DRI state
*/
__DRIcontextPrivate *driContext; /* DRI context */
__DRIscreenPrivate *driScreen; /* DRI screen */
__DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */
__DRIcontext *driContext; /* DRI context */
__DRIscreen *driScreen; /* DRI screen */
__DRIdrawable *driDrawable; /* DRI drawable bound to this ctx */

unsigned int lastStamp; /* mirror driDrawable->lastStamp */

@@ -274,16 +274,16 @@ struct mach64_context {


extern GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
__DRIcontext *driContextPriv,
void *sharedContextPrivate );

extern void mach64DestroyContext( __DRIcontextPrivate * );
extern void mach64DestroyContext( __DRIcontext * );

extern GLboolean mach64MakeCurrent( __DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv );
extern GLboolean mach64MakeCurrent( __DRIcontext *driContextPriv,
__DRIdrawable *driDrawPriv,
__DRIdrawable *driReadPriv );

extern GLboolean mach64UnbindContext( __DRIcontextPrivate *driContextPriv );
extern GLboolean mach64UnbindContext( __DRIcontext *driContextPriv );

/* ================================================================
* Byte ordering

+ 2
- 2
src/mesa/drivers/dri/mach64/mach64_ioctl.c View File

@@ -279,7 +279,7 @@ static int mach64WaitForFrameCompletion( mach64ContextPtr mmesa )

/* Copy the back color buffer to the front color buffer.
*/
void mach64CopyBuffer( __DRIdrawablePrivate *dPriv )
void mach64CopyBuffer( __DRIdrawable *dPriv )
{
mach64ContextPtr mmesa;
GLint nbox, i, ret;
@@ -668,7 +668,7 @@ void mach64PerformanceBoxesLocked( mach64ContextPtr mmesa )
static void mach64DDClear( GLcontext *ctx, GLbitfield mask )
{
mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
__DRIdrawablePrivate *dPriv = mmesa->driDrawable;
__DRIdrawable *dPriv = mmesa->driDrawable;
drm_mach64_clear_t clear;
GLuint flags = 0;
GLint i;

+ 1
- 1
src/mesa/drivers/dri/mach64/mach64_ioctl.h View File

@@ -78,7 +78,7 @@ extern void mach64FireBlitLocked( mach64ContextPtr mmesa, void *buffer,
GLint offset, GLint pitch, GLint format,
GLint x, GLint y, GLint width, GLint height );

extern void mach64CopyBuffer( __DRIdrawablePrivate *dPriv );
extern void mach64CopyBuffer( __DRIdrawable *dPriv );
#if ENABLE_PERF_BOXES
extern void mach64PerformanceCounters( mach64ContextPtr mmesa );
extern void mach64PerformanceBoxesLocked( mach64ContextPtr mmesa );

+ 2
- 2
src/mesa/drivers/dri/mach64/mach64_lock.c View File

@@ -51,8 +51,8 @@ int prevLockLine = 0;
*/
void mach64GetLock( mach64ContextPtr mmesa, GLuint flags )
{
__DRIdrawablePrivate *dPriv = mmesa->driDrawable;
__DRIscreenPrivate *sPriv = mmesa->driScreen;
__DRIdrawable *dPriv = mmesa->driDrawable;
__DRIscreen *sPriv = mmesa->driScreen;
drm_mach64_sarea_t *sarea = mmesa->sarea;
int i;


+ 15
- 9
src/mesa/drivers/dri/mach64/mach64_screen.c View File

@@ -68,7 +68,7 @@ static const GLuint __driNConfigOptions = 2;
#endif

static const __DRIconfig **
mach64FillInModes( __DRIscreenPrivate *psp,
mach64FillInModes( __DRIscreen *psp,
unsigned pixel_bits, unsigned depth_bits,
unsigned stencil_bits, GLboolean have_back_buffer )
{
@@ -144,7 +144,7 @@ mach64FillInModes( __DRIscreenPrivate *psp,
/* Create the device specific screen private data struct.
*/
static mach64ScreenRec *
mach64CreateScreen( __DRIscreenPrivate *sPriv )
mach64CreateScreen( __DRIscreen *sPriv )
{
mach64ScreenPtr mach64Screen;
ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv;
@@ -272,7 +272,7 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv )
/* Destroy the device specific screen private data struct.
*/
static void
mach64DestroyScreen( __DRIscreenPrivate *driScreen )
mach64DestroyScreen( __DRIscreen *driScreen )
{
mach64ScreenRec *mach64Screen = (mach64ScreenRec *) driScreen->private;

@@ -299,8 +299,8 @@ mach64DestroyScreen( __DRIscreenPrivate *driScreen )
* data.
*/
static GLboolean
mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
mach64CreateBuffer( __DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
{
@@ -370,7 +370,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,


static void
mach64DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
mach64DestroyBuffer(__DRIdrawable *driDrawPriv)
{
_mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
@@ -378,7 +378,7 @@ mach64DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)

/* Copy the back color buffer to the front color buffer */
static void
mach64SwapBuffers(__DRIdrawablePrivate *dPriv)
mach64SwapBuffers(__DRIdrawable *dPriv)
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
mach64ContextPtr mmesa;
@@ -400,7 +400,7 @@ mach64SwapBuffers(__DRIdrawablePrivate *dPriv)
/* Initialize the driver specific screen private data.
*/
static GLboolean
mach64InitDriver( __DRIscreenPrivate *driScreen )
mach64InitDriver( __DRIscreen *driScreen )
{
driScreen->private = (void *) mach64CreateScreen( driScreen );

@@ -420,7 +420,7 @@ mach64InitDriver( __DRIscreenPrivate *driScreen )
* \return the __GLcontextModes supported by this driver
*/
static const __DRIconfig **
mach64InitScreen(__DRIscreenPrivate *psp)
mach64InitScreen(__DRIscreen *psp)
{
static const __DRIversion ddx_expected = { 6, 4, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 };
@@ -457,3 +457,9 @@ const struct __DriverAPIRec driDriverAPI = {
.SwapBuffersMSC = NULL
};

/* This is the table of extensions that the loader will dlsym() for. */
PUBLIC const __DRIextension *__driDriverExtensions[] = {
&driCoreExtension.base,
&driLegacyExtension.base,
NULL
};

+ 1
- 1
src/mesa/drivers/dri/mach64/mach64_screen.h View File

@@ -70,7 +70,7 @@ typedef struct {

drmBufMapPtr buffers;

__DRIscreenPrivate *driScreen;
__DRIscreen *driScreen;

driOptionCache optionCache;


+ 4
- 4
src/mesa/drivers/dri/mach64/mach64_span.c View File

@@ -40,8 +40,8 @@

#define LOCAL_VARS \
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
__DRIscreenPrivate *sPriv = mmesa->driScreen; \
__DRIdrawablePrivate *dPriv = mmesa->driDrawable; \
__DRIscreen *sPriv = mmesa->driScreen; \
__DRIdrawable *dPriv = mmesa->driDrawable; \
driRenderbuffer *drb = (driRenderbuffer *) rb; \
GLuint height = dPriv->h; \
GLushort p; \
@@ -49,8 +49,8 @@

#define LOCAL_DEPTH_VARS \
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = mmesa->driDrawable; \
__DRIscreenPrivate *driScreen = mmesa->driScreen; \
__DRIdrawable *dPriv = mmesa->driDrawable; \
__DRIscreen *driScreen = mmesa->driScreen; \
driRenderbuffer *drb = (driRenderbuffer *) rb; \
GLuint height = dPriv->h; \
char *buf = (char *)(driScreen->pFB + drb->offset + \

+ 2
- 2
src/mesa/drivers/dri/mach64/mach64_state.c View File

@@ -388,7 +388,7 @@ static void mach64UpdateClipping( GLcontext *ctx )
mach64ScreenPtr mach64Screen = mmesa->mach64Screen;

if ( mmesa->driDrawable ) {
__DRIdrawablePrivate *drawable = mmesa->driDrawable;
__DRIdrawable *drawable = mmesa->driDrawable;
int x1 = 0;
int y1 = 0;
int x2 = drawable->w - 1;
@@ -689,7 +689,7 @@ static void mach64DDLogicOpCode( GLcontext *ctx, GLenum opcode )
void mach64SetCliprects( GLcontext *ctx, GLenum mode )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = mmesa->driDrawable;
__DRIdrawable *dPriv = mmesa->driDrawable;

switch ( mode ) {
case GL_FRONT_LEFT:

+ 23
- 16
src/mesa/drivers/dri/mga/mga_xmesa.c View File

@@ -108,7 +108,7 @@ int MGA_DEBUG = 0;
#endif

static const __DRIconfig **
mgaFillInModes( __DRIscreenPrivate *psp,
mgaFillInModes( __DRIscreen *psp,
unsigned pixel_bits, unsigned depth_bits,
unsigned stencil_bits, GLboolean have_back_buffer )
{
@@ -190,7 +190,7 @@ const __DRIextension *mgaScreenExtensions[] = {
};

static GLboolean
mgaInitDriver(__DRIscreenPrivate *sPriv)
mgaInitDriver(__DRIscreen *sPriv)
{
mgaScreenPrivate *mgaScreen;
MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv;
@@ -332,7 +332,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)


static void
mgaDestroyScreen(__DRIscreenPrivate *sPriv)
mgaDestroyScreen(__DRIscreen *sPriv)
{
mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *) sPriv->private;

@@ -426,14 +426,14 @@ static const struct dri_debug_control debug_control[] =

static GLboolean
mgaCreateContext( const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{
int i;
unsigned maxlevels;
GLcontext *ctx, *shareCtx;
mgaContextPtr mmesa;
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private;
drm_mga_sarea_t *saPriv = (drm_mga_sarea_t *)(((char*)sPriv->pSAREA)+
mgaScreen->sarea_priv_offset);
@@ -645,7 +645,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
}

static void
mgaDestroyContext(__DRIcontextPrivate *driContextPriv)
mgaDestroyContext(__DRIcontext *driContextPriv)
{
mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;

@@ -697,8 +697,8 @@ mgaDestroyContext(__DRIcontextPrivate *driContextPriv)


static GLboolean
mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
mgaCreateBuffer( __DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
{
@@ -814,13 +814,13 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,


static void
mgaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
mgaDestroyBuffer(__DRIdrawable *driDrawPriv)
{
_mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}

static void
mgaSwapBuffers(__DRIdrawablePrivate *dPriv)
mgaSwapBuffers(__DRIdrawable *dPriv)
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
mgaContextPtr mmesa;
@@ -839,7 +839,7 @@ mgaSwapBuffers(__DRIdrawablePrivate *dPriv)
}

static GLboolean
mgaUnbindContext(__DRIcontextPrivate *driContextPriv)
mgaUnbindContext(__DRIcontext *driContextPriv)
{
mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;
if (mmesa)
@@ -855,9 +855,9 @@ mgaUnbindContext(__DRIcontextPrivate *driContextPriv)
* But why are we doing context initialization here???
*/
static GLboolean
mgaMakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv)
mgaMakeCurrent(__DRIcontext *driContextPriv,
__DRIdrawable *driDrawPriv,
__DRIdrawable *driReadPriv)
{
if (driContextPriv) {
mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;
@@ -892,7 +892,7 @@ mgaMakeCurrent(__DRIcontextPrivate *driContextPriv,

void mgaGetLock( mgaContextPtr mmesa, GLuint flags )
{
__DRIdrawablePrivate *dPriv = mmesa->driDrawable;
__DRIdrawable *dPriv = mmesa->driDrawable;
drm_mga_sarea_t *sarea = mmesa->sarea;
int me = mmesa->hHWContext;
int i;
@@ -960,7 +960,7 @@ static const __DRIconfig **mgaInitScreen(__DRIscreen *psp)
* Get information about previous buffer swaps.
*/
static int
getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo )
getSwapInfo( __DRIdrawable *dPriv, __DRIswapInfo * sInfo )
{
mgaContextPtr mmesa;

@@ -998,3 +998,10 @@ const struct __DriverAPIRec driDriverAPI = {
.WaitForSBC = NULL,
.SwapBuffersMSC = NULL
};

/* This is the table of extensions that the loader will dlsym() for. */
PUBLIC const __DRIextension *__driDriverExtensions[] = {
&driCoreExtension.base,
&driLegacyExtension.base,
NULL
};

+ 1
- 1
src/mesa/drivers/dri/mga/mga_xmesa.h View File

@@ -67,7 +67,7 @@ typedef struct mga_screen_private_s {
char *texVirtual[MGA_NR_TEX_HEAPS];


__DRIscreenPrivate *sPriv;
__DRIscreen *sPriv;
drmBufMapPtr bufs;

drmRegion mmio;

+ 3
- 3
src/mesa/drivers/dri/mga/mgacontext.h View File

@@ -294,10 +294,10 @@ struct mga_context_t {
drm_context_t hHWContext;
drm_hw_lock_t *driHwLock;
int driFd;
__DRIdrawablePrivate *driDrawable;
__DRIdrawablePrivate *driReadable;
__DRIdrawable *driDrawable;
__DRIdrawable *driReadable;

__DRIscreenPrivate *driScreen;
__DRIscreen *driScreen;
struct mga_screen_private_s *mgaScreen;
drm_mga_sarea_t *sarea;


+ 3
- 3
src/mesa/drivers/dri/mga/mgaioctl.c View File

@@ -207,7 +207,7 @@ static void
mgaClear( GLcontext *ctx, GLbitfield mask )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = mmesa->driDrawable;
__DRIdrawable *dPriv = mmesa->driDrawable;
GLuint flags = 0;
GLuint clear_color = mmesa->ClearColor;
GLuint clear_depth = 0;
@@ -409,7 +409,7 @@ static void mgaWaitForFrameCompletion( mgaContextPtr mmesa )
/*
* Copy the back buffer to the front buffer.
*/
void mgaCopyBuffer( __DRIdrawablePrivate *dPriv )
void mgaCopyBuffer( __DRIdrawable *dPriv )
{
mgaContextPtr mmesa;
drm_clip_rect_t *pbox;
@@ -417,7 +417,7 @@ void mgaCopyBuffer( __DRIdrawablePrivate *dPriv )
GLint ret;
GLint i;
GLboolean missed_target;
__DRIscreenPrivate *psp = dPriv->driScreenPriv;
__DRIscreen *psp = dPriv->driScreenPriv;

assert(dPriv);
assert(dPriv->driContextPriv);

+ 1
- 1
src/mesa/drivers/dri/mga/mgaioctl.h View File

@@ -32,7 +32,7 @@
#include "mgacontext.h"
#include "mga_xmesa.h"

void mgaCopyBuffer( __DRIdrawablePrivate *dPriv );
void mgaCopyBuffer( __DRIdrawable *dPriv );
void mgaWaitForVBlank( mgaContextPtr mmesa );

void mgaGetILoadBufferLocked( mgaContextPtr mmesa );

+ 0
- 0
src/mesa/drivers/dri/mga/mgapixel.c View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save