[Mesa-dev] [PATCH 04/27] gbm: Create a gbm_device getter for stride

Ben Widawsky ben at bwidawsk.net
Tue Jan 3 02:09:15 UTC 2017


On 16-12-02 17:58:40, Eric Engestrom wrote:
>On Thursday, 2016-12-01 14:09:45 -0800, Ben Widawsky wrote:
>> From: Ben Widawsky <ben at bwidawsk.net>
>>
>> This will be used so we can query information per plane.
>>
>> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
>> ---
>>  src/gbm/backends/dri/gbm_dri.c | 7 +++++++
>>  src/gbm/main/gbm.c             | 2 +-
>>  src/gbm/main/gbmint.h          | 1 +
>>  3 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
>> index c61d56b..f3ca228 100644
>> --- a/src/gbm/backends/dri/gbm_dri.c
>> +++ b/src/gbm/backends/dri/gbm_dri.c
>> @@ -622,6 +622,12 @@ gbm_dri_bo_get_planes(struct gbm_bo *_bo)
>>     return get_number_planes(dri, bo->image);
>>  }
>>
>> +static uint32_t
>> +gbm_dri_bo_get_stride(struct gbm_bo *_bo, int plane)
>
>`unsigned plane`?
>Same in the next patches.
>
>There is a very weird mix of sized- and unsized-types in these patches
>(see also comment on patch #2); what is the reasoning here?
>(For instance, the return type is sized but the input plane isn't.)
>

I took the parameter type from fromPlanar. That was the first DRI interface to
use plane as an argument, and it was signed. As for my return types, signed
return types don't make sense.

I honestly don't care what we do - my vote would be to keep signed plane; you
tell me if you want signed return types.

>> +{
>> +   return _bo->stride;
>> +}
>> +
>>  static void
>>  gbm_dri_bo_destroy(struct gbm_bo *_bo)
>>  {
>> @@ -1080,6 +1086,7 @@ dri_device_create(int fd)
>>     dri->base.base.bo_write = gbm_dri_bo_write;
>>     dri->base.base.bo_get_fd = gbm_dri_bo_get_fd;
>>     dri->base.base.bo_get_planes = gbm_dri_bo_get_planes;
>> +   dri->base.base.bo_get_stride = gbm_dri_bo_get_stride;
>>     dri->base.base.bo_destroy = gbm_dri_bo_destroy;
>>     dri->base.base.destroy = dri_destroy;
>>     dri->base.base.surface_create = gbm_dri_surface_create;
>> diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
>> index b5e0316..14c31ad 100644
>> --- a/src/gbm/main/gbm.c
>> +++ b/src/gbm/main/gbm.c
>> @@ -165,7 +165,7 @@ gbm_bo_get_height(struct gbm_bo *bo)
>>  GBM_EXPORT uint32_t
>>  gbm_bo_get_stride(struct gbm_bo *bo)
>>  {
>> -   return bo->stride;
>> +   return bo->gbm->bo_get_stride(bo, 0);
>>  }
>>
>>  /** Get the format of the buffer object
>> diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h
>> index c6a6701..35d3bcb 100644
>> --- a/src/gbm/main/gbmint.h
>> +++ b/src/gbm/main/gbmint.h
>> @@ -77,6 +77,7 @@ struct gbm_device {
>>     int (*bo_write)(struct gbm_bo *bo, const void *buf, size_t data);
>>     int (*bo_get_fd)(struct gbm_bo *bo);
>>     int (*bo_get_planes)(struct gbm_bo *bo);
>> +   uint32_t (*bo_get_stride)(struct gbm_bo *bo, int plane);
>>     void (*bo_destroy)(struct gbm_bo *bo);
>>
>>     struct gbm_surface *(*surface_create)(struct gbm_device *gbm,
>> --
>> 2.10.2
>>


More information about the mesa-dev mailing list