summaryrefslogtreecommitdiff
path: root/drm-common.c
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2018-02-09 20:49:48 -0500
committerDaniel Stone <daniels@collabora.com>2018-02-16 12:33:32 +0000
commit56c3917ffd1f05942246e2532ca4a5707554a2fc (patch)
treeb648a03a8ead1b859236d819773aafbd9e61154e /drm-common.c
parentc2d4ba86de1bebca536ef03525b067a42106f06e (diff)
downloadkmscube-56c3917ffd1f05942246e2532ca4a5707554a2fc.tar.gz
formats: use weston's egl config matching logic, centralize format
The GBM surface format has to match the DRM mode. Both are used in a couple of places, so unify it so that it's only set in one place. Note that the GBM and DRM formats are identical. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'drm-common.c')
-rw-r--r--drm-common.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drm-common.c b/drm-common.c
index 4b55745..1ec2820 100644
--- a/drm-common.c
+++ b/drm-common.c
@@ -47,7 +47,7 @@ struct drm_fb * drm_fb_get_from_bo(struct gbm_bo *bo)
{
int drm_fd = gbm_device_get_fd(gbm_bo_get_device(bo));
struct drm_fb *fb = gbm_bo_get_user_data(bo);
- uint32_t width, height,
+ uint32_t width, height, format,
strides[4] = {0}, handles[4] = {0},
offsets[4] = {0}, flags = 0;
int ret = -1;
@@ -60,6 +60,7 @@ struct drm_fb * drm_fb_get_from_bo(struct gbm_bo *bo)
width = gbm_bo_get_width(bo);
height = gbm_bo_get_height(bo);
+ format = gbm_bo_get_format(bo);
#ifdef HAVE_GBM_MODIFIERS
uint64_t modifiers[4] = {0};
@@ -78,7 +79,7 @@ struct drm_fb * drm_fb_get_from_bo(struct gbm_bo *bo)
}
ret = drmModeAddFB2WithModifiers(drm_fd, width, height,
- DRM_FORMAT_XRGB8888, handles, strides, offsets,
+ format, handles, strides, offsets,
modifiers, &fb->fb_id, flags);
#endif
if (ret) {
@@ -88,7 +89,7 @@ struct drm_fb * drm_fb_get_from_bo(struct gbm_bo *bo)
memcpy(handles, (uint32_t [4]){gbm_bo_get_handle(bo).u32,0,0,0}, 16);
memcpy(strides, (uint32_t [4]){gbm_bo_get_stride(bo),0,0,0}, 16);
memset(offsets, 0, 16);
- ret = drmModeAddFB2(drm_fd, width, height, DRM_FORMAT_XRGB8888,
+ ret = drmModeAddFB2(drm_fd, width, height, format,
handles, strides, offsets, &fb->fb_id, 0);
}