[Mesa-dev] [PATCH 01/12] intel: Conditionally compile mcs-related code for i965 only.

Paul Berry stereotype441 at gmail.com
Thu May 23 09:33:40 PDT 2013


On 22 May 2013 12:18, Ian Romanick <idr at freedesktop.org> wrote:

> On 05/21/2013 04:52 PM, Paul Berry wrote:
>
>> This patch ifdefs out intel_mipmap_tree::mcs_mt when building the i915
>> (pre-Gen4) driver (MCS buffers aren't supported until Gen7, so there
>> is no need for this field in the i915 driver).  This should make it a
>> bit easier to implement fast color clears without undue risk to i915.
>>
>
> We have a bunch of other fields like this (e.g., hiz_mt).  Should we have
> done this with those fields, or is this case different?


Probably the only difference in this case is who is writing the patches :)

I'd be willing to write a follow-up patch that ifdefs out some of the other
i965-specific fields if there's interest.


>
>
>  ---
>>   src/mesa/drivers/dri/intel/**intel_mipmap_tree.c | 8 +++++++-
>>   src/mesa/drivers/dri/intel/**intel_mipmap_tree.h | 2 ++
>>   2 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/intel/**intel_mipmap_tree.c
>> b/src/mesa/drivers/dri/intel/**intel_mipmap_tree.c
>> index 2dfa787..ad9e2b3 100644
>> --- a/src/mesa/drivers/dri/intel/**intel_mipmap_tree.c
>> +++ b/src/mesa/drivers/dri/intel/**intel_mipmap_tree.c
>> @@ -624,7 +624,9 @@ intel_miptree_release(struct intel_mipmap_tree **mt)
>>         intel_region_release(&((*mt)->**region));
>>         intel_miptree_release(&(*mt)->**stencil_mt);
>>         intel_miptree_release(&(*mt)->**hiz_mt);
>> +#ifndef I915
>>         intel_miptree_release(&(*mt)->**mcs_mt);
>> +#endif
>>         intel_miptree_release(&(*mt)->**singlesample_mt);
>>         intel_resolve_map_clear(&(*mt)**->hiz_map);
>>
>> @@ -963,8 +965,11 @@ intel_miptree_alloc_mcs(struct intel_context *intel,
>>                           struct intel_mipmap_tree *mt,
>>                           GLuint num_samples)
>>   {
>> -   assert(mt->mcs_mt == NULL);
>>      assert(intel->gen >= 7); /* MCS only used on Gen7+ */
>> +#ifdef I915
>> +   return false;
>>
>
>       return NULL;
>
> since this function returns 'struct intel_mipmap_tree*'.


Actually it returns bool.  It only looks like it returns struct
intel_mipmap_tree* because it ends with "return mt->mcs_mt;", but that is
implicitly converted to bool.


>
>
>  +#else
>> +   assert(mt->mcs_mt == NULL);
>>
>>      /* Choose the correct format for the MCS buffer.  All that really
>> matters
>>       * is that we allocate the right buffer size, since we'll always be
>> @@ -1021,6 +1026,7 @@ intel_miptree_alloc_mcs(struct intel_context *intel,
>>      intel_miptree_unmap_raw(intel, mt->mcs_mt);
>>
>>      return mt->mcs_mt;
>> +#endif
>>   }
>>
>>   /**
>> diff --git a/src/mesa/drivers/dri/intel/**intel_mipmap_tree.h
>> b/src/mesa/drivers/dri/intel/**intel_mipmap_tree.h
>> index b7376e0..0ec3c5e 100644
>> --- a/src/mesa/drivers/dri/intel/**intel_mipmap_tree.h
>> +++ b/src/mesa/drivers/dri/intel/**intel_mipmap_tree.h
>> @@ -373,6 +373,7 @@ struct intel_mipmap_tree
>>       */
>>      struct intel_mipmap_tree *stencil_mt;
>>
>> +#ifndef I915
>>      /**
>>       * \brief MCS miptree for multisampled textures.
>>       *
>> @@ -381,6 +382,7 @@ struct intel_mipmap_tree
>>       * (INTEL_MSAA_FORMAT_CMS).
>>       */
>>      struct intel_mipmap_tree *mcs_mt;
>> +#endif
>>
>>      /* These are also refcounted:
>>       */
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130523/1964e4b5/attachment.html>


More information about the mesa-dev mailing list