2 *-----------------------------------------------------------------------------
5 *-----------------------------------------------------------------------------
6 * Copyright (c) 2002-2010, Intel Corporation.
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 *-----------------------------------------------------------------------------
29 *-----------------------------------------------------------------------------
44 #include <plb/context.h>
46 #include "../cmn/dsp_dispatch.h"
50 extern igd_framebuffer_info_t fb_info_cmn[];
53 * NOTE: Some of these format lists are shared with GMM. For this reason
54 * they cannot be static.
56 unsigned long fb_pixel_formats_plb[] = {
60 IGD_PF_ARGB32_2101010,
66 unsigned long vga_pixel_formats_plb[] = {
72 unsigned long sprite_pixel_formats_plb[] = {
75 IGD_PF_ARGB32_2101010,
78 IGD_PF_YUV422_PACKED_YUY2,
79 IGD_PF_YUV422_PACKED_UYVY,
83 unsigned long render_pixel_formats_plb[] = {
86 IGD_PF_ARGB32_2101010,
91 IGD_PF_YUV422_PACKED_YUY2,
92 IGD_PF_YUV422_PACKED_UYVY,
96 IGD_PF_ABGR64_16161616F,
97 IGD_PF_YUV420_PLANAR_NV12,
98 IGD_PF_YUV410_PLANAR_YVU9,
102 unsigned long texture_pixel_formats_plb[] = {
111 IGD_PF_ARGB8_INDEXED,
112 IGD_PF_YUV422_PACKED_YUY2,
113 IGD_PF_YUV422_PACKED_UYVY,
114 IGD_PF_YUV420_PLANAR_I420,
115 IGD_PF_YUV420_PLANAR_IYUV,
116 IGD_PF_YUV420_PLANAR_YV12,
117 IGD_PF_YUV410_PLANAR_YVU9,
118 IGD_PF_YUV420_PLANAR_NV12,
132 IGD_PF_ARGB32_2101010,
133 IGD_PF_AWVU32_2101010,
140 IGD_PF_ABGR64_16161616F,
144 unsigned long depth_pixel_formats_plb[] = {
152 unsigned long cursor_pixel_formats_plb[] = {
160 unsigned long overlay_pixel_formats_plb[] = {
161 IGD_PF_YUV422_PACKED_YUY2,
162 IGD_PF_YUV422_PACKED_UYVY,
163 IGD_PF_YUV420_PLANAR_I420,
164 IGD_PF_YUV420_PLANAR_IYUV,
165 IGD_PF_YUV420_PLANAR_YV12,
166 IGD_PF_YUV420_PLANAR_NV12,
167 IGD_PF_YUV410_PLANAR_YVU9,
171 unsigned long video_pixel_formats_plb[] = {
172 IGD_PF_YUV420_PLANAR_NV12,
176 unsigned long blt_pixel_formats_plb[] = {
185 IGD_PF_ARGB8_INDEXED,
186 IGD_PF_YUV422_PACKED_YUY2,
187 IGD_PF_YUV422_PACKED_UYVY,
188 IGD_PF_YUV420_PLANAR_I420,
189 IGD_PF_YUV420_PLANAR_IYUV,
190 IGD_PF_YUV420_PLANAR_YV12,
191 IGD_PF_YUV420_PLANAR_NV12,
192 IGD_PF_YUV410_PLANAR_YVU9,
212 IGD_PF_ARGB32_2101010,
213 IGD_PF_AWVU32_2101010,
220 IGD_PF_ABGR64_16161616F,
224 static igd_fb_caps_t caps_table_plb[] = {
225 {IGD_PF_ARGB32, IGD_CAP_FULL_2D | IGD_CAP_BLEND},
226 {IGD_PF_xRGB32, IGD_CAP_FULL_2D | IGD_CAP_BLEND},
227 {IGD_PF_ABGR32, IGD_CAP_FULL_2D | IGD_CAP_BLEND},
228 {IGD_PF_xBGR32, IGD_CAP_FULL_2D | IGD_CAP_BLEND},
229 {IGD_PF_ARGB32_2101010, IGD_CAP_FULL_2D | IGD_CAP_BLEND},
230 {IGD_PF_RGB16_565, IGD_CAP_FULL_2D | IGD_CAP_BLEND},
231 {IGD_PF_ARGB8_INDEXED, IGD_CAP_FULL_2D},
238 * Plane Definitions for PLB family.
240 static igd_plane_t planea_plb = {
241 DSPACNTR, IGD_PLANE_DISPLAY | IGD_PLANE_DIH, 0, 0,
242 fb_pixel_formats_plb, &fb_info_cmn[0], NULL
245 static igd_plane_t planeb_plb = {
246 DSPBCNTR, IGD_PLANE_DISPLAY | IGD_PLANE_SPRITE | IGD_PLANE_DIH, 0, 0,
247 fb_pixel_formats_plb, &fb_info_cmn[1], NULL
250 static igd_plane_t planec_plb = {
251 DSPCCNTR, IGD_PLANE_SPRITE, 0, 0,
252 OPT_MICRO_VALUE(sprite_pixel_formats_plb, NULL), NULL, NULL
255 static igd_plane_t plane_vga_plb = {
256 VGACNTRL, IGD_PLANE_VGA, 0, 0,
257 vga_pixel_formats_plb, NULL, NULL
260 static igd_plane_t plane_overlay_plb = {
261 OVADD, IGD_PLANE_OVERLAY, 0, 0,
262 OPT_MICRO_VALUE(overlay_pixel_formats_plb, NULL), NULL, NULL
265 static igd_plane_t plane_cursora_plb = {
266 CUR_A_CNTR, IGD_PLANE_CURSOR|IGD_CURSOR_USE_PIPEA|IGD_CURSOR_USE_PIPEB, 0,0,
267 OPT_MICRO_VALUE(cursor_pixel_formats_plb, NULL), NULL, NULL
270 static igd_plane_t plane_cursorb_plb = {
271 CUR_B_CNTR, IGD_PLANE_CURSOR|IGD_CURSOR_USE_PIPEA|IGD_CURSOR_USE_PIPEB, 0,0,
272 OPT_MICRO_VALUE(cursor_pixel_formats_plb, NULL), NULL, NULL
276 * Plane lists for PLB family members.
278 /* Two Main Plane, One Sprite, One VGA, One Overlay, Two Cursor */
279 static igd_plane_t *plane_table_plb[] = {
290 static igd_clock_t clock_a_plb = {
294 static igd_clock_t clock_b_plb = {
299 * Pipe definitions for PLB family.
301 static igd_display_pipe_t pipea_plb = {
302 0, PIPEA_CONF, PIPEA_TIMINGS, DPALETTE_A, &clock_a_plb,
303 (IGD_PIPE_IS_PIPEA | IGD_PORT_SHARE_DIGITAL),
304 0, 0,{NULL, NULL, NULL}, NULL, NULL, NULL,
308 static igd_display_pipe_t pipeb_plb = {
309 1, PIPEB_CONF, PIPEB_TIMINGS, DPALETTE_B, &clock_b_plb,
310 (IGD_PIPE_IS_PIPEB | IGD_PORT_SHARE_LVDS),
311 0, 0,{NULL, NULL, NULL}, NULL, NULL, NULL,
315 static igd_display_pipe_t *pipe_table_plb[] = {
322 * Port definitions for PLB family.
326 * Port number: Port number is 1-number of available ports on any hardware.
327 * Here are the definitions:
335 * 4 - Internal LVDS port
338 * Note: Port number should match with port numbers in port parameters.
339 * See igd_init.h for more information.
344 * These are the port attributes that the PLB core support.
345 * Note that currently it only contains color correction attributes.
346 * Eventually, this will include all the attributes.
348 igd_attr_t port_attrib_plb[IGD_MAX_PORTS][5] = {
349 { /* Config for port 1: Integrated TV Encoder (Alviso only) */
353 "Frame Buffer Gamma",
354 PD_ATTR_FLAG_PD_INVISIBLE,
355 0x202020, /* default */
356 0x202020, /* current */
357 0x131313, /* Min: ~0.6 in 3i.5f format for R-G-B*/
358 0xC0C0C0, /* Max: 6 in 3i.5f format for R-G-B */
361 PD_ATTR_ID_FB_BRIGHTNESS,
363 "Frame Buffer Brightness",
364 PD_ATTR_FLAG_PD_INVISIBLE,
371 PD_ATTR_ID_FB_CONTRAST,
373 "Frame Buffer Contrast",
374 PD_ATTR_FLAG_PD_INVISIBLE,
381 PD_ATTR_ID_EXTENSION,
384 PD_ATTR_FLAG_PD_INVISIBLE|PD_ATTR_FLAG_USER_INVISIBLE,
401 { /* Config for port 2: DVO B */
405 "Frame Buffer Gamma",
406 PD_ATTR_FLAG_PD_INVISIBLE,
407 0x202020, /* default */
408 0x202020, /* current */
409 0x131313, /* Min: ~0.6 in 3i.5f format for R-G-B*/
410 0xC0C0C0, /* Max: 6 in 3i.5f format for R-G-B */
413 PD_ATTR_ID_FB_BRIGHTNESS,
415 "Frame Buffer Brightness",
416 PD_ATTR_FLAG_PD_INVISIBLE,
423 PD_ATTR_ID_FB_CONTRAST,
425 "Frame Buffer Contrast",
426 PD_ATTR_FLAG_PD_INVISIBLE,
433 PD_ATTR_ID_EXTENSION,
436 PD_ATTR_FLAG_PD_INVISIBLE|PD_ATTR_FLAG_USER_INVISIBLE,
453 { /* Config for port 3: DVO C */
457 "Frame Buffer Gamma",
458 PD_ATTR_FLAG_PD_INVISIBLE,
459 0x202020, /* default */
460 0x202020, /* current */
461 0x131313, /* Min: ~0.6 in 3i.5f format for R-G-B*/
462 0xC0C0C0, /* Max: 6 in 3i.5f format for R-G-B */
465 PD_ATTR_ID_FB_BRIGHTNESS,
467 "Frame Buffer Brightness",
468 PD_ATTR_FLAG_PD_INVISIBLE,
475 PD_ATTR_ID_FB_CONTRAST,
477 "Frame Buffer Contrast",
478 PD_ATTR_FLAG_PD_INVISIBLE,
485 PD_ATTR_ID_EXTENSION,
488 PD_ATTR_FLAG_PD_INVISIBLE|PD_ATTR_FLAG_USER_INVISIBLE,
505 { /* Config for port 4: LVDS */
509 "Frame Buffer Gamma",
510 PD_ATTR_FLAG_PD_INVISIBLE,
511 0x202020, /* default */
512 0x202020, /* current */
513 0x131313, /* Min: ~0.6 in 3i.5f format for R-G-B*/
514 0xC0C0C0, /* Max: 6 in 3i.5f format for R-G-B */
517 PD_ATTR_ID_FB_BRIGHTNESS,
519 "Frame Buffer Brightness",
520 PD_ATTR_FLAG_PD_INVISIBLE,
527 PD_ATTR_ID_FB_CONTRAST,
529 "Frame Buffer Contrast",
530 PD_ATTR_FLAG_PD_INVISIBLE,
537 PD_ATTR_ID_EXTENSION,
540 PD_ATTR_FLAG_PD_INVISIBLE|PD_ATTR_FLAG_USER_INVISIBLE,
557 { /* Config for port 5: ANALOG */
561 "Frame Buffer Gamma",
562 PD_ATTR_FLAG_PD_INVISIBLE,
563 0x202020, /* default */
564 0x202020, /* current */
565 0x131313, /* Min: ~0.6 in 3i.5f format for R-G-B*/
566 0xC0C0C0, /* Max: 6 in 3i.5f format for R-G-B */
569 PD_ATTR_ID_FB_BRIGHTNESS,
571 "Frame Buffer Brightness",
572 PD_ATTR_FLAG_PD_INVISIBLE,
579 PD_ATTR_ID_FB_CONTRAST,
581 "Frame Buffer Contrast",
582 PD_ATTR_FLAG_PD_INVISIBLE,
589 PD_ATTR_ID_EXTENSION,
592 PD_ATTR_FLAG_PD_INVISIBLE|PD_ATTR_FLAG_USER_INVISIBLE,
613 igd_display_port_t dvob_port_plb = {
614 IGD_PORT_DIGITAL, 2, "SDVO B", 0x61140, GMBUS_DVO_REG, 0,
615 GMBUS_DVOB_DDC, 0xA0,
616 (IGD_PORT_USE_PIPEA | IGD_VGA_COMPRESS | IGD_RGBA_COLOR |
618 TVCLKINBC, 0, IGD_POWERSTATE_D0, IGD_POWERSTATE_D0,
620 NULL, NULL, NULL, 0, NULL, 0,
621 DDC_DEFAULT_SPEED, NULL, NULL, NULL, NULL, 0, NULL, 0, 0,
622 IGD_POWERSTATE_UNDEFINED,
623 port_attrib_plb[2 - 1], /* Port Number - 1 */
625 (BIT14 | BIT16 | BIT17),
630 static igd_display_port_t lvds_port_plb = {
631 IGD_PORT_LVDS, 4, "IntLVDS", 0x61180, 0, 0,
632 GMBUS_INT_LVDS_DDC, 0xA0,
633 (IGD_PORT_USE_PIPEB | IGD_VGA_COMPRESS),
634 DREFCLK, 0, IGD_POWERSTATE_D0, IGD_POWERSTATE_D0, NULL, NULL,
635 NULL, NULL, NULL, 0, NULL, 0,
636 DDC_DEFAULT_SPEED, NULL, NULL, NULL, NULL, 0, NULL, 0, 0,
637 IGD_POWERSTATE_UNDEFINED,
638 port_attrib_plb[4 - 1], /* Port Number - 1 */
639 0, { NULL }, 0, 0, 0,
642 static igd_display_port_t *port_table_plb[] = {
648 static int dsp_init_plb(igd_context_t *context)
653 void dsp_control_plane_format_plb(igd_context_t *context,
654 int enable, int plane, igd_plane_t *plane_override)
656 igd_plane_t * pl = NULL;
657 unsigned char *mmio = EMGD_MMIO(context->device_context.virt_mmadr);
660 if (plane_override == NULL) {
661 pl = (plane == 0) ? &planea_plb : &planeb_plb;
665 tmp = EMGD_READ32(mmio + pl->plane_reg);
668 * Pixel format bits (29:26) are in plane control register 0x70180 for
669 * Plane A and 0x71180 for Plane B
670 * 0110 = XRGB pixel format
671 * 0111 = ARGB pixel format
672 * Note that the plane control register is double buffered and will be
673 * updated on the next VBLANK operation so there is no need to sync with
677 if((tmp & DSPxCNTR_SRC_FMT_MASK) == DSPxCNTR_RGB_8888) {
678 EMGD_WRITE32(tmp | DSPxCNTR_ARGB_8888, mmio + pl->plane_reg);
679 tmp = EMGD_READ32(mmio + pl->plane_reg + 4);
680 EMGD_WRITE32(tmp, mmio + pl->plane_reg + 4);
681 EMGD_DEBUG("Changed pixel format from XRGB to ARGB\n");
684 if((tmp & DSPxCNTR_SRC_FMT_MASK) == DSPxCNTR_ARGB_8888) {
685 tmp = tmp & (~(DSPxCNTR_SRC_FMT_MASK));
686 EMGD_WRITE32(tmp | DSPxCNTR_RGB_8888, mmio + pl->plane_reg);
687 tmp = EMGD_READ32(mmio + pl->plane_reg + 4);
688 EMGD_WRITE32(tmp, mmio + pl->plane_reg + 4);
690 EMGD_DEBUG("Changed pixel format from ARGB to XRGB\n");
693 EMGD_DEBUG("Plane register 0x%lX has value of 0x%X\n", pl->plane_reg,
694 EMGD_READ32(mmio + pl->plane_reg));
698 dsp_dispatch_t dsp_dispatch_plb = {
699 plane_table_plb, pipe_table_plb, port_table_plb,
700 OPT_MICRO_VALUE(caps_table_plb, NULL),
701 OPT_MICRO_VALUE(overlay_pixel_formats_plb, NULL),
702 OPT_MICRO_VALUE(render_pixel_formats_plb, NULL),
703 OPT_MICRO_VALUE(texture_pixel_formats_plb, NULL),
705 dsp_control_plane_format_plb,