r->mode = crtc.mode;
// r->width = crtc.width;
// r->height = crtc.height;
- r->bufferId = crtc.fb_id;
+ r->buffer_id = crtc.fb_id;
r->gamma_size = crtc.gamma_size;
r->count_outputs = crtc.count_outputs;
r->count_possibles = crtc.count_possibles;
}
EXPORT_SYMBOL(drm_mode_config_cleanup);
-int drm_crtc_set_config(struct drm_crtc *crtc, struct drm_mode_crtc *crtc_info, struct drm_display_mode *new_mode, struct drm_output **output_set)
+int drm_crtc_set_config(struct drm_crtc *crtc, struct drm_mode_crtc *crtc_info, struct drm_display_mode *new_mode, struct drm_output **output_set, struct drm_framebuffer *fb)
{
drm_device_t *dev = crtc->dev;
struct drm_crtc **save_crtcs, *new_crtc;
if (!save_crtcs)
return -ENOMEM;
+ if (crtc->fb != fb)
+ changed = true;
+
if (crtc_info->x != crtc->x || crtc_info->y != crtc->y)
changed = true;
}
if (changed) {
+ crtc->fb = fb;
crtc->enabled = (new_mode != NULL);
if (new_mode != NULL) {
DRM_DEBUG("attempting to set mode from userspace\n");
struct drm_crtc *crtc;
struct drm_output **output_set = NULL, *output;
struct drm_display_mode *mode;
+ struct drm_framebuffer *fb = NULL;
int retcode = 0;
int i;
}
if (crtc_req.mode) {
+
+ /* if we have a mode we need a framebuffer */
+ if (crtc_req.fb_id) {
+ fb = idr_find(&dev->mode_config.crtc_idr, crtc_req.fb_id);
+ if (!fb || (fb->id != crtc_req.fb_id)) {
+ DRM_DEBUG("Unknown FB ID%d\n", crtc_req.fb_id);
+ return -EINVAL;
+ }
+ }
mode = idr_find(&dev->mode_config.crtc_idr, crtc_req.mode);
if (!mode || (mode->mode_id != crtc_req.mode))
{
return -EINVAL;
}
- if (crtc_req.count_outputs > 0 && !mode) {
- DRM_DEBUG("Count outputs is %d but no mode set\n", crtc_req.count_outputs);
+ if (crtc_req.count_outputs > 0 && !mode && !fb) {
+ DRM_DEBUG("Count outputs is %d but no mode or fb set\n", crtc_req.count_outputs);
return -EINVAL;
}
}
}
- retcode = drm_crtc_set_config(crtc, &crtc_req, mode, output_set);
+ retcode = drm_crtc_set_config(crtc, &crtc_req, mode, output_set, fb);
return retcode;
}