Re: [Mesa-dev] [PATCH] st/xorg: flush after loading the cursor
On Mon, 2011-05-02 at 21:26 +0200, Marcin Slusarz wrote: > On Mon, May 02, 2011 at 08:57:25AM +0200, Michel Dänzer wrote: > > On Mon, 2011-05-02 at 00:01 +0200, Marcin Slusarz wrote: > > > We need cursor data to land in destination buffer before drmModeSetCursor. > > > It fixes "cursor lag" at least on nv50. > > > --- > > > src/gallium/state_trackers/xorg/xorg_crtc.c |1 + > > > 1 files changed, 1 insertions(+), 0 deletions(-) > > > > > > diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c > > > b/src/gallium/state_trackers/xorg/xorg_crtc.c > > > index b8d9474..e8ca631 100644 > > > --- a/src/gallium/state_trackers/xorg/xorg_crtc.c > > > +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c > > > @@ -247,6 +247,7 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * > > > image) > > > 64, 64, (void*)image, 64 * 4, 0, 0); > > > ms->ctx->transfer_unmap(ms->ctx, transfer); > > > ms->ctx->transfer_destroy(ms->ctx, transfer); > > > +ms->ctx->flush(ms->ctx, NULL); > > > > > > if (crtc->cursor_shown) > > > drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id, > > > > To guarantee that the data lands before drmModeSetCursor, you'd have to > > take a fence from the flush and finish that as well. > > > > Thanks! > > Updated patch below. Actually, it looks like an incremental patch against the previous version. A real updated patch would be better. > +ctx->transfer_unmap(ctx, transfer); > +ctx->transfer_destroy(ctx, transfer); > +ctx->flush(ctx, &fence); > + > +if (fence) { > + screen->fence_finish(screen, fence, PIPE_TIMEOUT_INFINITE); > + screen->fence_reference(screen, &fence, NULL); > +} This looks good. -- Earthling Michel Dänzer |http://www.vmware.com Libre software enthusiast | Debian, X and DRI developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] r600g on rv635 and broken mipmaps
2011/5/3 Mathias Fröhlich : > Correct me when I am wrong: > In u_gen_mipmap, we call cso_set_framebuffer, which I expect to be aequivalent > to switching rendering outputs to a different fbo. When I do the aequivalent > from OpenGL level, I expect to have everything available from the previous > bound fbo without the need for the texture barrier extension (I don't recall > the exact name). True? Yes. > Which led me to the to the conclusion that I do not want to use an explicit > texture barrier in this case but need to have something that flushes > implicitly > on setting a new framebuffer state. > True? Yes. > That would have the advantage that we already know what bo range to flush > instead of just the whole gpu memory like it is done and required for the > texture barrier. > That this does not work for the rv635 does not imply that other chips/drivers > cannot make use of this additional knowledge. > ... my two cents. > > > Appart from my current expectation about the implicit flush semantics on the > framebuffer state, some notes on what flush works and what not: > > The reason that the texture barrier works for me, is - by experimental > software development - that the texture barrier flushes the whole memory range > with the > > S_0085F0_TC_ACTION_ENA(1) | S_0085F0_CB_ACTION_ENA(1) | > S_0085F0_CB0_DEST_BASE_ENA(1) | > S_0085F0_CB1_DEST_BASE_ENA(1) | > S_0085F0_CB2_DEST_BASE_ENA(1) | > S_0085F0_CB3_DEST_BASE_ENA(1) | > S_0085F0_CB4_DEST_BASE_ENA(1) | > S_0085F0_CB5_DEST_BASE_ENA(1) | > S_0085F0_CB6_DEST_BASE_ENA(1) | > S_0085F0_CB7_DEST_BASE_ENA(1) > > bits. > If I do the same in r600_context_flush_dest_caches instead of the cache flush > and invalidate and reduce the flags to say > > S_0085F0_CB_ACTION_ENA(1) | > S_0085F0_CB0_DEST_BASE_ENA(1) | > S_0085F0_CB1_DEST_BASE_ENA(1) > > It works for me also, but > > S_0085F0_CB_ACTION_ENA(1) | > S_0085F0_CB0_DEST_BASE_ENA(1) > > does not work. Hmm, that's weird. I am out of ideas. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/xorg: flush after loading the cursor
On Tue, May 03, 2011 at 09:40:55AM +0200, Michel Dänzer wrote: > On Mon, 2011-05-02 at 21:26 +0200, Marcin Slusarz wrote: > > On Mon, May 02, 2011 at 08:57:25AM +0200, Michel Dänzer wrote: > > > On Mon, 2011-05-02 at 00:01 +0200, Marcin Slusarz wrote: > > > > We need cursor data to land in destination buffer before > > > > drmModeSetCursor. > > > > It fixes "cursor lag" at least on nv50. > > > > --- > > > > src/gallium/state_trackers/xorg/xorg_crtc.c |1 + > > > > 1 files changed, 1 insertions(+), 0 deletions(-) > > > > > > > > diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c > > > > b/src/gallium/state_trackers/xorg/xorg_crtc.c > > > > index b8d9474..e8ca631 100644 > > > > --- a/src/gallium/state_trackers/xorg/xorg_crtc.c > > > > +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c > > > > @@ -247,6 +247,7 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 > > > > * image) > > > >64, 64, (void*)image, 64 * 4, 0, 0); > > > > ms->ctx->transfer_unmap(ms->ctx, transfer); > > > > ms->ctx->transfer_destroy(ms->ctx, transfer); > > > > +ms->ctx->flush(ms->ctx, NULL); > > > > > > > > if (crtc->cursor_shown) > > > > drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id, > > > > > > To guarantee that the data lands before drmModeSetCursor, you'd have to > > > take a fence from the flush and finish that as well. > > > > > > > Thanks! > > > > Updated patch below. > > Actually, it looks like an incremental patch against the previous > version. A real updated patch would be better. Yes. I forgot to join them. Sorry. > > > +ctx->transfer_unmap(ctx, transfer); > > +ctx->transfer_destroy(ctx, transfer); > > +ctx->flush(ctx, &fence); > > + > > +if (fence) { > > + screen->fence_finish(screen, fence, PIPE_TIMEOUT_INFINITE); > > + screen->fence_reference(screen, &fence, NULL); > > +} > > This looks good. Thanks. New patch below. --- From: Marcin Slusarz Subject: [PATCH v3] st/xorg: flush after loading the cursor We need cursor data to land in destination buffer before drmModeSetCursor. It fixes "cursor lag" on nv50. --- src/gallium/state_trackers/xorg/xorg_crtc.c | 22 +++--- 1 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 8eaf414..0499ed1 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -210,6 +210,9 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image) modesettingPtr ms = modesettingPTR(crtc->scrn); struct crtc_private *crtcp = crtc->driver_private; struct pipe_transfer *transfer; +struct pipe_fence_handle *fence = NULL; +struct pipe_context *ctx = ms->ctx; +struct pipe_screen *screen = ms->screen; if (!crtcp->cursor_tex) { struct pipe_resource templat; @@ -230,23 +233,28 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image) memset(&whandle, 0, sizeof(whandle)); whandle.type = DRM_API_HANDLE_TYPE_KMS; - crtcp->cursor_tex = ms->screen->resource_create(ms->screen, - &templat); - ms->screen->resource_get_handle(ms->screen, crtcp->cursor_tex, &whandle); + crtcp->cursor_tex = screen->resource_create(screen, &templat); + screen->resource_get_handle(screen, crtcp->cursor_tex, &whandle); crtcp->cursor_handle = whandle.handle; } -transfer = pipe_get_transfer(ms->ctx, crtcp->cursor_tex, +transfer = pipe_get_transfer(ctx, crtcp->cursor_tex, 0, 0, PIPE_TRANSFER_WRITE, 0, 0, 64, 64); -ptr = ms->ctx->transfer_map(ms->ctx, transfer); +ptr = ctx->transfer_map(ctx, transfer); util_copy_rect(ptr, crtcp->cursor_tex->format, transfer->stride, 0, 0, 64, 64, (void*)image, 64 * 4, 0, 0); -ms->ctx->transfer_unmap(ms->ctx, transfer); -ms->ctx->transfer_destroy(ms->ctx, transfer); +ctx->transfer_unmap(ctx, transfer); +ctx->transfer_destroy(ctx, transfer); +ctx->flush(ctx, &fence); + +if (fence) { + screen->fence_finish(screen, fence, PIPE_TIMEOUT_INFINITE); + screen->fence_reference(screen, &fence, NULL); +} if (crtc->cursor_shown) drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id, -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium/xorg st/nv50/i915: add PIPE_BIND_CURSOR
On Mon, May 2, 2011 at 8:40 PM, Marcin Slusarz wrote: > On Mon, May 02, 2011 at 03:11:00PM +0200, Daniel Vetter wrote: >> On Mon, May 2, 2011 at 2:56 PM, Benjamin Franzke >> wrote: >> > I think in i915g the CURSOR flag should be used in i9x5_scanout_layout >> > for the "special case for cursors" as well, instead of only checking >> > only pt->width0 == 64 && pt->height0 == 64. >> >> Oops, so much for actually re-checking the code. On the other hand, that >> part is broken, it needs a >> tex->tiling = I915_TILE_NONE; >> and perhaps some check that width == height == 64 indeed holds. Then >> move it out as the first if clause and it'd start to make sense ... > > Could you fix it in separate patch? Jakob has said (on irc) that he intends to again play with xorg-i915g ... -Daniel -- Daniel Vetter daniel.vet...@ffwll.ch - +41 (0) 79 364 57 48 - http://blog.ffwll.ch ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 36792] New: [PATCH] link to shared LLVM library
https://bugs.freedesktop.org/show_bug.cgi?id=36792 Summary: [PATCH] link to shared LLVM library Product: Mesa Version: git Platform: All OS/Version: All Status: NEW Severity: normal Priority: medium Component: Mesa core AssignedTo: mesa-dev@lists.freedesktop.org ReportedBy: fabio@libero.it Created an attachment (id=46283) View: https://bugs.freedesktop.org/attachment.cgi?id=46283 Review: https://bugs.freedesktop.org/review?bug=36792&attachment=46283 link to shared llvm I am providing an Ubuntu PPA to enable some mesa features (e.g. llvm support) not available in the Ubuntu version: https://launchpad.net/~oibaf/+archive/graphics-drivers/ Mesa defaults to use static llvm libraries and this creates huge packages (+10MB for every file using it). I am using the attached patch to link to shared llvm library. Maybe it could be used when specifying a configure flag or be the default if the availability of the shared llvm is detected. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/2] Seamless cube map in Gallium and the AMD extension
Hi, the first patch adds AMD_seamless_cubemap_per_texture to Mesa. The second patch adds support for both seamless_cube_map extensions to Gallium. The motivation for this particular implementation is to make driver code as simple as possible. A Gallium driver can support either of these two CAPs: - PIPE_CAP_SEAMLESS_CUBE_MAP: the driver should follow pipe_rasterizer_state::seamless_cube_map. - PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE: the driver should follow pipe_sampler_state::seamless_cube_map. Both CAPs cannot be exposed at the same time. The reason for this is that there is no hardware which supports both. There are new piglit tests for both extensions. Please review. Marek Olšák (2): mesa: implement AMD_seamless_cubemap_per_texture gallium: implement seamless cubemap extensions src/gallium/include/pipe/p_defines.h|2 + src/gallium/include/pipe/p_state.h |2 + src/mesa/main/extensions.c |1 + src/mesa/main/mtypes.h |2 + src/mesa/main/texobj.c |2 + src/mesa/main/texparam.c| 32 +++ src/mesa/state_tracker/st_atom_rasterizer.c |6 - src/mesa/state_tracker/st_atom_sampler.c|3 ++ src/mesa/state_tracker/st_extensions.c |9 +++ 9 files changed, 58 insertions(+), 1 deletions(-) Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] mesa: implement AMD_seamless_cubemap_per_texture
--- src/mesa/main/extensions.c |1 + src/mesa/main/mtypes.h |2 ++ src/mesa/main/texobj.c |2 ++ src/mesa/main/texparam.c | 32 4 files changed, 37 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 1062cde..a9ef8fa 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -260,6 +260,7 @@ static const struct extension extension_table[] = { { "GL_3DFX_texture_compression_FXT1", o(TDFX_texture_compression_FXT1), GL, 1999 }, { "GL_AMD_conservative_depth", o(AMD_conservative_depth), GL, 2009 }, { "GL_AMD_draw_buffers_blend", o(ARB_draw_buffers_blend), GL, 2009 }, + { "GL_AMD_seamless_cubemap_per_texture", o(AMD_seamless_cubemap_per_texture),GL, 2009 }, { "GL_AMD_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 }, { "GL_APPLE_client_storage",o(APPLE_client_storage), GL, 2002 }, { "GL_APPLE_object_purgeable", o(APPLE_object_purgeable), GL, 2006 }, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index fba65e8..ad65b55 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1370,6 +1370,7 @@ struct gl_texture_object GLint CropRect[4]; /**< GL_OES_draw_texture */ GLenum Swizzle[4]; /**< GL_EXT_texture_swizzle */ GLuint _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */ + GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */ GLboolean GenerateMipmap;/**< GL_SGIS_generate_mipmap */ GLboolean _Complete;/**< Is texture object complete? */ GLboolean _RenderToTexture; /**< Any rendering to this texture? */ @@ -2885,6 +2886,7 @@ struct gl_extensions GLboolean OES_standard_derivatives; /* vendor extensions */ GLboolean AMD_conservative_depth; + GLboolean AMD_seamless_cubemap_per_texture; GLboolean APPLE_client_storage; GLboolean APPLE_packed_pixels; GLboolean APPLE_vertex_array_object; diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 43d6e52..2272110 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -146,6 +146,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj->Swizzle[2] = GL_BLUE; obj->Swizzle[3] = GL_ALPHA; obj->_Swizzle = SWIZZLE_NOOP; + obj->CubeMapSeamless = GL_FALSE; obj->Sampler.sRGBDecode = GL_DECODE_EXT; } @@ -259,6 +260,7 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, dest->_Complete = src->_Complete; COPY_4V(dest->Swizzle, src->Swizzle); dest->_Swizzle = src->_Swizzle; + dest->CubeMapSeamless = src->CubeMapSeamless; } diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index f86a8cf..05f77b3 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -439,6 +439,20 @@ set_tex_parameteri(struct gl_context *ctx, } goto invalid_pname; + case GL_TEXTURE_CUBE_MAP_SEAMLESS: + if (ctx->Extensions.AMD_seamless_cubemap_per_texture) { + GLenum param = params[0]; + if (param != GL_TRUE && param != GL_FALSE) { +goto invalid_param; + } + if (param != texObj->CubeMapSeamless) { +flush(ctx); +texObj->CubeMapSeamless = param; + } + return GL_TRUE; + } + goto invalid_pname; + default: goto invalid_pname; } @@ -580,6 +594,7 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) case GL_TEXTURE_COMPARE_FUNC_ARB: case GL_DEPTH_TEXTURE_MODE_ARB: case GL_TEXTURE_SRGB_DECODE_EXT: + case GL_TEXTURE_CUBE_MAP_SEAMLESS: { /* convert float param to int */ GLint p[4]; @@ -629,6 +644,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) case GL_TEXTURE_COMPARE_FUNC_ARB: case GL_DEPTH_TEXTURE_MODE_ARB: case GL_TEXTURE_SRGB_DECODE_EXT: + case GL_TEXTURE_CUBE_MAP_SEAMLESS: { /* convert float param to int */ GLint p[4]; @@ -1235,6 +1251,14 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) } break; + case GL_TEXTURE_CUBE_MAP_SEAMLESS: + if (ctx->Extensions.AMD_seamless_cubemap_per_texture) { + *params = (GLfloat) obj->CubeMapSeamless; + } + else { + error = GL_TRUE; + } + default: error = GL_TRUE; break; @@ -1396,6 +1420,14 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) } break; + case GL_TEXTURE_CUBE_MAP_SEAMLESS: + if (ctx->Extensions.AMD_seamless_cubemap_per_texture) { +
[Mesa-dev] [PATCH 2/2] gallium: implement seamless cubemap extensions
--- src/gallium/include/pipe/p_defines.h|2 ++ src/gallium/include/pipe/p_state.h |2 ++ src/mesa/state_tracker/st_atom_rasterizer.c |6 +- src/mesa/state_tracker/st_atom_sampler.c|3 +++ src/mesa/state_tracker/st_extensions.c |9 + 5 files changed, 21 insertions(+), 1 deletions(-) diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 431a7fb..bf09fca 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -465,6 +465,8 @@ enum pipe_cap { PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR = 44, PIPE_CAP_FRAGMENT_COLOR_CLAMP_CONTROL = 45, PIPE_CAP_MIXED_COLORBUFFER_FORMATS = 46, + PIPE_CAP_SEAMLESS_CUBE_MAP = 47, /* these two are mutually-exclusive */ + PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE = 48, }; /* Shader caps not specific to any single stage */ diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 0c1f509..3bc7f0f 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -101,6 +101,7 @@ struct pipe_rasterizer_state unsigned line_smooth:1; unsigned line_stipple_enable:1; unsigned line_last_pixel:1; + unsigned seamless_cube_map:1; /**< PIPE_CAP_SEAMLESS_CUBE_MAP */ /** * Use the first vertex of a primitive as the provoking vertex for @@ -269,6 +270,7 @@ struct pipe_sampler_state unsigned compare_func:3; /**< PIPE_FUNC_x */ unsigned normalized_coords:1; /**< Are coords normalized to [0,1]? */ unsigned max_anisotropy:6; + unsigned seamless_cube_map:1; /**< PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE */ float lod_bias; /**< LOD/lambda bias */ float min_lod, max_lod; /**< LOD clamp range, after bias */ float border_color[4]; diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 250cbb2..ac6d76a 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -257,6 +257,9 @@ static void update_raster_state( struct st_context *st ) /* _NEW_FRAG_CLAMP */ raster->clamp_fragment_color = ctx->Color._ClampFragmentColor; + /* _NEW_TEXTURE */ + raster->seamless_cube_map = ctx->Texture.CubeMapSeamless != GL_FALSE; + raster->gl_rasterization_rules = 1; cso_set_rasterizer(st->cso_context, raster); @@ -273,7 +276,8 @@ const struct st_tracked_state st_update_rasterizer = { _NEW_POLYGON | _NEW_PROGRAM | _NEW_SCISSOR | - _NEW_FRAG_CLAMP), /* mesa state dependencies*/ + _NEW_FRAG_CLAMP | + _NEW_TEXTURE), /* mesa state dependencies */ ST_NEW_VERTEX_PROGRAM, /* state tracker dependencies */ }, update_raster_state /* update function */ diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 56da010..199a755 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -201,6 +201,9 @@ update_samplers(struct st_context *st) = st_compare_func_to_pipe(msamp->CompareFunc); } + sampler->seamless_cube_map = + st->ctx->Texture.CubeMapSeamless || texobj->CubeMapSeamless; + st->state.num_samplers = su + 1; /*printf("%s su=%u non-null\n", __FUNCTION__, su);*/ diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 030bbc7..c610b0b 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -595,4 +595,13 @@ void st_init_extensions(struct st_context *st) PIPE_BIND_SAMPLER_VIEW)) { ctx->Extensions.EXT_packed_float = GL_TRUE; } + + /* These two CAPs are mutually-exclusive. */ + if (screen->get_param(screen, PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE)) { + ctx->Extensions.ARB_seamless_cube_map = GL_TRUE; + ctx->Extensions.AMD_seamless_cubemap_per_texture = GL_TRUE; + } + else if (screen->get_param(screen, PIPE_CAP_SEAMLESS_CUBE_MAP)) { + ctx->Extensions.ARB_seamless_cube_map = GL_TRUE; + } } -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] r600g on rv635 and broken mipmaps
2011/5/3 Mathias Fröhlich : > > Marek, > > On Tuesday, May 03, 2011 01:33:17 you wrote: >> 2011/5/2 Mathias Fröhlich : >> > I have again spent some more tries with different kinds of flushes on the >> > rv635. What helps for the mipmap problem here is emitting a >> > texture_barrier as well as flushing anything that covers the whole >> > memory range and more than two arbitrary color buffers. !?! >> >> The texture barrier in u_gen_mipmap seems to be the proper fix >> (texture_barrier can be NULL on other drivers though), but we should >> first make sure it wouldn't be hiding a bug elsewhere (see Alex's email). > > Hmm, I am not sure about this. I already had that patch also. > > Correct me when I am wrong: > In u_gen_mipmap, we call cso_set_framebuffer, which I expect to be aequivalent > to switching rendering outputs to a different fbo. When I do the aequivalent > from OpenGL level, I expect to have everything available from the previous > bound fbo without the need for the texture barrier extension (I don't recall > the exact name). True? > > Which led me to the to the conclusion that I do not want to use an explicit > texture barrier in this case but need to have something that flushes > implicitly > on setting a new framebuffer state. > True? > > That would have the advantage that we already know what bo range to flush > instead of just the whole gpu memory like it is done and required for the > texture barrier. > That this does not work for the rv635 does not imply that other chips/drivers > cannot make use of this additional knowledge. > ... my two cents. > > > Appart from my current expectation about the implicit flush semantics on the > framebuffer state, some notes on what flush works and what not: > > The reason that the texture barrier works for me, is - by experimental > software development - that the texture barrier flushes the whole memory range > with the > > S_0085F0_TC_ACTION_ENA(1) | S_0085F0_CB_ACTION_ENA(1) | > S_0085F0_CB0_DEST_BASE_ENA(1) | > S_0085F0_CB1_DEST_BASE_ENA(1) | > S_0085F0_CB2_DEST_BASE_ENA(1) | > S_0085F0_CB3_DEST_BASE_ENA(1) | > S_0085F0_CB4_DEST_BASE_ENA(1) | > S_0085F0_CB5_DEST_BASE_ENA(1) | > S_0085F0_CB6_DEST_BASE_ENA(1) | > S_0085F0_CB7_DEST_BASE_ENA(1) > > bits. > If I do the same in r600_context_flush_dest_caches instead of the cache flush > and invalidate and reduce the flags to say > > S_0085F0_CB_ACTION_ENA(1) | > S_0085F0_CB0_DEST_BASE_ENA(1) | > S_0085F0_CB1_DEST_BASE_ENA(1) > > It works for me also, but > > S_0085F0_CB_ACTION_ENA(1) | > S_0085F0_CB0_DEST_BASE_ENA(1) > > does not work. > > But that puzzled me. Note that there is no S_0085F0_TC_ACTION_ENA(1) enable in > there, and also there is no second color buffer while rendering mipmaps to > flush. Also the colorbuffer bo's are already flushed explicitly for their bo > range in r600_context_flush_dest_caches with their apropriate flags and > ranges. As noted in the r6xx/r7xx programming guide, SURFACE_BASE_UPDATE packets are required on rv6xx for the cp surface sync logic to work correctly. I suspect you are seeing the results of that. Alex > > The observation was that as long as I have at least 2 arbitrary colorbuffer > bits included in this PKT3_SURFACE_SYNC and the flush covers the whole gpu > memory range, the mipmaps are correct. Setting any other > {SMX,TC,VC}_ACTION_ENA(1) flags just did not matter for my setup. > > So to be honset I do not understand where the data sticks and what I need to > do to get it out. > May be that observations make sense for somebody else? > > I will look into alex note today evening. > > Greetings > > Mathias > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/xorg: flush after loading the cursor
On Die, 2011-05-03 at 11:45 +0200, Marcin Slusarz wrote: > On Tue, May 03, 2011 at 09:40:55AM +0200, Michel Dänzer wrote: > > On Mon, 2011-05-02 at 21:26 +0200, Marcin Slusarz wrote: > > > On Mon, May 02, 2011 at 08:57:25AM +0200, Michel Dänzer wrote: > > > > On Mon, 2011-05-02 at 00:01 +0200, Marcin Slusarz wrote: > > > > > We need cursor data to land in destination buffer before > > > > > drmModeSetCursor. > > > > > It fixes "cursor lag" at least on nv50. > > > > > --- > > > > > src/gallium/state_trackers/xorg/xorg_crtc.c |1 + > > > > > 1 files changed, 1 insertions(+), 0 deletions(-) > > > > > > > > > > diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c > > > > > b/src/gallium/state_trackers/xorg/xorg_crtc.c > > > > > index b8d9474..e8ca631 100644 > > > > > --- a/src/gallium/state_trackers/xorg/xorg_crtc.c > > > > > +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c > > > > > @@ -247,6 +247,7 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, > > > > > CARD32 * image) > > > > > 64, 64, (void*)image, 64 * 4, 0, 0); > > > > > ms->ctx->transfer_unmap(ms->ctx, transfer); > > > > > ms->ctx->transfer_destroy(ms->ctx, transfer); > > > > > +ms->ctx->flush(ms->ctx, NULL); > > > > > > > > > > if (crtc->cursor_shown) > > > > > drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id, > > > > > > > > To guarantee that the data lands before drmModeSetCursor, you'd have to > > > > take a fence from the flush and finish that as well. > > > > > > > > > > Thanks! > > > > > > Updated patch below. > > > > Actually, it looks like an incremental patch against the previous > > version. A real updated patch would be better. > > Yes. I forgot to join them. Sorry. > > > > > > +ctx->transfer_unmap(ctx, transfer); > > > +ctx->transfer_destroy(ctx, transfer); > > > +ctx->flush(ctx, &fence); > > > + > > > +if (fence) { > > > + screen->fence_finish(screen, fence, PIPE_TIMEOUT_INFINITE); > > > + screen->fence_reference(screen, &fence, NULL); > > > +} > > > > This looks good. > > Thanks. > > New patch below. Pushed, thanks. -- Earthling Michel Dänzer |http://www.vmware.com Libre software enthusiast | Debian, X and DRI developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/2] Seamless cube map in Gallium and the AMD extension
Am 03.05.2011 15:55, schrieb Marek Olšák: > Hi, > > the first patch adds AMD_seamless_cubemap_per_texture to Mesa. > > The second patch adds support for both seamless_cube_map extensions to > Gallium. The motivation for this particular implementation is to make driver > code as simple as possible. > > A Gallium driver can support either of these two CAPs: > - PIPE_CAP_SEAMLESS_CUBE_MAP: the driver should follow > pipe_rasterizer_state::seamless_cube_map. > - PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE: the driver should follow > pipe_sampler_state::seamless_cube_map. > Both CAPs cannot be exposed at the same time. The reason for this is that > there is no hardware which supports both. > > There are new piglit tests for both extensions. > > Please review. > > > Marek Olšák (2): > mesa: implement AMD_seamless_cubemap_per_texture > gallium: implement seamless cubemap extensions > > src/gallium/include/pipe/p_defines.h|2 + > src/gallium/include/pipe/p_state.h |2 + > src/mesa/main/extensions.c |1 + > src/mesa/main/mtypes.h |2 + > src/mesa/main/texobj.c |2 + > src/mesa/main/texparam.c| 32 > +++ > src/mesa/state_tracker/st_atom_rasterizer.c |6 - > src/mesa/state_tracker/st_atom_sampler.c|3 ++ > src/mesa/state_tracker/st_extensions.c |9 +++ > 9 files changed, 58 insertions(+), 1 deletions(-) > This looks ok to me if only half elegant. Please update the relevant sections in the gallium docs, though (screen, cso/sampler, cso/rasterizer probably). Roland ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] gallium: implement seamless cubemap extensions
Am 03.05.2011 15:55, schrieb Marek Olšák: > diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c > b/src/mesa/state_tracker/st_atom_rasterizer.c > index 250cbb2..ac6d76a 100644 > --- a/src/mesa/state_tracker/st_atom_rasterizer.c > +++ b/src/mesa/state_tracker/st_atom_rasterizer.c > @@ -257,6 +257,9 @@ static void update_raster_state( struct st_context *st ) > /* _NEW_FRAG_CLAMP */ > raster->clamp_fragment_color = ctx->Color._ClampFragmentColor; > > + /* _NEW_TEXTURE */ > + raster->seamless_cube_map = ctx->Texture.CubeMapSeamless != GL_FALSE; > + > raster->gl_rasterization_rules = 1; > > cso_set_rasterizer(st->cso_context, raster); > @@ -273,7 +276,8 @@ const struct st_tracked_state st_update_rasterizer = { > _NEW_POLYGON | > _NEW_PROGRAM | > _NEW_SCISSOR | > - _NEW_FRAG_CLAMP), /* mesa state dependencies*/ > + _NEW_FRAG_CLAMP | > + _NEW_TEXTURE), /* mesa state dependencies */ >ST_NEW_VERTEX_PROGRAM, /* state tracker dependencies */ > }, > update_raster_state /* update function */ Hmm seems rather unfortunate that this is _NEW_TEXTURE - looks like all the rest of the bits are likely much lower frequency (and of course the seamless bit itself probably only ever changes once). I can see now why you made that a new bit. I'll defer that to Brian though. Roland ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [RFC] swap complete event handling fixes
Ended up moving over to generic events since the GLX type code is part of the GLX namespace and larger than 8 bits. Apparently no one had ever tried ChangeDrawableAttributes with indirect clients, because simply going a glXSelectEvent causes a crash in that case. So this patch set includes a fix for that issue and has been tested with both direct and indirect clients, both with and without client and server support. New clients with old servers should get a 0 sbc rather than garbage. New servers will send old clients a 0 sbc, but the clients will still copy garbage into the event actually sent to clients. New servers with new clients should work both in the direct and indirect cases and get whatever values the server sends for each field. As always, testing and review appreciated. Piglit's glx-swap-event case now checks for swap count sanity (i.e. increasing, nonzero value) and allows you to dump the current values in verbose mode. I also added a few more return value checks to the test. Thanks, Jesse ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] GLX: fix broken swap event size by using a generic event
The existing event is too large for an XEvent meaning that the swap count is never sent to clients. Create a generic event instead for use by new clients & servers. Signed-off-by: Jesse Barnes --- configure.ac |2 +- glxproto.h | 18 ++ 2 files changed, 19 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index d88e6df..a3047e4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.60]) -AC_INIT([GLProto], [1.4.12], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) +AC_INIT([GLProto], [1.4.13], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE diff --git a/glxproto.h b/glxproto.h index 0ff44e3..d026d4d 100644 --- a/glxproto.h +++ b/glxproto.h @@ -1384,6 +1384,24 @@ typedef struct { CARD32 sbc_lo B32; } xGLXBufferSwapComplete; +/* The above is actually too large to fit in an XEvent, so use a generic + * event so we can send the sbc count as well. */ +typedef struct { +BYTE type; +CARD8 extension; +CARD16 sequenceNumber B16; +CARD32 length B32; /* should always be 8 for this event */ +CARD16 evtype B16; +CARD16 swap_event_type B16; +CARD32 drawable B32; +CARD32 ust_hi B32; +CARD32 ust_lo B32; +CARD32 msc_hi B32; +CARD32 msc_lo B32; +CARD32 sbc_hi B32; +CARD32 sbc_lo B32; +} xGLXBufferSwapComplete2; + // /* -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/5] GLX: support generic swap events
The existing swap event structure is too big to fit in an XEvent, so support servers that send generic events instead. Do this by advertising the GLX proto version we support when connecting and check for generic events in the event stream. Convert any received events into regular swap complete events for client compatibility. Signed-off-by: Jesse Barnes --- configure.ac|2 +- src/glx/glxclient.h |2 +- src/glx/glxext.c| 55 -- 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 92d11af..94fb6f7 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ LIBDRM_REQUIRED=2.4.24 LIBDRM_RADEON_REQUIRED=2.4.24 LIBDRM_INTEL_REQUIRED=2.4.24 DRI2PROTO_REQUIRED=2.4 -GLPROTO_REQUIRED=1.4.11 +GLPROTO_REQUIRED=1.4.13 LIBDRM_XORG_REQUIRED=2.4.24 LIBKMS_XORG_REQUIRED=1.0.0 diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index 755a66d..cdef2a1 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -63,7 +63,7 @@ #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) #define GLX_MAJOR_VERSION 1 /* current version numbers */ -#define GLX_MINOR_VERSION 4 +#define GLX_MINOR_VERSION 5 #define __GLX_MAX_TEXTURE_UNITS 32 diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 278c719..fb29711 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -104,14 +104,42 @@ XEXT_GENERATE_ERROR_STRING(__glXErrorString, __glXExtensionName, */ static Bool +__glXServerSupportsSBC(Display *dpy) +{ + struct glx_display *glx_dpy = __glXInitialize(dpy); + + return (glx_dpy->majorVersion > 1 || (glx_dpy->majorVersion == 1 && + glx_dpy->minorVersion > 4)); +} + +static Bool +__glXGenericEvent(Display *dpy, xGenericEvent *wire) +{ + struct glx_display *glx_dpy = __glXInitialize(dpy); + + return wire->extension == glx_dpy->codes->major_opcode; +} + +static Bool __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire) { struct glx_display *glx_dpy = __glXInitialize(dpy); + int type; if (glx_dpy == NULL) return False; - switch ((wire->u.u.type & 0x7f) - glx_dpy->codes->first_event) { + /* New extension will send generic events for some events */ + if (wire->u.u.type == GenericEvent && __glXServerSupportsSBC(dpy)) { + xGenericEvent *wire2 = (xGenericEvent *)wire; + if (!__glXGenericEvent(dpy, wire2)) +return False; + type = wire2->evtype; + } else { + type = (wire->u.u.type & 0x7f) - glx_dpy->codes->first_event; + } + + switch (type) { case GLX_PbufferClobber: { GLXPbufferClobberEvent *aevent = (GLXPbufferClobberEvent *)event; @@ -133,12 +161,23 @@ __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire) case GLX_BufferSwapComplete: { GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event; - xGLXBufferSwapComplete *awire = (xGLXBufferSwapComplete *)wire; - aevent->event_type = awire->event_type; - aevent->drawable = awire->drawable; - aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo; - aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo; - aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo; + if (__glXServerSupportsSBC(dpy)) { +xGLXBufferSwapComplete2 *awire = (xGLXBufferSwapComplete2 *)wire; +/* Make it look like a regular event to clients */ +aevent->type = glx_dpy->codes->first_event + awire->evtype; +aevent->event_type = awire->swap_event_type; +aevent->drawable = awire->drawable; +aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo; +aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo; +aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo; + } else { +xGLXBufferSwapComplete *awire = (xGLXBufferSwapComplete *)wire; +aevent->event_type = awire->event_type; +aevent->drawable = awire->drawable; +aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo; +aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo; +aevent->sbc = 0; + } return True; } default: @@ -843,6 +882,8 @@ __glXInitialize(Display * dpy) XESetEventToWire(dpy, dpyPriv->codes->first_event + i, __glXEventToWire); } + XESetWireToEvent(dpy, GenericEvent, __glXWireToEvent); + XESetCloseDisplay(dpy, dpyPriv->codes->extension, __glXCloseDisplay); XESetErrorString (dpy, dpyPriv->codes->extension,__glXErrorString); -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 6/8] GLX/DRI2: pass drawable correctly for indirect swap events
Pass the right drawable pointer as data to the swap complete function. Signed-off-by: Jesse Barnes --- glx/glxdri2.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/glx/glxdri2.c b/glx/glxdri2.c index d979717..93c5e5b 100644 --- a/glx/glxdri2.c +++ b/glx/glxdri2.c @@ -222,7 +222,7 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable) #endif if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused, - __glXdriSwapEvent, drawable->pDraw) != Success) + __glXdriSwapEvent, drawable) != Success) return FALSE; return TRUE; -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 7/8] DRI2: support generic swap events
Send the new generic swap event type if the client supports it. This means checking the client's DRI2 proto version at connect time and then constructing a new generic event at swap complete time. To track the client version, we need to add a new DRI2 client private type and track it for the lifetime of the client. Signed-off-by: Jesse Barnes --- configure.ac |2 +- glx/glxdri2.c | 20 +++ hw/xfree86/dri2/dri2.c| 57 - hw/xfree86/dri2/dri2.h|6 hw/xfree86/dri2/dri2ext.c | 47 +++- 5 files changed, 118 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 6eb780c..8e00fe7 100644 --- a/configure.ac +++ b/configure.ac @@ -771,7 +771,7 @@ RECORDPROTO="recordproto >= 1.13.99.1" SCRNSAVERPROTO="scrnsaverproto >= 1.1" RESOURCEPROTO="resourceproto" DRIPROTO="xf86driproto >= 2.1.0" -DRI2PROTO="dri2proto >= 2.3" +DRI2PROTO="dri2proto >= 2.4" XINERAMAPROTO="xineramaproto" BIGFONTPROTO="xf86bigfontproto >= 1.2.0" DGAPROTO="xf86dgaproto >= 2.0.99.1" diff --git a/glx/glxdri2.c b/glx/glxdri2.c index 93c5e5b..a17b4d5 100644 --- a/glx/glxdri2.c +++ b/glx/glxdri2.c @@ -228,6 +228,23 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable) return TRUE; } +static void +__glXDRIclientCallback(CallbackListPtr *list, + pointer closure, + pointer data) +{ +NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; +ClientPtr pClient = clientinfo->client; + +switch (pClient->clientState) { +case ClientStateGone: + DRI2ClientGone(pClient); + break; +default: + break; +} +} + static int __glXDRIdrawableSwapInterval(__GLXdrawable *drawable, int interval) { @@ -769,6 +786,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen) screen->leaveVT = pScrn->LeaveVT; pScrn->LeaveVT = glxDRILeaveVT; +if (!AddCallback (&ClientStateCallback, __glXDRIclientCallback, 0)) + return NULL; + LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", driverName); diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 5c42a51..9b5eab2 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -60,6 +60,9 @@ static DevPrivateKeyRec dri2WindowPrivateKeyRec; static DevPrivateKeyRec dri2PixmapPrivateKeyRec; #define dri2PixmapPrivateKey (&dri2PixmapPrivateKeyRec) +static DevPrivateKeyRec dri2ClientPrivateKeyRec; +#define dri2ClientPrivateKey (&dri2ClientPrivateKeyRec) + static RESTYPE dri2DrawableRes; typedef struct _DRI2Screen *DRI2ScreenPtr; @@ -107,6 +110,11 @@ typedef struct _DRI2Screen { ConfigNotifyProcPtr ConfigNotify; } DRI2ScreenRec; +typedef struct _DRI2Client { +CARD32 major; +CARD32 minor; +} DRI2ClientRec, *DRI2ClientPtr; + static DRI2ScreenPtr DRI2GetScreen(ScreenPtr pScreen) { @@ -131,6 +139,12 @@ DRI2GetDrawable(DrawablePtr pDraw) } } +static DRI2ClientPtr +DRI2GetClient(ClientPtr client) +{ +return dixLookupPrivate(&client->devPrivates, dri2ClientPrivateKey); +} + static unsigned long DRI2DrawableSerial(DrawablePtr pDraw) { @@ -190,6 +204,44 @@ DRI2AllocateDrawable(DrawablePtr pDraw) return pPriv; } +void +DRI2InitClient(ClientPtr client, CARD32 major, CARD32 minor) +{ +DRI2ClientPtr pPriv; + +pPriv = malloc(sizeof *pPriv); +if (!pPriv) + return; + +pPriv->major = major; +pPriv->minor = minor; + +dixSetPrivate(&client->devPrivates, dri2ClientPrivateKey, pPriv); +} + +void +DRI2ClientGone(ClientPtr client) +{ +DRI2ClientPtr pPriv = DRI2GetClient(client); + +if (pPriv) + free(pPriv); +} + +Bool +DRI2ClientSupportsSBC(ClientPtr client) +{ +DRI2ClientPtr pPriv = DRI2GetClient(client); + +if (!pPriv) + return FALSE; + +if (pPriv->major > 1 || (pPriv->major == 1 && pPriv->minor > 3)) + return TRUE; + +return FALSE; +} + typedef struct DRI2DrawableRefRec { XID id; XID dri2_id; @@ -1097,6 +1149,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) if (!dixRegisterPrivateKey(&dri2PixmapPrivateKeyRec, PRIVATE_PIXMAP, 0)) return FALSE; +if (!dixRegisterPrivateKey(&dri2ClientPrivateKeyRec, PRIVATE_CLIENT, 0)) + return FALSE; + ds = calloc(1, sizeof *ds); if (!ds) return FALSE; @@ -1114,7 +1169,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) ds->ScheduleSwap = info->ScheduleSwap; ds->ScheduleWaitMSC = info->ScheduleWaitMSC; ds->GetMSC = info->GetMSC; - cur_minor = 3; + cur_minor = 4; } else { cur_minor = 1; } diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index fe0bf6c..97e8e86 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -192,6 +192,7 @@ typedef struct { } DRI2
[Mesa-dev] [PATCH 3/5] GLX: don't crash when indirect clients try to set an event mask
After sending the GLXChangeDrawableAttributes request, we also set a local set of attributes on the DRI drawable. But in the indirect case this array won't be present, so skip the setting in that case to avoid a crash. Signed-off-by: Jesse Barnes --- src/glx/glx_pbuffer.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c index 5f91bc6..ec54f1e 100644 --- a/src/glx/glx_pbuffer.c +++ b/src/glx/glx_pbuffer.c @@ -137,6 +137,9 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable, #ifdef GLX_DIRECT_RENDERING pdraw = GetGLXDRIDrawable(dpy, drawable); + if (!pdraw) + return; + for (i = 0; i < num_attribs; i++) { switch(attribs[i * 2]) { case GLX_EVENT_MASK: -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/5] DRI2: support generic swap event handling
The existing swap event structure is too large to fit in an XEvent, so new servers will send a generic event if the client supports it. This allows a valid swap count value to be sent along with the event type, timestamp, and media stamp. Check for server support based on the advertised DRI2 version and look for generic events in the event stream with DRI2 in the extension field. Signed-off-by: Jesse Barnes --- configure.ac|2 +- src/glx/dri2.c | 105 -- src/glx/dri2.h |3 +- src/glx/dri2_glx.c | 31 +- src/glx/glxclient.h |2 + 5 files changed, 108 insertions(+), 35 deletions(-) diff --git a/configure.ac b/configure.ac index 3b05ca3..92d11af 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ dnl Versions for external dependencies LIBDRM_REQUIRED=2.4.24 LIBDRM_RADEON_REQUIRED=2.4.24 LIBDRM_INTEL_REQUIRED=2.4.24 -DRI2PROTO_REQUIRED=2.1 +DRI2PROTO_REQUIRED=2.4 GLPROTO_REQUIRED=1.4.11 LIBDRM_XORG_REQUIRED=2.4.24 LIBKMS_XORG_REQUIRED=1.0.0 diff --git a/src/glx/dri2.c b/src/glx/dri2.c index adfd3d1..9cab639 100644 --- a/src/glx/dri2.c +++ b/src/glx/dri2.c @@ -48,7 +48,7 @@ */ #if DRI2_MINOR < 1 #undef DRI2_MINOR -#define DRI2_MINOR 1 +#define DRI2_MINOR 4 #define X_DRI2GetBuffersWithFormat 7 #endif @@ -88,43 +88,85 @@ static Bool DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) { XExtDisplayInfo *info = DRI2FindDisplay(dpy); + int type; XextCheckExtension(dpy, info, dri2ExtensionName, False); - switch ((wire->u.u.type & 0x7f) - info->codes->first_event) { + if (wire->u.u.type == GenericEvent && + dri2ServerSupportsSBC(dpy)) { + xGenericEvent *wire2 = (xGenericEvent *)wire; + if (!dri2Event(dpy, wire2->extension)) + return False; + type = wire2->evtype; + } else { + type = (wire->u.u.type & 0x7f) - info->codes->first_event; + } + + switch (type) { #ifdef X_DRI2SwapBuffers case DRI2_BufferSwapComplete: { GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event; - xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire; - - /* Ignore swap events if we're not looking for them */ - aevent->type = dri2GetSwapEventType(dpy, awire->drawable); - if(!aevent->type) - return False; - - aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire); - aevent->send_event = (awire->type & 0x80) != 0; - aevent->display = dpy; - aevent->drawable = awire->drawable; - switch (awire->event_type) { - case DRI2_EXCHANGE_COMPLETE: -aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL; -break; - case DRI2_BLIT_COMPLETE: -aevent->event_type = GLX_COPY_COMPLETE_INTEL; -break; - case DRI2_FLIP_COMPLETE: -aevent->event_type = GLX_FLIP_COMPLETE_INTEL; -break; - default: -/* unknown swap completion type */ -return False; + + if (dri2ServerSupportsSBC(dpy)) { +xDRI2BufferSwapComplete2 *awire = (xDRI2BufferSwapComplete2 *)wire; + +/* Ignore swap events if we're not looking for them */ +aevent->type = dri2GetSwapEventType(dpy, awire->drawable); +if(!aevent->type) + return False; + +aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire); +aevent->send_event = (awire->type & 0x80) != 0; +aevent->display = dpy; +aevent->drawable = awire->drawable; +switch (awire->swap_event_type) { +case DRI2_EXCHANGE_COMPLETE: + aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL; + break; +case DRI2_BLIT_COMPLETE: + aevent->event_type = GLX_COPY_COMPLETE_INTEL; + break; +case DRI2_FLIP_COMPLETE: + aevent->event_type = GLX_FLIP_COMPLETE_INTEL; + break; +default: + /* unknown swap completion type */ + return False; +} +aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo; +aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo; +aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo; + } else { +xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire; +/* Ignore swap events if we're not looking for them */ +aevent->type = dri2GetSwapEventType(dpy, awire->drawable); +if(!aevent->type) + return False; + +aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire); +aevent->send_event = (awire->type & 0x80) != 0; +aevent->display = dpy; +aevent->drawable = awire->drawable; +switch (awire->event_type) { +case DRI2_EXCHANGE_COMPLETE: + aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL; + break; +case DRI2_BLIT_COMPLETE: + aevent->event_type = GLX_COPY_COMPLETE_INTEL; + break; +case DRI2_FLIP_CO
[Mesa-dev] [PATCH 8/8] GLX: support generic swap events
Send the new generic GLX swap event if supported by the client. This means checking the client GLX version at swap complete time and constructing a new generic swap completion event at swap complete time. Signed-off-by: Jesse Barnes --- configure.ac|2 +- glx/glxdri2.c | 99 +++--- glx/glxext.c|2 + glx/glxserver.h |1 + include/protocol-versions.h |2 +- 5 files changed, 78 insertions(+), 28 deletions(-) diff --git a/configure.ac b/configure.ac index 8e00fe7..87194a5 100644 --- a/configure.ac +++ b/configure.ac @@ -775,7 +775,7 @@ DRI2PROTO="dri2proto >= 2.4" XINERAMAPROTO="xineramaproto" BIGFONTPROTO="xf86bigfontproto >= 1.2.0" DGAPROTO="xf86dgaproto >= 2.0.99.1" -GLPROTO="glproto >= 1.4.10" +GLPROTO="glproto >= 1.4.13" DMXPROTO="dmxproto >= 2.2.99.1" VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1" WINDOWSWMPROTO="windowswmproto" diff --git a/glx/glxdri2.c b/glx/glxdri2.c index a17b4d5..dc96f55 100644 --- a/glx/glxdri2.c +++ b/glx/glxdri2.c @@ -161,41 +161,88 @@ __glXDRIdrawableWaitGL(__GLXdrawable *drawable) DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft); } +static Bool +__glXDRIclientSupportsSBC(ClientPtr client) +{ +__GLXclientState *cl = glxGetClient(client); + +if (!cl) + return 0; + +if (cl->GLClientmajorVersion > 1 || + (cl->GLClientmajorVersion == 1 && cl->GLClientminorVersion > 4)) + return TRUE; + +return FALSE; +} + static void __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc, CARD64 sbc) { __GLXdrawable *drawable = data; -xGLXBufferSwapComplete wire; if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK)) return; -wire.type = __glXEventBase + GLX_BufferSwapComplete; -switch (type) { -case DRI2_EXCHANGE_COMPLETE: - wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL; - break; -case DRI2_BLIT_COMPLETE: - wire.event_type = GLX_BLIT_COMPLETE_INTEL; - break; -case DRI2_FLIP_COMPLETE: - wire.event_type = GLX_FLIP_COMPLETE_INTEL; - break; -default: - /* unknown swap completion type */ - wire.event_type = 0; - break; +if (__glXDRIclientSupportsSBC(client)) { + xGLXBufferSwapComplete2 wire; + + wire.type = GenericEvent; + wire.extension = __glXExtBase; + wire.evtype = GLX_BufferSwapComplete; + switch (type) { + case DRI2_EXCHANGE_COMPLETE: + wire.swap_event_type = GLX_EXCHANGE_COMPLETE_INTEL; + break; + case DRI2_BLIT_COMPLETE: + wire.swap_event_type = GLX_BLIT_COMPLETE_INTEL; + break; + case DRI2_FLIP_COMPLETE: + wire.swap_event_type = GLX_FLIP_COMPLETE_INTEL; + break; + default: + /* unknown swap completion type */ + wire.swap_event_type = 0; + break; + } + wire.drawable = drawable->drawId; + wire.length = 8; + wire.ust_hi = ust >> 32; + wire.ust_lo = ust & 0x; + wire.msc_hi = msc >> 32; + wire.msc_lo = msc & 0x; + wire.sbc_hi = sbc >> 32; + wire.sbc_lo = sbc & 0x;; + WriteEventsToClient(client, 1, (xEvent *) &wire); +} else { + xGLXBufferSwapComplete wire; + + wire.type = __glXEventBase + GLX_BufferSwapComplete; + switch (type) { + case DRI2_EXCHANGE_COMPLETE: + wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL; + break; + case DRI2_BLIT_COMPLETE: + wire.event_type = GLX_BLIT_COMPLETE_INTEL; + break; + case DRI2_FLIP_COMPLETE: + wire.event_type = GLX_FLIP_COMPLETE_INTEL; + break; + default: + /* unknown swap completion type */ + wire.event_type = 0; + break; + } + wire.drawable = drawable->drawId; + wire.ust_hi = ust >> 32; + wire.ust_lo = ust & 0x; + wire.msc_hi = msc >> 32; + wire.msc_lo = msc & 0x; + wire.sbc_hi = 0; + wire.sbc_lo = 0; + WriteEventsToClient(client, 1, (xEvent *) &wire); } -wire.drawable = drawable->drawId; -wire.ust_hi = ust >> 32; -wire.ust_lo = ust & 0x; -wire.msc_hi = msc >> 32; -wire.msc_lo = msc & 0x; -wire.sbc_hi = sbc >> 32; -wire.sbc_lo = sbc & 0x; - -WriteEventsToClient(client, 1, (xEvent *) &wire); } /* @@ -779,7 +826,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) *- GLX_ARB_multisample (1.4) */ screen->base.GLXmajor = 1; -screen->base.GLXminor = 4; +screen->base.GLXminor = 5; screen->enterVT = pScrn->EnterVT; pScrn->EnterVT = glxDRIEnterVT; diff --git a/glx/glxext.c b/glx/glxext.c index 9cfc096..01960a0 100644 --- a/glx/glxext.c +++ b/glx/glxext.c @@ -242,6 +242,7 @@ GLboolean __glXErrorOccured(void) stat
[Mesa-dev] [PATCH] DRI2: fix swap complete event size by using a generic event
The existing swap complete event is too large to fit in an XEvent, so use a generic event instead. New servers and clients can use this structure to fully pass the swap count along with the media stamp counter, swap complete type, and timestamp. Signed-off-by: Jesse Barnes --- configure.ac |2 +- dri2proto.h | 22 -- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 5b78d6b..9505f56 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.60]) -AC_INIT([DRI2Proto], [2.3], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) +AC_INIT([DRI2Proto], [2.4], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE diff --git a/dri2proto.h b/dri2proto.h index 9708a4a..5a7d3e1 100644 --- a/dri2proto.h +++ b/dri2proto.h @@ -35,7 +35,7 @@ #define DRI2_NAME "DRI2" #define DRI2_MAJOR 1 -#define DRI2_MINOR 3 +#define DRI2_MINOR 4 #define DRI2NumberErrors 0 #define DRI2NumberEvents 2 @@ -298,7 +298,25 @@ typedef struct { CARD32 sbc_hi B32; CARD32 sbc_lo B32; } xDRI2BufferSwapComplete; -#define sz_xDRI2BufferSwapComplete 32 +#define sz_xDRI2BufferSwapComplete 32 /* This should have been 36 */ + +/* Use a generic event so we can transmit the sbc_lo value as well */ +typedef struct { +BYTE type; +CARD8 extension; +CARD16 sequenceNumber B16; +CARD32 length B32; /* should always be 8 for this event */ +CARD16 evtype B16; +CARD16 swap_event_type B16; +CARD32 drawable B32; +CARD32 ust_hi B32; +CARD32 ust_lo B32; +CARD32 msc_hi B32; +CARD32 msc_lo B32; +CARD32 sbc_hi B32; +CARD32 sbc_lo B32; +} xDRI2BufferSwapComplete2; +#define sz_xDRI2BufferSwapComplete2 38 typedef struct { CARD8 type; -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [RFC] swap complete event handling fixes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/03/2011 10:59 AM, Jesse Barnes wrote: > Ended up moving over to generic events since the GLX type code is part > of the GLX namespace and larger than 8 bits. > > Apparently no one had ever tried ChangeDrawableAttributes with indirect > clients, because simply going a glXSelectEvent causes a crash in that > case. So this patch set includes a fix for that issue and has been > tested with both direct and indirect clients, both with and without > client and server support. > > New clients with old servers should get a 0 sbc rather than garbage. > New servers will send old clients a 0 sbc, but the clients will still > copy garbage into the event actually sent to clients. New servers with > new clients should work both in the direct and indirect cases and get > whatever values the server sends for each field. > > As always, testing and review appreciated. Piglit's glx-swap-event case > now checks for swap count sanity (i.e. increasing, nonzero value) and > allows you to dump the current values in verbose mode. I also added a > few more return value checks to the test. I assume there will also be updates to the GLX_INTEL_swap_event extension spec? -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAk3AS6IACgkQX1gOwKyEAw+O2ACdG2GKmoQcywjiDLPF00rWRgy7 10gAnRzBCLgrHFRhK5KAsvNZ25fONQq7 =36VE -END PGP SIGNATURE- ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [RFC] swap complete event handling fixes
On Tue, 03 May 2011 11:38:26 -0700 Ian Romanick wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 05/03/2011 10:59 AM, Jesse Barnes wrote: > > Ended up moving over to generic events since the GLX type code is part > > of the GLX namespace and larger than 8 bits. > > > > Apparently no one had ever tried ChangeDrawableAttributes with indirect > > clients, because simply going a glXSelectEvent causes a crash in that > > case. So this patch set includes a fix for that issue and has been > > tested with both direct and indirect clients, both with and without > > client and server support. > > > > New clients with old servers should get a 0 sbc rather than garbage. > > New servers will send old clients a 0 sbc, but the clients will still > > copy garbage into the event actually sent to clients. New servers with > > new clients should work both in the direct and indirect cases and get > > whatever values the server sends for each field. > > > > As always, testing and review appreciated. Piglit's glx-swap-event case > > now checks for swap count sanity (i.e. increasing, nonzero value) and > > allows you to dump the current values in verbose mode. I also added a > > few more return value checks to the test. > > I assume there will also be updates to the GLX_INTEL_swap_event > extension spec? Yeah, though mainly informational since the client interface doesn't change with this version. Thanks, -- Jesse Barnes, Intel Open Source Technology Center ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [RFC] swap complete event handling fixes
On Tue, 03 May 2011 11:38:26 -0700 Ian Romanick wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 05/03/2011 10:59 AM, Jesse Barnes wrote: > > Ended up moving over to generic events since the GLX type code is part > > of the GLX namespace and larger than 8 bits. > > > > Apparently no one had ever tried ChangeDrawableAttributes with indirect > > clients, because simply going a glXSelectEvent causes a crash in that > > case. So this patch set includes a fix for that issue and has been > > tested with both direct and indirect clients, both with and without > > client and server support. > > > > New clients with old servers should get a 0 sbc rather than garbage. > > New servers will send old clients a 0 sbc, but the clients will still > > copy garbage into the event actually sent to clients. New servers with > > new clients should work both in the direct and indirect cases and get > > whatever values the server sends for each field. > > > > As always, testing and review appreciated. Piglit's glx-swap-event case > > now checks for swap count sanity (i.e. increasing, nonzero value) and > > allows you to dump the current values in verbose mode. I also added a > > few more return value checks to the test. > > I assume there will also be updates to the GLX_INTEL_swap_event > extension spec? Wait wtf; the spec has a 32 bit sbc count to fit inside XEvent, but when it was changed we never updated the code? That would certainly make things easier, since we wouldn't need any proto bumping. -- Jesse Barnes, Intel Open Source Technology Center ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] r600g on rv635 and broken mipmaps
On Monday 02 May 2011, Alex Deucher wrote: > One thing to double check is that rv6xx_context_surface_base_update() > gets emitted properly every time a base address is emitted. Right now > I think we only call it once per command buffer, but it needs to be > emitted every time a base address changes. It's always emitted in r600_context_draw(), which is actually more often than what is necessary since the surface base registers don't always change between draw calls. But maybe that's the source of the problem. Maybe you can't emit base update twice without flushing the caches in between? If that's the case, I think the attached patch should fix it. Regards, Fredrik From e4af4c7f038faa20ebbe6838bc48e9f1b23cf366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Tue, 3 May 2011 20:45:39 +0200 Subject: [PATCH] r600g: don't emit surface base update unecessarily Only emit rv6xx_surface_base_update when the surface base registers have actually changed. --- src/gallium/winsys/r600/drm/r600_hw_context.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index e28ef1f..a7d7b99 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -1261,8 +1261,10 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) r600_context_block_emit_dirty(ctx, dirty_block); } - /* rv6xx surface base udpate */ - if (rv6xx_surface_base_update) + /* rv6xx surface base update */ + /* If the dst caches are dirty we know that the surface base registers + * haven't changed since the last surface base update was emitted */ + if (rv6xx_surface_base_update && !(ctx->flags & R600_CONTEXT_DST_CACHES_DIRTY)) rv6xx_context_surface_base_update(ctx, rv6xx_surface_base_update); /* draw packet */ -- 1.7.4.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] Make swap event handling match the spec
Ian reminded me that we changed the spec to fit within an XEvent, but we never updated the code to match. This set of patches (much simpler than the last) does just that. Wrapping support can be added to Mesa if we really want 64 bit values, but that means checking the drawable sbc and adding whenver sbc hits 0. Thanks, Jesse ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/4] GLX/DRI2: pass drawable correctly for indirect swap events
Pass the right drawable pointer as data to the swap complete function. Signed-off-by: Jesse Barnes --- glx/glxdri2.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/glx/glxdri2.c b/glx/glxdri2.c index d979717..93c5e5b 100644 --- a/glx/glxdri2.c +++ b/glx/glxdri2.c @@ -222,7 +222,7 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable) #endif if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused, - __glXdriSwapEvent, drawable->pDraw) != Success) + __glXdriSwapEvent, drawable) != Success) return FALSE; return TRUE; -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4] GLX/DRI2: make GLX swap event handling match spec
Only send a 32 bit swap count out to the client. Signed-off-by: Jesse Barnes --- configure.ac |4 ++-- glx/glxdri2.c |5 ++--- hw/xfree86/dri2/dri2.c|2 +- hw/xfree86/dri2/dri2.h|2 +- hw/xfree86/dri2/dri2ext.c |5 ++--- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 6eb780c..87194a5 100644 --- a/configure.ac +++ b/configure.ac @@ -771,11 +771,11 @@ RECORDPROTO="recordproto >= 1.13.99.1" SCRNSAVERPROTO="scrnsaverproto >= 1.1" RESOURCEPROTO="resourceproto" DRIPROTO="xf86driproto >= 2.1.0" -DRI2PROTO="dri2proto >= 2.3" +DRI2PROTO="dri2proto >= 2.4" XINERAMAPROTO="xineramaproto" BIGFONTPROTO="xf86bigfontproto >= 1.2.0" DGAPROTO="xf86dgaproto >= 2.0.99.1" -GLPROTO="glproto >= 1.4.10" +GLPROTO="glproto >= 1.4.13" DMXPROTO="dmxproto >= 2.2.99.1" VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1" WINDOWSWMPROTO="windowswmproto" diff --git a/glx/glxdri2.c b/glx/glxdri2.c index 93c5e5b..450d8c9 100644 --- a/glx/glxdri2.c +++ b/glx/glxdri2.c @@ -163,7 +163,7 @@ __glXDRIdrawableWaitGL(__GLXdrawable *drawable) static void __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust, - CARD64 msc, CARD64 sbc) + CARD64 msc, CARD32 sbc) { __GLXdrawable *drawable = data; xGLXBufferSwapComplete wire; @@ -192,8 +192,7 @@ __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust, wire.ust_lo = ust & 0x; wire.msc_hi = msc >> 32; wire.msc_lo = msc & 0x; -wire.sbc_hi = sbc >> 32; -wire.sbc_lo = sbc & 0x; +wire.sbc = sbc; WriteEventsToClient(client, 1, (xEvent *) &wire); } diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 5c42a51..40829c2 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -76,7 +76,7 @@ typedef struct _DRI2Drawable { ClientPtr blockedClient; BoolblockedOnMsc; int swap_interval; -CARD64 swap_count; +CARD32 swap_count; int64_t target_sbc; /* -1 means no SBC wait outstanding */ CARD64 last_swap_target; /* most recently queued swap target */ CARD64 last_swap_msc; /* msc at completion of most recent swap */ diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index fe0bf6c..2a41ead 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -51,7 +51,7 @@ extern CARD8 dri2_minor; typedef DRI2BufferRec DRI2Buffer2Rec, *DRI2Buffer2Ptr; typedef void (*DRI2SwapEventPtr)(ClientPtr client, void *data, int type, -CARD64 ust, CARD64 msc, CARD64 sbc); +CARD64 ust, CARD64 msc, CARD32 sbc); typedef DRI2BufferPtr (*DRI2CreateBuffersProcPtr)(DrawablePtr pDraw, diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c index 4e48e65..2bb515f 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/hw/xfree86/dri2/dri2ext.c @@ -357,7 +357,7 @@ vals_to_card64(CARD32 lo, CARD32 hi) static void DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc, - CARD64 sbc) + CARD32 sbc) { xDRI2BufferSwapComplete event; DrawablePtr pDrawable = data; @@ -369,8 +369,7 @@ DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc, event.ust_lo = ust & 0x; event.msc_hi = (CARD64)msc >> 32; event.msc_lo = msc & 0x; -event.sbc_hi = (CARD64)sbc >> 32; -event.sbc_lo = sbc & 0x; +event.sbc = sbc; WriteEventsToClient(client, 1, (xEvent *)&event); } -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glxproto: make GLX swap event struct match spec
We only spec a 32 bit swap count, so drop the high sbc field. Signed-off-by: Jesse Barnes --- configure.ac |2 +- glxproto.h |3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d88e6df..a3047e4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.60]) -AC_INIT([GLProto], [1.4.12], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) +AC_INIT([GLProto], [1.4.13], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE diff --git a/glxproto.h b/glxproto.h index 0ff44e3..a6018a1 100644 --- a/glxproto.h +++ b/glxproto.h @@ -1380,8 +1380,7 @@ typedef struct { CARD32 ust_lo B32; CARD32 msc_hi B32; CARD32 msc_lo B32; -CARD32 sbc_hi B32; -CARD32 sbc_lo B32; +CARD32 sbc B32; } xGLXBufferSwapComplete; // -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] dri2proto: make DRI2 swap event match GLX spec
We only spec a 32 bit sbc count, so drop the high bits. Signed-off-by: Jesse Barnes --- configure.ac |2 +- dri2proto.h |3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 5b78d6b..9505f56 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.60]) -AC_INIT([DRI2Proto], [2.3], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) +AC_INIT([DRI2Proto], [2.4], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE diff --git a/dri2proto.h b/dri2proto.h index 9708a4a..12d834f 100644 --- a/dri2proto.h +++ b/dri2proto.h @@ -295,8 +295,7 @@ typedef struct { CARD32 ust_lo B32; CARD32 msc_hi B32; CARD32 msc_lo B32; -CARD32 sbc_hi B32; -CARD32 sbc_lo B32; +CARD32 sbc B32; } xDRI2BufferSwapComplete; #define sz_xDRI2BufferSwapComplete 32 -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/6] GLX: don't crash when indirect clients try to set an event mask
After sending the GLXChangeDrawableAttributes request, we also set a local set of attributes on the DRI drawable. But in the indirect case this array won't be present, so skip the setting in that case to avoid a crash. Signed-off-by: Jesse Barnes --- src/glx/glx_pbuffer.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c index 5f91bc6..ec54f1e 100644 --- a/src/glx/glx_pbuffer.c +++ b/src/glx/glx_pbuffer.c @@ -137,6 +137,9 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable, #ifdef GLX_DIRECT_RENDERING pdraw = GetGLXDRIDrawable(dpy, drawable); + if (!pdraw) + return; + for (i = 0; i < num_attribs; i++) { switch(attribs[i * 2]) { case GLX_EVENT_MASK: -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 6/6] DRI2/GLX: make swap event handling match spec
We only handle a 32 bit swap count, so use the new structure definitions. Signed-off-by: Jesse Barnes --- configure.ac |4 ++-- src/glx/dri2.c |2 +- src/glx/glxext.c |2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 3b05ca3..94fb6f7 100644 --- a/configure.ac +++ b/configure.ac @@ -21,8 +21,8 @@ dnl Versions for external dependencies LIBDRM_REQUIRED=2.4.24 LIBDRM_RADEON_REQUIRED=2.4.24 LIBDRM_INTEL_REQUIRED=2.4.24 -DRI2PROTO_REQUIRED=2.1 -GLPROTO_REQUIRED=1.4.11 +DRI2PROTO_REQUIRED=2.4 +GLPROTO_REQUIRED=1.4.13 LIBDRM_XORG_REQUIRED=2.4.24 LIBKMS_XORG_REQUIRED=1.0.0 diff --git a/src/glx/dri2.c b/src/glx/dri2.c index adfd3d1..2f18ca0 100644 --- a/src/glx/dri2.c +++ b/src/glx/dri2.c @@ -124,7 +124,7 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) } aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo; aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo; - aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo; + aevent->sbc = awire->sbc; return True; } #endif diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 278c719..831d83f 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -138,7 +138,7 @@ __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire) aevent->drawable = awire->drawable; aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo; aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo; - aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo; + aevent->sbc = awire->sbc; return True; } default: -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Make swap event handling match the spec
On Tue, 3 May 2011 12:21:23 -0700 Jesse Barnes wrote: > Ian reminded me that we changed the spec to fit within an XEvent, but we > never updated the code to match. This set of patches (much simpler than > the last) does just that. Wrapping support can be added to Mesa if we > really want 64 bit values, but that means checking the drawable sbc and > adding whenver sbc hits 0. Apparently I've confused git send-email... 3/4 and 4/4 are for the server and 5/6 and 6/6 are for Mesa. -- Jesse Barnes, Intel Open Source Technology Center ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] mesa: implement AMD_seamless_cubemap_per_texture
On 05/03/2011 07:55 AM, Marek Olšák wrote: --- src/mesa/main/extensions.c |1 + src/mesa/main/mtypes.h |2 ++ src/mesa/main/texobj.c |2 ++ src/mesa/main/texparam.c | 32 4 files changed, 37 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 1062cde..a9ef8fa 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -260,6 +260,7 @@ static const struct extension extension_table[] = { { "GL_3DFX_texture_compression_FXT1", o(TDFX_texture_compression_FXT1), GL, 1999 }, { "GL_AMD_conservative_depth", o(AMD_conservative_depth), GL, 2009 }, { "GL_AMD_draw_buffers_blend", o(ARB_draw_buffers_blend), GL, 2009 }, + { "GL_AMD_seamless_cubemap_per_texture", o(AMD_seamless_cubemap_per_texture),GL, 2009 }, { "GL_AMD_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 }, { "GL_APPLE_client_storage",o(APPLE_client_storage), GL, 2002 }, { "GL_APPLE_object_purgeable", o(APPLE_object_purgeable), GL, 2006 }, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index fba65e8..ad65b55 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1370,6 +1370,7 @@ struct gl_texture_object GLint CropRect[4]; /**< GL_OES_draw_texture */ GLenum Swizzle[4]; /**< GL_EXT_texture_swizzle */ GLuint _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */ + GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */ I'm wondering if this field should be per-texture object or per-sampler object. I've sent an email to someone at AMD to find out. I'll let you know. GLboolean GenerateMipmap;/**< GL_SGIS_generate_mipmap */ GLboolean _Complete; /**< Is texture object complete? */ GLboolean _RenderToTexture; /**< Any rendering to this texture? */ @@ -2885,6 +2886,7 @@ struct gl_extensions GLboolean OES_standard_derivatives; /* vendor extensions */ GLboolean AMD_conservative_depth; + GLboolean AMD_seamless_cubemap_per_texture; GLboolean APPLE_client_storage; GLboolean APPLE_packed_pixels; GLboolean APPLE_vertex_array_object; diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 43d6e52..2272110 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -146,6 +146,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj->Swizzle[2] = GL_BLUE; obj->Swizzle[3] = GL_ALPHA; obj->_Swizzle = SWIZZLE_NOOP; + obj->CubeMapSeamless = GL_FALSE; obj->Sampler.sRGBDecode = GL_DECODE_EXT; } @@ -259,6 +260,7 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, dest->_Complete = src->_Complete; COPY_4V(dest->Swizzle, src->Swizzle); dest->_Swizzle = src->_Swizzle; + dest->CubeMapSeamless = src->CubeMapSeamless; } diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index f86a8cf..05f77b3 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -439,6 +439,20 @@ set_tex_parameteri(struct gl_context *ctx, } goto invalid_pname; + case GL_TEXTURE_CUBE_MAP_SEAMLESS: + if (ctx->Extensions.AMD_seamless_cubemap_per_texture) { + GLenum param = params[0]; + if (param != GL_TRUE&& param != GL_FALSE) { +goto invalid_param; + } + if (param != texObj->CubeMapSeamless) { +flush(ctx); +texObj->CubeMapSeamless = param; + } + return GL_TRUE; + } + goto invalid_pname; + default: goto invalid_pname; } @@ -580,6 +594,7 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) case GL_TEXTURE_COMPARE_FUNC_ARB: case GL_DEPTH_TEXTURE_MODE_ARB: case GL_TEXTURE_SRGB_DECODE_EXT: + case GL_TEXTURE_CUBE_MAP_SEAMLESS: { /* convert float param to int */ GLint p[4]; @@ -629,6 +644,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) case GL_TEXTURE_COMPARE_FUNC_ARB: case GL_DEPTH_TEXTURE_MODE_ARB: case GL_TEXTURE_SRGB_DECODE_EXT: + case GL_TEXTURE_CUBE_MAP_SEAMLESS: { /* convert float param to int */ GLint p[4]; @@ -1235,6 +1251,14 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) } break; + case GL_TEXTURE_CUBE_MAP_SEAMLESS: + if (ctx->Extensions.AMD_seamless_cubemap_per_texture) { + *params = (GLfloat) obj->CubeMapSeamless; + } + else { + error = GL_TRUE; + } + default: error = GL_TRUE
Re: [Mesa-dev] [PATCH 2/2] gallium: implement seamless cubemap extensions
On 05/03/2011 11:55 AM, Roland Scheidegger wrote: Am 03.05.2011 15:55, schrieb Marek Olšák: diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 250cbb2..ac6d76a 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -257,6 +257,9 @@ static void update_raster_state( struct st_context *st ) /* _NEW_FRAG_CLAMP */ raster->clamp_fragment_color = ctx->Color._ClampFragmentColor; + /* _NEW_TEXTURE */ + raster->seamless_cube_map = ctx->Texture.CubeMapSeamless != GL_FALSE; + raster->gl_rasterization_rules = 1; cso_set_rasterizer(st->cso_context, raster); @@ -273,7 +276,8 @@ const struct st_tracked_state st_update_rasterizer = { _NEW_POLYGON | _NEW_PROGRAM | _NEW_SCISSOR | - _NEW_FRAG_CLAMP), /* mesa state dependencies*/ + _NEW_FRAG_CLAMP | + _NEW_TEXTURE), /* mesa state dependencies */ ST_NEW_VERTEX_PROGRAM, /* state tracker dependencies */ }, update_raster_state /* update function */ Hmm seems rather unfortunate that this is _NEW_TEXTURE - looks like all the rest of the bits are likely much lower frequency (and of course the seamless bit itself probably only ever changes once). I can see now why you made that a new bit. I'll defer that to Brian though. Marek, are you sure it's too hard to check the currently bound samplers in the driver to check for global seamless cube map there? I'm still not too satisfied with having this state in two places. It feels shoehorned into the rasterizer state. But I don't want to hold this up too long. It could be changed in the future if we change our minds. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glxproto: make GLX swap event struct match spec
On Tue, 3 May 2011 12:21:24 -0700, Jesse Barnes wrote: > We only spec a 32 bit swap count, so drop the high sbc field. You're missing the explicit 16-bit padding field after 'event_type' The documented encoding http://www.opengl.org/registry/specs/INTEL/swap_event.txt needs to be fixed to match this, it has the padding at the end which leaves most of the structure mis-aligned. -- keith.pack...@intel.com pgpcqyknYnfHj.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glxproto: make GLX swap event struct match spec
On Tue, 03 May 2011 13:54:38 -0700 Keith Packard wrote: > On Tue, 3 May 2011 12:21:24 -0700, Jesse Barnes > wrote: > > > We only spec a 32 bit swap count, so drop the high sbc field. > > You're missing the explicit 16-bit padding field after 'event_type' > > The documented encoding > http://www.opengl.org/registry/specs/INTEL/swap_event.txt needs to be > fixed to match this, it has the padding at the end which leaves most of > the structure mis-aligned. Right, another case where we updated the spec incorrectly then failed to make the code match the broken definition (the complete enums also need to match the final values, which are correct in the first part of the spec). Yay for divergence. -- Jesse Barnes, Intel Open Source Technology Center ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glxproto: make GLX swap event struct match spec
On Tue, 3 May 2011 14:02:31 -0700 Jesse Barnes wrote: > On Tue, 03 May 2011 13:54:38 -0700 > Keith Packard wrote: > > > On Tue, 3 May 2011 12:21:24 -0700, Jesse Barnes > > wrote: > > > > > We only spec a 32 bit swap count, so drop the high sbc field. > > > > You're missing the explicit 16-bit padding field after 'event_type' > > > > The documented encoding > > http://www.opengl.org/registry/specs/INTEL/swap_event.txt needs to be > > fixed to match this, it has the padding at the end which leaves most of > > the structure mis-aligned. > > Right, another case where we updated the spec incorrectly then failed > to make the code match the broken definition (the complete enums also > need to match the final values, which are correct in the first part of > the spec). Yay for divergence. Fixed version below. -- Jesse Barnes, Intel Open Source Technology Center >From f5403828c68af0f12c79c0504df0a4781ca84b2b Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Tue, 3 May 2011 12:14:10 -0700 Subject: [PATCH] glxproto: make GLX swap event struct match spec We only spec a 32 bit swap count, so drop the high sbc field. Also make the padding explicit (most compilers would have already done this since it's not a packed structure, but making it explicit should prevent surprises in the future). Signed-off-by: Jesse Barnes --- configure.ac |2 +- glxproto.h |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d88e6df..a3047e4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.60]) -AC_INIT([GLProto], [1.4.12], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) +AC_INIT([GLProto], [1.4.13], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE diff --git a/glxproto.h b/glxproto.h index 0ff44e3..dfa0647 100644 --- a/glxproto.h +++ b/glxproto.h @@ -1375,13 +1375,13 @@ typedef struct { BYTE pad; CARD16 sequenceNumber B16; CARD16 event_type B16; +CARD16 pad2; CARD32 drawable; CARD32 ust_hi B32; CARD32 ust_lo B32; CARD32 msc_hi B32; CARD32 msc_lo B32; -CARD32 sbc_hi B32; -CARD32 sbc_lo B32; +CARD32 sbc B32; } xGLXBufferSwapComplete; // -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] dri2proto: make DRI2 swap event match GLX spec
Updated with explicit padding. -- Jesse Barnes, Intel Open Source Technology Center >From 0ca3778de195a82087d0f07415a1cf8fc94f5b0a Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Tue, 3 May 2011 12:14:58 -0700 Subject: [PATCH] dri2proto: make DRI2 swap event match GLX spec We only spec a 32 bit sbc count, so drop the high bits. Also make the padding explicit. Signed-off-by: Jesse Barnes --- configure.ac |2 +- dri2proto.h |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 5b78d6b..9505f56 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.60]) -AC_INIT([DRI2Proto], [2.3], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) +AC_INIT([DRI2Proto], [2.4], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE diff --git a/dri2proto.h b/dri2proto.h index 9708a4a..ff76355 100644 --- a/dri2proto.h +++ b/dri2proto.h @@ -290,13 +290,13 @@ typedef struct { CARD8 pad; CARD16 sequenceNumber B16; CARD16 event_type B16; +CARD16 pad2; CARD32 drawable B32; CARD32 ust_hi B32; CARD32 ust_lo B32; CARD32 msc_hi B32; CARD32 msc_lo B32; -CARD32 sbc_hi B32; -CARD32 sbc_lo B32; +CARD32 sbc B32; } xDRI2BufferSwapComplete; #define sz_xDRI2BufferSwapComplete 32 -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glxproto: make GLX swap event struct match spec
On Tue, 3 May 2011 14:08:58 -0700, Jesse Barnes wrote: > Fixed version below. Reviewed-by: Keith Packard (assuming that the GLX protocol specification gets updated to match :-) -- keith.pack...@intel.com pgpmw6kAybqOk.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glxproto: make GLX swap event struct match spec
On Tue, 03 May 2011 14:15:30 -0700 Keith Packard wrote: > On Tue, 3 May 2011 14:08:58 -0700, Jesse Barnes > wrote: > > > Fixed version below. > > Reviewed-by: Keith Packard > > (assuming that the GLX protocol specification gets updated to match :-) Yeah, Ian is fixing up the padding there to match what our existing gcc compiled implementations actually do (along with fixing the enums in the second half to match the first :) I'll push this out. Thanks, -- Jesse Barnes, Intel Open Source Technology Center ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] mesa: implement AMD_seamless_cubemap_per_texture
On 05/03/2011 01:24 PM, Brian Paul wrote: On 05/03/2011 07:55 AM, Marek Olšák wrote: --- src/mesa/main/extensions.c |1 + src/mesa/main/mtypes.h |2 ++ src/mesa/main/texobj.c |2 ++ src/mesa/main/texparam.c | 32 4 files changed, 37 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 1062cde..a9ef8fa 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -260,6 +260,7 @@ static const struct extension extension_table[] = { { "GL_3DFX_texture_compression_FXT1", o(TDFX_texture_compression_FXT1), GL, 1999 }, { "GL_AMD_conservative_depth", o(AMD_conservative_depth), GL, 2009 }, { "GL_AMD_draw_buffers_blend", o(ARB_draw_buffers_blend), GL, 2009 }, + { "GL_AMD_seamless_cubemap_per_texture", o(AMD_seamless_cubemap_per_texture),GL, 2009 }, { "GL_AMD_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 }, { "GL_APPLE_client_storage", o(APPLE_client_storage),GL, 2002 }, { "GL_APPLE_object_purgeable", o(APPLE_object_purgeable), GL, 2006 }, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index fba65e8..ad65b55 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1370,6 +1370,7 @@ struct gl_texture_object GLint CropRect[4]; /**< GL_OES_draw_texture */ GLenum Swizzle[4]; /**< GL_EXT_texture_swizzle */ GLuint _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */ + GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */ I'm wondering if this field should be per-texture object or per-sampler object. I've sent an email to someone at AMD to find out. I'll let you know. It's supposed to be per sampler object. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] mesa: implement AMD_seamless_cubemap_per_texture
On Tue, May 3, 2011 at 11:21 PM, Brian Paul wrote: > On 05/03/2011 01:24 PM, Brian Paul wrote: >> >> On 05/03/2011 07:55 AM, Marek Olšák wrote: >>> >>> --- >>> src/mesa/main/extensions.c | 1 + >>> src/mesa/main/mtypes.h | 2 ++ >>> src/mesa/main/texobj.c | 2 ++ >>> src/mesa/main/texparam.c | 32 >>> 4 files changed, 37 insertions(+), 0 deletions(-) >>> >>> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c >>> index 1062cde..a9ef8fa 100644 >>> --- a/src/mesa/main/extensions.c >>> +++ b/src/mesa/main/extensions.c >>> @@ -260,6 +260,7 @@ static const struct extension extension_table[] = { >>> { "GL_3DFX_texture_compression_FXT1", >>> o(TDFX_texture_compression_FXT1), GL, 1999 }, >>> { "GL_AMD_conservative_depth", >>> o(AMD_conservative_depth), GL, 2009 }, >>> { "GL_AMD_draw_buffers_blend", >>> o(ARB_draw_buffers_blend), GL, 2009 }, >>> + { "GL_AMD_seamless_cubemap_per_texture", >>> o(AMD_seamless_cubemap_per_texture), GL, 2009 }, >>> { "GL_AMD_shader_stencil_export", >>> o(ARB_shader_stencil_export), GL, 2009 }, >>> { "GL_APPLE_client_storage", >>> o(APPLE_client_storage), GL, 2002 }, >>> { "GL_APPLE_object_purgeable", >>> o(APPLE_object_purgeable), GL, 2006 }, >>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h >>> index fba65e8..ad65b55 100644 >>> --- a/src/mesa/main/mtypes.h >>> +++ b/src/mesa/main/mtypes.h >>> @@ -1370,6 +1370,7 @@ struct gl_texture_object >>> GLint CropRect[4]; /**< GL_OES_draw_texture */ >>> GLenum Swizzle[4]; /**< GL_EXT_texture_swizzle */ >>> GLuint _Swizzle; /**< same as Swizzle, but SWIZZLE_* >>> format */ >>> + GLboolean CubeMapSeamless; /**< >>> GL_AMD_seamless_cubemap_per_texture */ >> >> I'm wondering if this field should be per-texture object or per-sampler >> object. I've sent an email to someone at AMD to find out. I'll let you >> know. >> > > It's supposed to be per sampler object. OK, thanks for info. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] gallium: implement seamless cubemap extensions
On Tue, May 3, 2011 at 9:31 PM, Brian Paul wrote: > On 05/03/2011 11:55 AM, Roland Scheidegger wrote: >> >> Am 03.05.2011 15:55, schrieb Marek Olšák: >>> >>> diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c >>> b/src/mesa/state_tracker/st_atom_rasterizer.c >>> index 250cbb2..ac6d76a 100644 >>> --- a/src/mesa/state_tracker/st_atom_rasterizer.c >>> +++ b/src/mesa/state_tracker/st_atom_rasterizer.c >>> @@ -257,6 +257,9 @@ static void update_raster_state( struct st_context >>> *st ) >>> /* _NEW_FRAG_CLAMP */ >>> raster->clamp_fragment_color = ctx->Color._ClampFragmentColor; >>> >>> + /* _NEW_TEXTURE */ >>> + raster->seamless_cube_map = ctx->Texture.CubeMapSeamless != GL_FALSE; >>> + >>> raster->gl_rasterization_rules = 1; >>> >>> cso_set_rasterizer(st->cso_context, raster); >>> @@ -273,7 +276,8 @@ const struct st_tracked_state st_update_rasterizer = >>> { >>> _NEW_POLYGON | >>> _NEW_PROGRAM | >>> _NEW_SCISSOR | >>> - _NEW_FRAG_CLAMP), /* mesa state dependencies*/ >>> + _NEW_FRAG_CLAMP | >>> + _NEW_TEXTURE), /* mesa state dependencies */ >>> ST_NEW_VERTEX_PROGRAM, /* state tracker dependencies */ >>> }, >>> update_raster_state /* update function */ >> >> Hmm seems rather unfortunate that this is _NEW_TEXTURE - looks like all >> the rest of the bits are likely much lower frequency (and of course the >> seamless bit itself probably only ever changes once). I can see now why >> you made that a new bit. I'll defer that to Brian though. > > Marek, are you sure it's too hard to check the currently bound samplers in > the driver to check for global seamless cube map there? Not so hard, it's just additional work that I wanted to avoid. BTW I don't like the Mesa dirty flags either. They don't map to the gallium state objects very well and we already have 30 or so. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/11] implement GL_ARB_debug_output
On 05/02/2011 04:59 PM, nobled wrote: git repo: https://github.com/nobled/mesa.git (branch: arb_debug_output, rebased on bd661a933b18fccd7102d05932774ee61a90ec9e) web interface: https://github.com/nobled/mesa/commits/arb_debug_output spec: http://www.opengl.org/registry/specs/ARB/debug_output.txt This series adds almost everything needed to advertise the extension GL_ARB_debug_output. The only thing missing is the ability to pass an array of IDs to glDebugMessageControlARB with the parameter 'source' having the value GL_DEBUG_SOURCE_APPLICATION_ARB or GL_DEBUG_SOURCE_THIRD_PARTY_ARB. Since the *ControlARB stuff was the part I was least certain about, I also broke it up into even smaller patches. What I think is needed to fill in the missing functionality is a structure that works like C++'s std::map, with a GLuint/GLboolean key/value pair. There would also need to be, for each map, three std::set-like structures that record the HIGH, MEDIUM, and LOW-severity message IDs. Otherwise it wouldn't be possible for clients to make calls like this that impact all messages of a certain severity level: glDebugMessageControlARB(GL_DEBUG_SOURCE_APPLICATION_ARB, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE); Does mesa have structures like those in the auxiliary code somewhere? Or is there a way to wrap the C++ STL in C code? To map GLuint to 'something' we typically use the hash table in hash.c Otherwise, you could make something based on simple_list.h. I believe we're talking about a pretty small set of GLuints, right? So linear search wouldn't be a big deal? Open question: The app might pass 'implementation-dependent' message IDs to glDebugMessageControlARB that don't actually exist in mesa. The spec doesn't say whether we should give an error or silently ignore IDs like that. Also an open question: what to do when apps misbehave and send the same source/type/message ID tuple to glDebugMessageInsertARB twice or more, but with different severity levels each time, and then they call glDebugMessageControlARB on all messages with a certain severity. Should mesa use the latest-specified severity as the canonical one, or the first? I haven't even read the spec for this extension yet so I don't have any answers for you. I did a quick review of your patches and they mostly look OK. I'll post specific comments in a bit. It looks like almost all the changes are confined to errors.c and mtypes.h so I'm not too worried about regressions or a big impact on the rest of the code. I'm OK with you committing what you have and following up with changes if/when the above questions get answered. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 08/11] mesa: add glDebugMessageControlARB
On 05/02/2011 05:00 PM, nobled wrote: Controlling the output of client-provided messages isn't done yet. --- src/mesa/main/errors.c | 110 1 files changed, 110 insertions(+), 0 deletions(-) Please put comments on all the new functions defined here (and in your other patches) to explain what they do. diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index 9d74a05..e304184 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -41,6 +41,31 @@ static char out_of_memory[] = "Debugging error: out of memory"; +#define enum_is(e, kind1, kind2) \ + ((e) == GL_DEBUG_##kind1##_##kind2##_ARB || (e) == GL_DONT_CARE) +#define severity_is(sev, kind) enum_is(sev, SEVERITY, kind) +#define source_is(s, kind) enum_is(s, SOURCE, kind) +#define type_is(t, kind) enum_is(t, TYPE, kind) + +static GLboolean +should_log(struct gl_context *ctx, GLenum source, GLenum type, + GLuint id, GLenum severity) +{ + if (type_is(type, ERROR)) { + if (source_is(source, API)) + return ctx->Debug.ApiErrors[id]; + if (source_is(source, WINDOW_SYSTEM)) + return ctx->Debug.WinsysErrors[id]; + if (source_is(source, SHADER_COMPILER)) + return ctx->Debug.ShaderErrors[id]; + if (source_is(source, OTHER)) + return ctx->Debug.OtherErrors[id]; + } + + /* TODO: tracking client messages' state. */ + return (severity != GL_DEBUG_SEVERITY_LOW_ARB); +} + /* 'buf' is not necessarily a null-terminated string. When logging, copy * 'len' characters from it, store them in a new, null-terminated string, * and remember the number of bytes used by that string, *including* @@ -55,6 +80,9 @@ _mesa_log_msg(struct gl_context *ctx, GLenum source, GLenum type, assert(len>= 0&& len< _MESA_MAX_DEBUG_MESSAGE_LENGTH); + if (!should_log(ctx, source, type, id, severity)) + return; + if (ctx->Debug.Callback) { ctx->Debug.Callback(source, type, id, severity, len, buf, ctx->Debug.CallbackData); @@ -281,6 +309,82 @@ _mesa_GetDebugMessageLogARB(GLuint count, GLsizei logSize, GLenum* sources, return ret; } +static void +control_messages(GLboolean *array, GLuint size, + GLsizei count, const GLuint *ids, GLboolean enabled) +{ + int i; + + if (!count) { + for (i = 0; (GLuint)i< size; i++) { + array[i] = enabled; + } + return; + } If you put the declaration of 'i' inside that loop you can use the right type to avoid casting. + + for (i = 0; i< count; i++) { + if (ids[i]>= size) { + /* XXX: The spec doesn't say what to do with a non-existent ID. */ + continue; + } + array[ids[i]] = enabled; + } +} + +static void +control_app_messages(struct gl_context *ctx, GLenum source, GLenum type, + GLenum severity, GLsizei count, const GLuint *ids, + GLboolean enabled) +{ + assert(0&& "glDebugMessageControlARB():" + " Controlling application IDs not implemented"); +} + +static void GLAPIENTRY +_mesa_DebugMessageControlARB(GLenum source, GLenum type, GLenum severity, + GLsizei count, const GLuint *ids, + GLboolean enabled) +{ + GET_CURRENT_CONTEXT(ctx); + + if (count< 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glDebugMessageControlARB" + "(count=%d : count must not be negative)", count); + return; + } + + if (!validate_params(ctx, CONTROL, source, type, severity)) + return; /* GL_INVALID_ENUM */ + + if (count&& (severity != GL_DONT_CARE || type == GL_DONT_CARE + || source == GL_DONT_CARE)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDebugMessageControlARB" + "(When passing an array of ids, severity must be" + " GL_DONT_CARE, and source and type must not be GL_DONT_CARE."); + return; + } + + if (source_is(source, APPLICATION) || source_is(source, THIRD_PARTY)) + control_app_messages(ctx, source, type, severity, count, ids, enabled); + + if (severity_is(severity, HIGH)) { + if (type_is(type, ERROR)) { + if (source_is(source, API)) +control_messages(ctx->Debug.ApiErrors, API_ERROR_COUNT, + count, ids, enabled); + if (source_is(source, WINDOW_SYSTEM)) +control_messages(ctx->Debug.WinsysErrors, WINSYS_ERROR_COUNT, + count, ids, enabled); + if (source_is(source, SHADER_COMPILER)) +control_messages(ctx->Debug.ShaderErrors, SHADER_ERROR_COUNT, + count, ids, enabled); + if (source_is(source, OTHER)) +control_messages(ctx->Debug.OtherErrors, OTHER_ERROR_COUNT, + count, ids, enabled); + } + } +} + static void GLAPIENTRY _mesa_DebugMessageCallbackARB(GLDEBUGPROCARB callback, GLvoid*
Re: [Mesa-dev] [PATCH 07/11] mesa: add message-toggle booleans for GL_ARB_debug_output
On 05/02/2011 05:00 PM, nobled wrote: --- src/mesa/main/errors.c |2 +- src/mesa/main/mtypes.h | 32 +++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index c953fbf..9d74a05 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -86,7 +86,7 @@ _mesa_log_msg(struct gl_context *ctx, GLenum source, GLenum type, emptySlot->length = strlen(out_of_memory)+1; emptySlot->source = GL_DEBUG_SOURCE_OTHER_ARB; emptySlot->type = GL_DEBUG_TYPE_ERROR_ARB; - emptySlot->id = 1; /* TODO: proper id namespace */ + emptySlot->id = OTHER_ERROR_OUT_OF_MEMORY; emptySlot->severity = GL_DEBUG_SEVERITY_HIGH_ARB; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 647c1b7..41f6470 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3169,12 +3169,42 @@ struct gl_debug_msg #define _MESA_MAX_DEBUG_LOGGED_MESSAGES 3 #define _MESA_MAX_DEBUG_MESSAGE_LENGTH 4096 -/* GL_ARB_debug_output */ +typedef enum { +API_ERROR_UNKNOWN, + +API_ERROR_COUNT +} ApiError; + +typedef enum { +WINSYS_ERROR_UNKNOWN, + +WINSYS_ERROR_COUNT +} WinsysError; + +typedef enum { +SHADER_ERROR_UNKNOWN, + +SHADER_ERROR_COUNT +} ShaderError; + +typedef enum { +OTHER_ERROR_UNKNOWN, +OTHER_ERROR_OUT_OF_MEMORY, + +OTHER_ERROR_COUNT +} OtherError; + The whitespace there seems off (not sure if it's just Thunderbird). And the enum names don't follow the pattern of other enums in mtypes.h. I think these should look like: typedef enum { OTHER_ERROR_UNKNOWN, OTHER_ERROR_OUT_OF_MEMORY, OTHER_ERROR_COUNT } gl_other_error; struct gl_debug_state { GLDEBUGPROCARB Callback; GLvoid *CallbackData; GLboolean SyncOutput; + GLboolean ApiErrors[API_ERROR_COUNT]; + GLboolean WinsysErrors[WINSYS_ERROR_COUNT]; + GLboolean ShaderErrors[SHADER_ERROR_COUNT]; + GLboolean OtherErrors[OTHER_ERROR_COUNT]; + /* TODO: Add an object here that tracks the state of client-provided IDs + in the APPLICATION and THIRD_PARTY namespaces. */ struct gl_debug_msg Log[_MESA_MAX_DEBUG_LOGGED_MESSAGES]; GLint NumMessages; GLint NextMsg; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 05/11] mesa: add infrastructure for GL_ARB_debug_output
On 05/02/2011 05:00 PM, nobled wrote: --- src/mesa/main/context.c|1 + src/mesa/main/enable.c |5 + src/mesa/main/errors.c | 10 ++ src/mesa/main/extensions.c |1 + src/mesa/main/get.c|7 +++ src/mesa/main/getstring.c |6 ++ src/mesa/main/imports.h|3 +++ src/mesa/main/mtypes.h | 31 +++ 8 files changed, 64 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index ea13bdd..0173535 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -763,6 +763,7 @@ init_attrib_groups(struct gl_context *ctx) _mesa_init_depth( ctx ); _mesa_init_debug( ctx ); _mesa_init_display_list( ctx ); + _mesa_init_errors( ctx ); _mesa_init_eval( ctx ); _mesa_init_fbobjects( ctx ); _mesa_init_feedback( ctx ); diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 2ec19c8..c2286a0 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -344,6 +344,9 @@ FLUSH_VERTICES(ctx, _NEW_DEPTH); ctx->Depth.Test = state; break; + case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB: + ctx->Debug.SyncOutput = state; + break; case GL_DITHER: if (ctx->Color.DitherFlag == state) return; @@ -1097,6 +1100,8 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Light.ColorMaterialEnabled; case GL_CULL_FACE: return ctx->Polygon.CullFlag; + case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB: + return ctx->Debug.SyncOutput; case GL_DEPTH_TEST: return ctx->Depth.Test; case GL_DITHER: diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index 009681a..e112915 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -38,6 +38,16 @@ #define MAXSTRING 4000 /* for _mesa_vsnprintf() */ +void +_mesa_init_errors(struct gl_context *ctx) +{ + ctx->Debug.Callback = NULL; + ctx->Debug.SyncOutput = GL_FALSE; + ctx->Debug.Log[0].length = 0; + ctx->Debug.NextMsg =&ctx->Debug.Log[0]; + ctx->Debug.NumMessages = 0; +} + /**/ /** \name Diagnostics */ /*@{*/ diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index e0562cc..c034370 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -81,6 +81,7 @@ { "GL_ARB_blend_func_extended", o(ARB_blend_func_extended), GL, 2009 }, { "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), GL, 2004 }, { "GL_ARB_copy_buffer", o(ARB_copy_buffer), GL, 2008 }, + { "GL_ARB_debug_output", o(ARB_debug_output),GL, 2009 }, { "GL_ARB_depth_buffer_float", o(ARB_depth_buffer_float), GL, 2008 }, { "GL_ARB_depth_clamp", o(ARB_depth_clamp), GL, 2003 }, { "GL_ARB_depth_texture", o(ARB_depth_texture), GL, 2001 }, diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index e933bbe..527480b 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1284,6 +1284,13 @@ /* GL_ARB_robustness */ { GL_RESET_NOTIFICATION_STRATEGY_ARB, CONTEXT_ENUM(Const.ResetStrategy), NO_EXTRA }, + + /* GL_ARB_debug_output */ + { GL_DEBUG_LOGGED_MESSAGES_ARB, CONTEXT_INT(Debug.NumMessages), NO_EXTRA }, + { GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB, CONTEXT_INT(Debug.NextMsgLength), NO_EXTRA }, + { GL_MAX_DEBUG_LOGGED_MESSAGES_ARB, CONST(_MESA_MAX_DEBUG_LOGGED_MESSAGES), NO_EXTRA }, + { GL_MAX_DEBUG_MESSAGE_LENGTH_ARB, CONST(_MESA_MAX_DEBUG_MESSAGE_LENGTH), NO_EXTRA }, + #endif /* FEATURE_GL */ }; diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index c381fb2..019d931 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -224,6 +224,12 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) *params = (GLvoid *) ctx->Array.ArrayObj->PointSize.Ptr; break; #endif + case GL_DEBUG_CALLBACK_FUNCTION_ARB: + *params = (GLvoid *) ctx->Debug.Callback; + break; + case GL_DEBUG_CALLBACK_USER_PARAM_ARB: + *params = ctx->Debug.CallbackData; + break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" ); return; diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 604fbcb..cc5f154 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -610,6 +610,9 @@ extern void _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); +extern void +_mesa_init_errors( struct gl_context *ctx ); + #if defined(_MSC_VER)&& !defined(snprintf) #define snprintf _snprintf diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index fba65e
Re: [Mesa-dev] [PATCH 06/11] mesa: add some GL_ARB_debug_output functions
On 05/02/2011 05:00 PM, nobled wrote: They're not actually exported yet. --- src/mesa/main/api_exec.c | 12 ++- src/mesa/main/errors.c | 262 ++ src/mesa/main/errors.h |4 + 3 files changed, 274 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 93214dd..dbbed56 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -57,6 +57,7 @@ #include "drawpix.h" #include "rastpos.h" #include "enable.h" +#include "errors.h" #include "eval.h" #include "get.h" #include "feedback.h" @@ -600,15 +601,18 @@ _mesa_create_exec_table(void) SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB); #endif - /* ARB 104. GL_ARB_robustness */ + /* ARB 66. GL_ARB_sync */ + _mesa_init_sync_dispatch(exec); + + /* ARB 104. GL_ARB_debug_output */ + _mesa_init_errors_dispatch(exec); + + /* ARB 105. GL_ARB_robustness */ SET_GetGraphicsResetStatusARB(exec, _mesa_GetGraphicsResetStatusARB); SET_GetnPolygonStippleARB(exec, _mesa_GetnPolygonStippleARB); SET_GetnTexImageARB(exec, _mesa_GetnTexImageARB); SET_ReadnPixelsARB(exec, _mesa_ReadnPixelsARB); - /* GL_ARB_sync */ - _mesa_init_sync_dispatch(exec); - /* GL_ATI_fragment_shader */ _mesa_init_ati_fragment_shader_dispatch(exec); diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index bb6270b..c953fbf 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -38,6 +38,268 @@ #define MAXSTRING _MESA_MAX_DEBUG_MESSAGE_LENGTH + +static char out_of_memory[] = "Debugging error: out of memory"; + +/* 'buf' is not necessarily a null-terminated string. When logging, copy + * 'len' characters from it, store them in a new, null-terminated string, + * and remember the number of bytes used by that string, *including* + * the null terminator this time. + */ I don't think anyone's running doxygen on a regular basis, but to stay consistant with the rest of core Mesa, the function comment should look more like this: /** * 'buf' is not necessarily... */ +static void +_mesa_log_msg(struct gl_context *ctx, GLenum source, GLenum type, + GLuint id, GLenum severity, GLint len, const char *buf) +{ + GLint nextEmpty; + struct gl_debug_msg *emptySlot; + + assert(len>= 0&& len< _MESA_MAX_DEBUG_MESSAGE_LENGTH); + + if (ctx->Debug.Callback) { + ctx->Debug.Callback(source, type, id, severity, + len, buf, ctx->Debug.CallbackData); + return; + } + + if (ctx->Debug.NumMessages == _MESA_MAX_DEBUG_LOGGED_MESSAGES) + return; + + nextEmpty = (ctx->Debug.NextMsg + ctx->Debug.NumMessages) + % _MESA_MAX_DEBUG_LOGGED_MESSAGES; + emptySlot =&ctx->Debug.Log[nextEmpty]; + + assert(!emptySlot->message&& !emptySlot->length); + + emptySlot->message = MALLOC(len+1); + if (emptySlot->message) { + (void) strncpy(emptySlot->message, buf, (size_t)len); + emptySlot->message[len] = '\0'; + + emptySlot->length = len+1; + emptySlot->source = source; + emptySlot->type = type; + emptySlot->id = id; + emptySlot->severity = severity; + } else { + /* malloc failed! */ + emptySlot->message = out_of_memory; + emptySlot->length = strlen(out_of_memory)+1; + emptySlot->source = GL_DEBUG_SOURCE_OTHER_ARB; + emptySlot->type = GL_DEBUG_TYPE_ERROR_ARB; + emptySlot->id = 1; /* TODO: proper id namespace */ + emptySlot->severity = GL_DEBUG_SEVERITY_HIGH_ARB; + } + + if (ctx->Debug.NumMessages == 0) + ctx->Debug.NextMsgLength = ctx->Debug.Log[ctx->Debug.NextMsg].length; + + ctx->Debug.NumMessages++; +} + +/** Pop the oldest debug message out of the log. + * Writes the message string, including the null terminator, into 'buf', + * using up to 'bufSize' bytes. If 'bufSize' is too small, or + * if 'buf' is NULL, nothing is written. + * + * Returns the number of bytes written on success, or when 'buf' is NULL, + * the number that would have been written. A return value of 0 + * indicates failure. + */ +static GLsizei +_mesa_get_msg(struct gl_context *ctx, GLenum *source, GLenum *type, + GLuint *id, GLenum *severity, GLsizei bufSize, char *buf) +{ + struct gl_debug_msg *msg; + GLsizei length; + + if (ctx->Debug.NumMessages == 0) + return 0; + + msg =&ctx->Debug.Log[ctx->Debug.NextMsg]; + length = msg->length; + + assert(length> 0&& length == ctx->Debug.NextMsgLength); + + if (bufSize< length&& buf != NULL) + return 0; + + if (severity) + *severity = msg->severity; + if (source) + *source = msg->source; + if (type) + *type = msg->type; + if (id) + *id = msg->id; + + if (buf) { + assert(msg->message[length-1] == '\0'); + (void) strncpy(buf, msg->message, (size_t)length); + } + + if (msg->message != (char*)out_of_memory) + FREE(msg->message); + msg->message = NULL; + msg->l
Re: [Mesa-dev] [PATCH 09/11] mesa: add yet more context fields for GL_ARB_debug_output
On 05/02/2011 05:01 PM, nobled wrote: --- src/mesa/main/mtypes.h | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 41f6470..d381719 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3194,6 +3194,13 @@ OTHER_ERROR_OUT_OF_MEMORY, OTHER_ERROR_COUNT } OtherError; +struct gl_client_debug +{ + GLboolean defaults[3][2][6]; /* severity, source, type */ The field should be named "Defaults" to match the style of other fields. + /* TODO: Add an object here that can track the state of an arbitrary + number of client-provided IDs. */ +}; + struct gl_debug_state { GLDEBUGPROCARB Callback; @@ -3203,8 +3210,7 @@ struct gl_debug_state GLboolean WinsysErrors[WINSYS_ERROR_COUNT]; GLboolean ShaderErrors[SHADER_ERROR_COUNT]; GLboolean OtherErrors[OTHER_ERROR_COUNT]; - /* TODO: Add an object here that tracks the state of client-provided IDs - in the APPLICATION and THIRD_PARTY namespaces. */ + struct gl_client_debug ClientIDs; struct gl_debug_msg Log[_MESA_MAX_DEBUG_LOGGED_MESSAGES]; GLint NumMessages; GLint NextMsg; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] r600g on rv635 and broken mipmaps
On Wed, May 4, 2011 at 5:05 AM, Fredrik Höglund wrote: > On Monday 02 May 2011, Alex Deucher wrote: >> One thing to double check is that rv6xx_context_surface_base_update() >> gets emitted properly every time a base address is emitted. Right now >> I think we only call it once per command buffer, but it needs to be >> emitted every time a base address changes. > > It's always emitted in r600_context_draw(), which is actually more > often than what is necessary since the surface base registers don't > always change between draw calls. > > But maybe that's the source of the problem. Maybe you can't emit > base update twice without flushing the caches in between? > > If that's the case, I think the attached patch should fix it. This doesn't help here at least, I'm just playing with the problem on my rv635 now. Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev