Results 1 to 10 of 13

Thread: Easy Mesa Projects To Start Working On GPU Drivers

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Posts
    14,335

    Default Easy Mesa Projects To Start Working On GPU Drivers

    Phoronix: Easy Mesa Projects To Start Working On GPU Drivers

    For those Linux users with C/C++ development experience that have been wanting to get involved with working on the open-source Mesa 3D/OpenGL drivers, a new Wiki page has been setup that outlines -- almost step-by-step -- some easy projects to get started on for adding new OpenGL features to Mesa...

    http://www.phoronix.com/vr.php?view=MTUyNDY

  2. #2
    Join Date
    Sep 2010
    Posts
    453

    Default

    Very useful.
    Documentation about how features where implemented could be added to help newbies.
    It tells them how stuff are being done and gives a good example to get some information about the problems encountered.

  3. #3
    Join Date
    Oct 2013
    Posts
    187

    Default

    Thank you very much Michael for covering this on front page! Hopefully this will help main developers to focus on delivering key features and attracting more people.


    Quote Originally Posted by plonoma View Post
    Very useful.
    Documentation about how features where implemented could be added to help newbies.
    It tells them how stuff are being done and gives a good example to get some information about the problems encountered.
    First project was fairly easy and it was mostly a matter of looking up function definitions and replacing them

  4. #4
    Join Date
    Nov 2008
    Posts
    762

    Default

    Quote Originally Posted by siavashserver View Post
    First project was fairly easy and it was mostly a matter of looking up function definitions and replacing them
    Programming Mantra: If it seems easy, you have not yet understood the problem :-)


    Since I'm not subscribed to mesa-dev, I'll post here:
    11/17:
    Code:
    -   new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size );
    +   new_data = _mesa_align_malloc( size, ctx->Const.MinMapBufferAlignment );
    malloc and realloc do entirely different things. I don't think this change is correct.


    Thanks for your work!

  5. #5
    Join Date
    Jan 2011
    Posts
    1,287

    Default

    Quote Originally Posted by rohcQaH View Post
    Programming Mantra: If it seems easy, you have not yet understood the problem :-)


    Since I'm not subscribed to mesa-dev, I'll post here:
    11/17:
    Code:
    -   new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size );
    +   new_data = _mesa_align_malloc( size, ctx->Const.MinMapBufferAlignment );
    malloc and realloc do entirely different things. I don't think this change is correct.


    Thanks for your work!
    Actually, that change seems to be correct, as the guidelines for the project say whoever wrote it believes it shouldn't be using realloc

  6. #6
    Join Date
    Nov 2008
    Location
    Madison, WI, USA
    Posts
    862

    Default

    Quote Originally Posted by mrugiero View Post
    Actually, that change seems to be correct, as the guidelines for the project say whoever wrote it believes it shouldn't be using realloc
    But as I replied on the list, we have the potential for a memory leak here. It's possible that the ->Data pointer is always null at the beginning of this function, but if it's not, we've just allocated memory that we'll never free.

  7. #7
    Join Date
    Oct 2013
    Posts
    187

    Default

    Quote Originally Posted by rohcQaH View Post
    Since I'm not subscribed to mesa-dev, I'll post here:
    11/17:
    Code:
    -   new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size );
    +   new_data = _mesa_align_malloc( size, ctx->Const.MinMapBufferAlignment );
    malloc and realloc do entirely different things. I don't think this change is correct.
    Quote Originally Posted by mrugiero View Post
    Actually, that change seems to be correct, as the guidelines for the project say whoever wrote it believes it shouldn't be using realloc
    Quote Originally Posted by Veerappan View Post
    But as I replied on the list, we have the potential for a memory leak here. It's possible that the ->Data pointer is always null at the beginning of this function, but if it's not, we've just allocated memory that we'll never free.
    I guess you guys are correct; I've proposed to use _mesa_align_realloc instead. I'll wait for Ian's comment.


    Quote Originally Posted by mrugiero View Post
    I do not know what mesa_buffer_data is supposed to do.
    From source code we have:

    Code:
    /**
     * Allocate space for and store data in a buffer object.  Any data that was
     * previously stored in the buffer object is lost.  If \c data is \c NULL,
     * memory will be allocated, but no copy will occur.
     *
     * This is the default callback for \c dd_function_table::BufferData()
     * Note that all GL error checking will have been done already.
     *
     * \param ctx     GL context.
     * \param target  Buffer object target on which to operate.
     * \param size    Size, in bytes, of the new data store.
     * \param data    Pointer to the data to store in the buffer object.  This
     *                pointer may be \c NULL.
     * \param usage   Hints about how the data will be used.
     * \param bufObj  Object to be used.
     *
     * \return GL_TRUE for success, GL_FALSE for failure
     * \sa glBufferDataARB, dd_function_table::BufferData.
     */
    static GLboolean
    _mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size,
    		   const GLvoid * data, GLenum usage,
    		   struct gl_buffer_object * bufObj )
    So what is glBufferData supposed to do in plain English? Well that's going to feed the binded (currently active) OpenGL buffer with data residing in memory (CPU side) which can be geometry attributes like vertex positions, normals, tangents, indices, bone weights (used for skinning) or whatever user (graphics/game programmer) wants and uploads them to GPU memory. Now everytime that user wants to draw something, he just binds those buffers which already resides in GPU memory again and kindly asks her to render them.

    Take a look at here for glBufferData definition: http://www.khronos.org/opengles/sdk/...BufferData.xml

  8. #8
    Join Date
    Jan 2011
    Posts
    1,287

    Default

    Quote Originally Posted by siavashserver View Post
    From source code we have:

    Code:
    /**
     * Allocate space for and store data in a buffer object.  Any data that was
     * previously stored in the buffer object is lost.  If \c data is \c NULL,
     * memory will be allocated, but no copy will occur.
     *
     * This is the default callback for \c dd_function_table::BufferData()
     * Note that all GL error checking will have been done already.
     *
     * \param ctx     GL context.
     * \param target  Buffer object target on which to operate.
     * \param size    Size, in bytes, of the new data store.
     * \param data    Pointer to the data to store in the buffer object.  This
     *                pointer may be \c NULL.
     * \param usage   Hints about how the data will be used.
     * \param bufObj  Object to be used.
     *
     * \return GL_TRUE for success, GL_FALSE for failure
     * \sa glBufferDataARB, dd_function_table::BufferData.
     */
    static GLboolean
    _mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size,
    		   const GLvoid * data, GLenum usage,
    		   struct gl_buffer_object * bufObj )
    So what is glBufferData supposed to do in plain English? Well that's going to feed the binded (currently active) OpenGL buffer with data residing in memory (CPU side) which can be geometry attributes like vertex positions, normals, tangents, indices, bone weights (used for skinning) or whatever user (graphics/game programmer) wants and uploads them to GPU memory. Now everytime that user wants to draw something, he just binds those buffers which already resides in GPU memory again and kindly asks her to render them.

    Take a look at here for glBufferData definition: http://www.khronos.org/opengles/sdk/...BufferData.xml
    Thanks for the pointers. I read the source code after commenting. According to that definition, I think it would be proper to just use FREE(), as it says it discards the old data. A realloc would probably incur in an unneeded copy. At least that's how the traditional realloc works, I ignore how mesa_realloc works, but I assume they chose to name it realloc because it works like realloc. In that case, either the documentation is wrong for data == NULL (as it wouldn't copy anything and the original data will still be there) or realloc shouldn't be used, as it contradicts the documentation in this case.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •