Bug 60143 - gbm_dri_bo_create fails to initialize bo->base.base.format
Summary: gbm_dri_bo_create fails to initialize bo->base.base.format
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: 9.0
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-01 05:42 UTC by Daniel van Vugt
Modified: 2013-02-08 01:02 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


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

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.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.