From c738ea1191cd1b5a0dc60b0e6d05fd918083e961 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Wed, 18 Jul 2012 12:54:48 -0700 Subject: [PATCH] intel: Make more consistent use of _mesa_is_{user,winsys}_fbo() A lot of code was still differentiating between between winsys and user fbos by testing the fbo's name against zero. This converts everything in the i915 and 965 drivers over to use _mesa_is_user_fbo() and _mesa_is_winsys_fbo(). Reviewed-by: Brian Paul Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i915/i830_vtbl.c | 3 ++- src/mesa/drivers/dri/i915/intel_tris.c | 3 ++- src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 5 +++-- src/mesa/drivers/dri/intel/intel_blit.c | 3 ++- src/mesa/drivers/dri/intel/intel_buffers.c | 2 +- src/mesa/drivers/dri/intel/intel_fbo.c | 2 +- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 5 +++-- src/mesa/drivers/dri/intel/intel_pixel_copy.c | 5 +++-- src/mesa/drivers/dri/intel/intel_tex_copy.c | 3 ++- 9 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 28e95d97cc3..6019852bf6c 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -39,6 +39,7 @@ #include "swrast_setup/swrast_setup.h" #include "main/renderbuffer.h" #include "main/framebuffer.h" +#include "main/fbobject.h" #define FILE_DEBUG_FLAG DEBUG_STATE @@ -769,7 +770,7 @@ i830_update_draw_buffer(struct intel_context *intel) /* Get the intel_renderbuffer for the single colorbuffer we're drawing * into. */ - if (fb->Name == 0) { + if (_mesa_is_winsys_fbo(fb)) { /* drawing to window system buffer */ if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) colorRegions[0] = intel_get_rb_region(fb, BUFFER_FRONT_LEFT); diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index cf67d743004..5954b24fe5a 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -38,6 +38,7 @@ #include "main/texobj.h" #include "main/state.h" #include "main/dd.h" +#include "main/fbobject.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -503,7 +504,7 @@ intel_emit_fragcoord(struct intel_context *intel, intelVertexPtr v) fragcoord[0] = vertex_position[0]; - if (fb->Name) + if (_mesa_is_user_fbo(fb)) fragcoord[1] = vertex_position[1]; else fragcoord[1] = fb->Height - vertex_position[1]; diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index f8b7e4add8f..bd156327463 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -22,6 +22,7 @@ */ #include "main/teximage.h" +#include "main/fbobject.h" #include "glsl/ralloc.h" @@ -214,13 +215,13 @@ try_blorp_blit(struct intel_context *intel, /* Account for the fact that in the system framebuffer, the origin is at * the lower left. */ - if (read_fb->Name == 0) { + if (_mesa_is_winsys_fbo(read_fb)) { GLint tmp = read_fb->Height - srcY0; srcY0 = read_fb->Height - srcY1; srcY1 = tmp; mirror_y = !mirror_y; } - if (draw_fb->Name == 0) { + if (_mesa_is_winsys_fbo(draw_fb)) { GLint tmp = draw_fb->Height - dstY0; dstY0 = draw_fb->Height - dstY1; dstY1 = tmp; diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index fd4a86c4e72..36a2c6aadac 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -30,6 +30,7 @@ #include "main/context.h" #include "main/enums.h" #include "main/colormac.h" +#include "main/fbobject.h" #include "intel_blit.h" #include "intel_buffers.h" @@ -248,7 +249,7 @@ intelClearWithBlit(struct gl_context *ctx, GLbitfield mask) } cx = fb->_Xmin; - if (fb->Name == 0) + if (_mesa_is_winsys_fbo(fb)) cy = ctx->DrawBuffer->Height - fb->_Ymax; else cy = fb->_Ymin; diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 2b0276327d2..9a9a259c9e5 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -70,7 +70,7 @@ void intel_check_front_buffer_rendering(struct intel_context *intel) { const struct gl_framebuffer *fb = intel->ctx.DrawBuffer; - if (fb->Name == 0) { + if (_mesa_is_winsys_fbo(fb)) { /* drawing to window system buffer */ if (fb->_NumColorDrawBuffers > 0) { if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) { diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index ac7d6c11665..a53985b1893 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -359,7 +359,7 @@ intel_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *fb, fb->Initialized = true; /* XXX remove someday */ - if (fb->Name != 0) { + if (_mesa_is_user_fbo(fb)) { return; } diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 769738c0ec2..954dfc50b14 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" @@ -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; @@ -265,7 +266,7 @@ do_blit_bitmap( struct gl_context *ctx, w, h, (GLubyte *)stipple, 8, - fb->Name == 0 ? true : false) == 0) + _mesa_is_winsys_fbo(fb)) == 0) continue; if (!intelEmitImmediateColorExpandBlit(intel, diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c index 18a807508b3..682a52d97d2 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c @@ -30,6 +30,7 @@ #include "main/state.h" #include "main/mtypes.h" #include "main/condrender.h" +#include "main/fbobject.h" #include "drivers/common/meta.h" #include "intel_context.h" @@ -175,14 +176,14 @@ do_blit_copypixels(struct gl_context * ctx, dsty += srcy - orig_srcy; /* Flip dest Y if it's a window system framebuffer. */ - if (fb->Name == 0) { + if (_mesa_is_winsys_fbo(fb)) { /* copypixels to a window system framebuffer */ dsty = fb->Height - dsty - height; flip = !flip; } /* Flip source Y if it's a window system framebuffer. */ - if (read_fb->Name == 0) { + if (_mesa_is_winsys_fbo(read_fb)) { srcy = read_fb->Height - srcy - height; flip = !flip; } diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 0798cec8f3c..6da4ec6da3e 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -30,6 +30,7 @@ #include "main/image.h" #include "main/teximage.h" #include "main/texstate.h" +#include "main/fbobject.h" #include "drivers/common/meta.h" @@ -108,7 +109,7 @@ intel_copy_texsubimage(struct intel_context *intel, return false; } - if (ctx->ReadBuffer->Name == 0) { + if (_mesa_is_winsys_fbo(ctx->ReadBuffer)) { /* Flip vertical orientation for system framebuffers */ y = ctx->ReadBuffer->Height - (y + height); src_pitch = -region->pitch; -- 2.30.2