From 17f1cb1d99e66227d1e05925ef937643f5c1089a Mon Sep 17 00:00:00 2001 From: Jan de Groot Date: Thu, 07 Mar 2013 18:48:13 +0000 Subject: dri/nouveau: fix crash in nouveau_flush https://bugs.freedesktop.org/show_bug.cgi?id=61947 Note: this is a candidate for the stable branches --- diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index f56b3b2..6c119d5 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c @@ -69,7 +69,8 @@ nouveau_flush(struct gl_context *ctx) __DRIdri2LoaderExtension *dri2 = screen->dri2.loader; __DRIdrawable *drawable = nctx->dri_context->driDrawablePriv; - dri2->flushFrontBuffer(drawable, drawable->loaderPrivate); + if (drawable && drawable->loaderPrivate) + dri2->flushFrontBuffer(drawable, drawable->loaderPrivate); } } -- cgit v0.9.0.2-2-gbebe From e062a4187d8ea518a39c913ae7562cf1d8ac3205 Mon Sep 17 00:00:00 2001 From: Tapani Pälli Date: Mon, 28 Jan 2013 06:53:56 +0000 Subject: intel: Fix regression in intel_create_image_from_name stride handling Strangely, the DRIimage interface we have passes the pitch in pixels instead of bytes, which anholt missed in the change to using bytes for region pitch. Signed-off-by: Tapani Pälli Reviewed-by: Eric Anholt --- diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index defcd73..d223a0b 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -377,7 +377,7 @@ intel_create_image_from_name(__DRIscreen *screen, cpp = _mesa_get_format_bytes(image->format); image->region = intel_region_alloc_for_handle(intelScreen, cpp, width, height, - pitch, name, "image"); + pitch * cpp, name, "image"); if (image->region == NULL) { free(image); return NULL; -- cgit v0.9.0.2-2-gbebe -- cgit v0.9.0.2-2-gbebe From f299f3fe6138723e4fde3aced48646118e4abe6a Author: Linas Date: Thu Apr 18 12:28:11 2013 +0200 Revert "st/dri: implement MSAA for GLX/DRI2 framebuffers" This reverts commit 35840ab189595b817fa8b1a1df8cc92474a7c38d. diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c index 87ab764..d03a690 100644 --- a/src/gallium/state_trackers/dri/common/dri_drawable.c +++ b/src/gallium/state_trackers/dri/common/dri_drawable.c @@ -54,9 +54,6 @@ dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, boolean new_stamp; int i; unsigned int lastStamp; - struct pipe_resource **textures = - drawable->stvis.samples > 1 ? drawable->msaa_textures - : drawable->textures; statt_mask = 0x0; for (i = 0; i < count; i++) @@ -82,7 +79,7 @@ dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, /* add existing textures */ for (i = 0; i < ST_ATTACHMENT_COUNT; i++) { - if (textures[i]) + if (drawable->textures[i]) statt_mask |= (1 << i); } @@ -94,10 +91,9 @@ dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, if (!out) return TRUE; - /* Set the window-system buffers for the state tracker. */ for (i = 0; i < count; i++) { out[i] = NULL; - pipe_resource_reference(&out[i], textures[statts[i]]); + pipe_resource_reference(&out[i], drawable->textures[statts[i]]); } return TRUE; @@ -170,8 +166,6 @@ dri_destroy_buffer(__DRIdrawable * dPriv) for (i = 0; i < ST_ATTACHMENT_COUNT; i++) pipe_resource_reference(&drawable->textures[i], NULL); - for (i = 0; i < ST_ATTACHMENT_COUNT; i++) - pipe_resource_reference(&drawable->msaa_textures[i], NULL); swap_fences_unref(drawable); @@ -358,48 +352,6 @@ swap_fences_unref(struct dri_drawable *draw) } } -void -dri_msaa_resolve(struct dri_context *ctx, - struct dri_drawable *drawable, - enum st_attachment_type att) -{ - struct pipe_context *pipe = ctx->st->pipe; - struct pipe_resource *dst = drawable->textures[att]; - struct pipe_resource *src = drawable->msaa_textures[att]; - struct pipe_blit_info blit; - - if (!dst || !src) - return; - - memset(&blit, 0, sizeof(blit)); - blit.dst.resource = dst; - blit.dst.box.width = dst->width0; - blit.dst.box.height = dst->width0; - blit.dst.box.depth = 1; - blit.dst.format = util_format_linear(dst->format); - blit.src.resource = src; - blit.src.box.width = src->width0; - blit.src.box.height = src->width0; - blit.src.box.depth = 1; - blit.src.format = util_format_linear(src->format); - blit.mask = PIPE_MASK_RGBA; - blit.filter = PIPE_TEX_FILTER_NEAREST; - - pipe->blit(pipe, &blit); -} - -static void -dri_postprocessing(struct dri_context *ctx, - struct dri_drawable *drawable, - enum st_attachment_type att) -{ - struct pipe_resource *src = drawable->textures[att]; - struct pipe_resource *zsbuf = drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]; - - if (ctx->pp && src && zsbuf) - pp_run(ctx->pp, src, src, zsbuf); -} - /** * DRI2 flush extension, the flush_with_flags function. * @@ -436,13 +388,10 @@ dri_flush(__DRIcontext *cPriv, /* Flush the drawable. */ if (flags & __DRI2_FLUSH_DRAWABLE) { - /* Resolve MSAA buffers. */ - if (drawable->stvis.samples > 1) { - dri_msaa_resolve(ctx, drawable, ST_ATTACHMENT_BACK_LEFT); - /* FRONT_LEFT is resolved in drawable->flush_frontbuffer. */ - } + struct pipe_resource *ptex = drawable->textures[ST_ATTACHMENT_BACK_LEFT]; - dri_postprocessing(ctx, drawable, ST_ATTACHMENT_BACK_LEFT); + if (ptex && ctx->pp && drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]) + pp_run(ctx->pp, ptex, ptex, drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]); } flush_flags = 0; diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.h b/src/gallium/state_trackers/dri/common/dri_drawable.h index 56f8a40..70bc82b 100644 --- a/src/gallium/state_trackers/dri/common/dri_drawable.h +++ b/src/gallium/state_trackers/dri/common/dri_drawable.h @@ -57,7 +57,6 @@ struct dri_drawable unsigned old_h; struct pipe_resource *textures[ST_ATTACHMENT_COUNT]; - struct pipe_resource *msaa_textures[ST_ATTACHMENT_COUNT]; unsigned int texture_mask, texture_stamp; struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX]; @@ -110,11 +109,6 @@ dri_drawable_get_format(struct dri_drawable *drawable, unsigned *bind); void -dri_msaa_resolve(struct dri_context *ctx, - struct dri_drawable *drawable, - enum st_attachment_type att); - -void dri_flush(__DRIcontext *cPriv, __DRIdrawable *dPriv, unsigned flags, diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c index a908e28..fcbfdb8 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.c +++ b/src/gallium/state_trackers/dri/common/dri_screen.c @@ -104,7 +104,7 @@ dri_fill_in_modes(struct dri_screen *screen) stencil_bits_array[0] = 0; depth_buffer_factor = 1; - msaa_samples_max = (screen->st_api->feature_mask & ST_API_FEATURE_MS_VISUALS_MASK) + msaa_samples_max = (screen->st_api->feature_mask & ST_API_FEATURE_MS_VISUALS) ? MSAA_VISUAL_MAX_SAMPLES : 1; pf_x8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24X8_UNORM, @@ -237,6 +237,8 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen, if (!mode) return; + stvis->samples = mode->samples; + if (mode->redBits == 8) { if (mode->alphaBits == 8) stvis->color_format = PIPE_FORMAT_B8G8R8A8_UNORM; diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index f8d311c..5ebe184 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -190,8 +190,6 @@ dri2_drawable_process_buffers(struct dri_drawable *drawable, for (i = 0; i < ST_ATTACHMENT_COUNT; i++) pipe_resource_reference(&drawable->textures[i], NULL); - for (i = 0; i < ST_ATTACHMENT_COUNT; i++) - pipe_resource_reference(&drawable->msaa_textures[i], NULL); memset(&templ, 0, sizeof(templ)); templ.target = screen->target; @@ -237,25 +235,6 @@ dri2_drawable_process_buffers(struct dri_drawable *drawable, drawable->textures[statt] = screen->base.screen->resource_from_handle(screen->base.screen, &templ, &whandle); - assert(drawable->textures[statt]); - } - - /* Allocate private MSAA colorbuffers. */ - if (drawable->stvis.samples > 1) { - for (i = 0; i < att_count; i++) { - enum st_attachment_type att = atts[i]; - - if (drawable->textures[att]) { - templ.format = drawable->textures[att]->format; - templ.bind = drawable->textures[att]->bind; - templ.nr_samples = drawable->stvis.samples; - - drawable->msaa_textures[att] = - screen->base.screen->resource_create(screen->base.screen, - &templ); - assert(drawable->msaa_textures[att]); - } - } } /* See if we need a depth-stencil buffer. */ @@ -277,20 +256,8 @@ dri2_drawable_process_buffers(struct dri_drawable *drawable, templ.format = format; templ.bind = bind; - if (drawable->stvis.samples > 1) { - templ.nr_samples = drawable->stvis.samples; - drawable->msaa_textures[ST_ATTACHMENT_DEPTH_STENCIL] = - screen->base.screen->resource_create(screen->base.screen, - &templ); - assert(drawable->msaa_textures[ST_ATTACHMENT_DEPTH_STENCIL]); - } - else { - templ.nr_samples = 0; - drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL] = - screen->base.screen->resource_create(screen->base.screen, - &templ); - assert(drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]); - } + drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL] = + screen->base.screen->resource_create(screen->base.screen, &templ); } } @@ -413,17 +380,10 @@ dri2_flush_frontbuffer(struct dri_context *ctx, __DRIdrawable *dri_drawable = drawable->dPriv; struct __DRIdri2LoaderExtensionRec *loader = drawable->sPriv->dri2.loader; - if (statt != ST_ATTACHMENT_FRONT_LEFT) + if (loader->flushFrontBuffer == NULL) return; - if (drawable->stvis.samples > 1) { - struct pipe_context *pipe = ctx->st->pipe; - - dri_msaa_resolve(ctx, drawable, ST_ATTACHMENT_FRONT_LEFT); - pipe->flush(pipe, NULL, 0); - } - - if (loader->flushFrontBuffer) { + if (statt == ST_ATTACHMENT_FRONT_LEFT) { loader->flushFrontBuffer(dri_drawable, dri_drawable->loaderPrivate); } } diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index a3a6771..274d63c 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -392,7 +392,7 @@ st_visual_to_context_mode(const struct st_visual *visual, UTIL_FORMAT_COLORSPACE_RGB, 3); } - if (visual->samples > 1) { + if (visual->samples) { mode->sampleBuffers = 1; mode->samples = visual->samples; } @@ -896,7 +896,7 @@ static const struct st_api st_gl_api = { ST_PROFILE_OPENGL_ES2_MASK | #endif 0, - ST_API_FEATURE_MS_VISUALS_MASK, + 0, st_api_destroy, st_api_get_proc_address, st_api_create_context, -- cgit v0.9.0.2-2-gbebe