Skip to content

Commit

Permalink
drm/exynos: Use struct drm_mode_fb_cmd2
Browse files Browse the repository at this point in the history
The exynos drm also should use struct drm_mode_fb_cmd2 by changes of
308e5bc commit(drm: add an fb creation
ioctl that takes a pixel format v5).

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
  • Loading branch information
Joonyoung Shim authored and Inki Dae committed Dec 21, 2011
1 parent ac2bdf7 commit a794d57
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
20 changes: 9 additions & 11 deletions drivers/gpu/drm/exynos/exynos_drm_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static struct drm_framebuffer_funcs exynos_drm_fb_funcs = {

static struct drm_framebuffer *
exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev,
struct drm_mode_fb_cmd *mode_cmd)
struct drm_mode_fb_cmd2 *mode_cmd)
{
struct exynos_drm_fb *exynos_fb;
struct drm_framebuffer *fb;
Expand All @@ -115,9 +115,6 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev,

DRM_DEBUG_KMS("%s\n", __FILE__);

mode_cmd->pitch = max(mode_cmd->pitch,
mode_cmd->width * (mode_cmd->bpp >> 3));

DRM_LOG_KMS("drm fb create(%dx%d)\n",
mode_cmd->width, mode_cmd->height);

Expand All @@ -136,14 +133,14 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev,

DRM_LOG_KMS("create: fb id: %d\n", fb->base.id);

size = mode_cmd->pitch * mode_cmd->height;
size = mode_cmd->pitches[0] * mode_cmd->height;

/*
* mode_cmd->handle could be NULL at booting time or
* mode_cmd->handles[0] could be NULL at booting time or
* with user request. if NULL, a new buffer or a gem object
* would be allocated.
*/
if (!mode_cmd->handle) {
if (!mode_cmd->handles[0]) {
if (!file_priv) {
struct exynos_drm_gem_buf *buffer;

Expand All @@ -166,15 +163,16 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev,
goto out;
} else {
exynos_gem_obj = exynos_drm_gem_create(dev, file_priv,
&mode_cmd->handle,
&mode_cmd->handles[0],
size);
if (IS_ERR(exynos_gem_obj)) {
ret = PTR_ERR(exynos_gem_obj);
goto err_buffer;
}
}
} else {
obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handle);
obj = drm_gem_object_lookup(dev, file_priv,
mode_cmd->handles[0]);
if (!obj) {
DRM_ERROR("failed to lookup gem object.\n");
goto err_buffer;
Expand Down Expand Up @@ -214,8 +212,8 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev,
}

struct drm_framebuffer *exynos_drm_fb_create(struct drm_device *dev,
struct drm_file *file_priv,
struct drm_mode_fb_cmd *mode_cmd)
struct drm_file *file_priv,
struct drm_mode_fb_cmd2 *mode_cmd)
{
DRM_DEBUG_KMS("%s\n", __FILE__);

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/exynos/exynos_drm_fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#define _EXYNOS_DRM_FB_H

struct drm_framebuffer *exynos_drm_fb_create(struct drm_device *dev,
struct drm_file *filp,
struct drm_mode_fb_cmd *mode_cmd);
struct drm_file *filp,
struct drm_mode_fb_cmd2 *mode_cmd);

void exynos_drm_mode_config_init(struct drm_device *dev);

Expand Down
14 changes: 8 additions & 6 deletions drivers/gpu/drm/exynos/exynos_drm_fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
struct exynos_drm_fbdev *exynos_fbdev = to_exynos_fbdev(helper);
struct drm_device *dev = helper->dev;
struct fb_info *fbi;
struct drm_mode_fb_cmd mode_cmd = { 0 };
struct drm_mode_fb_cmd2 mode_cmd = { 0 };
struct platform_device *pdev = dev->platformdev;
int ret;

Expand All @@ -138,8 +138,9 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,

mode_cmd.width = sizes->surface_width;
mode_cmd.height = sizes->surface_height;
mode_cmd.bpp = sizes->surface_bpp;
mode_cmd.depth = sizes->surface_depth;
mode_cmd.pitches[0] = sizes->surface_width * (sizes->surface_bpp >> 3);
mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
sizes->surface_depth);

mutex_lock(&dev->struct_mutex);

Expand Down Expand Up @@ -206,7 +207,7 @@ static int exynos_drm_fbdev_recreate(struct drm_fb_helper *helper,
struct drm_device *dev = helper->dev;
struct exynos_drm_fbdev *exynos_fbdev = to_exynos_fbdev(helper);
struct drm_framebuffer *fb = exynos_fbdev->fb;
struct drm_mode_fb_cmd mode_cmd = { 0 };
struct drm_mode_fb_cmd2 mode_cmd = { 0 };

DRM_DEBUG_KMS("%s\n", __FILE__);

Expand All @@ -220,8 +221,9 @@ static int exynos_drm_fbdev_recreate(struct drm_fb_helper *helper,

mode_cmd.width = sizes->surface_width;
mode_cmd.height = sizes->surface_height;
mode_cmd.bpp = sizes->surface_bpp;
mode_cmd.depth = sizes->surface_depth;
mode_cmd.pitches[0] = sizes->surface_width * (sizes->surface_bpp >> 3);
mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
sizes->surface_depth);

if (fb->funcs->destroy)
fb->funcs->destroy(fb);
Expand Down

0 comments on commit a794d57

Please sign in to comment.