Merge remote-tracking branch 'pfdo/drm-fixes' into drm-core-next
authorDave Airlie <airlied@redhat.com>
Wed, 21 Dec 2011 09:50:56 +0000 (09:50 +0000)
committerDave Airlie <airlied@redhat.com>
Wed, 21 Dec 2011 09:50:56 +0000 (09:50 +0000)
-next reported a messy merge, so I've merged my upstream pull into
my -next tree.

Conflicts:
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

1  2 
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c

index 1748a7142aca76811ab6fff8b4dbcf921496737b,8aa1dbb45c67efad383e6f938383efeb11589210..c4bdef3062c7245a7a8edadea7fa5cd165764793
@@@ -1041,46 -1123,29 +1131,33 @@@ static struct drm_framebuffer *vmw_kms_
                return ERR_PTR(-ENOENT);
        }
  
-       ret = vmw_user_surface_lookup_handle(dev_priv, tfile,
-                                            mode_cmd.handle, &surface);
 +      /**
 +       * End conditioned code.
 +       */
 +
 -                                   mode_cmd->handle,
+       /* returns either a dmabuf or surface */
+       ret = vmw_user_lookup_handle(dev_priv, tfile,
++                                   mode_cmd.handle,
+                                    &surface, &bo);
        if (ret)
-               goto try_dmabuf;
-       if (!surface->scanout)
-               goto err_not_scanout;
-       ret = vmw_kms_new_framebuffer_surface(dev_priv, file_priv, surface,
-                                             &vfb, &mode_cmd);
-       /* vmw_user_surface_lookup takes one ref so does new_fb */
-       vmw_surface_unreference(&surface);
-       if (ret) {
-               DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret);
-               ttm_base_object_unref(&user_obj);
-               return ERR_PTR(ret);
-       } else
-               vfb->user_obj = user_obj;
-       return &vfb->base;
- try_dmabuf:
-       DRM_INFO("%s: trying buffer\n", __func__);
-       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);
-       /* vmw_user_dmabuf_lookup takes one ref so does new_fb */
-       vmw_dmabuf_unreference(&bo);
+               goto err_out;
+       /* Create the new framebuffer depending one what we got back */
+       if (bo)
+               ret = vmw_kms_new_framebuffer_dmabuf(dev_priv, bo, &vfb,
 -                                                   mode_cmd);
++                                                   &mode_cmd);
+       else if (surface)
+               ret = vmw_kms_new_framebuffer_surface(dev_priv, file_priv,
 -                                                    surface, &vfb, mode_cmd);
++                                                    surface, &vfb, &mode_cmd);
+       else
+               BUG();
+ err_out:
+       /* vmw_user_lookup_handle takes one ref so does new_fb */
+       if (bo)
+               vmw_dmabuf_unreference(&bo);
+       if (surface)
+               vmw_surface_unreference(&surface);
  
        if (ret) {
                DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret);
Simple merge
Simple merge