}
#endif
-int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
+int udl_handle_damage(struct drm_framebuffer *fb, int x, int y,
int width, int height)
{
- struct drm_device *dev = fb->base.dev;
+ struct drm_device *dev = fb->dev;
struct udl_device *udl = to_udl(dev);
int i, ret;
char *cmd;
int log_bpp;
void *vaddr;
- BUG_ON(!is_power_of_2(fb->base.format->cpp[0]));
- log_bpp = __ffs(fb->base.format->cpp[0]);
+ if (WARN_ON(!is_power_of_2(fb->format->cpp[0])))
+ return -EINVAL;
+
+ log_bpp = __ffs(fb->format->cpp[0]);
spin_lock(&udl->active_fb_16_lock);
- if (udl->active_fb_16 != &fb->base) {
+ if (udl->active_fb_16 != fb) {
spin_unlock(&udl->active_fb_16_lock);
return 0;
}
spin_unlock(&udl->active_fb_16_lock);
- vaddr = drm_gem_shmem_vmap(&fb->shmem->base);
+ vaddr = drm_gem_shmem_vmap(fb->obj[0]);
if (IS_ERR(vaddr)) {
DRM_ERROR("failed to vmap fb\n");
return 0;
x = aligned_x;
if ((width <= 0) ||
- (x + width > fb->base.width) ||
- (y + height > fb->base.height)) {
+ (x + width > fb->width) ||
+ (y + height > fb->height)) {
ret = -EINVAL;
goto err_drm_gem_shmem_vunmap;
}
cmd = urb->transfer_buffer;
for (i = y; i < y + height ; i++) {
- const int line_offset = fb->base.pitches[0] * i;
+ const int line_offset = fb->pitches[0] * i;
const int byte_offset = line_offset + (x << log_bpp);
- const int dev_byte_offset = (fb->base.width * i + x) << log_bpp;
+ const int dev_byte_offset = (fb->width * i + x) << log_bpp;
if (udl_render_hline(dev, log_bpp, &urb, (char *)vaddr,
&cmd, byte_offset, dev_byte_offset,
width << log_bpp,
&udl->cpu_kcycles_used);
out:
- drm_gem_shmem_vunmap(&fb->shmem->base, vaddr);
+ drm_gem_shmem_vunmap(fb->obj[0], vaddr);
return 0;
err_drm_gem_shmem_vunmap:
- drm_gem_shmem_vunmap(&fb->shmem->base, vaddr);
+ drm_gem_shmem_vunmap(fb->obj[0], vaddr);
return ret;
}
struct drm_clip_rect *clips,
unsigned num_clips)
{
- struct udl_framebuffer *ufb = to_udl_fb(fb);
struct udl_device *udl = fb->dev->dev_private;
struct dma_buf_attachment *import_attach;
int i;
}
spin_unlock(&udl->active_fb_16_lock);
- import_attach = ufb->shmem->base.import_attach;
+ import_attach = fb->obj[0]->import_attach;
if (import_attach) {
ret = dma_buf_begin_cpu_access(import_attach->dmabuf,
}
for (i = 0; i < num_clips; i++) {
- ret = udl_handle_damage(ufb, clips[i].x1, clips[i].y1,
- clips[i].x2 - clips[i].x1,
- clips[i].y2 - clips[i].y1);
+ ret = udl_handle_damage(fb, clips[i].x1, clips[i].y1,
+ clips[i].x2 - clips[i].x1,
+ clips[i].y2 - clips[i].y1);
if (ret)
break;
}
{
struct drm_device *dev = crtc->dev;
- struct udl_framebuffer *ufb = to_udl_fb(crtc->primary->fb);
+ struct drm_framebuffer *fb = crtc->primary->fb;
struct udl_device *udl = dev->dev_private;
char *buf;
char *wrptr;
wrptr = udl_dummy_render(wrptr);
spin_lock(&udl->active_fb_16_lock);
- udl->active_fb_16 = &ufb->base;
+ udl->active_fb_16 = fb;
spin_unlock(&udl->active_fb_16_lock);
udl->mode_buf_len = wrptr - buf;
/* damage all of it */
- udl_handle_damage(ufb, 0, 0, ufb->base.width, ufb->base.height);
+ udl_handle_damage(fb, 0, 0, fb->width, fb->height);
return 0;
}
uint32_t page_flip_flags,
struct drm_modeset_acquire_ctx *ctx)
{
- struct udl_framebuffer *ufb = to_udl_fb(fb);
struct drm_device *dev = crtc->dev;
struct udl_device *udl = dev->dev_private;
udl->active_fb_16 = fb;
spin_unlock(&udl->active_fb_16_lock);
- udl_handle_damage(ufb, 0, 0, fb->width, fb->height);
+ udl_handle_damage(fb, 0, 0, fb->width, fb->height);
spin_lock_irq(&dev->event_lock);
if (event)
void udl_modeset_restore(struct drm_device *dev)
{
struct udl_device *udl = dev->dev_private;
- struct udl_framebuffer *ufb;
+ struct drm_framebuffer *fb;
if (!udl->crtc || !udl->crtc->primary->fb)
return;
udl_crtc_commit(udl->crtc);
- ufb = to_udl_fb(udl->crtc->primary->fb);
- udl_handle_damage(ufb, 0, 0, ufb->base.width, ufb->base.height);
+ fb = udl->crtc->primary->fb;
+ udl_handle_damage(fb, 0, 0, fb->width, fb->height);
}
void udl_modeset_cleanup(struct drm_device *dev)