Hi, Looks to me like a lot of whitespace changes were included in the patch. Is this intended?
Matt On Mon, Jul 13, 2009 at 3:48 PM, Nicolai Hähnle<nhaeh...@gmail.com> wrote: > Hey there, > > I hacked together the following patch to make Gallium compile against recent > libdrm. Does it seem right to you? > > --- > src/gallium/drivers/r300/r300_context.h | 4 +- > src/gallium/drivers/r300/r300_query.h | 2 + > src/gallium/drivers/r300/r300_screen.h | 2 +- > src/gallium/drivers/softpipe/sp_winsys.h | 12 ++-- > src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 10 ++- > src/gallium/winsys/drm/radeon/core/radeon_buffer.h | 13 +--- > src/gallium/winsys/drm/radeon/core/radeon_drm.c | 16 +++-- > src/gallium/winsys/drm/radeon/core/radeon_r300.c | 74 > +++++--------------- > src/gallium/winsys/drm/radeon/core/radeon_r300.h | 7 ++ > 9 files changed, 57 insertions(+), 83 deletions(-) > > diff --git a/src/gallium/drivers/r300/r300_context.h > b/src/gallium/drivers/r300/r300_context.h > index ae78574..e56cfcc 100644 > --- a/src/gallium/drivers/r300/r300_context.h > +++ b/src/gallium/drivers/r300/r300_context.h > @@ -217,7 +217,7 @@ struct r300_texture { > > /* Stride (pitch?) of this texture in bytes */ > unsigned stride; > - > + > /* Total size of this texture, in bytes. */ > unsigned size; > > @@ -331,7 +331,7 @@ struct r300_context { > }; > > /* Convenience cast wrapper. */ > -static struct r300_context* r300_context(struct pipe_context* context) { > +static INLINE struct r300_context* r300_context(struct pipe_context* context) > { > return (struct r300_context*)context; > } > > diff --git a/src/gallium/drivers/r300/r300_query.h > b/src/gallium/drivers/r300/r300_query.h > index 4f447ea..6a76460 100644 > --- a/src/gallium/drivers/r300/r300_query.h > +++ b/src/gallium/drivers/r300/r300_query.h > @@ -27,6 +27,8 @@ > #include "r300_cs.h" > #include "r300_reg.h" > > +struct r300_context; > + > struct r300_query { > /* The kind of query. Currently only OQ is supported. */ > unsigned type; > diff --git a/src/gallium/drivers/r300/r300_screen.h > b/src/gallium/drivers/r300/r300_screen.h > index 3f52dbc..2a0e41f 100644 > --- a/src/gallium/drivers/r300/r300_screen.h > +++ b/src/gallium/drivers/r300/r300_screen.h > @@ -49,7 +49,7 @@ struct r300_transfer { > }; > > /* Convenience cast wrapper. */ > -static struct r300_screen* r300_screen(struct pipe_screen* screen) { > +static INLINE struct r300_screen* r300_screen(struct pipe_screen* screen) { > return (struct r300_screen*)screen; > } > > diff --git a/src/gallium/drivers/softpipe/sp_winsys.h > b/src/gallium/drivers/softpipe/sp_winsys.h > index 9e57186..6eeb3f3 100644 > --- a/src/gallium/drivers/softpipe/sp_winsys.h > +++ b/src/gallium/drivers/softpipe/sp_winsys.h > @@ -1,8 +1,8 @@ > /************************************************************************** > - * > + * > * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. > * All Rights Reserved. > - * > + * > * Permission is hereby granted, free of charge, to any person obtaining a > * copy of this software and associated documentation files (the > * "Software"), to deal in the Software without restriction, including > @@ -10,11 +10,11 @@ > * distribute, sub license, and/or sell copies of the Software, and to > * permit persons to whom the Software is furnished to do so, subject to > * the following conditions: > - * > + * > * The above copyright notice and this permission notice (including the > * next paragraph) shall be included in all copies or substantial portions > * of the Software. > - * > + * > * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS > * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. > @@ -22,7 +22,7 @@ > * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, > * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE > * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > - * > + * > **************************************************************************/ > > /* This is the interface that softpipe requires any window system > @@ -40,7 +40,9 @@ extern "C" { > #endif > > > +struct pipe_buffer; > struct pipe_screen; > +struct pipe_texture; > struct pipe_winsys; > struct pipe_context; > > diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c > b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c > index 263f684..275ab99 100644 > --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c > +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c > @@ -1,8 +1,8 @@ > -/* > +/* > * Copyright © 2008 Jérôme Glisse > * 2009 Corbin Simpson > * All Rights Reserved. > - * > + * > * Permission is hereby granted, free of charge, to any person obtaining > * a copy of this software and associated documentation files (the > * "Software"), to deal in the Software without restriction, including > @@ -10,14 +10,14 @@ > * distribute, sub license, and/or sell copies of the Software, and to > * permit persons to whom the Software is furnished to do so, subject to > * the following conditions: > - * > + * > * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES > * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND > * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS > * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, > - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE > * USE OR OTHER DEALINGS IN THE SOFTWARE. > * > * The above copyright notice and this permission notice (including the > @@ -32,6 +32,8 @@ > > #include "radeon_buffer.h" > > +#include "radeon_bo_gem.h" > + > static const char *radeon_get_name(struct pipe_winsys *ws) > { > return "Radeon/GEM+KMS"; > diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h > b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h > index 14c463d..f5153b0 100644 > --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h > +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h > @@ -1,7 +1,7 @@ > -/* > +/* > * Copyright © 2008 Jérôme Glisse > * All Rights Reserved. > - * > + * > * Permission is hereby granted, free of charge, to any person obtaining > * a copy of this software and associated documentation files (the > * "Software"), to deal in the Software without restriction, including > @@ -9,14 +9,14 @@ > * distribute, sub license, and/or sell copies of the Software, and to > * permit persons to whom the Software is furnished to do so, subject to > * the following conditions: > - * > + * > * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES > * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND > * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS > * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, > - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE > * USE OR OTHER DEALINGS IN THE SOFTWARE. > * > * The above copyright notice and this permission notice (including the > @@ -61,11 +61,6 @@ struct radeon_winsys_priv { > /* Radeon BO manager. */ > struct radeon_bo_manager* bom; > > - /* Radeon BO space checker. */ > - struct radeon_cs_space_check sc[RADEON_MAX_BOS]; > - /* Current BO count. */ > - unsigned bo_count; > - > /* Radeon CS manager. */ > struct radeon_cs_manager* csm; > > diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c > b/src/gallium/winsys/drm/radeon/core/radeon_drm.c > index 8561e12..dc7a2fb 100644 > --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c > +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c > @@ -1,7 +1,7 @@ > -/* > +/* > * Copyright © 2009 Corbin Simpson > * All Rights Reserved. > - * > + * > * Permission is hereby granted, free of charge, to any person obtaining > * a copy of this software and associated documentation files (the > * "Software"), to deal in the Software without restriction, including > @@ -9,14 +9,14 @@ > * distribute, sub license, and/or sell copies of the Software, and to > * permit persons to whom the Software is furnished to do so, subject to > * the following conditions: > - * > + * > * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES > * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND > * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS > * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, > - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE > * USE OR OTHER DEALINGS IN THE SOFTWARE. > * > * The above copyright notice and this permission notice (including the > @@ -31,6 +31,12 @@ > #include "radeon_drm.h" > #include "trace/tr_drm.h" > > +#include "r300_screen.h" > +#include "xf86drm.h" > + > +#include <sys/ioctl.h> > + > + > /* Create a pipe_screen. */ > struct pipe_screen* radeon_create_screen(struct drm_api* api, > int drmFB, > @@ -54,7 +60,7 @@ struct pipe_context* radeon_create_context(struct drm_api* > api, > if (getenv("RADEON_SOFTPIPE")) { > return radeon_create_softpipe(screen->winsys); > } else { > - return r300_create_context(screen, screen->winsys); > + return r300_create_context(screen, (struct r300_winsys*)screen- >>winsys); > } > } > > diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c > b/src/gallium/winsys/drm/radeon/core/radeon_r300.c > index 8c5f756..8c93a31 100644 > --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c > +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c > @@ -22,71 +22,33 @@ > > #include "radeon_r300.h" > > +#include "radeon_cs_gem.h" > +#include "xf86drm.h" > + > static boolean radeon_r300_add_buffer(struct r300_winsys* winsys, > struct pipe_buffer* pbuffer, > uint32_t rd, > uint32_t wd) > { > - int i; > - struct radeon_winsys_priv* priv = > - (struct radeon_winsys_priv*)winsys->radeon_winsys; > - struct radeon_cs_space_check* sc = priv->sc; > - struct radeon_bo* bo = ((struct radeon_pipe_buffer*)pbuffer)->bo; > - > - /* Check to see if this BO is already in line for validation; > - * find a slot for it otherwise. */ > - for (i = 0; i < priv->bo_count; i++) { > - if (sc[i].bo == bo) { > - sc[i].read_domains |= rd; > - sc[i].write_domain |= wd; > - return TRUE; > - } > - } > - > - if (priv->bo_count >= RADEON_MAX_BOS) { > - /* Dohoho. Not falling for that one again. Request a flush. */ > - return FALSE; > - } > - > - sc[priv->bo_count].bo = bo; > - sc[priv->bo_count].read_domains = rd; > - sc[priv->bo_count].write_domain = wd; > - priv->bo_count++; > + struct radeon_winsys_priv* priv = > + (struct radeon_winsys_priv*)winsys->radeon_winsys; > + struct radeon_bo* bo = ((struct radeon_pipe_buffer*)pbuffer)->bo; > > - return TRUE; > + radeon_cs_space_add_persistent_bo(priv->cs, bo, rd, wd); > + return TRUE; > } > > static boolean radeon_r300_validate(struct r300_winsys* winsys) > { > - int retval, i; > - struct radeon_winsys_priv* priv = > - (struct radeon_winsys_priv*)winsys->radeon_winsys; > - struct radeon_cs_space_check* sc = priv->sc; > - > - retval = radeon_cs_space_check(priv->cs, sc, priv->bo_count); > - > - if (retval == RADEON_CS_SPACE_OP_TO_BIG) { > - /* We might as well HCF, since this is not going to fit in the card, > - * period. */ > - /* XXX just drop it on the floor instead */ > - exit(1); > - } else if (retval == RADEON_CS_SPACE_FLUSH) { > - /* We must flush before more rendering can commence. */ > - return TRUE; > - } > + struct radeon_winsys_priv* priv = > + (struct radeon_winsys_priv*)winsys->radeon_winsys; > > - /* XXX should probably be its own function */ > - for (i = 0; i < priv->bo_count; i++) { > - if (sc[i].read_domains && sc[i].write_domain) { > - /* Cute, cute. We need to flush first. */ > - debug_printf("radeon: BO %p can't be read and written; " > - "requesting flush.\n", sc[i].bo); > - return TRUE; > - } > - } > + if (radeon_cs_space_check(priv->cs) < 0) > + return TRUE; > > - /* Things are fine, we can proceed as normal. */ > - return FALSE; > + > + /* Things are fine, we can proceed as normal. */ > + return FALSE; > } > > static boolean radeon_r300_check_cs(struct r300_winsys* winsys, int size) > @@ -151,8 +113,7 @@ static void radeon_r300_flush_cs(struct r300_winsys* > winsys) > { > struct radeon_winsys_priv* priv = > (struct radeon_winsys_priv*)winsys->radeon_winsys; > - struct radeon_cs_space_check* sc = priv->sc; > - int retval = 1; > + int retval; > > /* Emit the CS. */ > retval = radeon_cs_emit(priv->cs); > @@ -163,8 +124,7 @@ static void radeon_r300_flush_cs(struct r300_winsys* > winsys) > radeon_cs_erase(priv->cs); > > /* Clean out BOs. */ > - memset(sc, 0, sizeof(struct radeon_cs_space_check) * RADEON_MAX_BOS); > - priv->bo_count = 0; > + radeon_cs_space_reset_bos(priv->cs); > } > > /* Helper function to do the ioctls needed for setup and init. */ > diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.h > b/src/gallium/winsys/drm/radeon/core/radeon_r300.h > index a2e0e58..7f0246c 100644 > --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.h > +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.h > @@ -20,6 +20,9 @@ > * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE > * USE OR OTHER DEALINGS IN THE SOFTWARE. */ > > +#ifndef RADEON_R300_H > +#define RADEON_R300_H > + > /* XXX WTF is this! I shouldn't have to include those first three! FUCK! */ > #include <stdint.h> > #include <stdlib.h> > @@ -44,5 +47,9 @@ struct drm_radeon_info { > }; > #endif > > +struct radeon_winsys; > + > struct r300_winsys* > radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys); > + > +#endif /* RADEON_R300_H */ > -- > 1.6.0.4 > > > > ------------------------------------------------------------------------------ > Enter the BlackBerry Developer Challenge > This is your chance to win up to $100,000 in prizes! For a limited time, > vendors submitting new applications to BlackBerry App World(TM) will have > the opportunity to enter the BlackBerry Developer Challenge. See full prize > details at: http://p.sf.net/sfu/Challenge > _______________________________________________ > Mesa3d-dev mailing list > Mesa3d-dev@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mesa3d-dev > ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev