[Mesa-dev] [PATCH 05/32] [v2] gbm: Export a getter for per plane handles

Ben Widawsky ben at bwidawsk.net
Thu Jan 12 22:44:54 UTC 2017


On 17-01-12 14:22:09, Jason Ekstrand wrote:
>On Thu, Jan 12, 2017 at 10:57 AM, Daniel Stone <daniel at fooishbar.org> wrote:
>
>> Hi,
>>
>> On 5 January 2017 at 04:43, Ben Widawsky <ben at bwidawsk.net> wrote:
>> > diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_
>> dri.c
>> > index c61d56b44a..f9c1afd8cb 100644
>> > --- a/src/gbm/backends/dri/gbm_dri.c
>> > +++ b/src/gbm/backends/dri/gbm_dri.c
>> > @@ -622,6 +622,33 @@ gbm_dri_bo_get_planes(struct gbm_bo *_bo)
>> >     return get_number_planes(dri, bo->image);
>> >  }
>> >
>> > +static union gbm_bo_handle
>> > +gbm_dri_bo_get_handle_for_plane(struct gbm_bo *_bo, int plane)
>> > +{
>> > +   struct gbm_dri_device *dri = gbm_dri_device(_bo->gbm);
>> > +   struct gbm_dri_bo *bo = gbm_dri_bo(_bo);
>> > +   union gbm_bo_handle ret;
>> > +   ret.s32 = -1;
>> > +
>> > +   if (!dri->image || dri->image->base.version < 13 ||
>> !dri->image->fromPlanar) {
>> > +      errno = ENOSYS;
>> > +      return ret;
>> > +   }
>> > +
>> > +   if (plane >= get_number_planes(dri, bo->image))
>> > +      return ret;
>>
>> if (!bo->image) {
>>    ret.s32 = bo->handle;
>>    return ret;
>> }
>
>
>I suggested EINVAL if plane is too large.  Would you rather do a default
>thing?

They aren't the same thing. Daniel is saying for cases where there is no
DRIimage (dumb BOs). Yours is for a bad plane. The two should be complementary.


More information about the mesa-dev mailing list