case FB1_IOCTL_SET_YUV_ADDR: //when in video mode, buff alloc by android
if((!strcmp(fix->id,"fb1"))||(!strcmp(fix->id,"fb3")))
{
- if (copy_from_user(yuv_phy, arg, 8))
+ if (copy_from_user(yuv_phy, argp, 8))
return -EFAULT;
info->fix.smem_start = yuv_phy[0]; //four y
info->fix.mmio_start = yuv_phy[1]; //four uv
struct layer_par *par = NULL;
rk_screen *screen = NULL;
int layer_id = 0;
- u32 smem_len=0,map_size = 0;
+ u32 smem_len=0;
u32 cblen = 0,crlen = 0;
u16 xsize =0,ysize = 0; //winx display window height/width --->LCDC_WINx_DSP_INFO
u32 xoffset = var->xoffset; // offset from virtual to visible
u16 ypos = (var->nonstd>>20) & 0xfff;
u32 xvir = var->xres_virtual;
u32 yvir = var->yres_virtual;
- u8 data_format = var->nonstd&0x0f;
+ u8 data_format = var->nonstd&0xff;
if(!strcmp(fix->id,"fb1")){
dev_drv = inf->rk_lcdc_device[0];
/* calculate y_offset,c_offset,line_length,cblen and crlen */
switch (data_format)
{
- case 0: // rgb
- switch(var->bits_per_pixel)
- {
- case 16: // rgb565
- par->format =RGB565;
- fix->line_length = 2 * xvir;
- par->y_offset = (yoffset*xvir + xoffset)*2;
- break;
- case 32: // rgb888
- if(var->transp.length) //we need ditinguish ARGB888 and RGB888
- par->format = ARGB888; //in some register,they have different configration
- else
- par->format = RGB888;
- fix->line_length = 4 * xvir;
- par->y_offset = (yoffset*xvir + xoffset)*4;
- break;
- default:
- return -EINVAL;
- }
- break;
- case 1: // yuv422
- par->format = YUV422;
- fix->line_length = xvir;
- cblen = crlen = (xvir*yvir)>>1;
- par->y_offset = yoffset*xvir + xoffset;
- par->c_offset = par->y_offset;
- break;
- case 2: // YUV420
- par->format = YUV420;
- fix->line_length = xvir;
- cblen = crlen = (xvir*yvir)>>2;
- par->y_offset = yoffset*xvir + xoffset;
- par->c_offset = (yoffset>>1)*xvir + xoffset;
- break;
- case 4: // none
- case 5: // yuv444
- par->format = 5;
- fix->line_length = xvir<<2;
- par->y_offset = yoffset*xvir + xoffset;
- par->c_offset = yoffset*2*xvir +(xoffset<<1);
- cblen = crlen = (xvir*yvir);
- break;
- default:
+ case HAL_PIXEL_FORMAT_RGBA_8888 : // rgb
+ par->format = ARGB888;
+ fix->line_length = 4 * xvir;
+ par->y_offset = (yoffset*xvir + xoffset)*4;
+ break;
+ case HAL_PIXEL_FORMAT_RGBX_8888:
+ case HAL_PIXEL_FORMAT_RGB_888 :
+ par->format = RGB888;
+ fix->line_length = 4 * xvir;
+ par->y_offset = (yoffset*xvir + xoffset)*4;
+ break;
+ case HAL_PIXEL_FORMAT_RGB_565: //RGB565
+ par->format = RGB565;
+ fix->line_length = 2 * xvir;
+ par->y_offset = (yoffset*xvir + xoffset)*2;
+ break;
+ case HAL_PIXEL_FORMAT_YCbCr_422_SP : // yuv422
+ par->format = YUV422;
+ fix->line_length = xvir;
+ cblen = crlen = (xvir*yvir)>>1;
+ par->y_offset = yoffset*xvir + xoffset;
+ par->c_offset = par->y_offset;
+ break;
+ case HAL_PIXEL_FORMAT_YCrCb_NV12 : // YUV420---uvuvuv
+ par->format = YUV420;
+ fix->line_length = xvir;
+ cblen = crlen = (xvir*yvir)>>2;
+ par->y_offset = yoffset*xvir + xoffset;
+ par->c_offset = (yoffset>>1)*xvir + xoffset;
+ break;
+ case HAL_PIXEL_FORMAT_YCrCb_444 : // yuv444
+ par->format = 5;
+ fix->line_length = xvir<<2;
+ par->y_offset = yoffset*xvir + xoffset;
+ par->c_offset = yoffset*2*xvir +(xoffset<<1);
+ cblen = crlen = (xvir*yvir);
+ break;
+ default:
+ printk("un supported format:0x%x\n",data_format);
return -EINVAL;
}
.green = {5,6,0},
.blue = {0,5,0},
.transp = {0,0,0},
- .nonstd = 0, //win1 format & ypos & xpos (ypos<<20 + xpos<<8 + format)
- .grayscale = 0, //win1 transprent mode & value(mode<<8 + value)
+ .nonstd = HAL_PIXEL_FORMAT_RGB_565, //(ypos<<20+xpos<<8+format) format
+ .grayscale = 0, //(ysize<<20+xsize<<8)
.activate = FB_ACTIVATE_NOW,
.accel_flags = 0,
.vmode = FB_VMODE_NONINTERLACED,
#define OUT_D888_P565 0x22 //
+/**
+ * pixel format definitions,this is copy from android/system/core/include/system/graphics.h
+ */
+
+enum {
+ HAL_PIXEL_FORMAT_RGBA_8888 = 1,
+ HAL_PIXEL_FORMAT_RGBX_8888 = 2,
+ HAL_PIXEL_FORMAT_RGB_888 = 3,
+ HAL_PIXEL_FORMAT_RGB_565 = 4,
+ HAL_PIXEL_FORMAT_BGRA_8888 = 5,
+ HAL_PIXEL_FORMAT_RGBA_5551 = 6,
+ HAL_PIXEL_FORMAT_RGBA_4444 = 7,
+
+ /* 0x8 - 0xFF range unavailable */
+
+ /*
+ * 0x100 - 0x1FF
+ *
+ * This range is reserved for pixel formats that are specific to the HAL
+ * implementation. Implementations can use any value in this range to
+ * communicate video pixel formats between their HAL modules. These formats
+ * must not have an alpha channel. Additionally, an EGLimage created from a
+ * gralloc buffer of one of these formats must be supported for use with the
+ * GL_OES_EGL_image_external OpenGL ES extension.
+ */
+
+ /*
+ * Android YUV format:
+ *
+ * This format is exposed outside of the HAL to software decoders and
+ * applications. EGLImageKHR must support it in conjunction with the
+ * OES_EGL_image_external extension.
+ *
+ * YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
+ * by (W/2) x (H/2) Cr and Cb planes.
+ *
+ * This format assumes
+ * - an even width
+ * - an even height
+ * - a horizontal stride multiple of 16 pixels
+ * - a vertical stride equal to the height
+ *
+ * y_size = stride * height
+ * c_size = ALIGN(stride/2, 16) * height/2
+ * size = y_size + c_size * 2
+ * cr_offset = y_size
+ * cb_offset = y_size + c_size
+ *
+ */
+ HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar
+
+
+
+ /* Legacy formats (deprecated), used by ImageFormat.java */
+ HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16
+ HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21
+ HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2
+ HAL_PIXEL_FORMAT_YCrCb_NV12 = 0x20, // YUY2
+ HAL_PIXEL_FORMAT_YCrCb_NV12_VIDEO = 0x21, // YUY2
+ HAL_PIXEL_FORMAT_YCrCb_444 = 0x22, //yuv444
+
+
+};
+
+
//display data format
enum data_format{
ARGB888 = 0,