diff options
author | Kristian Høgsberg <krh@sasori.boston.redhat.com> | 2008-03-09 21:28:04 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@sasori.boston.redhat.com> | 2008-03-09 21:28:04 -0400 |
commit | dcbe215c015c8dc48440f578023c2b9d12b934e4 (patch) | |
tree | ff2196f4e814c36ec23cbaf1a94bac152a8acdf7 /src/mesa/drivers/dri | |
parent | 180b41594c669574355b54ceb2c2ff96889bf336 (diff) |
DRI2: Make setTexBuffer take a __DRIdrawable instead of a BO handle.
This fixes a problem where texturing from the same Pixmap more than
once per batchbuffer would hang the DRI driver. We just use the region
associated with the front left renderbuffer of the __DRIdrawable for
texturing, which avoids creating different regions for the same BO.
This change also make GLX_EXT_texture_from_pixmap work for direct
rendering, since tracking the __DRIdrawable -> BO handle now uses
the standard DRI2 event buffer. Of course, DRI2 direct rendering
doesn't exist yet.
Finally, this commit bumps the DRI interface version again, accounting
for the change in the DRI_TEX_BUFFER extension and the change in
commit 0bba0e5be7a4a7275dad1edc34bdcc134ea1f424 to pass in the
event buffer head index on drawable creation.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_image.c | 31 |
2 files changed, 16 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h index 34995f4ebf..3a87137cc9 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.h +++ b/src/mesa/drivers/dri/intel/intel_tex.h @@ -138,8 +138,7 @@ void intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, void intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); void intelSetTexBuffer(__DRIcontext *pDRICtx, - GLint target, unsigned long handle, - GLint cpp, GLuint pitch, GLuint height); + GLint target, __DRIdrawable *pDraw); GLuint intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit); diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index df08ee1a3b..5bf1c51538 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -23,6 +23,7 @@ #include "intel_tex.h" #include "intel_ioctl.h" #include "intel_blit.h" +#include "intel_fbo.h" #define FILE_DEBUG_FLAG DEBUG_TEXTURE @@ -694,26 +695,20 @@ intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname, } void -intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, - unsigned long handle, GLint cpp, GLuint pitch, GLuint height) +intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *pDraw) { __DRIcontextPrivate *driContext = pDRICtx->private; + __DRIdrawablePrivate *dPriv = pDraw->private; + struct intel_framebuffer *intel_fb = dPriv->driverPrivate; struct intel_context *intel = driContext->driverPrivate; struct intel_texture_object *intelObj; struct intel_texture_image *intelImage; struct intel_mipmap_tree *mt; - struct intel_region *region; + struct intel_renderbuffer *rb; struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; - int level = 0; - - /* FIXME: type, format, internalFormat */ - int type = GL_BGRA; - int format = GL_UNSIGNED_BYTE; - int internalFormat = (cpp == 3 ? 3 : 4); - cpp = 4; - pitch /= 4; + int level = 0, type, format, internalFormat; texUnit = &intel->ctx.Texture.Unit[intel->ctx.Texture.CurrentUnit]; texObj = _mesa_select_tex_object(&intel->ctx, texUnit, target); @@ -722,12 +717,16 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, if (!intelObj) return; - region = intel_region_alloc_for_handle(intel, cpp, pitch, height, - 0, handle); + __driParseEvents(driContext, dPriv); + + rb = intel_fb->color_rb[0]; + type = GL_BGRA; + format = GL_UNSIGNED_BYTE; + internalFormat = (rb->region->cpp == 3 ? 3 : 4); mt = intel_miptree_create_for_region(intel, target, internalFormat, - 0, 0, region, 1, 0); + 0, 0, rb->region, 1, 0); if (mt == NULL) return; @@ -739,7 +738,7 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, intelObj->mt = mt; texImage = _mesa_get_tex_image(&intel->ctx, texObj, target, level); _mesa_init_teximage_fields(&intel->ctx, target, texImage, - pitch, height, 1, + rb->region->pitch, rb->region->height, 1, 0, internalFormat); intelImage = intel_texture_image(texImage); @@ -748,7 +747,7 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, texImage->TexFormat = intelChooseTextureFormat(&intel->ctx, internalFormat, type, format); _mesa_set_fetch_functions(texImage, 2); - texImage->RowStride = pitch; + texImage->RowStride = rb->region->pitch; intel_miptree_reference(&intelImage->mt, intelObj->mt); if (!intel_miptree_match_image(intelObj->mt, &intelImage->base, |