Merge tag 'v3.2-rc6' of /home/airlied/devel/kernel/linux-2.6 into drm-core-next
[pandora-kernel.git] / drivers / gpu / drm / vmwgfx / vmwgfx_kms.c
index 37d4054..1748a71 100644 (file)
@@ -610,7 +610,7 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv,
 
        /* XXX get the first 3 from the surface info */
        vfbs->base.base.bits_per_pixel = mode_cmd->bpp;
-       vfbs->base.base.pitch = mode_cmd->pitch;
+       vfbs->base.base.pitches[0] = mode_cmd->pitch;
        vfbs->base.base.depth = mode_cmd->depth;
        vfbs->base.base.width = mode_cmd->width;
        vfbs->base.base.height = mode_cmd->height;
@@ -724,7 +724,7 @@ static int do_dmabuf_define_gmrfb(struct drm_file *file_priv,
        cmd->body.format.bitsPerPixel = framebuffer->base.bits_per_pixel;
        cmd->body.format.colorDepth = depth;
        cmd->body.format.reserved = 0;
-       cmd->body.bytesPerLine = framebuffer->base.pitch;
+       cmd->body.bytesPerLine = framebuffer->base.pitches[0];
        cmd->body.ptr.gmrId = framebuffer->user_handle;
        cmd->body.ptr.offset = 0;
 
@@ -966,7 +966,7 @@ static int vmw_kms_new_framebuffer_dmabuf(struct vmw_private *dev_priv,
        }
 
        vfbd->base.base.bits_per_pixel = mode_cmd->bpp;
-       vfbd->base.base.pitch = mode_cmd->pitch;
+       vfbd->base.base.pitches[0] = mode_cmd->pitch;
        vfbd->base.base.depth = mode_cmd->depth;
        vfbd->base.base.width = mode_cmd->width;
        vfbd->base.base.height = mode_cmd->height;
@@ -995,7 +995,7 @@ out_err1:
 
 static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
                                                 struct drm_file *file_priv,
-                                                struct drm_mode_fb_cmd *mode_cmd)
+                                                struct drm_mode_fb_cmd2 *mode_cmd2)
 {
        struct vmw_private *dev_priv = vmw_priv(dev);
        struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
@@ -1003,16 +1003,24 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
        struct vmw_surface *surface = NULL;
        struct vmw_dma_buffer *bo = NULL;
        struct ttm_base_object *user_obj;
+       struct drm_mode_fb_cmd mode_cmd;
        u64 required_size;
        int ret;
 
+       mode_cmd.width = mode_cmd2->width;
+       mode_cmd.height = mode_cmd2->height;
+       mode_cmd.pitch = mode_cmd2->pitches[0];
+       mode_cmd.handle = mode_cmd2->handles[0];
+       drm_fb_get_bpp_depth(mode_cmd2->pixel_format, &mode_cmd.depth,
+                                   &mode_cmd.bpp);
+
        /**
         * This code should be conditioned on Screen Objects not being used.
         * If screen objects are used, we can allocate a GMR to hold the
         * requested framebuffer.
         */
 
-       required_size = mode_cmd->pitch * mode_cmd->height;
+       required_size = mode_cmd.pitch * mode_cmd.height;
        if (unlikely(required_size > (u64) dev_priv->vram_size)) {
                DRM_ERROR("VRAM size is too small for requested mode.\n");
                return ERR_PTR(-ENOMEM);
@@ -1027,7 +1035,7 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
         * command stream using user-space handles.
         */
 
-       user_obj = ttm_base_object_lookup(tfile, mode_cmd->handle);
+       user_obj = ttm_base_object_lookup(tfile, mode_cmd.handle);
        if (unlikely(user_obj == NULL)) {
                DRM_ERROR("Could not locate requested kms frame buffer.\n");
                return ERR_PTR(-ENOENT);
@@ -1038,7 +1046,7 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
         */
 
        ret = vmw_user_surface_lookup_handle(dev_priv, tfile,
-                                            mode_cmd->handle, &surface);
+                                            mode_cmd.handle, &surface);
        if (ret)
                goto try_dmabuf;
 
@@ -1046,7 +1054,7 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
                goto err_not_scanout;
 
        ret = vmw_kms_new_framebuffer_surface(dev_priv, file_priv, surface,
-                                             &vfb, mode_cmd);
+                                             &vfb, &mode_cmd);
 
        /* vmw_user_surface_lookup takes one ref so does new_fb */
        vmw_surface_unreference(&surface);
@@ -1062,14 +1070,14 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
 try_dmabuf:
        DRM_INFO("%s: trying buffer\n", __func__);
 
-       ret = vmw_user_dmabuf_lookup(tfile, mode_cmd->handle, &bo);
+       ret = vmw_user_dmabuf_lookup(tfile, mode_cmd.handle, &bo);
        if (ret) {
                DRM_ERROR("failed to find buffer: %i\n", ret);
                return ERR_PTR(-ENOENT);
        }
 
        ret = vmw_kms_new_framebuffer_dmabuf(dev_priv, bo, &vfb,
-                                            mode_cmd);
+                                            &mode_cmd);
 
        /* vmw_user_dmabuf_lookup takes one ref so does new_fb */
        vmw_dmabuf_unreference(&bo);
@@ -1240,7 +1248,7 @@ int vmw_kms_readback(struct vmw_private *dev_priv,
        cmd->body.format.bitsPerPixel = vfb->base.bits_per_pixel;
        cmd->body.format.colorDepth = vfb->base.depth;
        cmd->body.format.reserved = 0;
-       cmd->body.bytesPerLine = vfb->base.pitch;
+       cmd->body.bytesPerLine = vfb->base.pitches[0];
        cmd->body.ptr.gmrId = vfb->user_handle;
        cmd->body.ptr.offset = 0;