/* DSS driver wants the w & h in rotated orientation */ if (drm_rotation_90_or_270(state->rotation))
swap(info->width, info->height);
x = state->src_x >> 16;
y = state->src_y >> 16;
if (omap_gem_flags(fb->obj[0]) & OMAP_BO_TILED_MASK) {
u32 w = state->src_w >> 16;
u32 h = state->src_h >> 16;
orient = drm_rotation_to_tiler(state->rotation);
/* *omap_gem_rotated_paddr()wantsthex&yintilerunits. *Usuallytilerunitsizeisthesameasthepixelsize,except *forYUV422formats,forwhichthetilerunitsizeis32bits *andpixelsizeis16bits.
*/ if (fb->format->format == DRM_FORMAT_UYVY ||
fb->format->format == DRM_FORMAT_YUYV) {
x /= 2;
w /= 2;
}
/* adjust x,y offset for invert: */ if (orient & MASK_Y_INVERT)
y += h - 1; if (orient & MASK_X_INVERT)
x += w - 1;
/* Note: x and y are in TILER units, not pixels */
omap_gem_rotated_dma_addr(fb->obj[0], orient, x, y,
&info->paddr);
info->rotation_type = OMAP_DSS_ROT_TILER;
info->rotation = state->rotation ?: DRM_MODE_ROTATE_0; /* Note: stride in TILER units, not pixels */
info->screen_width = omap_gem_tiled_stride(fb->obj[0], orient);
} else { switch (state->rotation & DRM_MODE_ROTATE_MASK) { case0: case DRM_MODE_ROTATE_0: /* OK */ break;
if (r_info) {
info->width /= 2;
info->out_width /= 2;
*r_info = *info;
if (fb->format->is_yuv) { if (info->width & 1) {
info->width++;
r_info->width--;
}
if (info->out_width & 1) {
info->out_width++;
r_info->out_width--;
}
}
r_info->pos_x = info->pos_x + info->out_width;
r_info->paddr = get_linear_addr(fb, format, 0,
x + info->width, y); if (fb->format->format == DRM_FORMAT_NV12) {
r_info->p_uv_addr =
get_linear_addr(fb, format, 1,
x + info->width, y);
}
}
}
/* pin, prepare for scanout: */ int omap_framebuffer_pin(struct drm_framebuffer *fb)
{ struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb); int ret, i, n = fb->format->num_planes;
mutex_lock(&omap_fb->lock);
if (omap_fb->pin_count > 0) {
omap_fb->pin_count++;
mutex_unlock(&omap_fb->lock); return0;
}
for (i = 0; i < n; i++) { struct plane *plane = &omap_fb->planes[i];
ret = omap_gem_pin(fb->obj[i], &plane->dma_addr); if (ret) goto fail;
omap_gem_dma_sync_buffer(fb->obj[i], DMA_TO_DEVICE);
}
omap_fb->pin_count++;
mutex_unlock(&omap_fb->lock);
return0;
fail: for (i--; i >= 0; i--) { struct plane *plane = &omap_fb->planes[i];
omap_gem_unpin(fb->obj[i]);
plane->dma_addr = 0;
}
mutex_unlock(&omap_fb->lock);
return ret;
}
/* unpin, no longer being scanned out: */ void omap_framebuffer_unpin(struct drm_framebuffer *fb)
{ struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb); int i, n = fb->format->num_planes;
mutex_lock(&omap_fb->lock);
omap_fb->pin_count--;
if (omap_fb->pin_count > 0) {
mutex_unlock(&omap_fb->lock); return;
}
for (i = 0; i < n; i++) { struct plane *plane = &omap_fb->planes[i];
omap_gem_unpin(fb->obj[i]);
plane->dma_addr = 0;
}
mutex_unlock(&omap_fb->lock);
}
#ifdef CONFIG_DEBUG_FS void omap_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m)
{ int i, n = fb->format->num_planes;
/* *Thecodebelowassumesthatnoformatusemorethantwoplanes,and *thatthetwoplanesofmultiplaneformatsneedthesamenumberof *bytesperpixel.
*/ if (info->num_planes == 2 && pitch != mode_cmd->pitches[1]) {
dev_dbg(dev->dev, "pitches differ between planes 0 and 1\n");
ret = -EINVAL; goto fail;
}
if (pitch % info->cpp[0]) {
dev_dbg(dev->dev, "buffer pitch (%u bytes) is not a multiple of pixel size (%u bytes)\n",
pitch, info->cpp[0]);
ret = -EINVAL; goto fail;
}
for (i = 0; i < info->num_planes; i++) { struct plane *plane = &omap_fb->planes[i]; unsignedint vsub = i == 0 ? 1 : info->vsub; unsignedint size;
size = pitch * mode_cmd->height / vsub;
if (size > omap_gem_mmap_size(bos[i]) - mode_cmd->offsets[i]) {
dev_dbg(dev->dev, "provided buffer object is too small! %zu < %d\n",
bos[i]->size - mode_cmd->offsets[i], size);
ret = -EINVAL; goto fail;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.