Bug 60143 - gbm_dri_bo_create fails to initialize bo->base.base.format
gbm_dri_bo_create fails to initialize bo->base.base.format
Status: RESOLVED FIXED
Product: Mesa
Classification: Unclassified
Component: Other
9.0
Other All
: medium normal
Assigned To: mesa-dev
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-01 05:42 UTC by Daniel van Vugt
Modified: 2013-02-08 01:02 UTC (History)
0 users

See Also:


Attachments
gbm_dri_bo_create: Remember to initialize format (427 bytes, patch)
2013-02-06 09:31 UTC, Daniel van Vugt
Details | Splinter Review
[PATCH] gbm: Remember to init format on gbm_dri_bo_create (1.01 KB, patch)
2013-02-07 05:12 UTC, Daniel van Vugt
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel van Vugt 2013-02-01 05:42:28 UTC
Calling gbm_bo_create() with format == GBM_BO_FORMAT_ARGB8888 completes successfully. However reading back the format via gbm_bo_get_format() returns GBM_BO_FORMAT_XRGB8888.

The problem seems to be that the bo internal structure is initialized to zero by calloc, but the format field is never set by gbm_dri_bo_create, so it stays zero (GBM_BO_FORMAT_XRGB8888) even when the real image format is something different.

Should be a simple fix in gbm_dri_bo_create(). Just add:
  bo->base.base.format = gbm_dri_to_gbm_format(dri_format);
Comment 1 Daniel van Vugt 2013-02-01 06:42:29 UTC
Or even simpler fix...
  bo->base.base.format = format;
Comment 2 Daniel van Vugt 2013-02-06 09:31:23 UTC
Created attachment 74279 [details] [review]
gbm_dri_bo_create: Remember to initialize format
Comment 3 Kristian Høgsberg 2013-02-06 21:26:46 UTC
(In reply to comment #2)
> Created attachment 74279 [details] [review] [review]
> gbm_dri_bo_create: Remember to initialize format

That looks good, but please also fix create_dumb() and attach output of git format-patch -1 so I can git am it.  Thanks!
Comment 4 Daniel van Vugt 2013-02-07 05:12:50 UTC
Created attachment 74319 [details] [review]
[PATCH] gbm: Remember to init format on gbm_dri_bo_create
Comment 5 Kristian Høgsberg 2013-02-08 01:02:14 UTC
Pushed to master.