source: svn/newcon3bcm2_21bu/nexus/modules/graphics2d/7552/src/nexus_graphics2d_impl.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 7.2 KB
Line 
1/***************************************************************************
2 *     (c)2007-2011 Broadcom Corporation
3 *
4 *  This program is the proprietary software of Broadcom Corporation and/or its licensors,
5 *  and may only be used, duplicated, modified or distributed pursuant to the terms and
6 *  conditions of a separate, written license agreement executed between you and Broadcom
7 *  (an "Authorized License").  Except as set forth in an Authorized License, Broadcom grants
8 *  no license (express or implied), right to use, or waiver of any kind with respect to the
9 *  Software, and Broadcom expressly reserves all rights in and to the Software and all
10 *  intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU
11 *  HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY
12 *  NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE.
13 *
14 *  Except as expressly set forth in the Authorized License,
15 *
16 *  1.     This program, including its structure, sequence and organization, constitutes the valuable trade
17 *  secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof,
18 *  and to use this information only in connection with your use of Broadcom integrated circuit products.
19 *
20 *  2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
21 *  AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
22 *  WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
23 *  THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES
24 *  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,
25 *  LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION
26 *  OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF
27 *  USE OR PERFORMANCE OF THE SOFTWARE.
28 *
29 *  3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS
30 *  LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR
31 *  EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR
32 *  USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF
33 *  THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT
34 *  ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
35 *  LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF
36 *  ANY LIMITED REMEDY.
37 *
38 * $brcm_Workfile: nexus_graphics2d_impl.h $
39 * $brcm_Revision: 17 $
40 * $brcm_Date: 12/19/11 10:04a $
41 *
42 * Module Description:
43 *
44 * Revision History:
45 *
46 * $brcm_Log: /nexus/modules/graphics2d/7400/src/nexus_graphics2d_impl.h $
47 *
48 * 17   12/19/11 10:04a erickson
49 * SW7425-1795: allow NULL packet buffer heap. validate driver-side CPU
50 *  accessibility at GetPacketBuffer.
51 *
52 * 16   8/24/11 10:09a erickson
53 * SW7420-1894: add checkpoint watchdog if packetFifoThreshold is non-
54 *  zero. helps debug apps that aren't calling checkpoint.
55 *
56 * 15   5/24/11 4:03p erickson
57 * SW7346-149: support multiplexing of packet and function-based blit by
58 *  using two GRC packet contexts within a single NEXUS_Graphics2D context
59 *
60 * 14   5/24/11 3:13p erickson
61 * SW7420-1200: reduce cpu util on blit
62 *
63 * 13   5/23/11 4:50p erickson
64 * SW7420-1200: refactor grclib for optimal nexus use
65 *
66 * 12   10/28/10 5:48p jtna
67 * SW7405-4810: add checkpoint-based gfx2d power management
68 *
69 * 11   8/16/10 11:08a erickson
70 * SW7405-3671: add packet blit API. switch to packet-based GRC
71 *  implementation.
72 *
73 * 10   6/18/10 4:30p erickson
74 * SW7405-4508: virtualize NEXUS_Graphics2D_Open so that each user can
75 *  have their own blitter and their own checkpoint callback
76 *
77 * 9   8/12/09 1:34p vsilyaev
78 * PR 57629: Moved large structures from stack to permanent memory
79 *  storage, this decreased stack consumption from 514+ to 136 bytes. It
80 *  should also improve cache locality
81 *
82 * 8   8/12/09 12:52p vsilyaev
83 * PR 57629: Cache results of NEXUS_GRCLIB_PENDTYPE
84 *
85 * 7   8/10/09 6:02p vsilyaev
86 * PR 57552: Use tagged tailquee to manage temporary surfaces, traverse
87 *  list only after user called Checkpoint function
88 *
89 * 6   8/10/09 12:57p vsilyaev
90 * PR 57469: Return proper error code when queue is full and try to handle
91 *  condition when BGRC_WaitForOperationsComplete returns out of memory
92 *  error
93 *
94 * 5   6/24/09 1:37p erickson
95 * PR55968: added power management
96 *
97 * 4   5/13/09 9:34a erickson
98 * PR51077: use BGRC_WaitForOperationsComplete instead of dummy blit for
99 *  checkpoint
100 *
101 * 3   3/11/09 9:20a erickson
102 * PR53076: support NEXUS_Graphics2D_DestripeToSurface to an RGB surface
103 *
104 * 2   1/26/09 9:49a erickson
105 * PR51393: add support for async non-GRClib blits including Destripe and
106 *  Memset32
107 *
108 * 1   2/25/08 2:59p erickson
109 * PR39786: added NEXUS_Graphics2D_Destripe
110 *
111 **************************************************************************/
112#include "nexus_graphics2d_module.h"
113#include "nexus_graphics2d_init.h"
114#include "priv/nexus_graphics2d_standby_priv.h"
115#include "priv/nexus_surface_priv.h"
116#include "priv/nexus_core.h"
117
118#include "bgrclib_packet.h"
119#include "bgrc.h"
120#include "bgrc_packet.h"
121#include "blst_squeue.h"
122
123BDBG_OBJECT_ID_DECLARE(NEXUS_Graphics2D);
124
125#define NEXUS_GRAPHICS2D_MAX_CONTEXTS 32
126struct NEXUS_Graphics2DEngine {
127    BGRC_Handle grc;
128    BLST_S_HEAD(NEXUS_Graphics2DEngineContexts, NEXUS_Graphics2D) contexts;
129    BKNI_EventHandle advanceEvent;
130    NEXUS_EventCallbackHandle advanceEventCallback;
131    unsigned allocatedContexts;
132    BGRC_Packet_ContextStatus contextStatus[NEXUS_GRAPHICS2D_MAX_CONTEXTS];
133    bool powerOn;
134};
135
136struct NEXUS_Graphics2D {
137    BDBG_OBJECT(NEXUS_Graphics2D)
138    unsigned index;
139
140    /* magnum */
141    BGRC_Handle grc;
142    BGRClib_Handle grclib;
143    BGRC_PacketContext_Handle functionContext; /* context used for functions */
144    BGRC_PacketContext_Handle packetContext; /* context used for packet blit */
145    BLST_S_ENTRY(NEXUS_Graphics2D) link; /* for NEXUS_Graphics2DEngine.contexts */
146
147    NEXUS_Graphics2DOpenSettings openSettings;
148    NEXUS_Graphics2DSettings settings;
149    NEXUS_TaskCallbackHandle checkpoint;
150    NEXUS_TaskCallbackHandle packetSpaceAvailable;
151    unsigned packetSpaceAvailableCount;
152    unsigned checkpointCount;
153    struct {
154        unsigned counter;
155        NEXUS_TimerHandle timer;
156    } checkpointWatchdog;
157    bool verifyPacketHeap;
158
159    struct {
160        BGRClib_BlitParams blitParams;
161        BGRClib_BlitColorKeyParams colorKeyParams;
162        BGRClib_BlitMatrixParams matrixParams;
163        BGRClib_BlitPatternParams patternParams;
164        BGRClib_BlitScalingControlParams scalingControlParams;
165    } blitData;
166};
167
168typedef enum NEXUS_Graphics2DPowerState {
169    NEXUS_Graphics2DPowerState_ePowerUp, /* power up the HW. */
170    NEXUS_Graphics2DPowerState_eTryPowerDown, /* power down the HW if the last blit has completed. */
171    NEXUS_Graphics2DPowerState_ePowerDown /* there are no more blits bpending. power down the HW. */
172} NEXUS_Graphics2DPowerState;
173
174void NEXUS_Graphics2D_P_SetPower(NEXUS_Graphics2DHandle gfx, NEXUS_Graphics2DPowerState state);
175
176/* used for blit and destripe, so it can't be static */
177extern const int32_t g_NEXUS_ai32_Matrix_YCbCrtoRGB[20];
178
179/* global data. */
180struct Graphics2DData {
181    NEXUS_Graphics2DModuleSettings settings;
182};
183extern struct Graphics2DData g_NEXUS_graphics2DData;
Note: See TracBrowser for help on using the repository browser.