aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark2012-06-15 21:49:55 -0500
committerNikhil Devshatwar2013-05-15 07:55:54 -0500
commit6ef992da3fb323009a0e9eb1dde0d3ec57af9c85 (patch)
tree6d2eb064325ca0a73a88bf3986d16a7a4b047a67
parent380f02c795698eadee5c9ba831ff1336cf5e6741 (diff)
downloadxf86-video-omap-6ef992da3fb323009a0e9eb1dde0d3ec57af9c85.tar.gz
xf86-video-omap-6ef992da3fb323009a0e9eb1dde0d3ec57af9c85.tar.xz
xf86-video-omap-6ef992da3fb323009a0e9eb1dde0d3ec57af9c85.zip
WIP: non-multiplanar dri2video
-rw-r--r--src/omap_dri2.c53
-rw-r--r--src/omap_exa.c7
-rw-r--r--src/omap_exa.h1
3 files changed, 44 insertions, 17 deletions
diff --git a/src/omap_dri2.c b/src/omap_dri2.c
index f7ef4f8..7911e08 100644
--- a/src/omap_dri2.c
+++ b/src/omap_dri2.c
@@ -319,31 +319,50 @@ OMAPDRI2CreateBufferVid(DrawablePtr pDraw, unsigned int attachment,
319 OMAPDRI2BufferPtr buf; 319 OMAPDRI2BufferPtr buf;
320 PixmapPtr pPixmap; 320 PixmapPtr pPixmap;
321 int bpp, extraCount = 0, ew = width, eh = height; 321 int bpp, extraCount = 0, ew = width, eh = height;
322 unsigned usage_hint = 0;
322 323
323 DEBUG_MSG("pDraw=%p, attachment=%d, format=%08x", 324 DEBUG_MSG("pDraw=%p, attachment=%d, format=%08x",
324 pDraw, attachment, format); 325 pDraw, attachment, format);
325 326
326 switch(format) { 327#define MULTI_PLANAR 0
327 case fourcc_code('I','4','2','0'): 328 if (MULTI_PLANAR) {
328 case fourcc_code('Y','V','1','2'): 329 switch(format) {
329 extraCount++; 330 case fourcc_code('I','4','2','0'):
330 ew /= 2; 331 case fourcc_code('Y','V','1','2'):
332 extraCount++;
333 ew /= 2;
331 /* fallthru */ 334 /* fallthru */
332 case fourcc_code('N','V','1','2'): 335 case fourcc_code('N','V','1','2'):
333 extraCount++; 336 extraCount++;
334 eh /= 2; 337 eh /= 2;
335 bpp = 8; 338 bpp = 8;
336 break; 339 break;
337 case fourcc_code('U','Y','V','Y'): 340 case fourcc_code('U','Y','V','Y'):
338 case fourcc_code('Y','U','Y','2'): 341 case fourcc_code('Y','U','Y','2'):
339 bpp = 16; 342 bpp = 16;
340 break; 343 break;
341 default: 344 default:
342 return NULL; 345 return NULL;
346 }
347 } else {
348 switch(format) {
349 case fourcc_code('I','4','2','0'):
350 case fourcc_code('Y','V','1','2'):
351 case fourcc_code('N','V','1','2'):
352 bpp = 8;
353 usage_hint = OMAP_CREATE_PIXMAP_420;
354 break;
355 case fourcc_code('U','Y','V','Y'):
356 case fourcc_code('Y','U','Y','2'):
357 bpp = 16;
358 break;
359 default:
360 return NULL;
361 }
343 } 362 }
344 363
345 /* main buffer, luma buffer in case of multi-planar.. */ 364 /* main buffer, luma buffer in case of multi-planar.. */
346 pPixmap = pScreen->CreatePixmap(pScreen, width, height, bpp, 0); 365 pPixmap = pScreen->CreatePixmap(pScreen, width, height, bpp, usage_hint);
347 366
348 buf = createbuf(pDraw, pPixmap, attachment, format); 367 buf = createbuf(pDraw, pPixmap, attachment, format);
349 368
diff --git a/src/omap_exa.c b/src/omap_exa.c
index 33844be..7964879 100644
--- a/src/omap_exa.c
+++ b/src/omap_exa.c
@@ -156,6 +156,13 @@ OMAPModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
156 pPixmap->devKind = OMAPCalculateStride(width, bitsPerPixel); 156 pPixmap->devKind = OMAPCalculateStride(width, bitsPerPixel);
157 } 157 }
158 158
159 /* if this is a planar 420 YUV format, then the bpp field only
160 * represents the Y plane.. increase the height to account for
161 * the U and V..
162 */
163 if (pPixmap->usage_hint & OMAP_CREATE_PIXMAP_420)
164 height += (height + 1) / 2;
165
159 size = pPixmap->devKind * height; 166 size = pPixmap->devKind * height;
160 167
161 if ((!priv->bo) || (omap_bo_size(priv->bo) != size)) { 168 if ((!priv->bo) || (omap_bo_size(priv->bo) != size)) {
diff --git a/src/omap_exa.h b/src/omap_exa.h
index 94ac9cc..fba979d 100644
--- a/src/omap_exa.h
+++ b/src/omap_exa.h
@@ -130,6 +130,7 @@ typedef struct {
130 130
131#define OMAP_CREATE_PIXMAP_SCANOUT 0x80000000 131#define OMAP_CREATE_PIXMAP_SCANOUT 0x80000000
132#define OMAP_CREATE_PIXMAP_TILED 0x40000000 132#define OMAP_CREATE_PIXMAP_TILED 0x40000000
133#define OMAP_CREATE_PIXMAP_420 0x20000000
133 134
134 135
135void * OMAPCreatePixmap (ScreenPtr pScreen, int width, int height, 136void * OMAPCreatePixmap (ScreenPtr pScreen, int width, int height,