Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N2 drmfix #376

Open
wants to merge 2 commits into
base: odroidn2-4.9.y
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion drivers/amlogic/drm/am_meson_fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ static int am_meson_drm_fbdev_create(struct drm_fb_helper *helper,
struct fb_info *fbi;
size_t size;
int ret;
void* vaddr;

bytes_per_pixel = DIV_ROUND_UP(sizes->surface_bpp, 8);

Expand All @@ -101,6 +102,12 @@ static int am_meson_drm_fbdev_create(struct drm_fb_helper *helper,

private->fbdev_bo = &meson_obj->base;

vaddr = ion_map_kernel(client, meson_obj->handle);
if (!vaddr) {
ret = -ENOMEM;
goto err_meson_gem_free_object;
}

fbi = drm_fb_helper_alloc_fbi(helper);
if (IS_ERR(fbi)) {
dev_err(dev->dev, "Failed to create framebuffer info.\n");
Expand All @@ -119,8 +126,17 @@ static int am_meson_drm_fbdev_create(struct drm_fb_helper *helper,
fbi->par = helper;
fbi->flags = FBINFO_FLAG_DEFAULT;
fbi->fbops = &meson_drm_fbdev_ops;
fbi->screen_size = size;
fbi->fix.smem_len = fbi->screen_size;
fbi->screen_buffer = vaddr;
/* Shamelessly leak the physical address to user-space */
fbi->fix.smem_start =
page_to_phys(virt_to_page(fbi->screen_buffer));

fb = helper->fb;
fb->bits_per_pixel = sizes->surface_bpp;
fb->depth = sizes->surface_depth;

drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth);
drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height);

Expand Down Expand Up @@ -195,7 +211,7 @@ int am_meson_drm_fbdev_init(struct drm_device *dev)
err_drm_fb_helper_fini:
drm_fb_helper_fini(helper);
err_free:
kfree(fbdev_cma);
kfree(helper);
return ret;
}

Expand Down
5 changes: 5 additions & 0 deletions drivers/amlogic/media/vout/vout_serve/vout_serve.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ static enum vmode_e nulldisp_validate_vmode(char *name)
enum vmode_e vmode = VMODE_MAX;
int i;

if (!name) {
printk(KERN_ALERT "nulldisp_validate_vmode: name=NULL\n");
return VMODE_HDMI;
}

for (i = 0; i < ARRAY_SIZE(nulldisp_vinfo); i++) {
if (strcmp(nulldisp_vinfo[i].name, name) == 0) {
vmode = nulldisp_vinfo[i].mode;
Expand Down