glamor: xv: add rgb565
This commit adds RGB565 format to XVideo with reuse of RGBA32 shader Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Yuriy Vasilev <uuvasiliev@yandex.ru>
This commit is contained in:
parent
15412e78c8
commit
c170056111
|
@ -199,6 +199,7 @@ XvImageRec glamor_xv_images[] = {
|
||||||
XVIMAGE_NV12,
|
XVIMAGE_NV12,
|
||||||
XVIMAGE_UYVY,
|
XVIMAGE_UYVY,
|
||||||
XVIMAGE_RGB32,
|
XVIMAGE_RGB32,
|
||||||
|
XVIMAGE_RGB565,
|
||||||
};
|
};
|
||||||
int glamor_xv_num_images = ARRAY_SIZE(glamor_xv_images);
|
int glamor_xv_num_images = ARRAY_SIZE(glamor_xv_images);
|
||||||
|
|
||||||
|
@ -220,6 +221,7 @@ glamor_init_xv_shader(ScreenPtr screen, glamor_port_private *port_priv, int id)
|
||||||
glamor_facet_xv_planar = &glamor_facet_xv_uyvy;
|
glamor_facet_xv_planar = &glamor_facet_xv_uyvy;
|
||||||
break;
|
break;
|
||||||
case FOURCC_RGBA32:
|
case FOURCC_RGBA32:
|
||||||
|
case FOURCC_RGB565:
|
||||||
glamor_facet_xv_planar = &glamor_facet_xv_rgb_raw;
|
glamor_facet_xv_planar = &glamor_facet_xv_rgb_raw;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -250,6 +252,7 @@ glamor_init_xv_shader(ScreenPtr screen, glamor_port_private *port_priv, int id)
|
||||||
break;
|
break;
|
||||||
case FOURCC_UYVY:
|
case FOURCC_UYVY:
|
||||||
case FOURCC_RGBA32:
|
case FOURCC_RGBA32:
|
||||||
|
case FOURCC_RGB565:
|
||||||
sampler_loc = glGetUniformLocation(port_priv->xv_prog.prog, "sampler");
|
sampler_loc = glGetUniformLocation(port_priv->xv_prog.prog, "sampler");
|
||||||
glUniform1i(sampler_loc, 0);
|
glUniform1i(sampler_loc, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -376,6 +379,7 @@ glamor_xv_query_image_attributes(int id,
|
||||||
offsets[0] = 0;
|
offsets[0] = 0;
|
||||||
size *= *h;
|
size *= *h;
|
||||||
break;
|
break;
|
||||||
|
case FOURCC_RGB565:
|
||||||
case FOURCC_UYVY:
|
case FOURCC_UYVY:
|
||||||
/* UYVU is single-plane really, all tranformation is processed inside a shader */
|
/* UYVU is single-plane really, all tranformation is processed inside a shader */
|
||||||
size = *w * 2;
|
size = *w * 2;
|
||||||
|
@ -516,6 +520,7 @@ glamor_xv_render(glamor_port_private *port_priv, int id)
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
break;
|
break;
|
||||||
case FOURCC_RGBA32:
|
case FOURCC_RGBA32:
|
||||||
|
case FOURCC_RGB565:
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[0]->fbo->tex);
|
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[0]->fbo->tex);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
@ -692,6 +697,13 @@ glamor_xv_put_image(glamor_port_private *port_priv,
|
||||||
port_priv->src_pix[1] = NULL;
|
port_priv->src_pix[1] = NULL;
|
||||||
port_priv->src_pix[2] = NULL;
|
port_priv->src_pix[2] = NULL;
|
||||||
break;
|
break;
|
||||||
|
case FOURCC_RGB565:
|
||||||
|
port_priv->src_pix[0] =
|
||||||
|
glamor_create_pixmap(pScreen, width, height, 16,
|
||||||
|
GLAMOR_CREATE_FBO_NO_FBO);
|
||||||
|
port_priv->src_pix[1] = NULL;
|
||||||
|
port_priv->src_pix[2] = NULL;
|
||||||
|
break;
|
||||||
case FOURCC_UYVY:
|
case FOURCC_UYVY:
|
||||||
port_priv->src_pix[0] =
|
port_priv->src_pix[0] =
|
||||||
glamor_create_pixmap(pScreen, width, height, 32,
|
glamor_create_pixmap(pScreen, width, height, 32,
|
||||||
|
@ -775,6 +787,7 @@ glamor_xv_put_image(glamor_port_private *port_priv,
|
||||||
buf + s2offset, srcPitch);
|
buf + s2offset, srcPitch);
|
||||||
break;
|
break;
|
||||||
case FOURCC_UYVY:
|
case FOURCC_UYVY:
|
||||||
|
case FOURCC_RGB565:
|
||||||
srcPitch = width * 2;
|
srcPitch = width * 2;
|
||||||
full_box.x1 = 0;
|
full_box.x1 = 0;
|
||||||
full_box.y1 = 0;
|
full_box.y1 = 0;
|
||||||
|
|
|
@ -195,4 +195,24 @@
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
|
||||||
0 \
|
0 \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FOURCC_RGB565 0x36314752
|
||||||
|
#define XVIMAGE_RGB565 \
|
||||||
|
{ \
|
||||||
|
FOURCC_RGB565, \
|
||||||
|
XvRGB, \
|
||||||
|
LSBFirst, \
|
||||||
|
{'R','G','1','6', \
|
||||||
|
0x00, 0x00, 0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
|
||||||
|
16, \
|
||||||
|
XvPacked, \
|
||||||
|
1, \
|
||||||
|
16, 0xf800, 0x7e0, 0x1f, \
|
||||||
|
0, 0, 0, \
|
||||||
|
0, 0, 0, \
|
||||||
|
0, 0, 0, \
|
||||||
|
{0,0,0,0, \
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
|
||||||
|
0 \
|
||||||
|
}
|
||||||
#endif /* _XF86_FOURCC_H_ */
|
#endif /* _XF86_FOURCC_H_ */
|
||||||
|
|
Loading…
Reference in New Issue