display: mesa: eglapi接口:createWindowSurface

接上一篇:display: mesa: eglapi接口:bind/query api_maze的专栏-CSDN博客

eglCreateWindowSurface/eglCreatePlatformWindowSurfaceEXT

EGLSurface EGLAPIENTRY
eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
                       EGLNativeWindowType window, const EGLint *attrib_list)
//返回是的EGLSurface
{
   _EGLDisplay *disp = _eglLockDisplay(dpy);

   return _eglCreateWindowSurfaceCommon(disp, config, (void*) window, attrib_list);
       _EGLConfig *conf = _eglLookupConfig(config, disp);
       _EGLSurface *surf;

       surf = disp->Driver->CreateWindowSurface(disp, conf, native_window, attrib_list);//对应egl_dri2.c :: dri2_create_window_surface
           struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);

           return dri2_dpy->vtbl->create_window_surface(disp, conf, native_window, attrib_list);//对应platform_drm.c :: dri2_drm_create_window_surface
               struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
               struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
               struct dri2_egl_surface *dri2_surf;
               struct gbm_surface *surface = native_surface;
               struct gbm_dri_surface *surf;
               const __DRIconfig *config;
      
               dri2_init_surface(&dri2_surf->base, disp, EGL_WINDOW_BIT, conf, attrib_list, false, native_surface);
                   return _eglInitSurface(surf,disp,type,conf,attrib_list,native_surface);
                       surf->xxx = xxx;(全是这种赋值)
               真正初始化_EGLSurface object surf的地方。

               config = dri2_get_dri_config(dri2_conf, EGL_WINDOW_BIT, dri2_surf->base.GLColorspace);
                   return conf->dri_config[double_buffer][srgb];
               这个函数说明的double buffer的机制。如果是EGL_WINDOW_BIT,就是double buffer。返回的是__DRIconfig指针。

               dri2_drm_config_is_compatible(dri2_dpy, config, surface)
               如其名字,判断对应的config是否能正常。

               surf = gbm_dri_surface(surface);
               dri2_surf->gbm_surf = surf;
               dri2_surf->base.Width =  surf->base.v0.width;
               dri2_surf->base.Height = surf->base.v0.height;
               surf->dri_private = dri2_surf;

               dri2_create_drawable(dri2_dpy, config, dri2_surf, dri2_surf->gbm_surf) //假设接口是dri2_dpy->image_driver,egl_dri2.c
                   createNewDrawable = dri2_dpy->image_driver->createNewDrawable;
                   dri2_surf->dri_drawable = createNewDrawable(dri2_dpy->dri_screen, config, loaderPrivate);
                       driCreateNewDrawable(screen, config, data); //该接口在dri_util.c里面
                           __DRIdrawable *pdraw;
                           pdraw->xxx = xxx;//初始化 pdraw

                           dri_get_drawable(pdraw); //其实就是pdraw->refcount++;
                           
                           screen->driver->CreateBuffer(screen, pdraw, &config->modes. GL_FALSE);//调用的是gallium里面的dri2.c文件的galliumdrm_driver_api,具体位置是mesa/src/gallium/frontends/dri/dri2.c:: CreateBuffer = dri2_create_buffer;
                               struct dri2_drawable *drawable = NULL;
                               dri_create_buffer(sPriv, dPriv, visual, isPixmap);
                               //参看下个函数细节。
                               //参看下个函数细节。
                               //参看下个函数细节。
                               drawable = dPriv->driverPrivate;

                               drawable->allocate_textures = dri2_allocate_textures;
                               drawable->flush_frontbuffer = dri2_flush_frontbuffer;
                               drawable->update_tex_buffer = dri2_update_tex_buffer;
                               drawable->flush_swapbuffers = dri2_flush_swapbuffers;
                           return pdraw;           
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值