mode: fixup problems with framebuffer add function
parent
ed0ebd9d3d
commit
eb9bdc2787
|
@ -192,10 +192,11 @@ err_allocs:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t drmModeAddFB(int fd, uint32_t width, uint32_t height,
|
int drmModeAddFB(int fd, uint32_t width, uint32_t height,
|
||||||
uint8_t bpp, uint32_t pitch, drmBO *bo)
|
uint8_t bpp, uint32_t pitch, drmBO *bo, uint32_t *buf_id)
|
||||||
{
|
{
|
||||||
struct drm_mode_fb_cmd f;
|
struct drm_mode_fb_cmd f;
|
||||||
|
int ret;
|
||||||
|
|
||||||
f.width = width;
|
f.width = width;
|
||||||
f.height = height;
|
f.height = height;
|
||||||
|
@ -203,10 +204,11 @@ uint32_t drmModeAddFB(int fd, uint32_t width, uint32_t height,
|
||||||
f.bpp = bpp;
|
f.bpp = bpp;
|
||||||
f.handle = bo->handle;
|
f.handle = bo->handle;
|
||||||
|
|
||||||
if (ioctl(fd, DRM_IOCTL_MODE_ADDFB, &f))
|
if (ret = ioctl(fd, DRM_IOCTL_MODE_ADDFB, &f))
|
||||||
return 0;
|
return ret;
|
||||||
|
|
||||||
return f.buffer_id;
|
*buf_id = f.buffer_id;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drmModeRmFB(int fd, uint32_t bufferId)
|
int drmModeRmFB(int fd, uint32_t bufferId)
|
||||||
|
|
|
@ -502,6 +502,7 @@ bool drm_initial_config(drm_device_t *dev, bool can_grow)
|
||||||
struct drm_framebuffer *fb;
|
struct drm_framebuffer *fb;
|
||||||
struct drm_output *output, *use_output = NULL;
|
struct drm_output *output, *use_output = NULL;
|
||||||
|
|
||||||
|
#if 0
|
||||||
fb = drm_framebuffer_create(dev);
|
fb = drm_framebuffer_create(dev);
|
||||||
if (!fb)
|
if (!fb)
|
||||||
return false;
|
return false;
|
||||||
|
@ -512,6 +513,7 @@ bool drm_initial_config(drm_device_t *dev, bool can_grow)
|
||||||
fb->depth = 24;
|
fb->depth = 24;
|
||||||
fb->bits_per_pixel = 32;
|
fb->bits_per_pixel = 32;
|
||||||
|
|
||||||
|
#endif
|
||||||
/* bind both CRTCs to this fb */
|
/* bind both CRTCs to this fb */
|
||||||
/* only initialise one crtc to enabled state */
|
/* only initialise one crtc to enabled state */
|
||||||
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
|
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
|
||||||
|
@ -931,15 +933,15 @@ int drm_mode_addfb(struct inode *inode, struct file *filp,
|
||||||
struct drm_buffer_object *bo;
|
struct drm_buffer_object *bo;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!copy_from_user(&r, argp, sizeof(r)))
|
if (copy_from_user(&r, argp, sizeof(r)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
if (config->min_width > r.width || r.width > config->max_width) {
|
if ((config->min_width > r.width) || (r.width > config->max_width)) {
|
||||||
DRM_ERROR("mode new framebuffer width not within limits");
|
DRM_ERROR("mode new framebuffer width not within limits\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (config->min_height > r.height || r.height > config->min_height) {
|
if ((config->min_height > r.height) || (r.height > config->max_height)) {
|
||||||
DRM_ERROR("mode new framebuffer height not within limits");
|
DRM_ERROR("mode new framebuffer height not within limits\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -963,7 +965,7 @@ int drm_mode_addfb(struct inode *inode, struct file *filp,
|
||||||
fb->bo = bo;
|
fb->bo = bo;
|
||||||
|
|
||||||
r.buffer_id = fb->id;
|
r.buffer_id = fb->id;
|
||||||
if (!copy_to_user(argp, &r, sizeof(r)))
|
if (copy_to_user(argp, &r, sizeof(r)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1090,6 +1090,11 @@ void intel_modeset_init(drm_device_t *dev)
|
||||||
|
|
||||||
drm_mode_config_init(dev);
|
drm_mode_config_init(dev);
|
||||||
|
|
||||||
|
dev->mode_config.min_width = 0;
|
||||||
|
dev->mode_config.min_height = 0;
|
||||||
|
|
||||||
|
dev->mode_config.max_width = 4096;
|
||||||
|
dev->mode_config.max_height = 4096;
|
||||||
|
|
||||||
if (IS_MOBILE(dev) || IS_I9XX(dev))
|
if (IS_MOBILE(dev) || IS_I9XX(dev))
|
||||||
num_pipe = 2;
|
num_pipe = 2;
|
||||||
|
@ -1104,7 +1109,7 @@ void intel_modeset_init(drm_device_t *dev)
|
||||||
|
|
||||||
intel_setup_outputs(dev);
|
intel_setup_outputs(dev);
|
||||||
|
|
||||||
drm_initial_config(dev, false);
|
//drm_initial_config(dev, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void intel_modeset_cleanup(drm_device_t *dev)
|
void intel_modeset_cleanup(drm_device_t *dev)
|
||||||
|
|
Loading…
Reference in New Issue