aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorKristian H�gsberg <krh@redhat.com>2008-12-17 22:14:37 -0500
committerDave Airlie <airlied@linux.ie>2008-12-29 02:47:25 -0500
commit0c7c26647579e9e647e8b969bb0e7b3f5f1a1492 (patch)
tree741cd9680ce6a98def2e64f923efb713dae8908b /drivers/gpu
parente0c8463a8b00b467611607df0ff369d062528875 (diff)
drm: drop DRM_IOCTL_MODE_REPLACEFB, add+remove works just as well.
The replace fb ioctl replaces the backing buffer object for a modesetting framebuffer object. This can be acheived by just creating a new framebuffer backed by the new buffer object, setting that for the crtcs in question and then removing the old framebuffer object. Signed-off-by: Kristian Hogsberg <krh@redhat.com> Acked-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/drm_crtc.c40
-rw-r--r--drivers/gpu/drm/drm_drv.c1
-rw-r--r--drivers/gpu/drm/i915/intel_display.c31
3 files changed, 0 insertions, 72 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index ece947d3b25b..53c87254be4c 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2302,46 +2302,6 @@ out:
2302 return ret; 2302 return ret;
2303} 2303}
2304 2304
2305
2306int drm_mode_replacefb(struct drm_device *dev,
2307 void *data, struct drm_file *file_priv)
2308{
2309 struct drm_mode_fb_cmd *r = data;
2310 struct drm_mode_object *obj;
2311 struct drm_framebuffer *fb;
2312 int found = 0;
2313 struct drm_framebuffer *fbl = NULL;
2314 int ret = 0;
2315
2316 /* right replace the current bo attached to this fb with a new bo */
2317 mutex_lock(&dev->mode_config.mutex);
2318 obj = drm_mode_object_find(dev, r->fb_id, DRM_MODE_OBJECT_FB);
2319 if (!obj) {
2320 ret = -EINVAL;
2321 goto out;
2322 }
2323 fb = obj_to_fb(obj);
2324
2325 list_for_each_entry(fbl, &file_priv->fbs, filp_head)
2326 if (fb == fbl)
2327 found = 1;
2328
2329 if (!found) {
2330 DRM_ERROR("tried to replace an fb we didn't own\n");
2331 ret = -EINVAL;
2332 goto out;
2333 }
2334
2335 if (dev->mode_config.funcs->resize_fb)
2336 ret = dev->mode_config.funcs->resize_fb(dev, file_priv, fb, r);
2337 else
2338 ret = -EINVAL;
2339out:
2340 mutex_unlock(&dev->mode_config.mutex);
2341 return ret;
2342
2343}
2344
2345int drm_mode_connector_attach_encoder(struct drm_connector *connector, 2305int drm_mode_connector_attach_encoder(struct drm_connector *connector,
2346 struct drm_encoder *encoder) 2306 struct drm_encoder *encoder)
2347{ 2307{
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 7eb0e09fc73b..373e3de64340 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -143,7 +143,6 @@ static struct drm_ioctl_desc drm_ioctls[] = {
143 DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, DRM_MASTER|DRM_CONTROL_ALLOW), 143 DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, DRM_MASTER|DRM_CONTROL_ALLOW),
144 DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb, DRM_MASTER|DRM_CONTROL_ALLOW), 144 DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb, DRM_MASTER|DRM_CONTROL_ALLOW),
145 DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb, DRM_MASTER|DRM_CONTROL_ALLOW), 145 DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb, DRM_MASTER|DRM_CONTROL_ALLOW),
146 DRM_IOCTL_DEF(DRM_IOCTL_MODE_REPLACEFB, drm_mode_replacefb, DRM_MASTER|DRM_ROOT_ONLY|DRM_CONTROL_ALLOW),
147}; 146};
148 147
149#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls ) 148#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 96c2da5b74e3..5689e44d30b3 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1528,38 +1528,7 @@ intel_user_framebuffer_create(struct drm_device *dev,
1528 return fb; 1528 return fb;
1529} 1529}
1530 1530
1531static int intel_insert_new_fb(struct drm_device *dev,
1532 struct drm_file *file_priv,
1533 struct drm_framebuffer *fb,
1534 struct drm_mode_fb_cmd *mode_cmd)
1535{
1536 struct intel_framebuffer *intel_fb;
1537 struct drm_gem_object *obj;
1538 struct drm_crtc *crtc;
1539
1540 intel_fb = to_intel_framebuffer(fb);
1541
1542 obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handle);
1543
1544 if (!obj)
1545 return -EINVAL;
1546
1547 intel_fb->obj = obj;
1548 drm_gem_object_unreference(intel_fb->obj);
1549 drm_helper_mode_fill_fb_struct(fb, mode_cmd);
1550 mutex_unlock(&dev->struct_mutex);
1551
1552 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
1553 if (crtc->fb == fb) {
1554 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
1555 crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y);
1556 }
1557 }
1558 return 0;
1559}
1560
1561static const struct drm_mode_config_funcs intel_mode_funcs = { 1531static const struct drm_mode_config_funcs intel_mode_funcs = {
1562 .resize_fb = intel_insert_new_fb,
1563 .fb_create = intel_user_framebuffer_create, 1532 .fb_create = intel_user_framebuffer_create,
1564 .fb_changed = intelfb_probe, 1533 .fb_changed = intelfb_probe,
1565}; 1534};