Re: [Mesa-dev] [PATCH v5 00/10] new series of Mesa for Tizen
2017-11-15 19:32 GMT+09:00 Nicolai Hähnle <nhaeh...@gmail.com>: > Not sure if it's just my client, but all the nice ASCII art got messed up > unfortunately :/ > > On 14.11.2017 21:21, Mun, Gwan-gyeong wrote: >> >> >> +--+ >>| [Tizen Window System Architecture] >>| >>| >>| >>| >>| >>| >>| >>| +---+ >> ++ ++ | >>| | Enlightenment Display | | >> | | 3D UI| | >>| | Server for Tizen +-->| >> EvasGL | | Toolkit | | >>| | | | > > > and so on... > > I'm sorry that I shared the broken ascii images. Although when I sent the acsii image, I'd checked it on my text editor. It has been messed. I don't know why my ascii image was broken. therefore I attached a text file of the ascii image which describes Tizen Window System Architecture and a relation between display server and wayland-egl client. > > >> >> * TBM: >> - Tizen Buffer Manager (TBM) provides the abstraction interface for >> the graphic buffer manager >> in Tizen. [1] >> >> - Why does it needed? >> Because different vendors provides different user-level interface >> for the memory manager, >> Tizen made TBM for supporting a common interface. refer [3], page >> 6-8. > > > So it would be possible for the TBM backend to just call into libgbm, right? > Comparing to gbm, tbm backend also calls drm apis directly. this is example for tbm-vc4 backend.[1] For supporting the gbm on tizen, tizen has tbm backend for the gbm. [2] This link requires an account for review.tzein.org. If you don't want to create an account for https://review.tizen.org, you can refer this link [3]. [1] https://github.com/elongbug/libtbm-vc4 [2] https://review.tizen.org/gerrit/gitweb?p=platform/core/uifw/libgbm.git;a=tree;f=backends/tbm;h=1fe83c7ff96840e68176128a2cc341c7858e794a;hb=refs/heads/tizen [3] https://github.com/elongbug/libgbm-tbm > Cheers, > Nicolai > Best regard, Gwan-gyeong. -- Gwan-gyeong Mun +--+ | [Tizen Window System Architecture] | | | | | | | | +---+ ++ ++ | | | Enlightenment Display | || | 3D UI| | | | Server for Tizen +-->| EvasGL | | Toolkit | | | | | || || | | | | +-+--+ +-+--+ | | +--+-+--+ | | | | | |v | | | | | ++ | | | | | | GPU Vendor | | | | | | | GL/EGL |<---+ | | | | | Driver| | | | | +-+--+ | | | || | | v vv | | +---++-
Re: [Mesa-dev] [PATCH v5 00/10] new series of Mesa for Tizen
Hi all, I am sorry that I didn't have enough discussion about why new window system code is needed for Tizen on mesa. This is a brief architecture of Tizen Window System. +--+ | [Tizen Window System Architecture] | | | | | | | | +---+ ++ ++ | | | Enlightenment Display | | | | 3D UI| | | | Server for Tizen +-->| EvasGL | | Toolkit | | | | | | | || | | | | +-+--+ +-+--+ | | +--+-+--+ | | | | | | v | | | | | ++| | | | | | GPU Vendor || | | | | | GL/EGL|<---+ | | | | | Driver| | | | | +-+--+ | | | | | | | v v v | | +---++--+ ++ | | | TDM ||TBM | | | | | |(Tizen Display Manager)+--->|(Tizen Buffer Manager)|<-| TPL-EGL | | | | || | | | | | +---++--+ ++ | | | +--+ < display server / wayland-egl client > +-+ +---+ | | | | | +---+ | | +---+ | | | Enlightenment Display +---+ | | wayland-egl client | | | | Server for Tizen | || | +--+-+--+ | | +--++ || | | | | | | || | | | | | v || | | | | | +---+ || | | | | | | EVAS GL TBM | || | | | | | ++-++ || | | | | | | | || | | | | | | v || | v v | | |+-+ ||+--+ | +-+ +-+ | | || EGL +---|--->| GPU Vendor |<-+ EGL | | wayland-egl | | | |+++ ||| GL Driver | | +--+--+ +---+-+ | | | | ||+--+ | | | ^ | | v v || | v v | | | +-+ +-+ ||+--+ | ++--+ | | | TBM |<--+ TPL-EGL +---|--->| wayland-tbm |<-+TPL-EGL| | | +-+ +-+ ||+--+ | +---+ | | ||^ | | | ||| | | +-+++ +---+ * TBM: - Tizen Buffer Manager (TBM) provides the abstraction interface for the graphic buffer manager in Tizen. [1] - Why does it needed? Because different vendors provides different user-level interface for the memory manager,
Re: [Mesa-dev] [PATCH v2 6/8] egl: add dri2_egl_surface_destroy_image_front() helper (v2)
Hi Gurchetan, 2017-10-18 6:02 GMT+09:00 Gurchetan Singh: > dri2_egl_surface_destroy_image_front and dri2_egl_surface_destroy_image_back > are almost identical. Why don't you just create a > dri2_surface_free_image(struct dri2_egl_surface *dri2_surf, __DRIimage > **img) that you will call with both the front and back images? In addition, As your opinion, we can rafactor more for dri2_surface_free_image. Nevertheless however, I'd suggest keeping that as separate series. these patches started as a way to minimise the duplication we have in drivers/dri2. So that new platforms such as Tizen do not need to copy the lot. [1] > only platform_android has dri_image_back and dri_image_front -- please keep In this patch, dri2_egl_surface_destroy_image_front() helper is only used for android however it will also be used for new platform (Tizen). [2] [1] https://lists.freedesktop.org/archives/mesa-dev/2017-October/173269.html [2] https://lists.freedesktop.org/archives/mesa-dev/2017-October/172007.html Thanks, Gwan-gyeong ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 1/8] egl: add dri2_egl_surface_free_outdated_buffers_and_update_size() helper (v2)
Hi Emil and Gurchetan, Thank you for reviewing the patches. 2017-10-20 6:18 GMT+09:00 Gurchetan Singh: > De-duplicating and then trimming down works for me. > > On Thu, Oct 19, 2017 at 3:31 AM, Emil Velikov > wrote: >> >> On 18 October 2017 at 23:36, Gurchetan Singh >> wrote: >> >> Then again, I'd suggest keeping that as separate series. These patches >> >> started as a way to minimise the duplication we have in drivers/dri2. >> > >> > I'm fine with dri2_$action_$object. We can modify the existing >> > functions >> > later, but I recommend adopting more concise conventions in this >> > patchset, >> > i.e: >> > >> > dri2_egl_surface_record_buffers_and_update_back_buffer --> >> > dri2_set_back_buffer_surface >> > dri2_egl_surface_free_outdated_buffers_and_update_size --> >> > dri2_fixup_surface >> > dri2_egl_surface_update_buffer_age --> dri2_update_age_surface >> > dri2_egl_surface_get_image_front --> dri2_get_front_image_surface >> > >> Sure thing, let's use consistent names with this series. >> It seems great with your suggested helper function names. nevertheless, egl/driver/dri3/ codes also use such as dri2_surface_$action_$object naming conventions. (ie. __DRIdrawable *dri2_surface_get_dri_drawable(_EGLSurface *surf) void dri2_surface_set_out_fence_fd(_EGLSurface *surf, int fence_fd) ) If you are fine with dri2_surface_$action_$object naming convention, I suggest these function prototype. These have dri2_surface_$action_$object naming convention and change type of first argument. (struct dri2_egl_surface => _EGLSurface ) ie. void dri2_egl_surface_record_buffers_and_update_back_buffer(struct dri2_egl_surface *dri2_surf, void *buffer) => void dri2_surface_set_back_buffer(_EGLSurface *surf, void *buffer) void dri2_egl_surface_free_outdated_buffers_and_update_size(struct dri2_egl_surface *dri2_surf, int width, int height) => void dri2_surface_fixup(_EGLSurface *surf, int width, int height) void dri2_egl_surface_update_buffer_age(struct dri2_egl_surface *dri2_surf) => void dri2_surface_update_age(_EGLSurface *surf) int dri2_egl_surface_get_image_front(struct dri2_egl_surface *dri2_surf, unsigned int format) => int dri2_surface_get_front_image(_EGLSurface *surf, unsigned int format) What do you think about this? Thanks, Gwan-gyeong. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 0/9] Introduce supporting of Tizen to mesa's egl platform
Hi, Emil Thank you for reviewing patches in detail. > A couple of high level questions: > - there seems to be no EGL platform extension for Tizen > Pretty much every serious platform has one + most even made it as part > of EGL 1.5* As you mentioned, (as far as I know) for now, Tizen Platform don't have KHR_platform_tizen (a tentative name) extension such as EGL_KHR_platform_android.txt of EGL 1.5*. therefor in my opinion, I can share this issue again after I check the current situation in detail. > > - there is no high level info about Tizen/TBM/etc outside the commit logs. > Tizen is not as popular as Android/X11/Wayland, so we'd want a > separate file (say docs/tizen.html?) that gives a quick overview and > references. > I added tizen.html to new patchset to provide high level info for Tizen. > - the buffer age machinery seems like it could be refactored into nice > helpers > > There's a few small bits here and there, but I'll mention those in the > respective patches. > I fixed them at new patchset ^^. Many thanks Gwan-gyeong. -- Gwan-gyeong Mun ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] genxml: Remove a redundant identical code for different branches
Hi Jason, thanks for your kind explanation. I has totally understood your intention. ( I don't mean to bother you, at first I just wanted to silence of below coverity warning. --- Identical code for different branches (IDENTICAL_BRANCHES) identical_branches: The same code is executed regardless of whether devinfo->is_haswell is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced? --- } Best regards, Gwan-gyeong. 2017-07-27 4:30 GMT+09:00 Jason Ekstrand <ja...@jlekstrand.net>: > On July 25, 2017 8:16:42 PM "Mun, Gwan-gyeong" <elong...@gmail.com> wrote: > >> Hi Jason, >> You are right, as you commented, compilers can eliminate these >> redundancies >> easy. >> However I think we don't need to generate redundant codes. > > > The approach we generally take with generators like this is to not really > care too much what the generated C code looks like at that much so long as > it compiles down to what we want. We are far more concerned with keeping > the generator itself as simple and easy to maintain as possible. If we make > the C compiler do a little more work, that's considered an acceptable loss > so long as the final compiled binary is good. The part of the code which is > maintained by humans is the generator so the ease of maintenance of the > generator is more important than the generated C code. > > This patch makes the generator more complicated just to improve the > generated C even though it compiles to the same binary. As such, this patch > makes the codebase *less* maintainable with no improvement to the generated > binary. This is not something we want to do. > > --Jason > > >> Best regards, >> Gwan-gyeong >> >> 2017년 7월 26일 (수) 오전 12:34, Jason Ekstrand <ja...@jlekstrand.net>님이 작성: >> >>> Does the redundancy ends up mattering in any way? A decent optimizing >>> compiler should easily be able to get rid of that for you. >>> >>> --Jason >>> >>> >>> On July 25, 2017 2:51:31 AM Gwan-gyeong Mun <elong...@gmail.com> wrote: >>> >>> > Before, it generates functions like this, >>> > >>> > static inline uint32_t ATTRIBUTE_PURE >>> > RENDER_SURFACE_STATE_RedClearColor_start(const struct gen_device_info >>> *devinfo) >>> > { >>> >switch (devinfo->gen) { >>> >case 10: return 384; >>> >case 9: return 384; >>> >case 8: return 255; >>> >case 7: >>> > if (devinfo->is_haswell) { >>> > return 255; >>> > } else { >>> > return 255; >>> > } >>> >case 6: return 0; >>> >case 5: return 0; >>> >case 4: >>> > if (devinfo->is_g4x) { >>> > return 0; >>> > } else { >>> > return 0; >>> > } >>> >default: >>> > unreachable("Invalid hardware generation"); >>> >} >>> > } >>> > >>> > After, it generates fuctions without a redundant identical code for >>> different >>> > branches. >>> > >>> > static inline uint32_t ATTRIBUTE_PURE >>> > RENDER_SURFACE_STATE_RedClearColor_start(const struct gen_device_info >>> *devinfo) >>> > { >>> >switch (devinfo->gen) { >>> >case 10: return 384; >>> >case 9: return 384; >>> >case 8: return 255; >>> >case 7: return 255; >>> >case 6: return 0; >>> >case 5: return 0; >>> >case 4: return 0; >>> >default: >>> > unreachable("Invalid hardware generation"); >>> >} >>> > } >>> > >>> > Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> >>> > --- >>> > src/intel/genxml/gen_bits_header.py | 8 >>> > 1 file changed, 8 insertions(+) >>> > >>> > diff --git a/src/intel/genxml/gen_bits_header.py >>> > b/src/intel/genxml/gen_bits_header.py >>> > index 1b3504073b..8084facdb7 100644 >>> > --- a/src
Re: [Mesa-dev] [PATCH] genxml: Remove a redundant identical code for different branches
Hi Jason, You are right, as you commented, compilers can eliminate these redundancies easy. However I think we don't need to generate redundant codes. Best regards, Gwan-gyeong 2017년 7월 26일 (수) 오전 12:34, Jason Ekstrand <ja...@jlekstrand.net>님이 작성: > Does the redundancy ends up mattering in any way? A decent optimizing > compiler should easily be able to get rid of that for you. > > --Jason > > > On July 25, 2017 2:51:31 AM Gwan-gyeong Mun <elong...@gmail.com> wrote: > > > Before, it generates functions like this, > > > > static inline uint32_t ATTRIBUTE_PURE > > RENDER_SURFACE_STATE_RedClearColor_start(const struct gen_device_info > *devinfo) > > { > >switch (devinfo->gen) { > >case 10: return 384; > >case 9: return 384; > >case 8: return 255; > >case 7: > > if (devinfo->is_haswell) { > > return 255; > > } else { > > return 255; > > } > >case 6: return 0; > >case 5: return 0; > >case 4: > > if (devinfo->is_g4x) { > > return 0; > > } else { > > return 0; > > } > >default: > > unreachable("Invalid hardware generation"); > >} > > } > > > > After, it generates fuctions without a redundant identical code for > different > > branches. > > > > static inline uint32_t ATTRIBUTE_PURE > > RENDER_SURFACE_STATE_RedClearColor_start(const struct gen_device_info > *devinfo) > > { > >switch (devinfo->gen) { > >case 10: return 384; > >case 9: return 384; > >case 8: return 255; > >case 7: return 255; > >case 6: return 0; > >case 5: return 0; > >case 4: return 0; > >default: > > unreachable("Invalid hardware generation"); > >} > > } > > > > Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> > > --- > > src/intel/genxml/gen_bits_header.py | 8 > > 1 file changed, 8 insertions(+) > > > > diff --git a/src/intel/genxml/gen_bits_header.py > > b/src/intel/genxml/gen_bits_header.py > > index 1b3504073b..8084facdb7 100644 > > --- a/src/intel/genxml/gen_bits_header.py > > +++ b/src/intel/genxml/gen_bits_header.py > > @@ -83,20 +83,28 @@ ${item.token_name}_${prop}(const struct > gen_device_info > > *devinfo) > > case 10: return ${item.get_prop(prop, 10)}; > > case 9: return ${item.get_prop(prop, 9)}; > > case 8: return ${item.get_prop(prop, 8)}; > > +% if item.get_prop(prop, 7) == item.get_prop(prop, 7.5): > > + case 7: return ${item.get_prop(prop, 7)}; > > +% else: > > case 7: > >if (devinfo->is_haswell) { > > return ${item.get_prop(prop, 7.5)}; > >} else { > > return ${item.get_prop(prop, 7)}; > >} > > +% endif > > case 6: return ${item.get_prop(prop, 6)}; > > case 5: return ${item.get_prop(prop, 5)}; > > +% if item.get_prop(prop, 4) == item.get_prop(prop, 4.5): > > + case 4: return ${item.get_prop(prop, 4)}; > > +% else: > > case 4: > >if (devinfo->is_g4x) { > > return ${item.get_prop(prop, 4.5)}; > >} else { > > return ${item.get_prop(prop, 4)}; > >} > > +% endif > > default: > >unreachable("Invalid hardware generation"); > > } > > -- > > 2.13.3 > > > > > -- Gwan-gyeong Mun ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gbm: avoid null pointer dereference
Thanks Daniel for a detailed explain with link, that was totally my misunderstood. ignore this patch ^^. 2017-07-17 23:20 GMT+09:00 Daniel Stone: > Hi, > > On 17 July 2017 at 15:02, Gwan-gyeong Mun wrote: >> gbm_dri_surface_create() might create gbm_surface without modifiers. >> therefore, gbm_dri_surface_destroy() needs to check modifiers is null or not >> prior to free it. > > This is not true. The code here does not perform a dereference of > surf->base.modifiers (the only dereference occurs on surf). free() > itself is explicitly specified to be safe when passing NULL: > 'If ptr is a null pointer, no action shall occur.' > — http://pubs.opengroup.org/onlinepubs/009695399/functions/free.html > > Cheers, > Daniel -- Gwan-gyeong Mun ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] egl_dri2: Add support for Tizen
Hi Emil, Thanks for review my patch, 2017-04-26 0:58 GMT+09:00 Daniel Stone: > Hi, > > On 25 April 2017 at 17:03, Emil Velikov wrote: >> From a quick look most of this code is copy/pasted from platform_wayland.c. >> >> At the same time, large portions of the android, gbm and wayland (not >> sure about x11) platforms are almost identical. >> With the biggest differences due to feature X implemented on platform >> A, but not on platform B. >> >> Before we proceed with adding new platforms we _really_ want to >> refactor and de-duplicate the existing code. >> Can you give that a stab - the common code can go in egl_dri2.c? > > There are also parts which are clearly not relevant, e.g. checks for > the surface being a pbuffer, when the surface-creation code fails if a > pbuffer surface is requested. > > Cheers, > Daniel As you mentioned, tizen_platform.c is copy & pasted from other platform.c . Especially I referenced implementation of __DRIimageLoaderExtension and __DRIdri2LoaderExtension from android, because tizen's window buffer management concept is similiar to andriod's. and I also referenced software rasterization (__DRIswrastLoaderExtension) implementaion from wayland platform.c >> Before we proceed with adding new platforms we _really_ want to >> refactor and de-duplicate the existing code. >> Can you give that a stab - the common code can go in egl_dri2.c? If you agree, I want to refactor and de-duplication on android / tizen / wayland as first step. ( because a many parts of code are same on both tizen_platform.c and android_platform.c , so it looks easy as first step for removing of duplicate code. ) Many thanks, Gwan-gyeong. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] egl_dri2: Add support for Tizen
From: "Mun, Gwan-gyeong" <kk.m...@samsung.com> Add platform_tizen.c that supports _EGL_PLATFORM_TIZEN. It works with libtpl-egl (Tizen Porting Layer for egl), libtbm(Tizen Buffer Manager) where back buffers of windows are backed by GEM objects. In Tizen a native window has a queue (tbm_surface_queue) of back buffers allocated by the WL_TBM(wayland client case, WL_TBM is abbreviation of wayland-tbm protocol) or gbm ( tizen has implements gbm with tbm) or tbm through tbm_backend. For each frame, EGL needs to dequeue the next back buffer render to the buffer enqueue the buffer After enqueuing, the buffer is no longer valid to EGL. It supports DRI image loader extension, DRI dri2 loader extension and DRI swrast loader extension. It supports EGL_NATIVE_SURFACE_TIZEN target type for eglCreateImageKHR. (https://www.khronos.org/registry/EGL/extensions/TIZEN/EGL_TIZEN_image_native_surface.txt) BindWaylandDisplayWL / UnbindWaylandDisplayWL / QueryWaylandBufferWL are overloaded because tizen platform has its own instead of WL_DRM. Referenced documents: https://www.x.org/wiki/Events/XDC2016/Program/XDC2016_Tizen_Window_System_EGL_Vulkan.pdf https://wiki.tizen.org/wiki/3.0_Porting_Guide/Graphics_and_UI/libtpl-egl https://wiki.tizen.org/wiki/TBM Signed-off-by: Mun Gwan-gyeong <kk.m...@samsung.com> --- src/egl/Makefile.am |7 + src/egl/drivers/dri2/egl_dri2.c | 11 + src/egl/drivers/dri2/egl_dri2.h | 36 + src/egl/drivers/dri2/platform_tizen.c | 1543 + src/egl/main/eglapi.c | 16 + src/egl/main/egldisplay.c | 27 +- src/egl/main/egldisplay.h | 11 + 7 files changed, 1650 insertions(+), 1 deletion(-) create mode 100644 src/egl/drivers/dri2/platform_tizen.c diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am index 3477f797d7..1f7b15cce4 100644 --- a/src/egl/Makefile.am +++ b/src/egl/Makefile.am @@ -91,6 +91,13 @@ libEGL_la_LIBADD += $(ANDROID_LIBS) dri2_backend_FILES += drivers/dri2/platform_android.c endif +if HAVE_EGL_PLATFORM_TIZEN +AM_CFLAGS += -DHAVE_TIZEN_PLATFORM +AM_CFLAGS += $(TIZEN_CFLAGS) +libEGL_la_LIBADD += $(TIZEN_LIBS) +dri2_backend_FILES += drivers/dri2/platform_tizen.c +endif + AM_CFLAGS += \ -I$(top_srcdir)/src/loader \ -I$(top_srcdir)/src/egl/drivers/dri2 \ diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 2cab7d00c1..676f3a62c1 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -862,6 +862,11 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp) ret = dri2_initialize_android(drv, disp); break; #endif +#ifdef HAVE_TIZEN_PLATFORM + case _EGL_PLATFORM_TIZEN: + ret = dri2_initialize_tizen(drv, disp); + break; +#endif default: _eglLog(_EGL_WARNING, "No EGL platform enabled."); return EGL_FALSE; @@ -943,6 +948,12 @@ dri2_display_release(_EGLDisplay *disp) } break; #endif +#ifdef HAVE_TIZEN_PLATFORM + case _EGL_PLATFORM_TIZEN: + if (dri2_dpy->tpl_display) + tpl_object_unreference((tpl_object_t *)(dri2_dpy->tpl_display)); + break; +#endif default: break; } diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index f16663712d..e81691a4a0 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -63,6 +63,14 @@ #endif /* HAVE_ANDROID_PLATFORM */ +#ifdef HAVE_TIZEN_PLATFORM +#include +#include +#include +#include +#include +#endif /* HAVE_TIZEN_PLATFORM */ + #include "eglconfig.h" #include "eglcontext.h" #include "egldisplay.h" @@ -217,6 +225,10 @@ struct dri2_egl_display const gralloc_module_t *gralloc; #endif +#ifdef HAVE_TIZEN_PLATFORM + tpl_display_t*tpl_display; +#endif + int is_render_node; int is_different_gpu; }; @@ -265,6 +277,27 @@ struct dri2_egl_surface struct gbm_dri_surface *gbm_surf; #endif +#ifdef HAVE_TIZEN_PLATFORM + void *native_win; + tpl_surface_t *tpl_surface; + tbm_surface_h tbm_surface; + tbm_format tbm_format; + __DRIimage*dri_image_back; + __DRIimage*dri_image_front; + + /* EGL-owned buffers */ + __DRIbuffer *local_buffers[__DRI_BUFFER_COUNT]; + + /* Used to record all the tbm_surface created by tpl_surface and their ages. +* Usually Tizen uses at most triple buffers in tpl_surface (tbm_surface_queue) +* so hardcode the number of color_buffers to 3. +*/ + struct { + tbm_surface_h tbm_surface; + int age; + } color_buffers[3], *back; +#endif + #if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM) __DRIbuffer *dri_buffers[__DRI_BUFFER_COUNT]; struct { @@ -397,6 +430,9 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp); EGLBoo
[Mesa-dev] [PATCH 2/2] configure.ac: Add tizen to supported egl platforms
From: "Mun, Gwan-gyeong" <kk.m...@samsung.com> It checks tpl-egl/libtbm/libtdm packages and defines HAVE_EGL_PLATFORM_TIZEN. This feature is enabled by the config option '--with-egl-platforms=tizen' Signed-off-by: Mun Gwan-gyeong <kk.m...@samsung.com> --- configure.ac | 5 + 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index 7246c6017a..e8c3151809 100644 --- a/configure.ac +++ b/configure.ac @@ -2175,6 +2175,10 @@ for plat in $egl_platforms; do PKG_CHECK_MODULES([ANDROID], [cutils hardware sync]) ;; + tizen) + PKG_CHECK_MODULES([TIZEN], [tpl-egl libtbm libtdm]) + ;; + *) AC_MSG_ERROR([EGL platform '$plat' does not exist]) ;; @@ -2201,6 +2205,7 @@ AM_CONDITIONAL(HAVE_PLATFORM_WAYLAND, echo "$egl_platforms" | grep -q 'wayland') AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm') AM_CONDITIONAL(HAVE_EGL_PLATFORM_SURFACELESS, echo "$egl_platforms" | grep -q 'surfaceless') AM_CONDITIONAL(HAVE_EGL_PLATFORM_ANDROID, echo "$egl_platforms" | grep -q 'android') +AM_CONDITIONAL(HAVE_EGL_PLATFORM_TIZEN, echo "$egl_platforms" | grep -q 'tizen') AC_SUBST([EGL_NATIVE_PLATFORM]) AC_SUBST([EGL_CFLAGS]) -- 2.12.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/2] Introduce supporting of Tizen to mesa's egl platform
Hello, these commit series introduce supporting of Tizen to mesa's egl platform. It is tested on rpi3 with Tizen Platform. Below repository includes packaging info for tizen. https://github.com/elongbug/mesa/tree/tizen_work (this file includes build option for vc4 - https://github.com/elongbug/mesa/blob/tizen_work/packaging/mesa.spec ) Following docs describe howto seting up build environment for tizen and geting build dependancy packages and how to building RPI3 kernel for tizen and downloading to tizen platform binaries to rpi3. https://github.com/elongbug/mesa/blob/tizen_work/Readme_RPI3_Setup_for_Tizen https://github.com/elongbug/mesa/blob/tizen_work/Readme_for_Tizen https://github.com/elongbug/mesa/blob/tizen_work/Tizen_Binary_Download_Instructions_for_RPI3 Mun, Gwan-gyeong (2): egl_dri2: Add support for Tizen configure.ac: Add tizen to supported egl platforms configure.ac |5 + src/egl/Makefile.am |7 + src/egl/drivers/dri2/egl_dri2.c | 11 + src/egl/drivers/dri2/egl_dri2.h | 36 + src/egl/drivers/dri2/platform_tizen.c | 1543 + src/egl/main/eglapi.c | 16 + src/egl/main/egldisplay.c | 27 +- src/egl/main/egldisplay.h | 11 + 8 files changed, 1655 insertions(+), 1 deletion(-) create mode 100644 src/egl/drivers/dri2/platform_tizen.c -- 2.12.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/2] Introduce supporting of Tizen to mesa's egl platform
Hello, these commit series introduce supporting of Tizen to mesa's egl platform. It is tested on rpi3 with Tizen Platform. Below repository includes packaging info for tizen. https://github.com/elongbug/mesa/tree/tizen_work (this file includes build option for vc4 - https://github.com/elongbug/mesa/blob/tizen_work/packaging/mesa.spec ) Following docs describe howto seting up build environment for tizen and geting build dependancy packages and how to building RPI3 kernel for tizen and downloading to tizen platform binaries to rpi3. https://github.com/elongbug/mesa/blob/tizen_work/Readme_RPI3_Setup_for_Tizen https://github.com/elongbug/mesa/blob/tizen_work/Readme_for_Tizen https://github.com/elongbug/mesa/blob/tizen_work/Tizen_Binary_Download_Instructions_for_RPI3 Mun, Gwan-gyeong (2): egl_dri2: Add support for Tizen configure.ac: Add tizen to supported egl platforms configure.ac |5 + src/egl/Makefile.am |7 + src/egl/drivers/dri2/egl_dri2.c | 11 + src/egl/drivers/dri2/egl_dri2.h | 36 + src/egl/drivers/dri2/platform_tizen.c | 1543 + src/egl/main/eglapi.c | 16 + src/egl/main/egldisplay.c | 27 +- src/egl/main/egldisplay.h | 11 + 8 files changed, 1655 insertions(+), 1 deletion(-) create mode 100644 src/egl/drivers/dri2/platform_tizen.c -- 2.12.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 4/5] anv: Add missing error-checking to anv_CreateDevice (v3)
This patch adds missing error-checking and fixes resource leak in allocation failure path on anv_CreateDevice() v2: Fixes from Jason Ekstrand's review a) Add missing destructors for all of the state pools on allocation failure path b) Add missing destructor for batch bo pools on allocation failure path v3: Fixes from Emil Velikov's review Add missing destructor for queue and scratch_pool on allocation failure path Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/intel/vulkan/anv_device.c | 65 +-- 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 0fd7d41..decdf38 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -893,31 +893,57 @@ VkResult anv_CreateDevice( device->robust_buffer_access = pCreateInfo->pEnabledFeatures && pCreateInfo->pEnabledFeatures->robustBufferAccess; - pthread_mutex_init(>mutex, NULL); + if (pthread_mutex_init(>mutex, NULL) != 0) { + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_context_id; + } pthread_condattr_t condattr; - pthread_condattr_init(); - pthread_condattr_setclock(, CLOCK_MONOTONIC); - pthread_cond_init(>queue_submit, NULL); + if (pthread_condattr_init() != 0) { + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_mutex; + } + if (pthread_condattr_setclock(, CLOCK_MONOTONIC) != 0) { + pthread_condattr_destroy(); + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_mutex; + } + if (pthread_cond_init(>queue_submit, NULL) != 0) { + pthread_condattr_destroy(); + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_mutex; + } pthread_condattr_destroy(); anv_bo_pool_init(>batch_bo_pool, device); - anv_block_pool_init(>dynamic_state_block_pool, device, 16384); + result = anv_block_pool_init(>dynamic_state_block_pool, device, +16384); + if (result != VK_SUCCESS) + goto fail_batch_bo_pool; anv_state_pool_init(>dynamic_state_pool, >dynamic_state_block_pool); - anv_block_pool_init(>instruction_block_pool, device, 128 * 1024); + result = anv_block_pool_init(>instruction_block_pool, device, +128 * 1024); + if (result != VK_SUCCESS) + goto fail_dynamic_state_block_pool; + anv_state_pool_init(>instruction_state_pool, >instruction_block_pool); - anv_block_pool_init(>surface_state_block_pool, device, 4096); + result = anv_block_pool_init(>surface_state_block_pool, device, +4096); + if (result != VK_SUCCESS) + goto fail_instruction_block_pool; anv_state_pool_init(>surface_state_pool, >surface_state_block_pool); - anv_bo_init_new(>workaround_bo, device, 1024); + result = anv_bo_init_new(>workaround_bo, device, 1024); + if (result != VK_SUCCESS) + goto fail_surface_state_block_pool; anv_scratch_pool_init(device, >scratch_pool); @@ -942,7 +968,7 @@ VkResult anv_CreateDevice( unreachable("unhandled gen"); } if (result != VK_SUCCESS) - goto fail_fd; + goto fail_workaround_bo; anv_device_init_blorp(device); @@ -952,6 +978,27 @@ VkResult anv_CreateDevice( return VK_SUCCESS; + fail_workaround_bo: + anv_queue_finish(>queue); + anv_scratch_pool_finish(device, >scratch_pool); + anv_gem_munmap(device->workaround_bo.map, device->workaround_bo.size); + anv_gem_close(device, device->workaround_bo.gem_handle); + fail_surface_state_block_pool: + anv_state_pool_finish(>surface_state_pool); + anv_block_pool_finish(>surface_state_block_pool); + fail_instruction_block_pool: + anv_state_pool_finish(>instruction_state_pool); + anv_block_pool_finish(>instruction_block_pool); + fail_dynamic_state_block_pool: + anv_state_pool_finish(>dynamic_state_pool); + anv_block_pool_finish(>dynamic_state_block_pool); + fail_batch_bo_pool: + anv_bo_pool_finish(>batch_bo_pool); + pthread_cond_destroy(>queue_submit); + fail_mutex: + pthread_mutex_destroy(>mutex); + fail_context_id: + anv_gem_destroy_context(device, device->context_id); fail_fd: close(device->fd); fail_device: -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 4/5] anv: Add missing error-checking to anv_CreateDevice (v2)
This patch adds missing error-checking and fixes resource leak in allocation failure path on anv_CreateDevice() v2: Fixes from Jason Ekstrand's review a) Add missing destructors for all of the state pools on allocation failure path b) Add missing destructor for batch bo pools on allocation failure path Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/intel/vulkan/anv_device.c | 63 --- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 0fd7d41..768e8f9 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -893,31 +893,57 @@ VkResult anv_CreateDevice( device->robust_buffer_access = pCreateInfo->pEnabledFeatures && pCreateInfo->pEnabledFeatures->robustBufferAccess; - pthread_mutex_init(>mutex, NULL); + if (pthread_mutex_init(>mutex, NULL) != 0) { + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_context_id; + } pthread_condattr_t condattr; - pthread_condattr_init(); - pthread_condattr_setclock(, CLOCK_MONOTONIC); - pthread_cond_init(>queue_submit, NULL); + if (pthread_condattr_init() != 0) { + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_mutex; + } + if (pthread_condattr_setclock(, CLOCK_MONOTONIC) != 0) { + pthread_condattr_destroy(); + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_mutex; + } + if (pthread_cond_init(>queue_submit, NULL) != 0) { + pthread_condattr_destroy(); + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_mutex; + } pthread_condattr_destroy(); anv_bo_pool_init(>batch_bo_pool, device); - anv_block_pool_init(>dynamic_state_block_pool, device, 16384); + result = anv_block_pool_init(>dynamic_state_block_pool, device, +16384); + if (result != VK_SUCCESS) + goto fail_batch_bo_pool; anv_state_pool_init(>dynamic_state_pool, >dynamic_state_block_pool); - anv_block_pool_init(>instruction_block_pool, device, 128 * 1024); + result = anv_block_pool_init(>instruction_block_pool, device, +128 * 1024); + if (result != VK_SUCCESS) + goto fail_dynamic_state_block_pool; + anv_state_pool_init(>instruction_state_pool, >instruction_block_pool); - anv_block_pool_init(>surface_state_block_pool, device, 4096); + result = anv_block_pool_init(>surface_state_block_pool, device, +4096); + if (result != VK_SUCCESS) + goto fail_instruction_block_pool; anv_state_pool_init(>surface_state_pool, >surface_state_block_pool); - anv_bo_init_new(>workaround_bo, device, 1024); + result = anv_bo_init_new(>workaround_bo, device, 1024); + if (result != VK_SUCCESS) + goto fail_surface_state_block_pool; anv_scratch_pool_init(device, >scratch_pool); @@ -942,7 +968,7 @@ VkResult anv_CreateDevice( unreachable("unhandled gen"); } if (result != VK_SUCCESS) - goto fail_fd; + goto fail_workaround_bo; anv_device_init_blorp(device); @@ -952,6 +978,25 @@ VkResult anv_CreateDevice( return VK_SUCCESS; + fail_workaround_bo: + anv_gem_munmap(device->workaround_bo.map, device->workaround_bo.size); + anv_gem_close(device, device->workaround_bo.gem_handle); + fail_surface_state_block_pool: + anv_state_pool_finish(>surface_state_pool); + anv_block_pool_finish(>surface_state_block_pool); + fail_instruction_block_pool: + anv_state_pool_finish(>instruction_state_pool); + anv_block_pool_finish(>instruction_block_pool); + fail_dynamic_state_block_pool: + anv_state_pool_finish(>dynamic_state_pool); + anv_block_pool_finish(>dynamic_state_block_pool); + fail_batch_bo_pool: + anv_bo_pool_finish(>batch_bo_pool); + pthread_cond_destroy(>queue_submit); + fail_mutex: + pthread_mutex_destroy(>mutex); + fail_context_id: + anv_gem_destroy_context(device, device->context_id); fail_fd: close(device->fd); fail_device: -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] vulkan/wsi: Fix resource leak in success path of wsi_queue_init()
It fixes leakage of pthread_condattr resource on wsi_queue_init() Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/vulkan/wsi/wsi_common_queue.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vulkan/wsi/wsi_common_queue.h b/src/vulkan/wsi/wsi_common_queue.h index 0e72c8d..6d489cb 100644 --- a/src/vulkan/wsi/wsi_common_queue.h +++ b/src/vulkan/wsi/wsi_common_queue.h @@ -65,6 +65,7 @@ wsi_queue_init(struct wsi_queue *queue, int length) if (ret) goto fail_cond; + pthread_condattr_destroy(); return 0; fail_cond: -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/5] radv: drop the return type for radv_queue_init()
radv_queue_init() always returns VK_SUCCESS, so caller does not need to check return value of radv_queue_init(). Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/amd/vulkan/radv_device.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 1b8864d..3559c30 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -611,13 +611,11 @@ void radv_GetPhysicalDeviceMemoryProperties( }; } -static VkResult +static void radv_queue_init(struct radv_device *device, struct radv_queue *queue) { queue->_loader_data.loaderMagic = ICD_LOADER_MAGIC; queue->device = device; - - return VK_SUCCESS; } static void -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/5] anv: Add missing error-checking to anv_CreateDevice
This patch adds missing error-checking and fixes resource leak in allocation failure path on anv_CreateDevice() Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/intel/vulkan/anv_device.c | 59 --- 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 0fd7d41..1964fb7 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -893,31 +893,57 @@ VkResult anv_CreateDevice( device->robust_buffer_access = pCreateInfo->pEnabledFeatures && pCreateInfo->pEnabledFeatures->robustBufferAccess; - pthread_mutex_init(>mutex, NULL); + if (pthread_mutex_init(>mutex, NULL) != 0) { + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_context_id; + } pthread_condattr_t condattr; - pthread_condattr_init(); - pthread_condattr_setclock(, CLOCK_MONOTONIC); - pthread_cond_init(>queue_submit, NULL); + if (pthread_condattr_init() != 0) { + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_mutex; + } + if (pthread_condattr_setclock(, CLOCK_MONOTONIC) != 0) { + pthread_condattr_destroy(); + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_mutex; + } + if (pthread_cond_init(>queue_submit, NULL) != 0) { + pthread_condattr_destroy(); + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_mutex; + } pthread_condattr_destroy(); anv_bo_pool_init(>batch_bo_pool, device); - anv_block_pool_init(>dynamic_state_block_pool, device, 16384); + result = anv_block_pool_init(>dynamic_state_block_pool, device, +16384); + if (result != VK_SUCCESS) + goto fail_queue_submit; anv_state_pool_init(>dynamic_state_pool, >dynamic_state_block_pool); - anv_block_pool_init(>instruction_block_pool, device, 128 * 1024); + result = anv_block_pool_init(>instruction_block_pool, device, +128 * 1024); + if (result != VK_SUCCESS) + goto fail_dynamic_state_block_pool; + anv_state_pool_init(>instruction_state_pool, >instruction_block_pool); - anv_block_pool_init(>surface_state_block_pool, device, 4096); + result = anv_block_pool_init(>surface_state_block_pool, device, +4096); + if (result != VK_SUCCESS) + goto fail_instruction_block_pool; anv_state_pool_init(>surface_state_pool, >surface_state_block_pool); - anv_bo_init_new(>workaround_bo, device, 1024); + result = anv_bo_init_new(>workaround_bo, device, 1024); + if (result != VK_SUCCESS) + goto fail_surface_state_block_pool; anv_scratch_pool_init(device, >scratch_pool); @@ -942,7 +968,7 @@ VkResult anv_CreateDevice( unreachable("unhandled gen"); } if (result != VK_SUCCESS) - goto fail_fd; + goto fail_workaround_bo; anv_device_init_blorp(device); @@ -952,6 +978,21 @@ VkResult anv_CreateDevice( return VK_SUCCESS; + fail_workaround_bo: + anv_gem_munmap(device->workaround_bo.map, device->workaround_bo.size); + anv_gem_close(device, device->workaround_bo.gem_handle); + fail_surface_state_block_pool: + anv_block_pool_finish(>surface_state_block_pool); + fail_instruction_block_pool: + anv_block_pool_finish(>instruction_block_pool); + fail_dynamic_state_block_pool: + anv_block_pool_finish(>dynamic_state_block_pool); + fail_queue_submit: + pthread_cond_destroy(>queue_submit); + fail_mutex: + pthread_mutex_destroy(>mutex); + fail_context_id: + anv_gem_destroy_context(device, device->context_id); fail_fd: close(device->fd); fail_device: -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/5] anv: Update the teardown in reverse order of the anv_CreateDevice
This updates releasing of resource in reverse order of the anv_CreateDevice to anv_DestroyDevice. And it fixes resource leak in pthread_mutex, pthread_cond, anv_gem_context. Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/intel/vulkan/anv_device.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 1964fb7..76ea4cf 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1007,10 +1007,10 @@ void anv_DestroyDevice( { ANV_FROM_HANDLE(anv_device, device, _device); - anv_queue_finish(>queue); - anv_device_finish_blorp(device); + anv_queue_finish(>queue); + #ifdef HAVE_VALGRIND /* We only need to free these to prevent valgrind errors. The backing * BO will go away in a couple of lines so we don't actually leak. @@ -1018,22 +1018,27 @@ void anv_DestroyDevice( anv_state_pool_free(>dynamic_state_pool, device->border_colors); #endif + anv_scratch_pool_finish(device, >scratch_pool); + anv_gem_munmap(device->workaround_bo.map, device->workaround_bo.size); anv_gem_close(device, device->workaround_bo.gem_handle); - anv_bo_pool_finish(>batch_bo_pool); - anv_state_pool_finish(>dynamic_state_pool); - anv_block_pool_finish(>dynamic_state_block_pool); - anv_state_pool_finish(>instruction_state_pool); - anv_block_pool_finish(>instruction_block_pool); anv_state_pool_finish(>surface_state_pool); anv_block_pool_finish(>surface_state_block_pool); - anv_scratch_pool_finish(device, >scratch_pool); + anv_state_pool_finish(>instruction_state_pool); + anv_block_pool_finish(>instruction_block_pool); + anv_state_pool_finish(>dynamic_state_pool); + anv_block_pool_finish(>dynamic_state_block_pool); - close(device->fd); + anv_bo_pool_finish(>batch_bo_pool); + pthread_cond_destroy(>queue_submit); pthread_mutex_destroy(>mutex); + anv_gem_destroy_context(device, device->context_id); + + close(device->fd); + vk_free(>alloc, device); } -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/5] anv: drop the return type for anv_queue_init()
anv_queue_init() always returns VK_SUCCESS, so caller does not need to check return value of anv_queue_init(). Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/intel/vulkan/anv_device.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 2c8ac49..0fd7d41 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -710,14 +710,12 @@ PFN_vkVoidFunction anv_GetDeviceProcAddr( return anv_lookup_entrypoint(>info, pName); } -static VkResult +static void anv_queue_init(struct anv_device *device, struct anv_queue *queue) { queue->_loader_data.loaderMagic = ICD_LOADER_MAGIC; queue->device = device; queue->pool = >surface_state_pool; - - return VK_SUCCESS; } static void -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/5] anv: Add missing error-checking to anv_block_pool_init (v2)
When the memfd_create() and u_vector_init() fail on anv_block_pool_init(), this patch makes to return VK_ERROR_INITIALIZATION_FAILED. All of initialization success on anv_block_pool_init(), it makes to return VK_SUCCESS. CID 1394319 v2: Fixes from Emil's review: a) Add the return type for propagating the return value to caller. b) Changed anv_block_pool_init() to return VK_ERROR_INITIALIZATION_FAILED on failure of initialization. Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/intel/vulkan/anv_allocator.c | 27 +-- src/intel/vulkan/anv_private.h | 4 ++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index f472213..45c663b 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -246,10 +246,12 @@ anv_ptr_free_list_push(void **list, void *elem) static uint32_t anv_block_pool_grow(struct anv_block_pool *pool, struct anv_block_state *state); -void +VkResult anv_block_pool_init(struct anv_block_pool *pool, struct anv_device *device, uint32_t block_size) { + VkResult result; + assert(util_is_power_of_two(block_size)); pool->device = device; @@ -260,17 +262,23 @@ anv_block_pool_init(struct anv_block_pool *pool, pool->fd = memfd_create("block pool", MFD_CLOEXEC); if (pool->fd == -1) - return; + return vk_error(VK_ERROR_INITIALIZATION_FAILED); /* Just make it 2GB up-front. The Linux kernel won't actually back it * with pages until we either map and fault on one of them or we use * userptr and send a chunk of it off to the GPU. */ - if (ftruncate(pool->fd, BLOCK_POOL_MEMFD_SIZE) == -1) - return; + if (ftruncate(pool->fd, BLOCK_POOL_MEMFD_SIZE) == -1) { + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_fd; + } - u_vector_init(>mmap_cleanups, - round_to_power_of_two(sizeof(struct anv_mmap_cleanup)), 128); + if (!u_vector_init(>mmap_cleanups, + round_to_power_of_two(sizeof(struct anv_mmap_cleanup)), + 128)) { + result = vk_error(VK_ERROR_INITIALIZATION_FAILED); + goto fail_fd; + } pool->state.next = 0; pool->state.end = 0; @@ -279,6 +287,13 @@ anv_block_pool_init(struct anv_block_pool *pool, /* Immediately grow the pool so we'll have a backing bo. */ pool->state.end = anv_block_pool_grow(pool, >state); + + return VK_SUCCESS; + + fail_fd: + close(pool->fd); + + return result; } void diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 2fc543d..a7c31e3 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -432,8 +432,8 @@ anv_state_clflush(struct anv_state state) anv_clflush_range(state.map, state.alloc_size); } -void anv_block_pool_init(struct anv_block_pool *pool, - struct anv_device *device, uint32_t block_size); +VkResult anv_block_pool_init(struct anv_block_pool *pool, + struct anv_device *device, uint32_t block_size); void anv_block_pool_finish(struct anv_block_pool *pool); int32_t anv_block_pool_alloc(struct anv_block_pool *pool); int32_t anv_block_pool_alloc_back(struct anv_block_pool *pool); -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] docs: get rid of duplicated description from sourcetree.html
Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- docs/sourcetree.html | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/sourcetree.html b/docs/sourcetree.html index aee3321..7013f65 100644 --- a/docs/sourcetree.html +++ b/docs/sourcetree.html @@ -140,7 +140,6 @@ each directory. clover - OpenCL state tracker dri - Meta state tracker for DRI drivers glx - Meta state tracker for GLX - vdpau - VDPAU state tracker wgl - Windows WGL state tracker xa - XA state tracker xvmc - XvMC state tracker -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2] util/disk_cache: close a previously opened handle in disk_cache_put (v2)
We're missing the close() to the matching open(). CID 1373407 v2: Fixes from Emil Velikov's review Update the teardown in reverse order of the setup/init. Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/util/disk_cache.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index 4287878..80dc788 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -612,19 +612,18 @@ disk_cache_put(struct disk_cache *cache, p_atomic_add(cache->size, size); + done: + if (fd_final != -1) + close(fd_final); /* This close finally releases the flock, (now that the final dile * has been renamed into place and the size has been added). */ - close(fd); - fd = -1; - - done: + if (fd != -1) + close(fd); if (filename_tmp) ralloc_free(filename_tmp); if (filename) ralloc_free(filename); - if (fd != -1) - close(fd); } void * -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2] radeonsi: Add missing error-checking to si_create_compute_state (v2)
When the uploading of shader fails on si_shader_binary_upload(), it returns -ENOMEM. We should handle si_shader_binary_upload() failure path on si_create_compute_state(). CID 1394027 v2: Fixes from Edward O'Callaghan's review a) Update explicitly return value check with "si_shader_binary_upload() < 0" b) Update commit message. Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/gallium/drivers/radeonsi/si_compute.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index f1887bb..0815713 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -165,7 +165,11 @@ static void *si_create_compute_state( } si_shader_dump(sctx->screen, >shader, >b.debug, PIPE_SHADER_COMPUTE, stderr); - si_shader_binary_upload(sctx->screen, >shader); + if (si_shader_binary_upload(sctx->screen, >shader) < 0) { + fprintf(stderr, "LLVM failed to upload shader\n"); + FREE(program); + return NULL; + } } return program; -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] intel: aubinator: Fix resource leak in gen_spec_load_from_path
Hi, Lionel Landwerlin Thanks for reviewing. As I do not have the permission of mesa git, I can not push it. If you have permission for git push, can you push this patch? Best regards, Gwan-gyeong. 2016-11-21 20:20 GMT+09:00 Lionel Landwerlin <lionel.g.landwer...@intel.com>: > Thanks! > > Reviewed-by: Lionel Landwerlin <lionel.g.landwer...@intel.com> > > > On 20/11/16 07:07, Mun Gwan-gyeong wrote: >> >> This fixes resource leak in gen_spec_load_from_path XML_ParserCreate >> failure path >> >> CID 1373564 >> >> Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> >> --- >> src/intel/tools/decoder.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/src/intel/tools/decoder.c b/src/intel/tools/decoder.c >> index 6bd02bf..633251a 100644 >> --- a/src/intel/tools/decoder.c >> +++ b/src/intel/tools/decoder.c >> @@ -539,6 +539,7 @@ gen_spec_load_from_path(const struct gen_device_info >> *devinfo, >> XML_SetUserData(ctx.parser, ); >> if (ctx.parser == NULL) { >> fprintf(stderr, "failed to create parser\n"); >> + fclose(input); >> free(filename); >> return NULL; >> } > > > -- Mun, Gwan-gyeong ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] radeonsi: Fix resource leak in gs_copy_shader allocation failure path
Hi, Edward O'Callaghan , Marek Olšák and Nicolai Hähnle Thanks for reviewing. As I do not have the permission of mesa git, I can not push it. If you have permission for git push, can you push this patch? Best regards, Gwan-gyeong. 2016-11-21 17:41 GMT+09:00 Nicolai Hähnle <nhaeh...@gmail.com>: > Reviewed-by: Nicolai Hähnle <nicolai.haeh...@amd.com> > > > On 20.11.2016 05:19, Mun Gwan-gyeong wrote: >> >> CID 1394028 >> >> Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> >> --- >> src/gallium/drivers/radeonsi/si_shader.c | 8 +++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/src/gallium/drivers/radeonsi/si_shader.c >> b/src/gallium/drivers/radeonsi/si_shader.c >> index 917e148..608cb72 100644 >> --- a/src/gallium/drivers/radeonsi/si_shader.c >> +++ b/src/gallium/drivers/radeonsi/si_shader.c >> @@ -6137,9 +6137,15 @@ si_generate_gs_copy_shader(struct si_screen >> *sscreen, >> >> outputs = MALLOC(gsinfo->num_outputs * sizeof(outputs[0])); >> >> + if (!outputs) >> + return NULL; >> + >> shader = CALLOC_STRUCT(si_shader); >> - if (!shader) >> + if (!shader) { >> + FREE(outputs); >> return NULL; >> + } >> + >> >> shader->selector = gs_selector; >> shader->is_gs_copy_shader = true; >> > -- Mun, Gwan-gyeong ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] anv: Add missing error-checking to anv_block_pool_init
Hi Nayan Deshmukh, Thanks for reviewing. As I do not have the permission of mesa git, If you have permission for git push, can you push this patch? Best regards, Gwan-gyeong. 2016-11-20 20:44 GMT+09:00 Nayan Deshmukh <nayan26deshm...@gmail.com>: > Reviewed-by: Nayan Deshmukh <nayan26deshm...@gmail.com> > > On Sun, Nov 20, 2016 at 4:41 PM, Mun Gwan-gyeong <elong...@gmail.com> wrote: >> When the allocation fails on u_vector_init(), it returns 0 >> This fixes u_vector_init failure path on anv_block_pool_init >> >> CID 1394319 >> >> Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> >> --- >> src/intel/vulkan/anv_allocator.c | 6 -- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/src/intel/vulkan/anv_allocator.c >> b/src/intel/vulkan/anv_allocator.c >> index f472213..30bbd69 100644 >> --- a/src/intel/vulkan/anv_allocator.c >> +++ b/src/intel/vulkan/anv_allocator.c >> @@ -269,8 +269,10 @@ anv_block_pool_init(struct anv_block_pool *pool, >> if (ftruncate(pool->fd, BLOCK_POOL_MEMFD_SIZE) == -1) >>return; >> >> - u_vector_init(>mmap_cleanups, >> - round_to_power_of_two(sizeof(struct anv_mmap_cleanup)), >> 128); >> + if (!u_vector_init(>mmap_cleanups, >> + round_to_power_of_two(sizeof(struct >> anv_mmap_cleanup)), >> + 128)) >> + return; >> >> pool->state.next = 0; >> pool->state.end = 0; >> -- >> 2.10.2 >> >> ___ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev -- Mun, Gwan-gyeong ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] vc4: Fix resource leak
Thanks for reviewing and pushing! 2016-11-18 11:55 GMT+09:00 Eric Anholt <e...@anholt.net>: > Mun Gwan-gyeong <elong...@gmail.com> writes: > >> Add missed free() >> >> CID 1394322 >> >> Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> > > Pushed this yesterday. Thanks! > > (I made a little change to the commit message summary, as as time goes > on a project will end up with a lot of commits titled "vc4: Fix resource > leak") -- Mun, Gwan-gyeong ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] radeonsi: Add missing error-checking to si_create_compute_state
When the uploading of shader fails on si_shader_binary_upload(), it returns -ENOMEM. We handles si_shader_binary_upload() failure path on si_create_compute_state(). CID 1394027 Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/gallium/drivers/radeonsi/si_compute.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index f1887bb..c813621 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -165,7 +165,11 @@ static void *si_create_compute_state( } si_shader_dump(sctx->screen, >shader, >b.debug, PIPE_SHADER_COMPUTE, stderr); - si_shader_binary_upload(sctx->screen, >shader); + if (si_shader_binary_upload(sctx->screen, >shader)) { + fprintf(stderr, "LLVM failed to upload shader\n"); + FREE(program); + return NULL; + } } return program; -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] util/disk_cache: close a previously opened handle in disk_cache_put
We're missing the close() to the matching open(). CID 1373407 Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/util/disk_cache.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index 4287878..5ceb3aa 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -612,19 +612,18 @@ disk_cache_put(struct disk_cache *cache, p_atomic_add(cache->size, size); - /* This close finally releases the flock, (now that the final dile -* has been renamed into place and the size has been added). -*/ - close(fd); - fd = -1; - done: if (filename_tmp) ralloc_free(filename_tmp); if (filename) ralloc_free(filename); + /* This close finally releases the flock, (now that the final dile +* has been renamed into place and the size has been added). +*/ if (fd != -1) close(fd); + if (fd_final != -1) + close(fd_final); } void * -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] anv: Fix unintentional integer overflow in anv_CreateDmaBufImageINTEL
pCreateInfo->strideInBytes * pCreateInfo->extent.height with type "unsigned int" is evaluated using 32-bit arithmetic. This fixes unintentional integer overflow by casting to uint64_t before multifying. CID 1394321 Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/intel/vulkan/anv_intel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_intel.c b/src/intel/vulkan/anv_intel.c index 1c50e2b..8b251f8 100644 --- a/src/intel/vulkan/anv_intel.c +++ b/src/intel/vulkan/anv_intel.c @@ -55,7 +55,7 @@ VkResult anv_CreateDmaBufImageINTEL( goto fail; } - uint64_t size = pCreateInfo->strideInBytes * pCreateInfo->extent.height; + uint64_t size = (uint64_t)pCreateInfo->strideInBytes * (uint64_t)pCreateInfo->extent.height; anv_bo_init(>bo, gem_handle, size); -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] anv: Add missing error-checking to anv_block_pool_init
When the allocation fails on u_vector_init(), it returns 0 This fixes u_vector_init failure path on anv_block_pool_init CID 1394319 Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/intel/vulkan/anv_allocator.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index f472213..30bbd69 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -269,8 +269,10 @@ anv_block_pool_init(struct anv_block_pool *pool, if (ftruncate(pool->fd, BLOCK_POOL_MEMFD_SIZE) == -1) return; - u_vector_init(>mmap_cleanups, - round_to_power_of_two(sizeof(struct anv_mmap_cleanup)), 128); + if (!u_vector_init(>mmap_cleanups, + round_to_power_of_two(sizeof(struct anv_mmap_cleanup)), + 128)) + return; pool->state.next = 0; pool->state.end = 0; -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] intel: aubinator: Fix resource leak in gen_spec_load_from_path
This fixes resource leak in gen_spec_load_from_path XML_ParserCreate failure path CID 1373564 Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/intel/tools/decoder.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/intel/tools/decoder.c b/src/intel/tools/decoder.c index 6bd02bf..633251a 100644 --- a/src/intel/tools/decoder.c +++ b/src/intel/tools/decoder.c @@ -539,6 +539,7 @@ gen_spec_load_from_path(const struct gen_device_info *devinfo, XML_SetUserData(ctx.parser, ); if (ctx.parser == NULL) { fprintf(stderr, "failed to create parser\n"); + fclose(input); free(filename); return NULL; } -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] radeonsi: Fix resource leak in gs_copy_shader allocation failure path
CID 1394028 Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/gallium/drivers/radeonsi/si_shader.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 917e148..608cb72 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -6137,9 +6137,15 @@ si_generate_gs_copy_shader(struct si_screen *sscreen, outputs = MALLOC(gsinfo->num_outputs * sizeof(outputs[0])); + if (!outputs) + return NULL; + shader = CALLOC_STRUCT(si_shader); - if (!shader) + if (!shader) { + FREE(outputs); return NULL; + } + shader->selector = gs_selector; shader->is_gs_copy_shader = true; -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] vc4: Fix resource leak
Add missed free() CID 1394322 Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/gallium/drivers/vc4/vc4_register_allocate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/drivers/vc4/vc4_register_allocate.c b/src/gallium/drivers/vc4/vc4_register_allocate.c index 72e453a..247467b 100644 --- a/src/gallium/drivers/vc4/vc4_register_allocate.c +++ b/src/gallium/drivers/vc4/vc4_register_allocate.c @@ -354,6 +354,7 @@ vc4_register_allocate(struct vc4_context *vc4, struct vc4_compile *c) */ if (c->fs_threaded) { c->failed = true; +free(temp_registers); return NULL; } @@ -383,6 +384,7 @@ vc4_register_allocate(struct vc4_context *vc4, struct vc4_compile *c) } c->failed = true; +free(temp_registers); return NULL; } -- 2.10.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev