• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 Rockchip Electronics Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <stdio.h>
17 #include <string.h>
18 #include "im2d.h"
19 #include "rga.h"
20 #include "display_log.h"
21 #include "securec.h"
22 #include "display_gfx.h"
23 
24 #define ALIGN_UP(x, a) ((((x) + ((a)-1)) / (a)) * (a))
rkInitGfx()25 int32_t rkInitGfx()
26 {
27     DISPLAY_LOGE("%s\n", querystring(RGA_ALL));
28     return DISPLAY_SUCCESS;
29 }
30 
rkDeinitGfx()31 int32_t rkDeinitGfx()
32 {
33     return DISPLAY_SUCCESS;
34 }
35 
colorSpaceModeChange(PixelFormat color,uint8_t * isYuv)36 RgaSURF_FORMAT colorSpaceModeChange(PixelFormat color, uint8_t *isYuv)
37 {
38     RgaSURF_FORMAT rkFormat;
39     switch (color) {
40         case PIXEL_FMT_RGB_565:          /**< RGB565 format */
41             rkFormat = RK_FORMAT_RGB_565;
42             *isYuv = 0;
43             break;
44         case PIXEL_FMT_RGBA_4444:        /**< RGBA4444 format */
45             rkFormat = RK_FORMAT_RGBA_4444;
46             *isYuv = 0;
47             break;
48         case PIXEL_FMT_RGBA_5551:        /**< RGBA5551 format */
49             rkFormat = RK_FORMAT_RGBA_5551;
50             *isYuv = 0;
51             break;
52         case PIXEL_FMT_RGBX_8888:        /**< RGBX8888 format */
53             rkFormat = RK_FORMAT_RGBX_8888;
54             *isYuv = 0;
55             break;
56         case PIXEL_FMT_RGBA_8888:        /**< RGBA8888 format */
57             rkFormat = RK_FORMAT_RGBA_8888;
58             *isYuv = 0;
59             break;
60         case PIXEL_FMT_RGB_888:          /**< RGB888 format */
61             rkFormat = RK_FORMAT_RGB_888;
62             *isYuv = 0;
63             break;
64         case PIXEL_FMT_BGR_565:          /**< BGR565 format */
65             rkFormat = RK_FORMAT_BGR_565;
66             *isYuv = 0;
67             break;
68         case PIXEL_FMT_BGRA_4444:        /**< BGRA4444 format */
69             rkFormat = RK_FORMAT_BGRA_4444;
70             *isYuv = 0;
71             break;
72         case PIXEL_FMT_BGRA_5551:        /**< BGRA5551 format */
73             rkFormat = RK_FORMAT_BGRA_5551;
74             *isYuv = 0;
75             break;
76         case PIXEL_FMT_BGRX_8888:        /**< BGRX8888 format */
77             rkFormat = RK_FORMAT_BGRX_8888;
78             *isYuv = 0;
79             break;
80         case PIXEL_FMT_BGRA_8888:        /**< BGRA8888 format */
81             rkFormat = RK_FORMAT_BGRA_8888;
82             *isYuv = 0;
83             break;
84         case PIXEL_FMT_YCBCR_422_SP:     /**< YCBCR422 semi-planar format */
85             rkFormat = RK_FORMAT_YCbCr_420_SP;
86             *isYuv = 1;
87             break;
88         case PIXEL_FMT_YCRCB_422_SP:     /**< YCRCB422 semi-planar format */
89             rkFormat = RK_FORMAT_YCrCb_422_SP;
90             *isYuv = 1;
91             break;
92         case PIXEL_FMT_YCBCR_420_SP:     /**< YCBCR420 semi-planar format */
93             rkFormat = RK_FORMAT_YCbCr_420_SP;
94             *isYuv = 1;
95             break;
96         case PIXEL_FMT_YCRCB_420_SP:     /**< YCRCB420 semi-planar format */
97             rkFormat = RK_FORMAT_YCrCb_420_SP;
98             *isYuv = 1;
99             break;
100         case PIXEL_FMT_YCBCR_422_P:      /**< YCBCR422 planar format */
101             rkFormat = RK_FORMAT_YCbCr_422_P;
102             *isYuv = 1;
103             break;
104         case PIXEL_FMT_YCRCB_422_P:      /**< YCRCB422 planar format */
105             rkFormat = RK_FORMAT_YCrCb_422_P;
106             *isYuv = 1;
107             break;
108         case PIXEL_FMT_YCBCR_420_P:      /**< YCBCR420 planar format */
109             rkFormat = RK_FORMAT_YCbCr_420_P;
110             *isYuv = 1;
111             break;
112         case PIXEL_FMT_YCRCB_420_P:      /**< YCRCB420 planar format */
113             rkFormat = RK_FORMAT_YCrCb_420_P;
114             *isYuv = 1;
115             break;
116         case PIXEL_FMT_YUYV_422_PKG:     /**< YUYV422 packed format */
117             rkFormat = RK_FORMAT_YUYV_422;
118             *isYuv = 1;
119             break;
120         case PIXEL_FMT_UYVY_422_PKG:     /**< UYVY422 packed format */
121             rkFormat = RK_FORMAT_UYVY_422;
122             *isYuv = 1;
123             break;
124         case PIXEL_FMT_YVYU_422_PKG:     /**< YVYU422 packed format */
125             rkFormat = RK_FORMAT_YUYV_422;
126             *isYuv = 1;
127             break;
128         case PIXEL_FMT_VYUY_422_PKG:     /**< VYUY422 packed format */
129             rkFormat = RK_FORMAT_VYUY_422;
130             *isYuv = 1;
131             break;
132         default:
133 //          PIXEL_FMT_CLUT8:        /**< CLUT8 format */
134 //          PIXEL_FMT_CLUT1,            /**< CLUT1 format */
135 //          PIXEL_FMT_CLUT4,            /**< CLUT4 format */
136 //          PIXEL_FMT_RGBA_5658,        /**< RGBA5658 format */
137 //          PIXEL_FMT_RGBX_4444,        /**< RGBX4444 format */
138 //          PIXEL_FMT_RGB_444,          /**< RGB444 format */
139 //          PIXEL_FMT_RGBX_5551,        /**< RGBX5551 format */
140 //          PIXEL_FMT_RGB_555,          /**< RGB555 format */
141 //          PIXEL_FMT_BGRX_4444,        /**< BGRX4444 format */
142 //          PIXEL_FMT_BGRX_5551,        /**< BGRX5551 format */
143 //          PIXEL_FMT_YUV_422_I,        /**< YUV422 interleaved format */
144             rkFormat = RK_FORMAT_UNKNOWN;
145             break;
146     }
147     return rkFormat;
148 }
149 
rkFillRect(ISurface * iSurface,IRect * rect,uint32_t color,GfxOpt * opt)150 int32_t rkFillRect(ISurface *iSurface, IRect *rect, uint32_t color, GfxOpt *opt)
151 {
152     rga_buffer_t dst;
153     im_rect imRect;
154     IM_STATUS ret;
155     uint8_t isYuv;
156 
157     errno_t eok = memset_s((void *)&imRect, sizeof(imRect), 0, sizeof(imRect));
158     if (eok != EOK) {
159         DISPLAY_LOGE("memset_s failed");
160         return false;
161     }
162     imRect.x = rect->x;
163     imRect.y = rect->y;
164     imRect.width = rect->w;
165     imRect.height = rect->h;
166 
167     eok = memset_s((void *)&dst, sizeof(dst), 0, sizeof(dst));
168     if (eok != EOK) {
169         DISPLAY_LOGE("memset_s failed");
170         return false;
171     }
172     dst.phy_addr = 0; // (void*)iSurface->phyAddr;
173     dst.vir_addr = 0; // iSurface->virAddr;
174     dst.fd = (int32_t)iSurface->phyAddr;
175     if (dst.fd == 0) {
176         DISPLAY_LOGE("source fd is invalid");
177         return DISPLAY_PARAM_ERR;
178     }
179     DISPLAY_LOGD("fd %{public}d", dst.fd);
180     dst.width = iSurface->width;
181     dst.height = iSurface->height;
182     dst.wstride = ALIGN_UP(iSurface->width, 16);
183     dst.hstride = ALIGN_UP(iSurface->height, 2);
184     dst.format = colorSpaceModeChange(iSurface->enColorFmt, &isYuv);
185     dst.color_space_mode = IM_COLOR_SPACE_DEFAULT;
186     dst.color = color;
187     if (opt->enGlobalAlpha)
188         dst.global_alpha = opt->globalAlpha;
189     ret = imfill(dst, imRect, color);
190     if (ret != IM_STATUS_SUCCESS)
191         return DISPLAY_FAILURE;
192     else
193         return DISPLAY_SUCCESS;
194 }
195 
blendTypeChange(BlendType blendType)196 int32_t blendTypeChange(BlendType blendType)
197 {
198     int32_t rkBlendType;
199     switch (blendType) {
200         case BLEND_SRC:              /**< SRC blending */
201             rkBlendType = IM_ALPHA_BLEND_SRC;
202             break;
203         case BLEND_DST:              /**< SRC blending */
204             rkBlendType = IM_ALPHA_BLEND_DST;
205             break;
206         case BLEND_SRCOVER:          /**< SRC_OVER blending */
207             rkBlendType = IM_ALPHA_BLEND_SRC_OVER;
208             break;
209         case BLEND_DSTOVER:          /**< DST_OVER blending */
210             rkBlendType = IM_ALPHA_BLEND_DST_OVER;
211             break;
212         default:
213             /* Fix up later */
214 //        BLEND_NONE         /**< No blending */
215 //        BLEND_CLEAR:            /**< CLEAR blending */
216 //        BLEND_SRCIN:            /**< SRC_IN blending */
217 //        BLEND_DSTIN:            /**< DST_IN blending */
218 //        BLEND_SRCOUT:           /**< SRC_OUT blending */
219 //        BLEND_DSTOUT:           /**< DST_OUT blending */
220 //        BLEND_SRCATOP:          /**< SRC_ATOP blending */
221 //        BLEND_DSTATOP:          /**< DST_ATOP blending */
222 //        BLEND_ADD:              /**< ADD blending */
223 //        BLEND_XOR:              /**< XOR blending */
224 //        BLEND_DST:              /**< DST blending */
225 //        BLEND_AKS:              /**< AKS blending */
226 //        BLEND_AKD:              /**< AKD blending */
227 //        BLEND_BUTT:              /**< Null operation */
228             rkBlendType = IM_STATUS_NOT_SUPPORTED;
229             break;
230     }
231     return rkBlendType;
232 }
233 
TransformTypeChange(TransformType type)234 int32_t TransformTypeChange(TransformType type)
235 {
236     int32_t rkTransformType;
237     switch (type) {
238         case ROTATE_90:            /**< Rotation by 90 degrees */
239             rkTransformType = IM_HAL_TRANSFORM_ROT_90;
240             break;
241         case ROTATE_180:           /**< Rotation by 180 degrees */
242             rkTransformType = IM_HAL_TRANSFORM_ROT_180;
243             break;
244         case ROTATE_270:           /**< Rotation by 270 degrees */
245             rkTransformType = IM_HAL_TRANSFORM_ROT_270;
246             break;
247         case MIRROR_H:             /**< Mirror transform horizontally */
248             rkTransformType = IM_HAL_TRANSFORM_FLIP_H;
249             break;
250         case MIRROR_V:             /**< Mirror transform vertically */
251             rkTransformType = IM_HAL_TRANSFORM_FLIP_V;
252             break;
253         case MIRROR_H_ROTATE_90:   /**< Mirror transform horizontally, rotation by 90 degrees */
254             rkTransformType = IM_HAL_TRANSFORM_ROT_90 | IM_HAL_TRANSFORM_FLIP_V;
255             break;
256         case MIRROR_V_ROTATE_90:   /**< Mirror transform vertically, rotation by 90 degrees */
257             rkTransformType = IM_HAL_TRANSFORM_ROT_90 | IM_HAL_TRANSFORM_FLIP_H;
258             break;
259         default:
260             rkTransformType = 0;   /**< No rotation */
261             break;
262     }
263     return rkTransformType;
264 }
265 
doFlit(ISurface * srcSurface,IRect * srcRect,ISurface * dstSurface,IRect * dstRect,GfxOpt * opt)266 int32_t doFlit(ISurface *srcSurface, IRect *srcRect, ISurface *dstSurface, IRect *dstRect, GfxOpt *opt)
267 {
268     int32_t usage = 0;
269     uint8_t isYuv = 0;
270     rga_buffer_t dstRgaBuffer, srcRgaBuffer, bRgbBuffer;
271     IM_STATUS ret = 0;
272     im_rect srect;
273     im_rect drect;
274     im_rect prect;
275     int32_t rkBlendType = 0;
276     int32_t rkTransformType = 0;
277 
278     errno_t eok = memset_s(&dstRgaBuffer, sizeof(dstRgaBuffer), 0, sizeof(dstRgaBuffer));
279     if (eok != EOK) {
280         DISPLAY_LOGE("memset_s failed");
281         return false;
282     }
283     eok = memset_s(&srcRgaBuffer, sizeof(srcRgaBuffer), 0, sizeof(srcRgaBuffer));
284     if (eok != EOK) {
285         DISPLAY_LOGE("memset_s failed");
286         return false;
287     }
288     eok = memset_s(&bRgbBuffer, sizeof(bRgbBuffer), 0, sizeof(bRgbBuffer));
289     if (eok != EOK) {
290         DISPLAY_LOGE("memset_s failed");
291         return false;
292     }
293     eok = memset_s(&srect, sizeof(srect), 0, sizeof(srect));
294     if (eok != EOK) {
295         DISPLAY_LOGE("memset_s failed");
296         return false;
297     }
298     eok = memset_s(&drect, sizeof(drect), 0, sizeof(drect));
299     if (eok != EOK) {
300         DISPLAY_LOGE("memset_s failed");
301         return false;
302     }
303     eok = memset_s(&prect, sizeof(prect), 0, sizeof(prect));
304     if (eok != EOK) {
305         DISPLAY_LOGE("memset_s failed");
306         return false;
307     }
308     if (opt->enGlobalAlpha) {
309         dstRgaBuffer.global_alpha = opt->globalAlpha;
310         srcRgaBuffer.global_alpha = opt->globalAlpha;
311     }
312     dstRgaBuffer.width = dstSurface->width;
313     dstRgaBuffer.height = dstSurface->height;
314     dstRgaBuffer.wstride = ALIGN_UP(dstSurface->width, 16);
315     dstRgaBuffer.hstride = ALIGN_UP(dstSurface->height, 2);
316     dstRgaBuffer.format = colorSpaceModeChange(dstSurface->enColorFmt, &isYuv);
317     dstRgaBuffer.phy_addr = 0; // (void *)dstSurface->phyAddr;
318     dstRgaBuffer.vir_addr = 0; // dstSurface->virAddr;
319     dstRgaBuffer.color_space_mode = IM_COLOR_SPACE_DEFAULT;
320     dstRgaBuffer.fd = (int32_t)dstSurface->phyAddr;
321     if (isYuv == 1) {
322         DISPLAY_LOGE("rk gfx do not support dst buffer is yuv format");
323         return DISPLAY_PARAM_ERR;
324     }
325 
326     srcRgaBuffer.width = srcSurface->width;
327     srcRgaBuffer.height = srcSurface->height;
328     srcRgaBuffer.wstride = ALIGN_UP(srcSurface->width, 16);
329     srcRgaBuffer.hstride = ALIGN_UP(srcSurface->height, 2);
330     srcRgaBuffer.phy_addr = 0; // (void *)srcSurface->phyAddr;
331     srcRgaBuffer.vir_addr = 0; // srcSurface->virAddr;
332     srcRgaBuffer.format = colorSpaceModeChange(srcSurface->enColorFmt, &isYuv);
333     srcRgaBuffer.color_space_mode = IM_COLOR_SPACE_DEFAULT;
334     srcRgaBuffer.fd = (int32_t)srcSurface->phyAddr;
335 
336     if (srcRgaBuffer.fd == 0) {
337         DISPLAY_LOGE("source fd is invalid");
338         return DISPLAY_PARAM_ERR;
339     }
340 
341     DISPLAY_LOGD("gfx src fd %{public}d, w %{public}d, h %{publuc}d, sw %{public}d sh %{public}d",
342         (int32_t)srcSurface->phyAddr, srcSurface->width, srcSurface->height, ALIGN_UP(srcSurface->width, 16),
343         ALIGN_UP(srcSurface->height, 2));
344     DISPLAY_LOGD("gfx dst fd %{public}d, w %{public}d, h %{public}d, sw %{public}d sh %{public}d",
345         (int32_t)dstSurface->phyAddr, dstSurface->width, dstSurface->height, ALIGN_UP(dstSurface->width, 16),
346         ALIGN_UP(dstSurface->height, 2));
347 
348     srect.x = srcRect->x;
349     srect.x = (srect.x % 2 == 1) ? (srect.x - 1) : srect.x; // 2: Is it odd?
350     srect.y = srcRect->y;
351     srect.y = (srect.y % 2 == 1) ? (srect.y - 1) : srect.y; // 2: Is it odd?
352     srect.height = srcRect->h;
353     srect.height = (srect.height % 2 == 1) ? (srect.height + 1) : srect.height; // 2: Is it odd?
354     srect.width = srcRect->w;
355     srect.width = (srect.width % 2 == 1) ? (srect.width + 1) : srect.width; // 2: Is it odd?
356     drect.x = dstRect->x;
357     drect.x = (drect.x % 2 == 1) ? (drect.x - 1) : drect.x; // 2: Is it odd?
358     drect.y = dstRect->y;
359     drect.y = (drect.y % 2 == 1) ? (drect.y - 1) : drect.y; // 2: Is it odd?
360     drect.height = dstRect->h;
361     drect.height = (drect.height % 2 == 1) ? (drect.height + 1) : drect.height; // 2: Is it odd?
362     drect.width = dstRect->w;
363     drect.width = (drect.width % 2 == 1) ? (drect.width + 1) : drect.width; // 2: Is it odd?
364 
365     if (opt->blendType) {
366         rkBlendType = blendTypeChange(opt->blendType);
367         if (rkBlendType > 0) {
368             usage |= rkBlendType;
369         } else if (rkBlendType == IM_STATUS_NOT_SUPPORTED) {
370             return DISPLAY_NOT_SUPPORT;
371         }
372     }
373     if (opt->rotateType) {
374         rkTransformType = TransformTypeChange(opt->rotateType);
375         if (rkTransformType != 0)
376             usage |= rkTransformType;
377     }
378     if (opt->enableScale) {
379         DISPLAY_LOGE("gfx scale from (%{puhblic}d, %{public}d) to (%{public}d, %{public}d)", \
380             srcRgaBuffer.width, srcRgaBuffer.height, dstRgaBuffer.width, dstRgaBuffer.height);
381     }
382     usage |= IM_SYNC;
383     if (isYuv == 1) {
384         if (rkBlendType == IM_ALPHA_BLEND_SRC_OVER || rkBlendType == IM_ALPHA_BLEND_SRC) {
385             usage = 0;
386             if (opt->enableScale == 0) {
387                 eok = memset_s(&srect, sizeof(srect), 0, sizeof(srect));
388                 if (eok != EOK) {
389                     DISPLAY_LOGE("memset_s failed");
390                     return false;
391                 }
392                 srect.width = srcRgaBuffer.width;
393                 srect.height = srcRgaBuffer.height;
394 
395                 eok = memset_s(&drect, sizeof(drect), 0, sizeof(drect));
396                 if (eok != EOK) {
397                     DISPLAY_LOGE("memset_s failed");
398                     return false;
399                 }
400                 drect.x = dstRgaBuffer.width - srcRgaBuffer.width;
401                 drect.y = dstRgaBuffer.height - srcRgaBuffer.height;
402                 drect.width = srcRgaBuffer.width;
403                 drect.height = srcRgaBuffer.height;
404             }
405             srcRgaBuffer.wstride = srcSurface->stride;
406             usage = rkTransformType | IM_SYNC;
407             ret = improcess(srcRgaBuffer, dstRgaBuffer, bRgbBuffer, srect, drect, prect, usage);
408             if (ret != IM_STATUS_SUCCESS) {
409                 DISPLAY_LOGE("gfx improcess %{public}s", imStrError(ret));
410             }
411         } else if (rkBlendType == IM_ALPHA_BLEND_DST_OVER) {
412             bRgbBuffer.width = dstRgaBuffer.width;
413             bRgbBuffer.height = dstRgaBuffer.height;
414             bRgbBuffer.wstride = dstRgaBuffer.wstride;
415             bRgbBuffer.hstride = dstRgaBuffer.hstride;
416             bRgbBuffer.format = RK_FORMAT_RGBA_8888; // srcRgaBuffer.format;
417             bRgbBuffer.phy_addr = 0; // (void *) buffer->phyAddr;
418             bRgbBuffer.vir_addr = 0; // buffer->virAddr;
419             bRgbBuffer.color_space_mode = dstRgaBuffer.color_space_mode;
420             bRgbBuffer.fd = -1;
421             int ret = memcpy_s(&prect, sizeof(drect), &drect, sizeof(drect));
422             if (!ret) {
423                 printf("memcpy_s failed!\n");
424             }
425             ret = improcess(srcRgaBuffer, bRgbBuffer, dstRgaBuffer, srect, prect, drect, usage);
426             if (ret != IM_STATUS_SUCCESS) {
427                 DISPLAY_LOGE("gfx improcess %{public}s", imStrError(ret));
428             } else {
429                 ret = imcopy(bRgbBuffer, dstRgaBuffer);
430                 if (ret != IM_STATUS_SUCCESS) {
431                     DISPLAY_LOGE("gfx improcess %{public}s", imStrError(ret));
432                 }
433             }
434         }
435     } else {
436         ret = improcess(srcRgaBuffer, dstRgaBuffer, bRgbBuffer, srect, drect, prect, usage);
437         if (ret != IM_STATUS_SUCCESS) {
438             DISPLAY_LOGE("gfx improcess %{public}s", imStrError(ret));
439         }
440     }
441     if (ret != IM_STATUS_SUCCESS)
442         return DISPLAY_FAILURE;
443     else
444         return DISPLAY_SUCCESS;
445 }
446 
rkBlit(ISurface * srcSurface,IRect * srcRect,ISurface * dstSurface,IRect * dstRect,GfxOpt * opt)447 int32_t rkBlit(ISurface *srcSurface, IRect *srcRect, ISurface *dstSurface, IRect *dstRect, GfxOpt *opt)
448 {
449     CHECK_NULLPOINTER_RETURN_VALUE(srcSurface, DISPLAY_NULL_PTR);
450     CHECK_NULLPOINTER_RETURN_VALUE(srcRect, DISPLAY_NULL_PTR);
451     CHECK_NULLPOINTER_RETURN_VALUE(dstSurface, DISPLAY_NULL_PTR);
452     CHECK_NULLPOINTER_RETURN_VALUE(dstRect, DISPLAY_NULL_PTR);
453     CHECK_NULLPOINTER_RETURN_VALUE(opt, DISPLAY_NULL_PTR);
454 
455     if (doFlit(srcSurface, srcRect, dstSurface, dstRect, opt) < 0)
456         return DISPLAY_FAILURE;
457     else
458         return DISPLAY_SUCCESS;
459 }
460 
rkSync(int32_t timeOut)461 int32_t rkSync(int32_t timeOut)
462 {
463     return DISPLAY_SUCCESS;
464 }
465 
GfxInitialize(GfxFuncs ** funcs)466 int32_t GfxInitialize(GfxFuncs **funcs)
467 {
468     DISPLAY_CHK_RETURN((funcs == NULL), DISPLAY_PARAM_ERR, DISPLAY_LOGE("info is null"));
469     GfxFuncs *gfxFuncs = (GfxFuncs *)malloc(sizeof(GfxFuncs));
470     DISPLAY_CHK_RETURN((gfxFuncs == NULL), DISPLAY_NULL_PTR, DISPLAY_LOGE("gfxFuncs is nullptr"));
471     errno_t eok = memset_s((void *)gfxFuncs, sizeof(GfxFuncs), 0, sizeof(GfxFuncs));
472     if (eok != EOK) {
473         DISPLAY_LOGE("memset_s failed");
474         free(gfxFuncs);
475         return DISPLAY_FAILURE;
476     }
477     gfxFuncs->InitGfx = rkInitGfx;
478     gfxFuncs->DeinitGfx = rkDeinitGfx;
479     gfxFuncs->FillRect = rkFillRect;
480     gfxFuncs->Blit = rkBlit;
481     gfxFuncs->Sync = rkSync;
482     *funcs = gfxFuncs;
483 
484     return DISPLAY_SUCCESS;
485 }
486 
GfxUninitialize(GfxFuncs * funcs)487 int32_t GfxUninitialize(GfxFuncs *funcs)
488 {
489     CHECK_NULLPOINTER_RETURN_VALUE(funcs, DISPLAY_NULL_PTR);
490     free(funcs);
491     DISPLAY_LOGD("%s: gfx uninitialize success", __func__);
492     return DISPLAY_SUCCESS;
493 }
494