summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm/ecore_drm_fb.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-04-07 10:23:41 -0400
committerStefan Schmidt <s.schmidt@samsung.com>2015-04-09 17:40:22 +0200
commit2f62ebb223e589229947b12411579789e647bfcf (patch)
tree00b984aac4fa61354ba34e139db580003b7631ad /src/lib/ecore_drm/ecore_drm_fb.c
parent4ecdac93022505288a0162c8017bba8c8d2e9aed (diff)
ecore-drm: Create all framebuffers using XRGB8888 by default
Summary: By default, we should be creating dumb buffers using XRGB8888 that way it does not matter if we have an alpha channel or not in the buffer. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_drm/ecore_drm_fb.c')
-rw-r--r--src/lib/ecore_drm/ecore_drm_fb.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_fb.c b/src/lib/ecore_drm/ecore_drm_fb.c
index af05c171c5..67641c9113 100644
--- a/src/lib/ecore_drm/ecore_drm_fb.c
+++ b/src/lib/ecore_drm/ecore_drm_fb.c
@@ -14,6 +14,42 @@
14 14
15/* TODO: DOXY !! */ 15/* TODO: DOXY !! */
16 16
17static Eina_Bool
18_ecore_drm_fb_create2(int fd, int w, int h, Ecore_Drm_Fb *fb)
19{
20 struct drm_mode_fb_cmd2 cmd;
21 uint32_t hdls[4], pitches[4], offsets[4], fmt;
22
23#define _fourcc_code(a,b,c,d) \
24 ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
25 ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
26 fmt = (_fourcc_code('X', 'R', '2', '4'));
27
28 hdls[0] = fb->hdl;
29 pitches[0] = fb->stride;
30 offsets[0] = 0;
31
32 memset(&cmd, 0, sizeof(struct drm_mode_fb_cmd2));
33 cmd.fb_id = 0;
34 cmd.width = w;
35 cmd.height = h;
36 cmd.pixel_format = fmt;
37 cmd.flags = 0;
38 memcpy(cmd.handles, hdls, 4 * sizeof(hdls[0]));
39 memcpy(cmd.pitches, pitches, 4 * sizeof(pitches[0]));
40 memcpy(cmd.offsets, offsets, 4 * sizeof(offsets[0]));
41
42 if (drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &cmd))
43 return EINA_FALSE;
44
45 fb->id = cmd.fb_id;
46
47 /* if (drmModeAddFB2(fd, w, h, fmt, hdls, pitches, offsets, &fb->id, 0)) */
48 /* return EINA_FALSE; */
49
50 return EINA_TRUE;
51}
52
17EAPI Ecore_Drm_Fb * 53EAPI Ecore_Drm_Fb *
18ecore_drm_fb_create(Ecore_Drm_Device *dev, int width, int height) 54ecore_drm_fb_create(Ecore_Drm_Device *dev, int width, int height)
19{ 55{
@@ -42,11 +78,15 @@ ecore_drm_fb_create(Ecore_Drm_Device *dev, int width, int height)
42 fb->size = carg.size; 78 fb->size = carg.size;
43 fb->fd = dev->drm.fd; 79 fb->fd = dev->drm.fd;
44 80
45 if (drmModeAddFB(dev->drm.fd, width, height, 24, 32, 81 if (!_ecore_drm_fb_create2(dev->drm.fd, width, height, fb))
46 fb->stride, fb->hdl, &fb->id))
47 { 82 {
48 ERR("Could not add framebuffer: %m"); 83 WRN("Could not add framebuffer2: %m");
49 goto add_err; 84 if (drmModeAddFB(dev->drm.fd, width, height, 24, 32,
85 fb->stride, fb->hdl, &fb->id))
86 {
87 ERR("Could not add framebuffer: %m");
88 goto add_err;
89 }
50 } 90 }
51 91
52 memset(&marg, 0, sizeof(struct drm_mode_map_dumb)); 92 memset(&marg, 0, sizeof(struct drm_mode_map_dumb));