X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fintel%2Fintel_pixel_bitmap.c;h=c538a29571aa4b47b0dc5cf5bb7cfd9eacfad549;hb=6a7c27786c72f3fffc4a9cb8568fd5c6bcee2f5f;hp=1727d4c1a916cd39997b1b506891705b842c5fb4;hpb=56f0c00f125ee75caeadc1c9e8cab8a488635e5e;p=mesa.git diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 1727d4c1a91..c538a29571a 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -37,6 +37,7 @@ #include "main/state.h" #include "main/texobj.h" #include "main/context.h" +#include "main/fbobject.h" #include "swrast/swrast.h" #include "drivers/common/meta.h" @@ -74,9 +75,9 @@ static const GLubyte *map_pbo( struct gl_context *ctx, return NULL; } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - GL_READ_ONLY_ARB, - unpack->BufferObj); + buf = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size, + GL_MAP_READ_BIT, + unpack->BufferObj); if (!buf) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); return NULL; @@ -85,7 +86,7 @@ static const GLubyte *map_pbo( struct gl_context *ctx, return ADD_POINTERS(buf, bitmap); } -static GLboolean test_bit( const GLubyte *src, GLuint bit ) +static bool test_bit( const GLubyte *src, GLuint bit ) { return (src[bit/8] & (1<<(bit % 8))) ? 1 : 0; } @@ -105,7 +106,7 @@ static GLuint get_bitmap_rect(GLsizei width, GLsizei height, GLuint w, GLuint h, GLubyte *dest, GLuint row_align, - GLboolean invert) + bool invert) { GLuint src_offset = (x + unpack->SkipPixels) & 0x7; GLuint mask = unpack->LsbFirst ? 0 : 7; @@ -158,7 +159,7 @@ static GLuint get_bitmap_rect(GLsizei width, GLsizei height, static INLINE int y_flip(struct gl_framebuffer *fb, int y, int height) { - if (fb->Name != 0) + if (_mesa_is_user_fbo(fb)) return y; else return fb->Height - y - height; @@ -167,7 +168,7 @@ y_flip(struct gl_framebuffer *fb, int y, int height) /* * Render a bitmap. */ -static GLboolean +static bool do_blit_bitmap( struct gl_context *ctx, GLint dstx, GLint dsty, GLsizei width, GLsizei height, @@ -195,19 +196,19 @@ do_blit_bitmap( struct gl_context *ctx, * It seems the blit Z coord is always 1.0 (the far plane) so fragments * will likely be obscured by other, closer geometry. */ - return GL_FALSE; + return false; } intel_prepare_render(intel); dst = intel_drawbuf_region(intel); if (!dst) - return GL_FALSE; + return false; if (_mesa_is_bufferobj(unpack->BufferObj)) { bitmap = map_pbo(ctx, width, height, unpack, bitmap); if (bitmap == NULL) - return GL_TRUE; /* even though this is an error, we're done */ + return true; /* even though this is an error, we're done */ } COPY_4V(tmpColor, ctx->Current.RasterColor); @@ -227,7 +228,7 @@ do_blit_bitmap( struct gl_context *ctx, color = PACK_COLOR_8888(ubcolor[3], ubcolor[0], ubcolor[1], ubcolor[2]); if (!intel_check_blit_fragment_ops(ctx, tmpColor[3] == 1.0F)) - return GL_FALSE; + return false; /* Clip to buffer bounds and scissor. */ if (!_mesa_clip_to_region(fb->_Xmin, fb->_Ymin, @@ -258,14 +259,15 @@ do_blit_bitmap( struct gl_context *ctx, * Have to translate destination coordinates back into source * coordinates. */ - if (get_bitmap_rect(bitmap_width, bitmap_height, unpack, - bitmap, - -orig_dstx + (dstx + px), - -orig_dsty + y_flip(fb, dsty + py, h), - w, h, - (GLubyte *)stipple, - 8, - fb->Name == 0 ? GL_TRUE : GL_FALSE) == 0) + int count = get_bitmap_rect(bitmap_width, bitmap_height, unpack, + bitmap, + -orig_dstx + (dstx + px), + -orig_dsty + y_flip(fb, dsty + py, h), + w, h, + (GLubyte *)stipple, + 8, + _mesa_is_winsys_fbo(fb)); + if (count == 0) continue; if (!intelEmitImmediateColorExpandBlit(intel, @@ -274,15 +276,18 @@ do_blit_bitmap( struct gl_context *ctx, sz, color, dst->pitch, - dst->buffer, + dst->bo, 0, dst->tiling, dstx + px, dsty + py, w, h, logic_op)) { - return GL_FALSE; + return false; } + + if (ctx->Query.CurrentOcclusionObject) + ctx->Query.CurrentOcclusionObject->Result += count; } } out: @@ -297,7 +302,7 @@ out: intel_check_front_buffer_rendering(intel); - return GL_TRUE; + return true; } @@ -328,8 +333,6 @@ intelBitmap(struct gl_context * ctx, const struct gl_pixelstore_attrib *unpack, const GLubyte * pixels) { - struct intel_context *intel = intel_context(ctx); - if (!_mesa_check_conditional_render(ctx)) return; @@ -337,9 +340,5 @@ intelBitmap(struct gl_context * ctx, unpack, pixels)) return; - /* FIXME */ - if (intel->gen == 6) - return _swrast_Bitmap(ctx, x, y, width, height, unpack, pixels); - _mesa_meta_Bitmap(ctx, x, y, width, height, unpack, pixels); }