Re: [Mesa3d-dev] Revert ST_SURFACE_DEPTH = BUFFER_DEPTH in master too?

2010-03-11 Thread Luca Barbieri
I've looked into the issue, and found a workaround by looking at what
st_renderbuffer_alloc_storage (which is called to create the depth
buffer with ST_SURFACE_DEPTH != BUFFER_DEPTH) does.

Adding:
if(ctx) ctx-NewState |= _NEW_BUFFERS;

at the end of st_set_framebuffer_surface seems to solve the warsow
problem with no other regressions.

Brian, is this the right fix?
Marek, does it fix your r300g problems too?

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev


Re: [Mesa3d-dev] Revert ST_SURFACE_DEPTH = BUFFER_DEPTH in master too?

2010-03-11 Thread Brian Paul
Luca Barbieri wrote:
 I've looked into the issue, and found a workaround by looking at what
 st_renderbuffer_alloc_storage (which is called to create the depth
 buffer with ST_SURFACE_DEPTH != BUFFER_DEPTH) does.
 
 Adding:
 if(ctx) ctx-NewState |= _NEW_BUFFERS;
 
 at the end of st_set_framebuffer_surface seems to solve the warsow
 problem with no other regressions.
 
 Brian, is this the right fix?

That's probably the right direction, but I think there's several other 
things to be fixed in st_set_framebuffer_surface().  I'll have a patch 
soon...

-Brian

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev


Re: [Mesa3d-dev] Revert ST_SURFACE_DEPTH = BUFFER_DEPTH in master too?

2010-03-11 Thread Brian Paul

Brian Paul wrote:

Luca Barbieri wrote:

I've looked into the issue, and found a workaround by looking at what
st_renderbuffer_alloc_storage (which is called to create the depth
buffer with ST_SURFACE_DEPTH != BUFFER_DEPTH) does.

Adding:
if(ctx) ctx-NewState |= _NEW_BUFFERS;

at the end of st_set_framebuffer_surface seems to solve the warsow
problem with no other regressions.

Brian, is this the right fix?


That's probably the right direction, but I think there's several other 
things to be fixed in st_set_framebuffer_surface().  I'll have a patch 
soon...


OK, here's a patch which sets that flag, and:

1. always allocates the renderbuffer if it's not already present.

2. removes the framebuffer size update code.  Core Mesa will do this 
during state validation if _NEW_BUFFERS is set.


Please test.  Thanks.

-Brian


diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index 1d35e8d..cf8331f 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -167,9 +167,7 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb,
uint surfIndex, struct pipe_surface *surf)
 {
GET_CURRENT_CONTEXT(ctx);
-   static const GLuint invalid_size = 999;
struct st_renderbuffer *strb;
-   GLuint width, height, i;
 
/* sanity checks */
assert(ST_SURFACE_FRONT_LEFT == BUFFER_FRONT_LEFT);
@@ -183,18 +181,17 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb,
strb = st_renderbuffer(stfb-Base.Attachment[surfIndex].Renderbuffer);
 
if (!strb) {
-  if (surfIndex == ST_SURFACE_FRONT_LEFT) {
- /* Delayed creation when the window system supplies a fake front buffer */
- struct st_renderbuffer *strb_back
-= st_renderbuffer(stfb-Base.Attachment[ST_SURFACE_BACK_LEFT].Renderbuffer);
- struct gl_renderbuffer *rb
-= st_new_renderbuffer_fb(surf-format, strb_back-Base.NumSamples, FALSE);
- _mesa_add_renderbuffer(stfb-Base, BUFFER_FRONT_LEFT, rb);
- strb = st_renderbuffer(rb);
-  } else {
- /* fail */
+  /* create new renderbuffer for this surface now */
+  const GLuint numSamples = stfb-Base.Visual.samples;
+  struct gl_renderbuffer *rb =
+ st_new_renderbuffer_fb(surf-format, numSamples, FALSE);
+  if (!rb) {
+ /* out of memory */
+ _mesa_warning(ctx, Out of memory allocating renderbuffer);
  return;
   }
+  _mesa_add_renderbuffer(stfb-Base, BUFFER_FRONT_LEFT, rb);
+  strb = st_renderbuffer(rb);
}
 
/* replace the renderbuffer's surface/texture pointers */
@@ -206,39 +203,16 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb,
* But when we do, we need to start setting this dirty bit
* to ensure the renderbuffer attachements are up-to-date
* via update_framebuffer.
+   * Core Mesa's state validation will update the parent framebuffer's
+   * size info, etc.
*/
   ctx-st-dirty.st |= ST_NEW_FRAMEBUFFER;
+  ctx-NewState |= _NEW_BUFFERS;
}
 
/* update renderbuffer's width/height */
strb-Base.Width = surf-width;
strb-Base.Height = surf-height;
-
-   /* Try to update the framebuffer's width/height from the renderbuffer
-* sizes.  Before we start drawing, all the rbs _should_ be the same size.
-*/
-   width = height = invalid_size;
-   for (i = 0; i  BUFFER_COUNT; i++) {
-  if (stfb-Base.Attachment[i].Renderbuffer) {
- if (width == invalid_size) {
-width = stfb-Base.Attachment[i].Renderbuffer-Width;
-height = stfb-Base.Attachment[i].Renderbuffer-Height;
- }
- else if (width != stfb-Base.Attachment[i].Renderbuffer-Width ||
-  height != stfb-Base.Attachment[i].Renderbuffer-Height) {
-/* inconsistant renderbuffer sizes, bail out */
-return;
- }
-  }
-   }
-
-   if (width != invalid_size) {
-  /* OK, the renderbuffers are of a consistant size, so update the
-   * parent framebuffer's size.
-   */
-  stfb-Base.Width = width;
-  stfb-Base.Height = height;
-   }
 }
 
 
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev


Re: [Mesa3d-dev] Revert ST_SURFACE_DEPTH = BUFFER_DEPTH in master too?

2010-03-11 Thread Luca Barbieri
Solves the Warsow issue and seems to work.
Thanks!

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev


Re: [Mesa3d-dev] Revert ST_SURFACE_DEPTH = BUFFER_DEPTH in master too?

2010-03-11 Thread Brian Paul
Luca Barbieri wrote:
 Solves the Warsow issue and seems to work.

OK, I think you can commit the patch to 7.8 then.

-Brian


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev


Re: [Mesa3d-dev] Revert ST_SURFACE_DEPTH = BUFFER_DEPTH in master too?

2010-03-11 Thread Michel Dänzer
On Thu, 2010-03-11 at 11:28 -0700, Brian Paul wrote: 
 Luca Barbieri wrote:
  Solves the Warsow issue and seems to work.
 
 OK, I think you can commit the patch to 7.8 then.

Can this also be backported to mesa_7_7_branch?


-- 
Earthling Michel Dänzer   |http://www.vmware.com
Libre software enthusiast |  Debian, X and DRI developer

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev


Re: [Mesa3d-dev] Revert ST_SURFACE_DEPTH = BUFFER_DEPTH in master too?

2010-03-11 Thread Brian Paul
Michel Dänzer wrote:
 On Thu, 2010-03-11 at 11:28 -0700, Brian Paul wrote: 
 Luca Barbieri wrote:
 Solves the Warsow issue and seems to work.
 OK, I think you can commit the patch to 7.8 then.
 
 Can this also be backported to mesa_7_7_branch?

Sure, if you can test it.  We might want to wait a few days and make 
sure nothing regresses with it on the 7.8 branch.  I'll commit it there.

-Brian


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev


Re: [Mesa3d-dev] Revert ST_SURFACE_DEPTH = BUFFER_DEPTH in master too?

2010-03-11 Thread Luca Barbieri
Shouldn't

_mesa_add_renderbuffer(stfb-Base, BUFFER_FRONT_LEFT, rb);

be

_mesa_add_renderbuffer(stfb-Base, surfIndex, rb);

instead, since you seem to make the on-demand creation mechanism
generic and no longer limited to the front buffer?

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev


Re: [Mesa3d-dev] Revert ST_SURFACE_DEPTH = BUFFER_DEPTH in master too?

2010-03-11 Thread Brian Paul
Luca Barbieri wrote:
 Shouldn't
 
 _mesa_add_renderbuffer(stfb-Base, BUFFER_FRONT_LEFT, rb);
 
 be
 
 _mesa_add_renderbuffer(stfb-Base, surfIndex, rb);
 
 instead, since you seem to make the on-demand creation mechanism
 generic and no longer limited to the front buffer?

Yes. Fixed now.

-Brian


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev


Re: [Mesa3d-dev] Revert ST_SURFACE_DEPTH = BUFFER_DEPTH in master too?

2010-03-11 Thread Marek Olšák
On Thu, Mar 11, 2010 at 4:41 PM, Luca Barbieri l...@luca-barbieri.comwrote:

 I've looked into the issue, and found a workaround by looking at what
 st_renderbuffer_alloc_storage (which is called to create the depth
 buffer with ST_SURFACE_DEPTH != BUFFER_DEPTH) does.

 Adding:
 if(ctx) ctx-NewState |= _NEW_BUFFERS;

 at the end of st_set_framebuffer_surface seems to solve the warsow
 problem with no other regressions.

 Brian, is this the right fix?
 Marek, does it fix your r300g problems too?


Mesa master merged with 7.8 fixes all the glean regressions. Thanks.
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev


[Mesa3d-dev] Revert ST_SURFACE_DEPTH = BUFFER_DEPTH in master too?

2010-03-10 Thread Luca Barbieri
In mesa_7_7_branch, 52d83efdbc4735d721e6fc9b44f29bdd432d4d73 reverts
commit 9d17ad2891b58de9e33e943ff918a678c6a3c2bd.

How about cherry-picking that commit into master, until a fix for the
bugs the revert commit introduces are found?

The reverted commit currently breaks the Warsow main menu for me,
making it show garbage.

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev


Re: [Mesa3d-dev] Revert ST_SURFACE_DEPTH = BUFFER_DEPTH in master too?

2010-03-10 Thread Marek Olšák
I second that. The commit breaks 6 glean tests (api2, clipFlat, fragProg1,
occluQry, pointAtten, texCombine4) with r300g.

-Marek

On Wed, Mar 10, 2010 at 10:50 PM, Luca Barbieri l...@luca-barbieri.comwrote:

 In mesa_7_7_branch, 52d83efdbc4735d721e6fc9b44f29bdd432d4d73 reverts
 commit 9d17ad2891b58de9e33e943ff918a678c6a3c2bd.

 How about cherry-picking that commit into master, until a fix for the
 bugs the revert commit introduces are found?

 The reverted commit currently breaks the Warsow main menu for me,
 making it show garbage.


 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Mesa3d-dev mailing list
 Mesa3d-dev@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev


Re: [Mesa3d-dev] Revert ST_SURFACE_DEPTH = BUFFER_DEPTH in master too?

2010-03-10 Thread Brian Paul
Mesa/master is correct as is.  Changing ST_SURFACE_DEPTH to be !=
BUFFER_DEPTH is just hiding another problem elsewhere.

If ST_SURFACE_DEPTH==8 then calling st_set_framebuffer_surface(fb,
ST_SURFACE_DEPTH, surf) is effectively setting the fb's COLOR0
attachment to be a Z/stencil buffer (and leaves the fb's DEPTH
attachment undefined (or set to a default surface)).  I'm surprised
that doesn't cause tons of problems elsewhere.

To debug this, I'd start by looking for calls to
st_set_framebuffer_surface() with surfIndex==ST_SURFACE_DEPTH, then
no-op those calls.  That's roughly what would be happening if
ST_SURFACE_DEPTH==8.

-Brian


On Wed, Mar 10, 2010 at 6:33 PM, Marek Olšák mar...@gmail.com wrote:
 I second that. The commit breaks 6 glean tests (api2, clipFlat, fragProg1,
 occluQry, pointAtten, texCombine4) with r300g.

 -Marek

 On Wed, Mar 10, 2010 at 10:50 PM, Luca Barbieri l...@luca-barbieri.com
 wrote:

 In mesa_7_7_branch, 52d83efdbc4735d721e6fc9b44f29bdd432d4d73 reverts
 commit 9d17ad2891b58de9e33e943ff918a678c6a3c2bd.

 How about cherry-picking that commit into master, until a fix for the
 bugs the revert commit introduces are found?

 The reverted commit currently breaks the Warsow main menu for me,
 making it show garbage.


 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Mesa3d-dev mailing list
 Mesa3d-dev@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/mesa3d-dev


 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Mesa3d-dev mailing list
 Mesa3d-dev@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/mesa3d-dev



--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev