The drm fb helper has specific preference of bpp and depth. For example,
for 32bit bpp, the depth is hard-coded to be 24. If it's not aligned
with the supported format of a drm device, it fails to initialize fbdev.
So override the depth value from fb helper with the current format
of the drm device. This will allow to initialize the fbdev with
preferred format that matches with actual format.
Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
Reviewed-by: Saurabh Sengar <saurabhs@xilinx.com>
Tested-by: Anil Kumar Mamidala <amamidal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
#include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
+#include "xlnx_crtc.h"
#include "xlnx_drv.h"
#include "xlnx_fb.h"
unsigned int bytes_per_pixel;
unsigned long offset;
struct fb_info *fbi;
+ u32 format;
+ const struct drm_format_info *info;
size_t bytes;
int ret;
goto err_drm_gem_cma_free_object;
}
+ /* Override the depth given by fb helper with current format value */
+ format = xlnx_get_format(drm);
+ info = drm_format_info(format);
+ if (size->surface_bpp == info->cpp[0] * 8)
+ size->surface_depth = info->depth;
+
fbdev->fb = drm_gem_fbdev_fb_create(drm, size, fbdev->align, &obj->base,
&xlnx_fb_funcs);
if (IS_ERR(fbdev->fb)) {