[Mesa-dev] [PATCH 2/2] gallium: don't use enum bitfields in p_video_state.h
Brian Paul
brianp at vmware.com
Thu Jul 14 07:10:58 PDT 2011
On 07/14/2011 07:28 AM, Christian König wrote:
> Am Donnerstag, den 14.07.2011, 15:04 +0200 schrieb Michel Dänzer:
>> On Mit, 2011-07-13 at 16:28 -0600, Brian Paul wrote:
>>> Silences many warnings about "type of bit-field ‘field_select’ is a
>>> GCC extension".
>>> ---
>>> src/gallium/include/pipe/p_video_state.h | 8 ++++----
>>> 1 files changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h
>>> index 5b47b15..1f42ac5 100644
>>> --- a/src/gallium/include/pipe/p_video_state.h
>>> +++ b/src/gallium/include/pipe/p_video_state.h
>>> @@ -49,8 +49,8 @@ struct pipe_motionvector
>>> {
>>> struct {
>>> signed x:16, y:16;
>>> - enum pipe_video_field_select field_select:16;
>>> - enum pipe_video_mv_weight weight:16;
>>> + unsigned field_select:16; /**< enum pipe_video_field_select */
>>> + unsigned weight:16; /**< enum pipe_video_mv_weight */
>>> } top, bottom;
>>> };
>>>
>>> @@ -58,8 +58,8 @@ struct pipe_motionvector
>>> struct pipe_ycbcr_block
>>> {
>>> unsigned x:8, y:8;
>>> - enum pipe_mpeg12_dct_intra intra:8;
>>> - enum pipe_mpeg12_dct_type coding:8;
>>> + unsigned intra:8; /**< enum pipe_mpeg12_dct_intra */
>>> + unsigned coding:8; /**< enum pipe_mpeg12_dct_type */
>>> };
>>>
>>> struct pipe_picture_desc
>>
>> Out of curiosity, what's the benefit of using bitfields here at all, as
>> opposed to fixed size integer types?
>>
>> IME bitfields are generally best avoided if possible.
> There is no real benefit, those are there just for historical reasons. I
> started with and interface that looked some like this:
>
> app copies info into XvMC structure->XvMC state tracker copies into
> those pipe structures->driver copies them into vertex buffers.
>
> That were a bit too much copy things around for my taste, so I changed
> the driver interface to directly export pointers to the vertex buffers
> with types of pipe_motionvector/pipe_ycbcr_block and was so happy about
> the speed improvements that I forgotten to clean that up.
>
> I just put it onto my todo list, but not as prio 1. I've anybody has
> time to spare feel free to clean it up.
I'm taking care of it now.
-Brian
More information about the mesa-dev
mailing list