Bug 75543 - OSMesa Gallium OSMesaMakeCurrent
OSMesa Gallium OSMesaMakeCurrent
Status: RESOLVED FIXED
Product: Mesa
Classification: Unclassified
Component: Mesa core
git
All Linux (All)
: medium normal
Assigned To: mesa-dev
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-26 19:13 UTC by nachooya
Modified: 2014-03-04 15:50 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch to check buffer size when searching (2.14 KB, patch)
2014-03-01 18:17 UTC, Brian Paul
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description nachooya 2014-02-26 19:13:28 UTC
Related Bug ID: 63117

Function at /Mesa-10.0.3/src/gallium/state_trackers/osmesa/osmesa.c

Is defined as:

osmesa_find_buffer(enum pipe_format color_format,
                   enum pipe_format ds_format,
                   enum pipe_format accum_format)

but should take care, also, of buffer size, other case mesa segfaults when size changes between calls.

As a workaround I implemented it as (but probably is not the best approach):

static struct osmesa_buffer *
osmesa_find_buffer(enum pipe_format color_format,
                   enum pipe_format ds_format,
                   enum pipe_format accum_format,
                   GLsizei width, GLsizei height
                  )
{
   struct osmesa_buffer *b;

   /* Check if we already have a suitable buffer for the given formats */
   for (b = BufferList; b; b = b->next) {
      if (b->visual.color_format == color_format &&
          b->visual.depth_stencil_format == ds_format &&
          b->visual.accum_format == accum_format &&
          b->width == width &&
          b->height == height) {
         return b;
      }
   }
   return NULL;
}
Comment 1 Brian Paul 2014-03-01 18:10:32 UTC
I think your fix is correct.  I'll write a patch for this.
Comment 2 Brian Paul 2014-03-01 18:17:35 UTC
Created attachment 94934 [details] [review]
Patch to check buffer size when searching

Can you verify this patch is OK?
Comment 3 nachooya 2014-03-04 09:50:24 UTC
Verified, that's working. 

Thanks!
Comment 4 Brian Paul 2014-03-04 15:50:22 UTC
Committed: cbacee207faf866b0444beb583d3d6f341a8ee78