70 for (i = 0; i <
ARRAY_SIZE(formats) && nformats < max_formats; i++)
79 struct drm_gem_object *
bo;
85 #define to_omap_framebuffer(x) container_of(x, struct omap_framebuffer, base)
94 struct drm_file *file_priv,
99 omap_fb->
planes[0].bo, handle);
107 DBG(
"destroy: FB ID: %d (%p)", fb->
base.id, fb);
111 for (i = 0; i <
n; i++) {
114 drm_gem_object_unreference_unlocked(plane->
bo);
121 struct drm_file *file_priv,
unsigned flags,
unsigned color,
126 for (i = 0; i < num_clips; i++) {
128 clips[i].x2 - clips[i].x1,
129 clips[i].y2 - clips[i].y1);
136 .create_handle = omap_framebuffer_create_handle,
137 .destroy = omap_framebuffer_destroy,
138 .dirty = omap_framebuffer_dirty,
147 (x * format->
planes[
n].stride_bpp) +
159 const struct format *format = omap_fb->
format;
160 struct plane *plane = &omap_fb->
planes[0];
181 dev_err(fb->
dev->dev,
"invalid rotation: %02x",
217 info->
paddr = get_linear_addr(plane, format, 0, x, y);
226 plane = &omap_fb->
planes[1];
233 info->
p_uv_addr = get_linear_addr(plane, format, 1, x, y);
251 void (*unpin)(
void *arg,
struct drm_gem_object *
bo))
253 int ret = 0,
i, na, nb;
260 for (i = 0; i <
max(na, nb); i++) {
261 struct plane *pa, *pb;
280 for (i = 0; i < nb; i++) {
281 struct plane *pb = &ofba->
planes[
i];
307 struct list_head *connector_list = &dev->mode_config.connector_list;
315 if (connector != from) {
318 if (crtc && crtc->
fb == fb) {
331 int x,
int y,
int w,
int h)
335 VERB(
"flush: %d,%d %dx%d, fb=%p", x, y, w, h, fb);
344 int cx =
max(0, x - crtc->
x);
345 int cy =
max(0, y - crtc->
y);
346 int cw = w + (x - crtc->
x) - cx;
347 int ch = h + (y - crtc->
y) - cy;
354 #ifdef CONFIG_DEBUG_FS
363 for (i = 0; i <
n; i++) {
364 struct plane *plane = &omap_fb->
planes[
i];
365 seq_printf(m,
" %d: offset=%d pitch=%d, obj: ",
367 omap_gem_describe(plane->
bo, m);
375 struct drm_gem_object *
bos[4];
387 for (i = 0; i <
n; i++)
388 drm_gem_object_unreference_unlocked(bos[i]);
399 const struct format *format =
NULL;
402 DBG(
"create framebuffer: dev=%p, mode_cmd=%p (%dx%d@%4.4s)",
408 format = &formats[
i];
414 dev_err(dev->dev,
"unsupported pixel format: %4.4s\n",
420 omap_fb = kzalloc(
sizeof(*omap_fb),
GFP_KERNEL);
422 dev_err(dev->dev,
"could not allocate fb\n");
430 dev_err(dev->dev,
"framebuffer init failed: %d\n", ret);
434 DBG(
"create: FB ID: %d (%p)", fb->
base.id, fb);
438 for (i = 0; i <
n; i++) {
439 struct plane *plane = &omap_fb->
planes[
i];
442 if (pitch < (mode_cmd->
width * format->
planes[i].stride_bpp)) {
443 dev_err(dev->dev,
"provided buffer pitch is too small! %d < %d\n",
444 pitch, mode_cmd->
width * format->
planes[i].stride_bpp);
452 dev_err(dev->dev,
"provided buffer object is too small! %d < %d\n",
453 bos[i]->size - mode_cmd->
offsets[i], size);
470 omap_framebuffer_destroy(fb);