[Mesa-dev] [Bug 92687] Add support for EXT_internalformat_query2
https://bugs.freedesktop.org/show_bug.cgi?id=92687 Bug ID: 92687 Summary: Add support for EXT_internalformat_query2 Product: Mesa Version: unspecified Hardware: Other OS: All Status: ASSIGNED Severity: normal Priority: medium Component: Mesa core Assignee: el...@igalia.com Reporter: el...@igalia.com QA Contact: mesa-dev@lists.freedesktop.org CC: apinhe...@igalia.com, apuen...@igalia.com, ito...@igalia.com, sigles...@igalia.com This issue is to track progress for the implementation of EXT_internalformat_query2 extension in Mesa: https://www.opengl.org/registry/specs/ARB/internalformat_query2.txt This task involves adding the new GL API and symbols, driver hooks and default values, and piglit tests. -- You are receiving this mail because: You are the QA Contact for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] Intent to work on support for EXT_internalformat_query2
Hello, This is an announcement that a few folks at Igalia team are planning to work on adding support for EXT_internalformat_query2 extension to Mesa. If somebody had started work on this already, or has any input that is relevant to the implementation, we would be very thankful to hear about it. I just filed a bug [1] to track progress. Feel free to add your comments there too. That's all! cheers, Eduardo [1] https://bugs.freedesktop.org/show_bug.cgi?id=92687 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] nouveau: fix double free when screen_create fails
On 25 October 2015 at 21:56, Samuel Pitoisetwrote: > > > On 10/22/2015 01:16 AM, Julien Isorce wrote: > >> The real fix is in nouveau_drm_winsys.c by setting dev to 0. >> Which means dev's ownership has been passed to previous call. >> Other changes are there to be consistent with what the >> screen_create functions already do on errors. >> > > This actually happens because nouveau_device_del() is (sometimes) called > twice > when nvXX_screen_create() fails. > > I don't really like this solution but I don't have a better one for now, > I'll think about > that in the next few days. :) > Yeah and it is certainly hard to maintain. Ideally it should take ownership of the device only on success. I'll send another patch to compare with the other way around. > > Note that you forgot to call nouveau_device_del() in nvc0_screen_create(). Ah right, I missed it on the first return, thx. > > > >> Encountered this crash because nvc0_screen_create sometimes fails with: >> nvc0_screen_create:717 - Error allocating PGRAPH context for M2MF: -16 >> Also see: https://bugs.freedesktop.org/show_bug.cgi?id=70354 >> >> Signed-off-by: Julien Isorce >> --- >> src/gallium/drivers/nouveau/nv30/nv30_screen.c | 5 - >> src/gallium/drivers/nouveau/nv50/nv50_screen.c | 4 +++- >> src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 2 ++ >> 3 files changed, 9 insertions(+), 2 deletions(-) >> >> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c >> b/src/gallium/drivers/nouveau/nv30/nv30_screen.c >> index 0330164..9b8ddac 100644 >> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c >> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c >> @@ -425,8 +425,10 @@ nv30_screen_create(struct nouveau_device *dev) >> unsigned oclass = 0; >> int ret, i; >> - if (!screen) >> + if (!screen) { >> + nouveau_device_del(); >> return NULL; >> + } >>switch (dev->chipset & 0xf0) { >> case 0x30: >> @@ -456,6 +458,7 @@ nv30_screen_create(struct nouveau_device *dev) >>if (!oclass) { >> NOUVEAU_ERR("unknown 3d class for 0x%02x\n", dev->chipset); >> + nouveau_device_del(); >> FREE(screen); >> return NULL; >> } >> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c >> b/src/gallium/drivers/nouveau/nv50/nv50_screen.c >> index ec51d00..e9604d5 100644 >> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c >> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c >> @@ -711,8 +711,10 @@ nv50_screen_create(struct nouveau_device *dev) >> int ret; >>screen = CALLOC_STRUCT(nv50_screen); >> - if (!screen) >> + if (!screen) { >> + nouveau_device_del(); >> return NULL; >> + } >> pscreen = >base.base; >>ret = nouveau_screen_init(>base, dev); >> diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c >> b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c >> index c6603e3..bd1d761 100644 >> --- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c >> +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c >> @@ -117,6 +117,8 @@ nouveau_drm_screen_create(int fd) >> } >> screen = (struct nouveau_screen*)init(dev); >> + /* Previous init func took ownership of dev */ >> + dev = 0; >> if (!screen) >> goto err; >> >> > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: fix error type for GetFramebufferAttachmentParameteriv
Fixes following failing dEQP test: dEQP-GLES3.functional.fbo.api.attachment_query_empty_fbo Signed-off-by: Tapani PälliBugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92649 Cc: "11.0" --- src/mesa/main/fbobject.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index fe6bdc2..d91fb4a 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -3540,8 +3540,9 @@ _mesa_get_framebuffer_attachment_parameter(struct gl_context *ctx, const struct gl_renderbuffer_attachment *att; GLenum err; - /* The error differs in GL and GLES. */ - err = _mesa_is_desktop_gl(ctx) ? GL_INVALID_OPERATION : GL_INVALID_ENUM; + /* The error differs between GL/GLES3 and GLES 2.0. */ + err = _mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx) ? + GL_INVALID_OPERATION : GL_INVALID_ENUM; if (_mesa_is_winsys_fbo(buffer)) { /* Page 126 (page 136 of the PDF) of the OpenGL ES 2.0.25 spec -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 91596] EGL_KHR_gl_colorspace (v2) causes problem with Android-x86 GUI
https://bugs.freedesktop.org/show_bug.cgi?id=91596 --- Comment #23 from Chih-Wei Huang--- (In reply to Emil Velikov from comment #15) > (In reply to Chih-Wei Huang from comment #11) > > Mesa still doesn't support PIXEL_FORMAT_RGBA_? > > It should, depending on how exactly you define the formats. I've looked a > while back for some android documentation but I came short. Have you seen > any ? HAL_PIXEL_FORMAT_RGBA_ is mapped to DRM_FORMAT_RGBA in drm_galloc. Doesn't it look good? So whether if Mesa supports DRM_FORMAT_RGBA? > Upon closer look the mappings in drm_format_from_hal and get_pipe_format > look very funny. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Intent to work on support for EXT_internalformat_query2
Presumably ARB_internalformat_query2? On Tue, Oct 27, 2015 at 9:31 PM, Eduardo Lima Mitevwrote: > Hello, > > This is an announcement that a few folks at Igalia team are planning to > work on adding support for EXT_internalformat_query2 extension to Mesa. > > If somebody had started work on this already, or has any input that is > relevant to the implementation, we would be very thankful to hear about it. > > I just filed a bug [1] to track progress. Feel free to add your comments > there too. > > That's all! > > cheers, > Eduardo > > [1] https://bugs.freedesktop.org/show_bug.cgi?id=92687 > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2] nouveau: fix double free when screen_create fails
This patch prevents to call nouveau_device_del twice on the same device. Encountered this case when nvc0_screen_create fails with: nvc0_screen_create:717 - Error allocating PGRAPH context for M2MF: -16 https://bugs.freedesktop.org/show_bug.cgi?id=70354 Signed-off-by: Julien Isorce--- src/gallium/drivers/nouveau/nouveau_screen.c | 8 ++-- src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 + src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index b2290e7..2bd6d4f 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -177,13 +177,17 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) screen->device = dev; ret = nouveau_client_new(screen->device, >client); - if (ret) + if (ret) { + screen->device = 0; return ret; + } ret = nouveau_pushbuf_new(screen->client, screen->channel, 4, 512 * 1024, 1, >pushbuf); - if (ret) + if (ret) { + screen->device = 0; return ret; + } /* getting CPU time first appears to be more accurate */ screen->cpu_gpu_time_delta = os_time_get(); diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 0330164..54af655 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -411,6 +411,7 @@ nv30_screen_destroy(struct pipe_screen *pscreen) #define FAIL_SCREEN_INIT(str, err)\ do { \ NOUVEAU_ERR(str, err); \ + screen->base.device = 0;\ nv30_screen_destroy(pscreen); \ return NULL;\ } while(0) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index ec51d00..a1fad42 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -905,6 +905,7 @@ nv50_screen_create(struct nouveau_device *dev) return pscreen; fail: + screen->base.device = 0; nv50_screen_destroy(pscreen); return NULL; } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index af8e5f7..28fee35 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -609,6 +609,7 @@ nvc0_screen_resize_tls_area(struct nvc0_screen *screen, #define FAIL_SCREEN_INIT(str, err)\ do { \ NOUVEAU_ERR(str, err); \ + screen->base.device = 0;\ nvc0_screen_destroy(pscreen); \ return NULL;\ } while(0) -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] st/mesa: implement ARB_copy_image
On 25.10.2015 18:25, Marek Olšák wrote: +/** + * Handle complex format conversions using 2 blits with a temporary texture + * in between, e.g. blitting from B10G10R10A2 to G16R16. + * + * This example is implemented this way: + * 1) First, blit from B10G10R10A2 to R10G10B10A2, which is canonical, so it + *can be reinterpreted as a different canonical format of the same bpp, + *such as R16G16. This blit only swaps R and B 10-bit components. + * 2) Finnaly, blit the result, which is R10G10B10A2, as R16G16 to G16R16. + *This blit only swaps R and G 16-bit components. + */ Typo: Finally Nicolai ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] st/mesa: implement ARB_copy_image
On Tue, Oct 27, 2015 at 4:26 AM, Ilia Mirkinwrote: >> + >> +static void >> +copy_image(struct pipe_context *pipe, >> + struct pipe_resource *dst, >> + unsigned dst_level, >> + unsigned dstx, unsigned dsty, unsigned dstz, >> + struct pipe_resource *src, >> + unsigned src_level, >> + const struct pipe_box *src_box) >> +{ >> + if (src->format == dst->format || >> + util_format_is_compressed(src->format) || >> + util_format_is_compressed(dst->format)) { > > If only :( > > Situation: src internal format = GL_RGBA, dst internal format = > GL_BGRA, but both resources end up with PIPE_FORMAT_RGBA8. > > You end up not flipping the channels here. All of these decisions must > be done based on the GL format, not the PIPE format... I don't understand. The GL format doesn't specify component ordering, only the pipe format does. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] st/mesa: implement ARB_copy_image
On 26.10.2015 02:25, Marek Olšák wrote: > > +/** > + * Handle complex format conversions using 2 blits with a temporary texture > + * in between, e.g. blitting from B10G10R10A2 to G16R16. > + * > + * This example is implemented this way: > + * 1) First, blit from B10G10R10A2 to R10G10B10A2, which is canonical, so it > + *can be reinterpreted as a different canonical format of the same bpp, > + *such as R16G16. This blit only swaps R and B 10-bit components. > + * 2) Finnaly, blit the result, which is R10G10B10A2, as R16G16 to G16R16. > + *This blit only swaps R and G 16-bit components. In this example, some of the G10 bits will be covered by R16 and some of them by G16, so step 2) will tear the G10 bits apart and shuffle them around, won't it? Is that really what's supposed to happen in that case? Maybe I'm misunderstanding the example. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2] nouveau: fix double free when screen_create fails
On 27/10/2015 11:08, Julien Isorce wrote: Looks good though what happened to the del around if (!oclass) in nv30_screen_create ? Yeah, good catch. I think we could use FAIL_SCREEN_INIT() there. I'll send a new patch with this fix. Also it seems to fix the other problem around else if (dupfd) which was not closed on failure. Yes, it fixes both issues. On 27 October 2015 at 09:10, samuel.pitoiset> wrote: What about this one http://hastebin.com/uboruxicof.coffee ? This patch is loosely based on your first attempt, except that I removed the call to nouveau_device_del() in nouveau_drm_screen_create(). On 27/10/2015 09:52, Julien Isorce wrote: This patch prevents to call nouveau_device_del twice on the same device. Encountered this case when nvc0_screen_create fails with: nvc0_screen_create:717 - Error allocating PGRAPH context for M2MF: -16 https://bugs.freedesktop.org/show_bug.cgi?id=70354 Signed-off-by: Julien Isorce > --- src/gallium/drivers/nouveau/nouveau_screen.c | 8 ++-- src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 + src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index b2290e7..2bd6d4f 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -177,13 +177,17 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) screen->device = dev; ret = nouveau_client_new(screen->device, >client); - if (ret) + if (ret) { + screen->device = 0; return ret; + } ret = nouveau_pushbuf_new(screen->client, screen->channel, 4, 512 * 1024, 1, >pushbuf); - if (ret) + if (ret) { + screen->device = 0; return ret; + } /* getting CPU time first appears to be more accurate */ screen->cpu_gpu_time_delta = os_time_get(); diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 0330164..54af655 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -411,6 +411,7 @@ nv30_screen_destroy(struct pipe_screen *pscreen) #define FAIL_SCREEN_INIT(str, err) \ do { \ NOUVEAU_ERR(str, err); \ + screen->base.device = 0; \ nv30_screen_destroy(pscreen); \ return NULL; \ } while(0) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index ec51d00..a1fad42 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -905,6 +905,7 @@ nv50_screen_create(struct nouveau_device *dev) return pscreen; fail: + screen->base.device = 0; nv50_screen_destroy(pscreen); return NULL; } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index af8e5f7..28fee35 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -609,6 +609,7 @@ nvc0_screen_resize_tls_area(struct nvc0_screen *screen, #define FAIL_SCREEN_INIT(str, err) \ do { \ NOUVEAU_ERR(str, err); \ + screen->base.device = 0; \ nvc0_screen_destroy(pscreen); \ return NULL; \ } while(0) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] nouveau: fix double free when screen_create fails
On 22 October 2015 at 00:16, Julien Isorcewrote: > The real fix is in nouveau_drm_winsys.c by setting dev to 0. > Which means dev's ownership has been passed to previous call. > Other changes are there to be consistent with what the > screen_create functions already do on errors. > > Encountered this crash because nvc0_screen_create sometimes fails with: > nvc0_screen_create:717 - Error allocating PGRAPH context for M2MF: -16 > Also see: https://bugs.freedesktop.org/show_bug.cgi?id=70354 > > Signed-off-by: Julien Isorce > --- > src/gallium/drivers/nouveau/nv30/nv30_screen.c | 5 - > src/gallium/drivers/nouveau/nv50/nv50_screen.c | 4 +++- > src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 2 ++ > 3 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c > b/src/gallium/drivers/nouveau/nv30/nv30_screen.c > index 0330164..9b8ddac 100644 > --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c > +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c > @@ -425,8 +425,10 @@ nv30_screen_create(struct nouveau_device *dev) > unsigned oclass = 0; > int ret, i; > > - if (!screen) > + if (!screen) { > + nouveau_device_del(); >return NULL; > + } > Imho having these in screen_create() seems like the wrong 'layer'. Shouldn't one call nouveau_device_dev() from within nouveau_drm_screen_unref and explicitly call the latter if the calloc() (here and in nv50/nvc0) fails ? -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 92687] Add support for ARB_internalformat_query2
https://bugs.freedesktop.org/show_bug.cgi?id=92687 Alejandro Piñeiro (freenode IRC: apinheiro)changed: What|Removed |Added Summary|Add support for |Add support for |EXT_internalformat_query2 |ARB_internalformat_query2 -- You are receiving this mail because: You are the QA Contact for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2] nouveau: fix double free when screen_create fails
What about this one http://hastebin.com/uboruxicof.coffee ? This patch is loosely based on your first attempt, except that I removed the call to nouveau_device_del() in nouveau_drm_screen_create(). On 27/10/2015 09:52, Julien Isorce wrote: This patch prevents to call nouveau_device_del twice on the same device. Encountered this case when nvc0_screen_create fails with: nvc0_screen_create:717 - Error allocating PGRAPH context for M2MF: -16 https://bugs.freedesktop.org/show_bug.cgi?id=70354 Signed-off-by: Julien Isorce--- src/gallium/drivers/nouveau/nouveau_screen.c | 8 ++-- src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 + src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index b2290e7..2bd6d4f 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -177,13 +177,17 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) screen->device = dev; ret = nouveau_client_new(screen->device, >client); - if (ret) + if (ret) { + screen->device = 0; return ret; + } ret = nouveau_pushbuf_new(screen->client, screen->channel, 4, 512 * 1024, 1, >pushbuf); - if (ret) + if (ret) { + screen->device = 0; return ret; + } /* getting CPU time first appears to be more accurate */ screen->cpu_gpu_time_delta = os_time_get(); diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 0330164..54af655 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -411,6 +411,7 @@ nv30_screen_destroy(struct pipe_screen *pscreen) #define FAIL_SCREEN_INIT(str, err)\ do { \ NOUVEAU_ERR(str, err); \ + screen->base.device = 0;\ nv30_screen_destroy(pscreen); \ return NULL;\ } while(0) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index ec51d00..a1fad42 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -905,6 +905,7 @@ nv50_screen_create(struct nouveau_device *dev) return pscreen; fail: + screen->base.device = 0; nv50_screen_destroy(pscreen); return NULL; } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index af8e5f7..28fee35 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -609,6 +609,7 @@ nvc0_screen_resize_tls_area(struct nvc0_screen *screen, #define FAIL_SCREEN_INIT(str, err)\ do { \ NOUVEAU_ERR(str, err); \ + screen->base.device = 0;\ nvc0_screen_destroy(pscreen); \ return NULL;\ } while(0) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: fix error type for GetFramebufferAttachmentParameteriv
Reviewed-by: Samuel Iglesias GonsálvezOn 27/10/15 08:11, Tapani Pälli wrote: > Fixes following failing dEQP test: >dEQP-GLES3.functional.fbo.api.attachment_query_empty_fbo > > Signed-off-by: Tapani Pälli > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92649 > Cc: "11.0" > --- > src/mesa/main/fbobject.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c > index fe6bdc2..d91fb4a 100644 > --- a/src/mesa/main/fbobject.c > +++ b/src/mesa/main/fbobject.c > @@ -3540,8 +3540,9 @@ _mesa_get_framebuffer_attachment_parameter(struct > gl_context *ctx, > const struct gl_renderbuffer_attachment *att; > GLenum err; > > - /* The error differs in GL and GLES. */ > - err = _mesa_is_desktop_gl(ctx) ? GL_INVALID_OPERATION : GL_INVALID_ENUM; > + /* The error differs between GL/GLES3 and GLES 2.0. */ > + err = _mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx) ? > + GL_INVALID_OPERATION : GL_INVALID_ENUM; > > if (_mesa_is_winsys_fbo(buffer)) { >/* Page 126 (page 136 of the PDF) of the OpenGL ES 2.0.25 spec > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Intent to work on support for ARB_internalformat_query2
Hi! Chris, On mar, 2015-10-27 at 21:45 +1300, Chris Forbes wrote: > Presumably ARB_internalformat_query2? Eduardo meant ARB_internalformat_query2, indeed. > On Tue, Oct 27, 2015 at 9:31 PM, Eduardo Lima Mitev> wrote: > Hello, > > This is an announcement that a few folks at Igalia team are > planning to > work on adding support for EXT_internalformat_query2 extension > to Mesa. > > If somebody had started work on this already, or has any input > that is > relevant to the implementation, we would be very thankful to > hear about it. > > I just filed a bug [1] to track progress. Feel free to add > your comments > there too. > > That's all! > > cheers, > Eduardo > > [1] https://bugs.freedesktop.org/show_bug.cgi?id=92687 > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4] nir: add a load-combine pass
For now, this pass can handle ssbo load combines within the same block. This is useful, for example, to make code such as this: buffer SSBO { mat4 sm4; }; uniform mat4 um4; void main() { sm4 *= um4; } go from 16 SSBO loads down to only 4. --- src/glsl/Makefile.sources | 1 + src/glsl/nir/nir.h | 2 + src/glsl/nir/nir_opt_load_combine.c | 357 3 files changed, 360 insertions(+) create mode 100644 src/glsl/nir/nir_opt_load_combine.c diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources index ca87036..6f12434 100644 --- a/src/glsl/Makefile.sources +++ b/src/glsl/Makefile.sources @@ -67,6 +67,7 @@ NIR_FILES = \ nir/nir_opt_dead_cf.c \ nir/nir_opt_gcm.c \ nir/nir_opt_global_to_local.c \ + nir/nir_opt_load_combine.c \ nir/nir_opt_peephole_ffma.c \ nir/nir_opt_peephole_select.c \ nir/nir_opt_remove_phis.c \ diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 04a21a7..8881fc7 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -2015,6 +2015,8 @@ bool nir_opt_dead_cf(nir_shader *shader); void nir_opt_gcm(nir_shader *shader); +bool nir_opt_load_combine(nir_shader *shader); + bool nir_opt_peephole_select(nir_shader *shader); bool nir_opt_peephole_ffma(nir_shader *shader); diff --git a/src/glsl/nir/nir_opt_load_combine.c b/src/glsl/nir/nir_opt_load_combine.c new file mode 100644 index 000..926b1ab --- /dev/null +++ b/src/glsl/nir/nir_opt_load_combine.c @@ -0,0 +1,357 @@ +/* + * Copyright © 2015 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + *Iago Toral Quiroga+ * + */ + +/* + * Implements a load-combine pass for load/store instructions. Similar to a + * CSE pass, but needs to consider invalidation of cached loads by stores + * or memory barriers. It only works on local blocks for now. + */ + +#include "nir_instr_set.h" + +/* + * SSBO stores won't invalidate image loads for example, so we want to + * classify load/store operations in groups and only invalidate / reuse + * intrinsics in the same group. + */ +enum intrinsic_groups { + INTRINSIC_GROUP_NONE = 0, + INTRINSIC_GROUP_SSBO +}; + +/* SSBO load/store */ +static bool +is_indirect_store_ssbo(nir_intrinsic_instr *intrinsic) +{ + switch (intrinsic->intrinsic) { + case nir_intrinsic_store_ssbo_indirect: + case nir_intrinsic_ssbo_atomic_add: + case nir_intrinsic_ssbo_atomic_imin: + case nir_intrinsic_ssbo_atomic_umin: + case nir_intrinsic_ssbo_atomic_imax: + case nir_intrinsic_ssbo_atomic_umax: + case nir_intrinsic_ssbo_atomic_and: + case nir_intrinsic_ssbo_atomic_or: + case nir_intrinsic_ssbo_atomic_xor: + case nir_intrinsic_ssbo_atomic_exchange: + case nir_intrinsic_ssbo_atomic_comp_swap: + return true; + default: + return false; + } +} + +static bool +is_direct_store_ssbo(nir_intrinsic_instr *intrinsic) +{ + switch (intrinsic->intrinsic) { + case nir_intrinsic_store_ssbo: + return true; + default: + return false; + } +} + +static bool +is_indirect_load_ssbo(nir_intrinsic_instr *intrinsic) +{ + switch (intrinsic->intrinsic) { + case nir_intrinsic_load_ssbo_indirect: + return true; + default: + return false; + } +} + +static bool +is_direct_load_ssbo(nir_intrinsic_instr *intrinsic) +{ + switch (intrinsic->intrinsic) { + case nir_intrinsic_load_ssbo: + return true; + default: + return false; + } +} + +/* + * General load/store functions: we'll add more groups to this as needed. + * For now we only support SSBOs. + */ +static bool +is_indirect_store(nir_intrinsic_instr *intrinsic) +{ + return is_indirect_store_ssbo(intrinsic); +} + +static bool +is_direct_store(nir_intrinsic_instr *intrinsic) +{ + return is_direct_store_ssbo(intrinsic); +} + +static bool
[Mesa-dev] [PATCH 1/4] nir/instr_set: Add an allow_loads field
We need this so we can configure different behaviors for passes that cannot deal with side-effectful instructions (CSE) and passes that can (we will add a load-combine pass shortly). For now, when allow_loads is true, we let the instruction set rewrite SSBO loads. --- src/glsl/nir/nir_instr_set.c | 51 src/glsl/nir/nir_instr_set.h | 20 - src/glsl/nir/nir_opt_cse.c | 4 ++-- 3 files changed, 50 insertions(+), 25 deletions(-) diff --git a/src/glsl/nir/nir_instr_set.c b/src/glsl/nir/nir_instr_set.c index d3f939f..583618f 100644 --- a/src/glsl/nir/nir_instr_set.c +++ b/src/glsl/nir/nir_instr_set.c @@ -398,6 +398,13 @@ dest_is_ssa(nir_dest *dest, void *data) return dest->is_ssa; } +static bool +is_load(nir_intrinsic_instr *instr) +{ + return instr->intrinsic == nir_intrinsic_load_ssbo || + instr->intrinsic == nir_intrinsic_load_ssbo_indirect; +} + /* This function determines if uses of an instruction can safely be rewritten * to use another identical instruction instead. Note that this function must * be kept in sync with hash_instr() and nir_instrs_equal() -- only @@ -406,7 +413,7 @@ dest_is_ssa(nir_dest *dest, void *data) */ static bool -instr_can_rewrite(nir_instr *instr) +instr_can_rewrite(nir_instr *instr, bool allow_loads) { /* We only handle SSA. */ if (!nir_foreach_dest(instr, dest_is_ssa, NULL) || @@ -428,11 +435,15 @@ instr_can_rewrite(nir_instr *instr) return true; } case nir_instr_type_intrinsic: { + nir_intrinsic_instr *intrinsic = nir_instr_as_intrinsic(instr); const nir_intrinsic_info *info = - _intrinsic_infos[nir_instr_as_intrinsic(instr)->intrinsic]; - return (info->flags & NIR_INTRINSIC_CAN_ELIMINATE) && - (info->flags & NIR_INTRINSIC_CAN_REORDER) && - info->num_variables == 0; /* not implemented yet */ + _intrinsic_infos[intrinsic->intrinsic]; + bool can_eliminate_and_reorder = + (info->flags & NIR_INTRINSIC_CAN_ELIMINATE) && + (info->flags & NIR_INTRINSIC_CAN_REORDER) && + info->num_variables == 0; /* not implemented yet */ + return can_eliminate_and_reorder ? + true: allow_loads && is_load(intrinsic); } case nir_instr_type_call: case nir_instr_type_jump: @@ -475,25 +486,29 @@ cmp_func(const void *data1, const void *data2) return nir_instrs_equal(data1, data2); } -struct set * -nir_instr_set_create(void *mem_ctx) +struct nir_instr_set * +nir_instr_set_create(void *mem_ctx, bool allow_loads) { - return _mesa_set_create(mem_ctx, hash_instr, cmp_func); + struct nir_instr_set *instr_set = ralloc(mem_ctx, struct nir_instr_set); + instr_set->set = _mesa_set_create(mem_ctx, hash_instr, cmp_func); + instr_set->allow_loads = allow_loads; + return instr_set; } void -nir_instr_set_destroy(struct set *instr_set) +nir_instr_set_destroy(struct nir_instr_set *instr_set) { - _mesa_set_destroy(instr_set, NULL); + _mesa_set_destroy(instr_set->set, NULL); + ralloc_free(instr_set); } bool -nir_instr_set_add_or_rewrite(struct set *instr_set, nir_instr *instr) +nir_instr_set_add_or_rewrite(struct nir_instr_set *instr_set, nir_instr *instr) { - if (!instr_can_rewrite(instr)) + if (!instr_can_rewrite(instr, instr_set->allow_loads)) return false; - struct set_entry *entry = _mesa_set_search(instr_set, instr); + struct set_entry *entry = _mesa_set_search(instr_set->set, instr); if (entry) { nir_ssa_def *def = nir_instr_get_dest_ssa_def(instr); nir_ssa_def *new_def = @@ -502,18 +517,18 @@ nir_instr_set_add_or_rewrite(struct set *instr_set, nir_instr *instr) return true; } - _mesa_set_add(instr_set, instr); + _mesa_set_add(instr_set->set, instr); return false; } void -nir_instr_set_remove(struct set *instr_set, nir_instr *instr) +nir_instr_set_remove(struct nir_instr_set *instr_set, nir_instr *instr) { - if (!instr_can_rewrite(instr)) + if (!instr_can_rewrite(instr, instr_set->allow_loads)) return; - struct set_entry *entry = _mesa_set_search(instr_set, instr); + struct set_entry *entry = _mesa_set_search(instr_set->set, instr); if (entry) - _mesa_set_remove(instr_set, entry); + _mesa_set_remove(instr_set->set, entry); } diff --git a/src/glsl/nir/nir_instr_set.h b/src/glsl/nir/nir_instr_set.h index 939e8dd..d00f9a8 100644 --- a/src/glsl/nir/nir_instr_set.h +++ b/src/glsl/nir/nir_instr_set.h @@ -38,11 +38,20 @@ /*@{*/ -/** Creates an instruction set, using a given ralloc mem_ctx */ -struct set *nir_instr_set_create(void *mem_ctx); +struct nir_instr_set { + struct set *set; + bool allow_loads; +}; + +/** + * Creates an instruction set, using a given ralloc mem_ctx. If allow_loads + * is true, then side-effectful instructions like SSBO loads that can't be + * freely moved around can still be rewritten. + */ +struct nir_instr_set *nir_instr_set_create(void
[Mesa-dev] [PATCH 0/4] Nir: implement a load-combine pass
This follows the load-combine approach suggested by Connor and Jason in this thread: http://lists.freedesktop.org/archives/mesa-dev/2015-October/098052.html The pass works on local blocks only and supports rewriting loads with previous stores too. Only supports SSBO load/store operations at the moment. No regressions observed in piglit and dEQP's SSBO functional tests (dEQP-GLES31.functions.ssbo.*). Iago Toral Quiroga (4): nir/instr_set: Add an allow_loads field nir: add a load-combine pass nir/load_combine: expand the pass to support load-after-store. i965: use the load-combine pass src/glsl/Makefile.sources | 1 + src/glsl/nir/nir.h | 2 + src/glsl/nir/nir_instr_set.c| 51 ++-- src/glsl/nir/nir_instr_set.h| 20 +- src/glsl/nir/nir_opt_cse.c | 4 +- src/glsl/nir/nir_opt_load_combine.c | 460 src/mesa/drivers/dri/i965/brw_nir.c | 2 + 7 files changed, 515 insertions(+), 25 deletions(-) create mode 100644 src/glsl/nir/nir_opt_load_combine.c -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2] nouveau: fix double free when screen_create fails
Looks good though what happened to the del around if (!oclass) in nv30_screen_create ? Also it seems to fix the other problem around else if (dupfd) which was not closed on failure. On 27 October 2015 at 09:10, samuel.pitoisetwrote: > What about this one http://hastebin.com/uboruxicof.coffee ? > > This patch is loosely based on your first attempt, except that I removed > the call > to nouveau_device_del() in nouveau_drm_screen_create(). > > > On 27/10/2015 09:52, Julien Isorce wrote: > >> This patch prevents to call nouveau_device_del twice on the same device. >> >> Encountered this case when nvc0_screen_create fails with: >> nvc0_screen_create:717 - Error allocating PGRAPH context for M2MF: -16 >> >> https://bugs.freedesktop.org/show_bug.cgi?id=70354 >> >> Signed-off-by: Julien Isorce >> --- >> src/gallium/drivers/nouveau/nouveau_screen.c | 8 ++-- >> src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 + >> src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + >> src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + >> 4 files changed, 9 insertions(+), 2 deletions(-) >> >> diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c >> b/src/gallium/drivers/nouveau/nouveau_screen.c >> index b2290e7..2bd6d4f 100644 >> --- a/src/gallium/drivers/nouveau/nouveau_screen.c >> +++ b/src/gallium/drivers/nouveau/nouveau_screen.c >> @@ -177,13 +177,17 @@ nouveau_screen_init(struct nouveau_screen *screen, >> struct nouveau_device *dev) >> screen->device = dev; >> ret = nouveau_client_new(screen->device, >client); >> - if (ret) >> + if (ret) { >> + screen->device = 0; >> return ret; >> + } >> ret = nouveau_pushbuf_new(screen->client, screen->channel, >> 4, 512 * 1024, 1, >> >pushbuf); >> - if (ret) >> + if (ret) { >> + screen->device = 0; >> return ret; >> + } >> /* getting CPU time first appears to be more accurate */ >> screen->cpu_gpu_time_delta = os_time_get(); >> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c >> b/src/gallium/drivers/nouveau/nv30/nv30_screen.c >> index 0330164..54af655 100644 >> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c >> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c >> @@ -411,6 +411,7 @@ nv30_screen_destroy(struct pipe_screen *pscreen) >> #define FAIL_SCREEN_INIT(str, err)\ >> do { \ >> NOUVEAU_ERR(str, err); \ >> + screen->base.device = 0;\ >> nv30_screen_destroy(pscreen); \ >> return NULL;\ >> } while(0) >> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c >> b/src/gallium/drivers/nouveau/nv50/nv50_screen.c >> index ec51d00..a1fad42 100644 >> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c >> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c >> @@ -905,6 +905,7 @@ nv50_screen_create(struct nouveau_device *dev) >> return pscreen; >> fail: >> + screen->base.device = 0; >> nv50_screen_destroy(pscreen); >> return NULL; >> } >> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c >> b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c >> index af8e5f7..28fee35 100644 >> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c >> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c >> @@ -609,6 +609,7 @@ nvc0_screen_resize_tls_area(struct nvc0_screen >> *screen, >> #define FAIL_SCREEN_INIT(str, err)\ >> do { \ >> NOUVEAU_ERR(str, err); \ >> + screen->base.device = 0;\ >> nvc0_screen_destroy(pscreen); \ >> return NULL;\ >> } while(0) >> > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 92645] kodi vdpau interop fails since mesa, meta: move gl_texture_object::TargetIndex initializations
https://bugs.freedesktop.org/show_bug.cgi?id=92645 --- Comment #1 from Marek Olšák--- Created attachment 119221 --> https://bugs.freedesktop.org/attachment.cgi?id=119221=edit possible fix Could you please test this patch? -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] nouveau: fix double free when screen_create fails
On 27/10/2015 11:37, Emil Velikov wrote: On 22 October 2015 at 00:16, Julien Isorcewrote: The real fix is in nouveau_drm_winsys.c by setting dev to 0. Which means dev's ownership has been passed to previous call. Other changes are there to be consistent with what the screen_create functions already do on errors. Encountered this crash because nvc0_screen_create sometimes fails with: nvc0_screen_create:717 - Error allocating PGRAPH context for M2MF: -16 Also see: https://bugs.freedesktop.org/show_bug.cgi?id=70354 Signed-off-by: Julien Isorce --- src/gallium/drivers/nouveau/nv30/nv30_screen.c | 5 - src/gallium/drivers/nouveau/nv50/nv50_screen.c | 4 +++- src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 0330164..9b8ddac 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -425,8 +425,10 @@ nv30_screen_create(struct nouveau_device *dev) unsigned oclass = 0; int ret, i; - if (!screen) + if (!screen) { + nouveau_device_del(); return NULL; + } Imho having these in screen_create() seems like the wrong 'layer'. Shouldn't one call nouveau_device_dev() from within nouveau_drm_screen_unref and explicitly call the latter if the calloc() (here and in nv50/nvc0) fails ? We can't do that because nouveau_drm_screen_unref() needs a valid nouveau_screen object and in this case it is NULL. I agree that it's not really an elegant fix but we don't really have the choice actually. In my opinion, this is not that bad. -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] main: fix GL_MAX_NUM_ACTIVE_VARIABLES value for shader storage blocks
The maximum number of active variables for shader storage blocks should take into account the specific rules for shader storage blocks, i.e. for an active shader storage block member declared as an array, an entry will be generated only for the first array element, regardless of its type. Fixes 3 dEQP-GLES31.functional.* tests: dEQP-GLES31.functional.program_interface_query.shader_storage_block.active_variables.named_block dEQP-GLES31.functional.program_interface_query.shader_storage_block.active_variables.unnamed_block dEQP-GLES31.functional.program_interface_query.shader_storage_block.active_variables.block_array Signed-off-by: Samuel Iglesias Gonsalvez--- src/mesa/main/program_resource.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c index eb71fdd..b7e25fe 100644 --- a/src/mesa/main/program_resource.c +++ b/src/mesa/main/program_resource.c @@ -119,7 +119,6 @@ _mesa_GetProgramInterfaceiv(GLuint program, GLenum programInterface, case GL_MAX_NUM_ACTIVE_VARIABLES: switch (programInterface) { case GL_UNIFORM_BLOCK: - case GL_SHADER_STORAGE_BLOCK: for (i = 0, *params = 0; i < shProg->NumProgramResourceList; i++) { if (shProg->ProgramResourceList[i].Type == programInterface) { struct gl_uniform_block *block = @@ -129,6 +128,26 @@ _mesa_GetProgramInterfaceiv(GLuint program, GLenum programInterface, } } break; + case GL_SHADER_STORAGE_BLOCK: + for (i = 0, *params = 0; i < shProg->NumProgramResourceList; i++) { +if (shProg->ProgramResourceList[i].Type == programInterface) { + struct gl_uniform_block *block = + (struct gl_uniform_block *) + shProg->ProgramResourceList[i].Data; + GLint block_params = 0; + for (unsigned j = 0; j < block->NumUniforms; j++) { + const char *iname = block->Uniforms[j].IndexName; + struct gl_program_resource *uni = + _mesa_program_resource_find_name(shProg, GL_BUFFER_VARIABLE, + iname, NULL); + if (!uni) + continue; + block_params++; + } + *params = MAX2(*params, block_params); +} + } + break; case GL_ATOMIC_COUNTER_BUFFER: for (i = 0, *params = 0; i < shProg->NumProgramResourceList; i++) { if (shProg->ProgramResourceList[i].Type == programInterface) { -- 2.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4] i965: use the load-combine pass
--- src/mesa/drivers/dri/i965/brw_nir.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c index 11f1113..dd3b06c 100644 --- a/src/mesa/drivers/dri/i965/brw_nir.c +++ b/src/mesa/drivers/dri/i965/brw_nir.c @@ -170,6 +170,8 @@ nir_optimize(nir_shader *nir, bool is_scalar) nir_validate_shader(nir); progress |= nir_opt_constant_folding(nir); nir_validate_shader(nir); + progress |= nir_opt_load_combine(nir); + nir_validate_shader(nir); progress |= nir_opt_dead_cf(nir); nir_validate_shader(nir); progress |= nir_opt_remove_phis(nir); -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/4] nir/load_combine: expand the pass to support load-after-store.
--- src/glsl/nir/nir_opt_load_combine.c | 107 +++- 1 file changed, 105 insertions(+), 2 deletions(-) diff --git a/src/glsl/nir/nir_opt_load_combine.c b/src/glsl/nir/nir_opt_load_combine.c index 926b1ab..effba13 100644 --- a/src/glsl/nir/nir_opt_load_combine.c +++ b/src/glsl/nir/nir_opt_load_combine.c @@ -288,6 +288,102 @@ set_invalidate_for_store(struct nir_instr_set *instr_set, } } +static unsigned +get_store_writemask(nir_intrinsic_instr *instr) +{ + switch (instr->intrinsic) { + case nir_intrinsic_store_ssbo: + case nir_intrinsic_store_ssbo_indirect: + return instr->const_index[1]; + case nir_intrinsic_ssbo_atomic_add: + case nir_intrinsic_ssbo_atomic_imin: + case nir_intrinsic_ssbo_atomic_umin: + case nir_intrinsic_ssbo_atomic_imax: + case nir_intrinsic_ssbo_atomic_umax: + case nir_intrinsic_ssbo_atomic_and: + case nir_intrinsic_ssbo_atomic_or: + case nir_intrinsic_ssbo_atomic_xor: + case nir_intrinsic_ssbo_atomic_exchange: + case nir_intrinsic_ssbo_atomic_comp_swap: + return 0x1; + default: + assert(!"not implemented"); + } +} + +/* + * Traverses the set of load/store intrinsics trying to find a previous store + * operation to the same block/offset which we can reuse to re-write a load + * from the same block/offset. + */ +static bool +rewrite_load_with_store(struct nir_instr_set *instr_set, +nir_intrinsic_instr *load) +{ + nir_src *load_block = NULL; + nir_src *load_offset = NULL; + unsigned load_const_offset; + get_load_store_address(load, _block, _offset, _const_offset); + + for (struct set_entry *entry = _mesa_set_next_entry(instr_set->set, NULL); +entry != NULL; entry = _mesa_set_next_entry(instr_set->set, entry)) { + + nir_instr *instr = (nir_instr *) entry->key; + if (instr->type != nir_instr_type_intrinsic) + continue; + + nir_intrinsic_instr *store = nir_instr_as_intrinsic(instr); + if (!is_store(store)) + continue; + + nir_src *store_block = NULL; + nir_src *store_offset = NULL; + unsigned store_const_offset; + get_load_store_address(store, _block, _offset, + _const_offset); + + /* The store must write to all the channels we are loading */ + unsigned store_writemask = get_store_writemask(store); + bool writes_all_channels = true; + for (int i = 0; i < load->num_components; i++) { + if (!((1 << i) & store_writemask)) { +writes_all_channels = false; +break; + } + } + if (!writes_all_channels) + continue; + + /* blocks must match */ + if ((load_block->ssa->parent_instr->type != + store_block->ssa->parent_instr->type) || + !nir_srcs_equal(*store_block, *load_block)) + continue; + + /* address type (indirect/direct) must match */ + if (!load_offset != !store_offset) + continue; + + /* indirect address mismatch */ + if (load_offset && store_offset && + !nir_srcs_equal(*store_offset, *load_offset)) + continue; + + /* direct address mismatch */ + if (!load_offset && !store_offset && + store_const_offset != load_const_offset) + continue; + + /* rewrite the load with this store */ + nir_ssa_def *def = >dest.ssa; + nir_ssa_def *new_def = store->src[0].ssa; + nir_ssa_def_rewrite_uses(def, nir_src_for_ssa(new_def)); + return true; + } + + return false; +} + static bool load_combine_block(nir_block *block) { @@ -304,14 +400,21 @@ load_combine_block(nir_block *block) nir_intrinsic_instr *intrinsic = nir_instr_as_intrinsic(instr); if (is_load(intrinsic)) { - /* Try to rewrite with a previous load */ + /* Try to rewrite with a previous load, if that fails, try to + * rewrite with a previous store + */ if (nir_instr_set_add_or_rewrite(instr_set, instr)) { progress = true; nir_instr_remove(instr); + } else if(rewrite_load_with_store(instr_set, intrinsic)) { +progress = true; } } else if (is_store(intrinsic)) { - /* Invalidate conflicting load/stores */ + /* Invalidate conflicting load/stores and add the store to the set + * so we can rewrite future loads with it + */ set_invalidate_for_store(instr_set, intrinsic); + _mesa_set_add(instr_set->set, instr); } else if (is_memory_barrier(intrinsic)) { /* If we see a memory barrier we have to invalidate all cached * load/store operations -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] st/mesa: implement ARB_copy_image
On Tue, Oct 27, 2015 at 10:33 AM, Michel Dänzerwrote: > On 26.10.2015 02:25, Marek Olšák wrote: >> >> +/** >> + * Handle complex format conversions using 2 blits with a temporary texture >> + * in between, e.g. blitting from B10G10R10A2 to G16R16. >> + * >> + * This example is implemented this way: >> + * 1) First, blit from B10G10R10A2 to R10G10B10A2, which is canonical, so it >> + *can be reinterpreted as a different canonical format of the same bpp, >> + *such as R16G16. This blit only swaps R and B 10-bit components. >> + * 2) Finnaly, blit the result, which is R10G10B10A2, as R16G16 to G16R16. >> + *This blit only swaps R and G 16-bit components. > > In this example, some of the G10 bits will be covered by R16 and some of > them by G16, so step 2) will tear the G10 bits apart and shuffle them > around, won't it? Is that really what's supposed to happen in that case? > Maybe I'm misunderstanding the example. Yes, that's correct. ARB_copy_image is memcpy-like. RGB10A2 -> R16G16 must be memcpy. BGRA channel ordering doesn't exist in OpenGL. The code only deals with GR and BGRA swizzling in gallium and reorders those to standard RGBA, so that the memcpy can be executed. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2] mesa: Draw indirect is not allowed if the default VAO is bound.
Reviewed-by: Tapani PälliOn 10/26/2015 11:58 AM, Marta Lofstedt wrote: From: Marta Lofstedt From OpenGL ES 3.1 specification, section 10.5: "DrawArraysIndirect requires that all data sourced for the command, including the DrawArraysIndirectCommand structure, be in buffer objects, and may not be called when the default vertex array object is bound." Signed-off-by: Marta Lofstedt --- src/mesa/main/api_validate.c | 12 1 file changed, 12 insertions(+) diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index a46c194..40a2f43 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -698,6 +698,18 @@ valid_draw_indirect(struct gl_context *ctx, { const GLsizeiptr end = (GLsizeiptr)indirect + size; + /* OpenGL ES 3.1 spec. section 10.5: +* +* "DrawArraysIndirect requires that all data sourced for the +* command, including the DrawArraysIndirectCommand +* structure, be in buffer objects, and may not be called when +* the default vertex array object is bound." +*/ + if (ctx->Array.VAO == ctx->Array.DefaultVAO) { + _mesa_error(ctx, GL_INVALID_OPERATION, "(no VAO bound)"); + return GL_FALSE; + } + if (!_mesa_valid_prim_mode(ctx, mode, name)) return GL_FALSE; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] nouveau: fix double free when screen_create fails
On 27/10/2015 12:52, Emil Velikov wrote: On 27 October 2015 at 10:50, samuel.pitoisetwrote: On 27/10/2015 11:37, Emil Velikov wrote: On 22 October 2015 at 00:16, Julien Isorce wrote: The real fix is in nouveau_drm_winsys.c by setting dev to 0. Which means dev's ownership has been passed to previous call. Other changes are there to be consistent with what the screen_create functions already do on errors. Encountered this crash because nvc0_screen_create sometimes fails with: nvc0_screen_create:717 - Error allocating PGRAPH context for M2MF: -16 Also see: https://bugs.freedesktop.org/show_bug.cgi?id=70354 Signed-off-by: Julien Isorce --- src/gallium/drivers/nouveau/nv30/nv30_screen.c | 5 - src/gallium/drivers/nouveau/nv50/nv50_screen.c | 4 +++- src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 0330164..9b8ddac 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -425,8 +425,10 @@ nv30_screen_create(struct nouveau_device *dev) unsigned oclass = 0; int ret, i; - if (!screen) + if (!screen) { + nouveau_device_del(); return NULL; + } Imho having these in screen_create() seems like the wrong 'layer'. Shouldn't one call nouveau_device_dev() from within nouveau_drm_screen_unref and explicitly call the latter if the calloc() (here and in nv50/nvc0) fails ? We can't do that because nouveau_drm_screen_unref() needs a valid nouveau_screen object and in this case it is NULL. Ouch I was under the impression that we've brought back the concept of winsys in nouveau with the hash_table patches. Seems like we haven't :( If we are to do so (split things just like the radeon/amdgpu winsys) then we can kill two birds with one stone. The missing device_del() on calloc failure as well as other error paths in nvxx_screen_create(). Okay, I'll have a look at how radeon/amdgpu split those things. I agree that it's not really an elegant fix but we don't really have the choice actually. In my opinion, this is not that bad. I never said it's "bad" just the wrong place for the fix. Or in other words - if we're to fix things might as well do it properly :-) Sure, I agree. :) -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: join calculate_array_size() and calculate_array_stride()
Reviewed-by: Samuel Iglesias GonsálvezOn 27/10/15 12:55, Juha-Pekka Heikkila wrote: > These helpers are ran for same case the same loop. Here joined > their operation so the loop is ran just once. Also fixed > out-of-memory condition here. > > v2: Make the loop simpler to read as per Tapani's suggestion > > Signed-off-by: Juha-Pekka Heikkila > --- > src/glsl/linker.cpp | 190 > ++-- > 1 file changed, 80 insertions(+), 110 deletions(-) > > diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp > index cfd8f81..5404faf 100644 > --- a/src/glsl/linker.cpp > +++ b/src/glsl/linker.cpp > @@ -3504,80 +3504,78 @@ is_top_level_shader_storage_block_member(const char* > name, > return result; > } > > -static void > -calculate_array_size(struct gl_shader_program *shProg, > - struct gl_uniform_storage *uni) > +static int > +get_array_size(struct gl_uniform_storage *uni, const glsl_struct_field > *field, > + char *interface_name, char *var_name) > { > - int block_index = uni->block_index; > - int array_size = -1; > - char *var_name = get_top_level_name(uni->name); > - char *interface_name = > - get_top_level_name(shProg->BufferInterfaceBlocks[block_index].Name); > - > - if (strcmp(var_name, interface_name) == 0) { > - /* Deal with instanced array of SSBOs */ > - char *temp_name = get_var_name(uni->name); > - free(var_name); > - var_name = get_top_level_name(temp_name); > - free(temp_name); > - } > - > - for (unsigned i = 0; i < shProg->NumShaders; i++) { > - if (shProg->Shaders[i] == NULL) > - continue; > - > - const gl_shader *stage = shProg->Shaders[i]; > - foreach_in_list(ir_instruction, node, stage->ir) { > - ir_variable *var = node->as_variable(); > - if (!var || !var->get_interface_type() || > - var->data.mode != ir_var_shader_storage) > -continue; > - > - const glsl_type *interface = var->get_interface_type(); > - > - if (strcmp(interface_name, interface->name) != 0) > -continue; > - > - for (unsigned i = 0; i < interface->length; i++) { > -const glsl_struct_field *field = >fields.structure[i]; > -if (strcmp(field->name, var_name) != 0) > - continue; > -/* From GL_ARB_program_interface_query spec: > - * > - * "For the property TOP_LEVEL_ARRAY_SIZE, a single integer > - * identifying the number of active array elements of the > top-level > - * shader storage block member containing to the active variable > is > - * written to . If the top-level block member is not > - * declared as an array, the value one is written to . > If > - * the top-level block member is an array with no declared size, > - * the value zero is written to . > - */ > -if (is_top_level_shader_storage_block_member(uni->name, > - interface_name, > - var_name)) > - array_size = 1; > -else if (field->type->is_unsized_array()) > - array_size = 0; > -else if (field->type->is_array()) > - array_size = field->type->length; > -else > - array_size = 1; > + /* From GL_ARB_program_interface_query spec: > +* > +* "For the property TOP_LEVEL_ARRAY_SIZE, a single integer > +* identifying the number of active array elements of the top-level > +* shader storage block member containing to the active variable is > +* written to . If the top-level block member is not > +* declared as an array, the value one is written to . If > +* the top-level block member is an array with no declared size, > +* the value zero is written to . > +*/ > + if (is_top_level_shader_storage_block_member(uni->name, > +interface_name, > +var_name)) > + return 1; > + else if (field->type->is_unsized_array()) > + return 0; > + else if (field->type->is_array()) > + return field->type->length; > + > + return 1; > +} > > -goto found_top_level_array_size; > - } > +static int > +get_array_stride(struct gl_uniform_storage *uni, const glsl_type *interface, > + const glsl_struct_field *field, char *interface_name, > + char *var_name) > +{ > + /* From GL_ARB_program_interface_query: > +* > +* "For the property TOP_LEVEL_ARRAY_STRIDE, a single integer > +* identifying the stride between array elements of the top-level > +* shader storage block member containing the active variable is > +* written to .
Re: [Mesa-dev] [PATCH 1/2] mesa: add fragdata_arrays list to gl_shader
Reviewed-by: Marta Lofstedt> -Original Message- > From: Palli, Tapani > Sent: Tuesday, October 27, 2015 12:19 PM > To: mesa-dev@lists.freedesktop.org > Cc: Lofstedt, Marta; Palli, Tapani > Subject: [PATCH 1/2] mesa: add fragdata_arrays list to gl_shader > > This is required to store information about fragdata arrays, currently these > variables get lost and cannot be retrieved later in sensible way for program > interface queries. List will be utilized by next patch. > > Patch also modifies opt_dead_builtin_varyings pass to build list when > lowering fragdata arrays. This is identical approach as taken with packed > varyings pass. > > Signed-off-by: Tapani Pälli > --- > src/glsl/opt_dead_builtin_varyings.cpp | 42 +-- > --- > src/mesa/main/mtypes.h | 1 + > 2 files changed, 27 insertions(+), 16 deletions(-) > > diff --git a/src/glsl/opt_dead_builtin_varyings.cpp > b/src/glsl/opt_dead_builtin_varyings.cpp > index 31719d2..68b70ee 100644 > --- a/src/glsl/opt_dead_builtin_varyings.cpp > +++ b/src/glsl/opt_dead_builtin_varyings.cpp > @@ -269,14 +269,14 @@ public: > */ > class replace_varyings_visitor : public ir_rvalue_visitor { > public: > - replace_varyings_visitor(exec_list *ir, > + replace_varyings_visitor(struct gl_shader *sha, > const varying_info_visitor *info, > unsigned external_texcoord_usage, > unsigned external_color_usage, > bool external_has_fog) > - : info(info), new_fog(NULL) > + : shader(sha), info(info), new_fog(NULL) > { > - void *const ctx = ir; > + void *const ctx = shader->ir; > >memset(this->new_fragdata, 0, sizeof(this->new_fragdata)); >memset(this->new_texcoord, 0, sizeof(this->new_texcoord)); @@ - > 293,14 +293,16 @@ public: > * occurrences of gl_TexCoord will be replaced with. > */ >if (info->lower_texcoord_array) { > - prepare_array(ir, this->new_texcoord, ARRAY_SIZE(this- > >new_texcoord), > + prepare_array(shader->ir, this->new_texcoord, > + ARRAY_SIZE(this->new_texcoord), > VARYING_SLOT_TEX0, "TexCoord", mode_str, > info->texcoord_usage, external_texcoord_usage); >} > >/* Handle gl_FragData in the same way like gl_TexCoord. */ >if (info->lower_fragdata_array) { > - prepare_array(ir, this->new_fragdata, ARRAY_SIZE(this- > >new_fragdata), > + prepare_array(shader->ir, this->new_fragdata, > + ARRAY_SIZE(this->new_fragdata), > FRAG_RESULT_DATA0, "FragData", mode_str, > info->fragdata_usage, (1 << MAX_DRAW_BUFFERS) - 1); >} > @@ -340,7 +342,7 @@ public: >} > >/* Now do the replacing. */ > - visit_list_elements(this, ir); > + visit_list_elements(this, shader->ir); > } > > void prepare_array(exec_list *ir, > @@ -389,6 +391,13 @@ public: >/* Remove the gl_FragData array. */ >if (this->info->lower_fragdata_array && >var == this->info->fragdata_array) { > + > + /* Clone variable for program resource list before it is removed. */ > + if (!shader->fragdata_arrays) > +shader->fragdata_arrays = new (shader) exec_list; > + > + shader->fragdata_arrays->push_tail(var->clone(shader, NULL)); > + > var->remove(); >} > > @@ -487,6 +496,7 @@ public: > } > > private: > + struct gl_shader *shader; > const varying_info_visitor *info; > ir_variable *new_fragdata[MAX_DRAW_BUFFERS]; > ir_variable *new_texcoord[MAX_TEXTURE_COORD_UNITS]; > @@ -498,20 +508,20 @@ private: > } /* anonymous namespace */ > > static void > -lower_texcoord_array(exec_list *ir, const varying_info_visitor *info) > +lower_texcoord_array(struct gl_shader *shader, const > +varying_info_visitor *info) > { > - replace_varyings_visitor(ir, info, > + replace_varyings_visitor(shader, info, > (1 << MAX_TEXTURE_COORD_UNITS) - 1, > 1 | 2, true); } > > static void > -lower_fragdata_array(exec_list *ir) > +lower_fragdata_array(struct gl_shader *shader) > { > varying_info_visitor info(ir_var_shader_out, true); > - info.get(ir, 0, NULL); > + info.get(shader->ir, 0, NULL); > > - replace_varyings_visitor(ir, , 0, 0, 0); > + replace_varyings_visitor(shader, , 0, 0, 0); > } > > > @@ -523,7 +533,7 @@ do_dead_builtin_varyings(struct gl_context *ctx, { > /* Lower the gl_FragData array to separate variables. */ > if (consumer && consumer->Stage == MESA_SHADER_FRAGMENT) { > - lower_fragdata_array(consumer->ir); > + lower_fragdata_array(consumer); > } > > /* Lowering of built-in varyings has no effect with the
Re: [Mesa-dev] [PATCH 1/2] gbm: Add a flag to enable creation of rotated scanout buffers
On Fri, Oct 23, 2015 at 06:25:55PM -0700, Vivek Kasireddy wrote: > On Fri, 23 Oct 2015 15:29:08 +0300 > Ville Syrjäläwrote: > > > On Fri, Oct 23, 2015 at 12:18:39PM +0900, Michel Dänzer wrote: > > > On 23.10.2015 10:44, Vivek Kasireddy wrote: > > > > For certain platforms that support rotated scanout buffers, > > > > currently, there is no way to create them with the GBM DRI > > > > interface. This flag will instruct the DRI driver to create the > > > > buffer by setting additional requirements. > > > > > > > > Cc: Kristian Hogsberg > > > > Signed-off-by: Vivek Kasireddy > > > > --- > > > > include/GL/internal/dri_interface.h | 1 + > > > > src/gbm/backends/dri/gbm_dri.c | 9 +++-- > > > > src/gbm/main/gbm.h | 5 + > > > > 3 files changed, 13 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/include/GL/internal/dri_interface.h > > > > b/include/GL/internal/dri_interface.h index a0f155a..2271217 > > > > 100644 --- a/include/GL/internal/dri_interface.h > > > > +++ b/include/GL/internal/dri_interface.h > > > > @@ -1091,6 +1091,7 @@ struct __DRIdri2ExtensionRec { > > > > #define __DRI_IMAGE_USE_SCANOUT0x0002 > > > > #define __DRI_IMAGE_USE_CURSOR 0x0004 /* > > > > Depricated */ #define __DRI_IMAGE_USE_LINEAR0x0008 > > > > +#define __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270 > > > > 0x0010 > > > > > > > > /** > > > > > > Thank you for splitting out the driver change. Sorry I didn't think > > > of this before, but it might be worth splitting out the > > > dri_interface.h change as well. I'm fine either way, though. > > > > > > > > > > diff --git a/src/gbm/backends/dri/gbm_dri.c > > > > b/src/gbm/backends/dri/gbm_dri.c index 57cdeac..cde63de 100644 > > > > --- a/src/gbm/backends/dri/gbm_dri.c > > > > +++ b/src/gbm/backends/dri/gbm_dri.c > > > > @@ -539,7 +539,7 @@ gbm_dri_is_format_supported(struct gbm_device > > > > *gbm, break; > > > > case GBM_BO_FORMAT_ARGB: > > > > case GBM_FORMAT_ARGB: > > > > - if (usage & GBM_BO_USE_SCANOUT) > > > > + if (usage & (GBM_BO_USE_SCANOUT | > > > > GBM_BO_USE_SCANOUT_ROTATED_90_270)) return 0; > > > >break; > > > > default: > > > > @@ -748,6 +748,8 @@ gbm_dri_bo_import(struct gbm_device *gbm, > > > > > > > > if (usage & GBM_BO_USE_SCANOUT) > > > >dri_use |= __DRI_IMAGE_USE_SCANOUT; > > > > + if (usage & GBM_BO_USE_SCANOUT_ROTATED_90_270) > > > > + dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270; > > > > if (usage & GBM_BO_USE_CURSOR) > > > >dri_use |= __DRI_IMAGE_USE_CURSOR; > > > > if (dri->image->base.version >= 2 && > > > > @@ -786,7 +788,8 @@ create_dumb(struct gbm_device *gbm, > > > > > > > > is_cursor = (usage & GBM_BO_USE_CURSOR) != 0 && > > > >format == GBM_FORMAT_ARGB; > > > > - is_scanout = (usage & GBM_BO_USE_SCANOUT) != 0 && > > > > + is_scanout = (usage & (GBM_BO_USE_SCANOUT | > > > > + GBM_BO_USE_SCANOUT_ROTATED_90_270)) != 0 && > > > >format == GBM_FORMAT_XRGB; > > > > if (!is_cursor && !is_scanout) { > > > >errno = EINVAL; > > > > @@ -880,6 +883,8 @@ gbm_dri_bo_create(struct gbm_device *gbm, > > > > > > > > if (usage & GBM_BO_USE_SCANOUT) > > > >dri_use |= __DRI_IMAGE_USE_SCANOUT; > > > > + if (usage & GBM_BO_USE_SCANOUT_ROTATED_90_270) > > > > + dri_use |= __DRI_IMAGE_USE_SCANOUT_ROTATED_90_270; > > > > if (usage & GBM_BO_USE_CURSOR) > > > >dri_use |= __DRI_IMAGE_USE_CURSOR; > > > > if (usage & GBM_BO_USE_LINEAR) > > > > diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h > > > > index 2708e50..2ef7bd8 100644 > > > > --- a/src/gbm/main/gbm.h > > > > +++ b/src/gbm/main/gbm.h > > > > @@ -213,6 +213,11 @@ enum gbm_bo_flags { > > > > * Buffer is linear, i.e. not tiled. > > > > */ > > > > GBM_BO_USE_LINEAR = (1 << 4), > > > > + /** > > > > +* Buffer would be rotated and some platforms have additional > > > > tiling > > > > +* requirements for 90/270 rotated buffers. > > > > +*/ > > > > + GBM_BO_USE_SCANOUT_ROTATED_90_270 = (1 << 5), > > > > }; > > > > > > > > int > > > > > > > > > > I asked internally, and apparently our display hardware requires a > > > rotation specific tiling mode for 180 degree rotation as well. In > > > order to avoid having to add *_SCANOUT_ROTATED_180 later, would > > > *_SCANOUT_ROTATED work for you as well? Or would using Y-tiling for > > > 180 degree rotation be an issue? > > > > What about a bit per angle? To avoid hardware specifics. > > Hi Ville, > I am not sure what's the best way to move forward as you know our > (Intel) new hardware needs Y-tiling only for 90/270. Not sure what's the problem. A bit per angle should work for everyone AFAICS. The already existing scanout flag could be considered to mean 0 degrees. -- Ville Syrjälä Intel OTC
Re: [Mesa-dev] [PATCH 18/20] i965: Program the push constants state using the gather table
Francisco Jerezwrites: > Abdiel Janulgue writes: > >> Use the gather table generated from the uniform uploads and >> ir_binop_ubo_load to gather and pack the constants to the gather pool. >> >> Note that the 3DSTATE_CONSTANT_* packet now refers to the gather >> pool generated by the resource streamer instead of the constant buffer >> pointed to by an offset of the dynamic state base address. >> >> v2: Support GEN8 + non-trivial rebase. >> >> Signed-off-by: Abdiel Janulgue >> --- >> src/mesa/drivers/dri/i965/brw_state.h | 2 +- >> src/mesa/drivers/dri/i965/gen6_gs_state.c | 2 +- >> src/mesa/drivers/dri/i965/gen6_vs_state.c | 2 +- >> src/mesa/drivers/dri/i965/gen6_wm_state.c | 2 +- >> src/mesa/drivers/dri/i965/gen7_vs_state.c | 84 >> +++ >> 5 files changed, 79 insertions(+), 13 deletions(-) >> >> diff --git a/src/mesa/drivers/dri/i965/brw_state.h >> b/src/mesa/drivers/dri/i965/brw_state.h >> index c7c7e0b..a1e6c73 100644 >> --- a/src/mesa/drivers/dri/i965/brw_state.h >> +++ b/src/mesa/drivers/dri/i965/brw_state.h >> @@ -361,7 +361,7 @@ brw_upload_pull_constants(struct brw_context *brw, >> void >> gen7_upload_constant_state(struct brw_context *brw, >> const struct brw_stage_state *stage_state, >> - bool active, unsigned opcode); >> + bool active, unsigned opcode, unsigned >> gather_op); >> >> void gen7_rs_control(struct brw_context *brw, int enable); >> >> diff --git a/src/mesa/drivers/dri/i965/gen6_gs_state.c >> b/src/mesa/drivers/dri/i965/gen6_gs_state.c >> index eb4c586..79a899e 100644 >> --- a/src/mesa/drivers/dri/i965/gen6_gs_state.c >> +++ b/src/mesa/drivers/dri/i965/gen6_gs_state.c >> @@ -48,7 +48,7 @@ gen6_upload_gs_push_constants(struct brw_context *brw) >> } >> >> if (brw->gen >= 7) >> - gen7_upload_constant_state(brw, stage_state, gp, >> _3DSTATE_CONSTANT_GS); >> + gen7_upload_constant_state(brw, stage_state, gp, >> _3DSTATE_CONSTANT_GS, _3DSTATE_GATHER_CONSTANT_GS); >> } >> >> const struct brw_tracked_state gen6_gs_push_constants = { >> diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c >> b/src/mesa/drivers/dri/i965/gen6_vs_state.c >> index d43af5b..bb375b9 100644 >> --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c >> +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c >> @@ -174,7 +174,7 @@ gen6_upload_vs_push_constants(struct brw_context *brw) >> gen7_emit_vs_workaround_flush(brw); >> >>gen7_upload_constant_state(brw, stage_state, true /* active */, >> - _3DSTATE_CONSTANT_VS); >> + _3DSTATE_CONSTANT_VS, >> _3DSTATE_GATHER_CONSTANT_VS); >> } >> } >> >> diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c >> b/src/mesa/drivers/dri/i965/gen6_wm_state.c >> index d1748ba..c7b37c6 100644 >> --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c >> +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c >> @@ -51,7 +51,7 @@ gen6_upload_wm_push_constants(struct brw_context *brw) >> >> if (brw->gen >= 7) { >>gen7_upload_constant_state(brw, >wm.base, true, >> - _3DSTATE_CONSTANT_PS); >> + _3DSTATE_CONSTANT_PS, >> _3DSTATE_GATHER_CONSTANT_PS); >> } >> } >> >> diff --git a/src/mesa/drivers/dri/i965/gen7_vs_state.c >> b/src/mesa/drivers/dri/i965/gen7_vs_state.c >> index b7e4858..cf07658 100644 >> --- a/src/mesa/drivers/dri/i965/gen7_vs_state.c >> +++ b/src/mesa/drivers/dri/i965/gen7_vs_state.c >> @@ -28,19 +28,70 @@ >> #include "program/prog_parameter.h" >> #include "program/prog_statevars.h" >> #include "intel_batchbuffer.h" >> +#include "glsl/glsl_parser_extras.h" >> >> +static void >> +gen7_submit_gather_table(struct brw_context* brw, >> + const struct brw_stage_state *stage_state, >> + const struct brw_stage_prog_data *prog_data, >> + unsigned gather_opcode) >> +{ >> + uint32_t gather_dwords = 3 + prog_data->nr_gather_table; >> + >> + /* Ordinary uniforms are assigned to the first constant buffer slot */ >> + unsigned cb_valid = 1; >> + /* Assign subsequent constant buffer slots to UBOs if any */ >> + cb_valid |= (prog_data->nr_ubo_params > 0) ? >> + (2 << (BRW_UBO_GATHER_INDEX_APPEND + prog_data->max_ubo_const_block)) >> - 1 : 0; >> + >> + assert(cb_valid < 0x); >> + >> + BEGIN_BATCH(gather_dwords); >> + OUT_BATCH(gather_opcode << 16 | (gather_dwords - 2)); >> + OUT_BATCH(SET_FIELD(cb_valid, BRW_GATHER_BUFFER_VALID) | >> + SET_FIELD(BRW_UNIFORM_GATHER_INDEX_START / 16, >> + BRW_GATHER_BINDING_TABLE_BLOCK)); >> + OUT_BATCH(stage_state->push_const_offset); >> + for (int i = 0; i < prog_data->nr_gather_table; i++) { >> + /* Which bo are we
Re: [Mesa-dev] [PATCH 2/2] glsl: add fragdata arrays to program resource list
Reviewed-by: Marta Lofstedt> -Original Message- > From: Palli, Tapani > Sent: Tuesday, October 27, 2015 12:19 PM > To: mesa-dev@lists.freedesktop.org > Cc: Lofstedt, Marta; Palli, Tapani > Subject: [PATCH 2/2] glsl: add fragdata arrays to program resource list > > This makes sure that user is still able to query properties about variables > that > have gotten removed by opt_dead_builtin_varyings pass. > > Fixes following OpenGL ES 3.1 test: >ES31-CTS.program_interface_query.output-layout > > No Piglit regressions. > > Signed-off-by: Tapani Pälli > --- > src/glsl/linker.cpp | 29 + > 1 file changed, 29 insertions(+) > > diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index cfd8f81..e9660fc > 100644 > --- a/src/glsl/linker.cpp > +++ b/src/glsl/linker.cpp > @@ -3386,6 +3386,12 @@ add_interface_variables(struct > gl_shader_program *shProg, >if (strncmp(var->name, "packed:", 7) == 0) > continue; > > + /* Skip fragdata arrays, these are handled separately > + * by add_fragdata_arrays. > + */ > + if (strncmp(var->name, "gl_out_FragData", 15) == 0) > + continue; > + >if (!add_program_resource(shProg, programInterface, var, > build_stageref(shProg, var->name, > var->data.mode) | mask)) @@ > -3425,6 +3431,26 @@ > add_packed_varyings(struct gl_shader_program *shProg, int stage) > return true; > } > > +static bool > +add_fragdata_arrays(struct gl_shader_program *shProg) { > + struct gl_shader *sh = shProg- > >_LinkedShaders[MESA_SHADER_FRAGMENT]; > + > + if (!sh || !sh->fragdata_arrays) > + return true; > + > + foreach_in_list(ir_instruction, node, sh->fragdata_arrays) { > + ir_variable *var = node->as_variable(); > + if (var) { > + assert(var->data.mode == ir_var_shader_out); > + if (!add_program_resource(shProg, GL_PROGRAM_OUTPUT, var, > + (1 << MESA_SHADER_FRAGMENT))) > +return false; > + } > + } > + return true; > +} > + > static char* > get_top_level_name(const char *name) > { > @@ -3701,6 +3727,9 @@ build_program_resource_list(struct > gl_shader_program *shProg) > return; > } > > + if (!add_fragdata_arrays(shProg)) > + return; > + > /* Add inputs and outputs to the resource list. */ > if (!add_interface_variables(shProg, shProg- > >_LinkedShaders[input_stage]->ir, > GL_PROGRAM_INPUT)) > -- > 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: set the texture target in VDPAUMapSurfacesNV
From: Marek OlšákThis is required since 7d7dd1871174905dfdd3ca874a09d9. --- src/mesa/main/vdpau.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/main/vdpau.c b/src/mesa/main/vdpau.c index 0efa56e..0c000c4 100644 --- a/src/mesa/main/vdpau.c +++ b/src/mesa/main/vdpau.c @@ -375,6 +375,9 @@ _mesa_VDPAUMapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces) return; } + tex->Target = surf->target; + tex->TargetIndex = _mesa_tex_target_to_index(ctx, surf->target); + ctx->Driver.FreeTextureImageBuffer(ctx, image); ctx->Driver.VDPAUMapSurface(ctx, surf->target, surf->access, -- 2.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] nouveau: fix double free when screen_create fails
On 27 October 2015 at 10:50, samuel.pitoisetwrote: > On 27/10/2015 11:37, Emil Velikov wrote: >> >> On 22 October 2015 at 00:16, Julien Isorce >> wrote: >>> >>> The real fix is in nouveau_drm_winsys.c by setting dev to 0. >>> Which means dev's ownership has been passed to previous call. >>> Other changes are there to be consistent with what the >>> screen_create functions already do on errors. >>> >>> Encountered this crash because nvc0_screen_create sometimes fails with: >>> nvc0_screen_create:717 - Error allocating PGRAPH context for M2MF: -16 >>> Also see: https://bugs.freedesktop.org/show_bug.cgi?id=70354 >>> >>> Signed-off-by: Julien Isorce >>> --- >>> src/gallium/drivers/nouveau/nv30/nv30_screen.c | 5 - >>> src/gallium/drivers/nouveau/nv50/nv50_screen.c | 4 +++- >>> src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 2 ++ >>> 3 files changed, 9 insertions(+), 2 deletions(-) >>> >>> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c >>> b/src/gallium/drivers/nouveau/nv30/nv30_screen.c >>> index 0330164..9b8ddac 100644 >>> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c >>> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c >>> @@ -425,8 +425,10 @@ nv30_screen_create(struct nouveau_device *dev) >>> unsigned oclass = 0; >>> int ret, i; >>> >>> - if (!screen) >>> + if (!screen) { >>> + nouveau_device_del(); >>> return NULL; >>> + } >>> >> Imho having these in screen_create() seems like the wrong 'layer'. >> Shouldn't one call nouveau_device_dev() from within >> nouveau_drm_screen_unref >> and explicitly call the latter if the calloc() (here and in nv50/nvc0) >> fails ? > > > We can't do that because nouveau_drm_screen_unref() needs a valid > nouveau_screen > object and in this case it is NULL. > Ouch I was under the impression that we've brought back the concept of winsys in nouveau with the hash_table patches. Seems like we haven't :( If we are to do so (split things just like the radeon/amdgpu winsys) then we can kill two birds with one stone. The missing device_del() on calloc failure as well as other error paths in nvxx_screen_create(). > I agree that it's not really an elegant fix but we don't really have the > choice actually. > In my opinion, this is not that bad. > I never said it's "bad" just the wrong place for the fix. Or in other words - if we're to fix things might as well do it properly :-) -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/4] nir/instr_set: Add an allow_loads field
On Tue, Oct 27, 2015 at 10:28:58AM +0100, Iago Toral Quiroga wrote: > We need this so we can configure different behaviors for passes that > cannot deal with side-effectful instructions (CSE) and passes that can > (we will add a load-combine pass shortly). > > For now, when allow_loads is true, we let the instruction set rewrite > SSBO loads. > --- > src/glsl/nir/nir_instr_set.c | 51 > > src/glsl/nir/nir_instr_set.h | 20 - > src/glsl/nir/nir_opt_cse.c | 4 ++-- > 3 files changed, 50 insertions(+), 25 deletions(-) > > diff --git a/src/glsl/nir/nir_instr_set.c b/src/glsl/nir/nir_instr_set.c > index d3f939f..583618f 100644 > --- a/src/glsl/nir/nir_instr_set.c > +++ b/src/glsl/nir/nir_instr_set.c > @@ -398,6 +398,13 @@ dest_is_ssa(nir_dest *dest, void *data) > return dest->is_ssa; > } > > +static bool > +is_load(nir_intrinsic_instr *instr) > +{ > + return instr->intrinsic == nir_intrinsic_load_ssbo || > + instr->intrinsic == nir_intrinsic_load_ssbo_indirect; > +} > + > /* This function determines if uses of an instruction can safely be rewritten > * to use another identical instruction instead. Note that this function must > * be kept in sync with hash_instr() and nir_instrs_equal() -- only > @@ -406,7 +413,7 @@ dest_is_ssa(nir_dest *dest, void *data) > */ > > static bool > -instr_can_rewrite(nir_instr *instr) > +instr_can_rewrite(nir_instr *instr, bool allow_loads) > { > /* We only handle SSA. */ > if (!nir_foreach_dest(instr, dest_is_ssa, NULL) || > @@ -428,11 +435,15 @@ instr_can_rewrite(nir_instr *instr) >return true; > } > case nir_instr_type_intrinsic: { > + nir_intrinsic_instr *intrinsic = nir_instr_as_intrinsic(instr); >const nir_intrinsic_info *info = > - _intrinsic_infos[nir_instr_as_intrinsic(instr)->intrinsic]; > - return (info->flags & NIR_INTRINSIC_CAN_ELIMINATE) && > - (info->flags & NIR_INTRINSIC_CAN_REORDER) && > - info->num_variables == 0; /* not implemented yet */ > + _intrinsic_infos[intrinsic->intrinsic]; > + bool can_eliminate_and_reorder = > + (info->flags & NIR_INTRINSIC_CAN_ELIMINATE) && > + (info->flags & NIR_INTRINSIC_CAN_REORDER) && > + info->num_variables == 0; /* not implemented yet */ > + return can_eliminate_and_reorder ? > + true: allow_loads && is_load(intrinsic); Isn't this just? return can_eliminate_and_reorder || (allow_loads && is_load(intrinsic)); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: set the texture target in VDPAUMapSurfacesNV
On 27.10.2015 13:16, Emil Velikov wrote: Hi Marek, On 27 October 2015 at 11:31, Marek Olšákwrote: From: Marek Olšák This is required since 7d7dd1871174905dfdd3ca874a09d9. Can you add the bugzilla tag please. I'd suspect many of us are not fluent in gl-vdpau interop can you please throw in a small comment. Thinking about the following but I'm sure you can think of something better. "With the said commit the initialization of the Target{,Index} was moved from glBindTexture to glTextureView. One does not need the latter for GL VDPAU interop thus things broke." With those Reviewed-by: Emil Velikov Yeah that explanation sounds sane to me. Patch is Reviewed-by: Christian König as well. Thanks for digging up why that failed, Christian. -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] i965/vec4: Remove unnecessary #includes from the generator.
Reviewed-by: Iago Toral QuirogaOn Sat, 2015-10-24 at 13:20 -0700, Matt Turner wrote: > --- > src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 8 > 1 file changed, 8 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp > b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp > index 6569d81..d50184a 100644 > --- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp > +++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp > @@ -20,18 +20,10 @@ > * IN THE SOFTWARE. > */ > > -#include > #include "glsl/glsl_parser_extras.h" > #include "brw_vec4.h" > #include "brw_cfg.h" > > -extern "C" { > -#include "brw_eu.h" > -#include "main/macros.h" > -#include "program/prog_print.h" > -#include "program/prog_parameter.h" > -}; > - > using namespace brw; > > static void ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] glsl: add fragdata arrays to program resource list
This makes sure that user is still able to query properties about variables that have gotten removed by opt_dead_builtin_varyings pass. Fixes following OpenGL ES 3.1 test: ES31-CTS.program_interface_query.output-layout No Piglit regressions. Signed-off-by: Tapani Pälli--- src/glsl/linker.cpp | 29 + 1 file changed, 29 insertions(+) diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index cfd8f81..e9660fc 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -3386,6 +3386,12 @@ add_interface_variables(struct gl_shader_program *shProg, if (strncmp(var->name, "packed:", 7) == 0) continue; + /* Skip fragdata arrays, these are handled separately + * by add_fragdata_arrays. + */ + if (strncmp(var->name, "gl_out_FragData", 15) == 0) + continue; + if (!add_program_resource(shProg, programInterface, var, build_stageref(shProg, var->name, var->data.mode) | mask)) @@ -3425,6 +3431,26 @@ add_packed_varyings(struct gl_shader_program *shProg, int stage) return true; } +static bool +add_fragdata_arrays(struct gl_shader_program *shProg) +{ + struct gl_shader *sh = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]; + + if (!sh || !sh->fragdata_arrays) + return true; + + foreach_in_list(ir_instruction, node, sh->fragdata_arrays) { + ir_variable *var = node->as_variable(); + if (var) { + assert(var->data.mode == ir_var_shader_out); + if (!add_program_resource(shProg, GL_PROGRAM_OUTPUT, var, + (1 << MESA_SHADER_FRAGMENT))) +return false; + } + } + return true; +} + static char* get_top_level_name(const char *name) { @@ -3701,6 +3727,9 @@ build_program_resource_list(struct gl_shader_program *shProg) return; } + if (!add_fragdata_arrays(shProg)) + return; + /* Add inputs and outputs to the resource list. */ if (!add_interface_variables(shProg, shProg->_LinkedShaders[input_stage]->ir, GL_PROGRAM_INPUT)) -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 69589] [bisected] Piglit gl-3.2-draw-buffers-errors fails
https://bugs.freedesktop.org/show_bug.cgi?id=69589 Tapani Pällichanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED Assignee|mesa-dev@lists.freedesktop. |lem...@gmail.com |org | --- Comment #2 from Tapani Pälli --- resolving old bug, test is called gl-3.1-draw-buffers-errors nowadays and it passes fine -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] glsl: add fragdata arrays to program resource list
On Tue, Oct 27, 2015 at 01:18:42PM +0200, Tapani P?lli wrote: > This makes sure that user is still able to query properties about > variables that have gotten removed by opt_dead_builtin_varyings pass. > > Fixes following OpenGL ES 3.1 test: >ES31-CTS.program_interface_query.output-layout > > No Piglit regressions. > > Signed-off-by: Tapani Pälli> --- > src/glsl/linker.cpp | 29 + > 1 file changed, 29 insertions(+) > > diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp > index cfd8f81..e9660fc 100644 > --- a/src/glsl/linker.cpp > +++ b/src/glsl/linker.cpp > @@ -3386,6 +3386,12 @@ add_interface_variables(struct gl_shader_program > *shProg, >if (strncmp(var->name, "packed:", 7) == 0) > continue; > > + /* Skip fragdata arrays, these are handled separately > + * by add_fragdata_arrays. > + */ > + if (strncmp(var->name, "gl_out_FragData", 15) == 0) > + continue; > + >if (!add_program_resource(shProg, programInterface, var, > build_stageref(shProg, var->name, > var->data.mode) | mask)) > @@ -3425,6 +3431,26 @@ add_packed_varyings(struct gl_shader_program *shProg, > int stage) > return true; > } > > +static bool > +add_fragdata_arrays(struct gl_shader_program *shProg) > +{ > + struct gl_shader *sh = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]; > + > + if (!sh || !sh->fragdata_arrays) > + return true; > + > + foreach_in_list(ir_instruction, node, sh->fragdata_arrays) { > + ir_variable *var = node->as_variable(); > + if (var) { > + assert(var->data.mode == ir_var_shader_out); > + if (!add_program_resource(shProg, GL_PROGRAM_OUTPUT, var, > + (1 << MESA_SHADER_FRAGMENT))) You can drop the extra (). ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] mesa: add fragdata_arrays list to gl_shader
This is required to store information about fragdata arrays, currently these variables get lost and cannot be retrieved later in sensible way for program interface queries. List will be utilized by next patch. Patch also modifies opt_dead_builtin_varyings pass to build list when lowering fragdata arrays. This is identical approach as taken with packed varyings pass. Signed-off-by: Tapani Pälli--- src/glsl/opt_dead_builtin_varyings.cpp | 42 +- src/mesa/main/mtypes.h | 1 + 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/glsl/opt_dead_builtin_varyings.cpp b/src/glsl/opt_dead_builtin_varyings.cpp index 31719d2..68b70ee 100644 --- a/src/glsl/opt_dead_builtin_varyings.cpp +++ b/src/glsl/opt_dead_builtin_varyings.cpp @@ -269,14 +269,14 @@ public: */ class replace_varyings_visitor : public ir_rvalue_visitor { public: - replace_varyings_visitor(exec_list *ir, + replace_varyings_visitor(struct gl_shader *sha, const varying_info_visitor *info, unsigned external_texcoord_usage, unsigned external_color_usage, bool external_has_fog) - : info(info), new_fog(NULL) + : shader(sha), info(info), new_fog(NULL) { - void *const ctx = ir; + void *const ctx = shader->ir; memset(this->new_fragdata, 0, sizeof(this->new_fragdata)); memset(this->new_texcoord, 0, sizeof(this->new_texcoord)); @@ -293,14 +293,16 @@ public: * occurrences of gl_TexCoord will be replaced with. */ if (info->lower_texcoord_array) { - prepare_array(ir, this->new_texcoord, ARRAY_SIZE(this->new_texcoord), + prepare_array(shader->ir, this->new_texcoord, + ARRAY_SIZE(this->new_texcoord), VARYING_SLOT_TEX0, "TexCoord", mode_str, info->texcoord_usage, external_texcoord_usage); } /* Handle gl_FragData in the same way like gl_TexCoord. */ if (info->lower_fragdata_array) { - prepare_array(ir, this->new_fragdata, ARRAY_SIZE(this->new_fragdata), + prepare_array(shader->ir, this->new_fragdata, + ARRAY_SIZE(this->new_fragdata), FRAG_RESULT_DATA0, "FragData", mode_str, info->fragdata_usage, (1 << MAX_DRAW_BUFFERS) - 1); } @@ -340,7 +342,7 @@ public: } /* Now do the replacing. */ - visit_list_elements(this, ir); + visit_list_elements(this, shader->ir); } void prepare_array(exec_list *ir, @@ -389,6 +391,13 @@ public: /* Remove the gl_FragData array. */ if (this->info->lower_fragdata_array && var == this->info->fragdata_array) { + + /* Clone variable for program resource list before it is removed. */ + if (!shader->fragdata_arrays) +shader->fragdata_arrays = new (shader) exec_list; + + shader->fragdata_arrays->push_tail(var->clone(shader, NULL)); + var->remove(); } @@ -487,6 +496,7 @@ public: } private: + struct gl_shader *shader; const varying_info_visitor *info; ir_variable *new_fragdata[MAX_DRAW_BUFFERS]; ir_variable *new_texcoord[MAX_TEXTURE_COORD_UNITS]; @@ -498,20 +508,20 @@ private: } /* anonymous namespace */ static void -lower_texcoord_array(exec_list *ir, const varying_info_visitor *info) +lower_texcoord_array(struct gl_shader *shader, const varying_info_visitor *info) { - replace_varyings_visitor(ir, info, + replace_varyings_visitor(shader, info, (1 << MAX_TEXTURE_COORD_UNITS) - 1, 1 | 2, true); } static void -lower_fragdata_array(exec_list *ir) +lower_fragdata_array(struct gl_shader *shader) { varying_info_visitor info(ir_var_shader_out, true); - info.get(ir, 0, NULL); + info.get(shader->ir, 0, NULL); - replace_varyings_visitor(ir, , 0, 0, 0); + replace_varyings_visitor(shader, , 0, 0, 0); } @@ -523,7 +533,7 @@ do_dead_builtin_varyings(struct gl_context *ctx, { /* Lower the gl_FragData array to separate variables. */ if (consumer && consumer->Stage == MESA_SHADER_FRAGMENT) { - lower_fragdata_array(consumer->ir); + lower_fragdata_array(consumer); } /* Lowering of built-in varyings has no effect with the core context and @@ -544,7 +554,7 @@ do_dead_builtin_varyings(struct gl_context *ctx, if (!consumer) { /* At least eliminate unused gl_TexCoord elements. */ if (producer_info.lower_texcoord_array) { -lower_texcoord_array(producer->ir, _info); +lower_texcoord_array(producer, _info); } return; } @@ -556,7 +566,7 @@ do_dead_builtin_varyings(struct gl_context *ctx, if (!producer) { /* At least eliminate unused gl_TexCoord elements. */
[Mesa-dev] [Bug 92645] kodi vdpau interop fails since mesa, meta: move gl_texture_object::TargetIndex initializations
https://bugs.freedesktop.org/show_bug.cgi?id=92645 --- Comment #2 from Andy Furniss--- (In reply to Marek Olšák from comment #1) > Created attachment 119221 [details] [review] > possible fix > > Could you please test this patch? Working OK with the patch, thanks. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] main: fix GL_MAX_NUM_ACTIVE_VARIABLES value for shader storage blocks
Reviewed-by: Tapani PälliOn 10/27/2015 11:08 AM, Samuel Iglesias Gonsalvez wrote: The maximum number of active variables for shader storage blocks should take into account the specific rules for shader storage blocks, i.e. for an active shader storage block member declared as an array, an entry will be generated only for the first array element, regardless of its type. Fixes 3 dEQP-GLES31.functional.* tests: dEQP-GLES31.functional.program_interface_query.shader_storage_block.active_variables.named_block dEQP-GLES31.functional.program_interface_query.shader_storage_block.active_variables.unnamed_block dEQP-GLES31.functional.program_interface_query.shader_storage_block.active_variables.block_array Signed-off-by: Samuel Iglesias Gonsalvez --- src/mesa/main/program_resource.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c index eb71fdd..b7e25fe 100644 --- a/src/mesa/main/program_resource.c +++ b/src/mesa/main/program_resource.c @@ -119,7 +119,6 @@ _mesa_GetProgramInterfaceiv(GLuint program, GLenum programInterface, case GL_MAX_NUM_ACTIVE_VARIABLES: switch (programInterface) { case GL_UNIFORM_BLOCK: - case GL_SHADER_STORAGE_BLOCK: for (i = 0, *params = 0; i < shProg->NumProgramResourceList; i++) { if (shProg->ProgramResourceList[i].Type == programInterface) { struct gl_uniform_block *block = @@ -129,6 +128,26 @@ _mesa_GetProgramInterfaceiv(GLuint program, GLenum programInterface, } } break; + case GL_SHADER_STORAGE_BLOCK: + for (i = 0, *params = 0; i < shProg->NumProgramResourceList; i++) { +if (shProg->ProgramResourceList[i].Type == programInterface) { + struct gl_uniform_block *block = + (struct gl_uniform_block *) + shProg->ProgramResourceList[i].Data; + GLint block_params = 0; + for (unsigned j = 0; j < block->NumUniforms; j++) { + const char *iname = block->Uniforms[j].IndexName; + struct gl_program_resource *uni = + _mesa_program_resource_find_name(shProg, GL_BUFFER_VARIABLE, + iname, NULL); + if (!uni) + continue; + block_params++; + } + *params = MAX2(*params, block_params); +} + } + break; case GL_ATOMIC_COUNTER_BUFFER: for (i = 0, *params = 0; i < shProg->NumProgramResourceList; i++) { if (shProg->ProgramResourceList[i].Type == programInterface) { ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glsl: join calculate_array_size() and calculate_array_stride()
These helpers are ran for same case the same loop. Here joined their operation so the loop is ran just once. Also fixed out-of-memory condition here. v2: Make the loop simpler to read as per Tapani's suggestion Signed-off-by: Juha-Pekka Heikkila--- src/glsl/linker.cpp | 190 ++-- 1 file changed, 80 insertions(+), 110 deletions(-) diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index cfd8f81..5404faf 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -3504,80 +3504,78 @@ is_top_level_shader_storage_block_member(const char* name, return result; } -static void -calculate_array_size(struct gl_shader_program *shProg, - struct gl_uniform_storage *uni) +static int +get_array_size(struct gl_uniform_storage *uni, const glsl_struct_field *field, + char *interface_name, char *var_name) { - int block_index = uni->block_index; - int array_size = -1; - char *var_name = get_top_level_name(uni->name); - char *interface_name = - get_top_level_name(shProg->BufferInterfaceBlocks[block_index].Name); - - if (strcmp(var_name, interface_name) == 0) { - /* Deal with instanced array of SSBOs */ - char *temp_name = get_var_name(uni->name); - free(var_name); - var_name = get_top_level_name(temp_name); - free(temp_name); - } - - for (unsigned i = 0; i < shProg->NumShaders; i++) { - if (shProg->Shaders[i] == NULL) - continue; - - const gl_shader *stage = shProg->Shaders[i]; - foreach_in_list(ir_instruction, node, stage->ir) { - ir_variable *var = node->as_variable(); - if (!var || !var->get_interface_type() || - var->data.mode != ir_var_shader_storage) -continue; - - const glsl_type *interface = var->get_interface_type(); - - if (strcmp(interface_name, interface->name) != 0) -continue; - - for (unsigned i = 0; i < interface->length; i++) { -const glsl_struct_field *field = >fields.structure[i]; -if (strcmp(field->name, var_name) != 0) - continue; -/* From GL_ARB_program_interface_query spec: - * - * "For the property TOP_LEVEL_ARRAY_SIZE, a single integer - * identifying the number of active array elements of the top-level - * shader storage block member containing to the active variable is - * written to . If the top-level block member is not - * declared as an array, the value one is written to . If - * the top-level block member is an array with no declared size, - * the value zero is written to . - */ -if (is_top_level_shader_storage_block_member(uni->name, - interface_name, - var_name)) - array_size = 1; -else if (field->type->is_unsized_array()) - array_size = 0; -else if (field->type->is_array()) - array_size = field->type->length; -else - array_size = 1; + /* From GL_ARB_program_interface_query spec: +* +* "For the property TOP_LEVEL_ARRAY_SIZE, a single integer +* identifying the number of active array elements of the top-level +* shader storage block member containing to the active variable is +* written to . If the top-level block member is not +* declared as an array, the value one is written to . If +* the top-level block member is an array with no declared size, +* the value zero is written to . +*/ + if (is_top_level_shader_storage_block_member(uni->name, +interface_name, +var_name)) + return 1; + else if (field->type->is_unsized_array()) + return 0; + else if (field->type->is_array()) + return field->type->length; + + return 1; +} -goto found_top_level_array_size; - } +static int +get_array_stride(struct gl_uniform_storage *uni, const glsl_type *interface, + const glsl_struct_field *field, char *interface_name, + char *var_name) +{ + /* From GL_ARB_program_interface_query: +* +* "For the property TOP_LEVEL_ARRAY_STRIDE, a single integer +* identifying the stride between array elements of the top-level +* shader storage block member containing the active variable is +* written to . For top-level block members declared as +* arrays, the value written is the difference, in basic machine +* units, between the offsets of the active variable for +* consecutive elements in the top-level array. For top-level +* block members not declared as an array, zero is written to +* ." +*/ + if
Re: [Mesa-dev] [PATCH] mesa: set the texture target in VDPAUMapSurfacesNV
Hi Marek, On 27 October 2015 at 11:31, Marek Olšákwrote: > From: Marek Olšák > > This is required since 7d7dd1871174905dfdd3ca874a09d9. Can you add the bugzilla tag please. I'd suspect many of us are not fluent in gl-vdpau interop can you please throw in a small comment. Thinking about the following but I'm sure you can think of something better. "With the said commit the initialization of the Target{,Index} was moved from glBindTexture to glTextureView. One does not need the latter for GL VDPAU interop thus things broke." With those Reviewed-by: Emil Velikov -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH] mesa: fix error type for GetFramebufferAttachmentParameteriv
On 10/27/2015 12:11 AM, Tapani Pälli wrote: > Fixes following failing dEQP test: >dEQP-GLES3.functional.fbo.api.attachment_query_empty_fbo > > Signed-off-by: Tapani Pälli> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92649 > Cc: "11.0" > --- > src/mesa/main/fbobject.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c > index fe6bdc2..d91fb4a 100644 > --- a/src/mesa/main/fbobject.c > +++ b/src/mesa/main/fbobject.c > @@ -3540,8 +3540,9 @@ _mesa_get_framebuffer_attachment_parameter(struct > gl_context *ctx, > const struct gl_renderbuffer_attachment *att; > GLenum err; > > - /* The error differs in GL and GLES. */ > - err = _mesa_is_desktop_gl(ctx) ? GL_INVALID_OPERATION : GL_INVALID_ENUM; > + /* The error differs between GL/GLES3 and GLES 2.0. */ Could we get quotations from the various specs here? That would have saved me some time. The commit log for 000896c0 as the GLES2 reference. For GLES 3.0, Section 6.1.13 (Framebuffer Object Queries) of the OpenGL ES 3.0.4 spec says: "If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, no framebuffer is bound to target. In this case querying pname FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero, and all other queries will generate an INVALID_OPERATION error." The GLES2 reference in the commit above is Section 6.1.3 (Enumerated Queries). I feel a bit conflicted about this change. Section F.2 (Differences in Runtime Behavior) of the OpenGL ES 3.0.4 spec lists three subtle (but possibly important) differences between ES2 and ES3. This list does *not* include changed errors. I don't have any specific recollection about these changes, but this causes me to believe that these are corrects to ES2. What do the CTS and dEQP do if you... - Always generate GL_INVALID_OPERATION. - Only return an ES2 context. If all the GLES2 conformance tests and the dEQP-GLES2 tests still pass, I would be inclined to just always do GL_INVALID_OPERATION. > + err = _mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx) ? > + GL_INVALID_OPERATION : GL_INVALID_ENUM; > > if (_mesa_is_winsys_fbo(buffer)) { >/* Page 126 (page 136 of the PDF) of the OpenGL ES 2.0.25 spec > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: set the texture target in VDPAUMapSurfacesNV
Sorry for causing this regression. Thanks for fixing it. Question below... On 10/27/2015 05:31 AM, Marek Olšák wrote: From: Marek OlšákThis is required since 7d7dd1871174905dfdd3ca874a09d9. --- src/mesa/main/vdpau.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/main/vdpau.c b/src/mesa/main/vdpau.c index 0efa56e..0c000c4 100644 --- a/src/mesa/main/vdpau.c +++ b/src/mesa/main/vdpau.c @@ -375,6 +375,9 @@ _mesa_VDPAUMapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces) return; } + tex->Target = surf->target; + tex->TargetIndex = _mesa_tex_target_to_index(ctx, surf->target); + ctx->Driver.FreeTextureImageBuffer(ctx, image); ctx->Driver.VDPAUMapSurface(ctx, surf->target, surf->access, It looks like tex->Target is getting set at line 167. Could you simply initialize tex->TargetIndex at that point too? -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: fix mipmap generation for immutable textures with incomplete pyramids
On Fri, Oct 23, 2015 at 1:28 AM, Nicolai Hähnlewrote: > (This is an alternative to my previous patch, "mesa: clamp MaxLevel for > immutable textures at initialization"; this patch has no opinion about > how the spec should be interpreted.) > > Without the clamping by NumLevels, the state tracker would reallocate the > texture storage (incorrect) and even fail to copy the base level image > after reallocation, leading to the graphical glitch of > https://bugs.freedesktop.org/show_bug.cgi?id=91993 . > > A piglit test has been submitted for review as well (subtest of > arb_texture_storage-texture-storage). > --- > src/mesa/state_tracker/st_gen_mipmap.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/mesa/state_tracker/st_gen_mipmap.c > b/src/mesa/state_tracker/st_gen_mipmap.c > index 26e1c21..3125b2a 100644 > --- a/src/mesa/state_tracker/st_gen_mipmap.c > +++ b/src/mesa/state_tracker/st_gen_mipmap.c > @@ -61,6 +61,8 @@ compute_num_levels(struct gl_context *ctx, > > numLevels = texObj->BaseLevel + baseImage->MaxNumLevels; > numLevels = MIN2(numLevels, (GLuint) texObj->MaxLevel + 1); > + if (texObj->Immutable) > + numLevels = MIN2(numLevels, texObj->NumLevels); > assert(numLevels >= 1); > > return numLevels; Thanks for looking into this. Cc: mesa-sta...@lists.freedesktop.org Reviewed-by: Marek Olšák While this may fix the bug, it's not immediately obvious that it won't reallocate the texture. I think st_generate_mipmap should simply check the immutable flag and skip all the reallocation code. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 92645] kodi vdpau interop fails since mesa, meta: move gl_texture_object::TargetIndex initializations
https://bugs.freedesktop.org/show_bug.cgi?id=92645 Marek Olšákchanged: What|Removed |Added Attachment #119221|0 |1 is obsolete|| --- Comment #3 from Marek Olšák --- Created attachment 119225 --> https://bugs.freedesktop.org/attachment.cgi?id=119225=edit fix 2 The first fix was not completely correct. Would you please test this one? Thanks. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 92645] kodi vdpau interop fails since mesa, meta: move gl_texture_object::TargetIndex initializations
https://bugs.freedesktop.org/show_bug.cgi?id=92645 --- Comment #4 from Andy Furniss--- (In reply to Marek Olšák from comment #3) > Created attachment 119225 [details] [review] > fix 2 > > The first fix was not completely correct. Would you please test this one? > Thanks. fix2 is working OK. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: set the texture target in VDPAUMapSurfacesNV (v2)
Thanks, and sorry, I forgot to update the commit message. I will commit it shortly with that fixed. Marek On Tue, Oct 27, 2015 at 9:19 PM, Brian Paulwrote: > On 10/27/2015 02:17 PM, Marek Olšák wrote: >> >> From: Marek Olšák >> >> We initialized Target, but not TargetIndex. >> This is required since 7d7dd1871174905dfdd3ca874a09d9. >> >> v2: do it in the right place. Noticed by Brian Paul. >> >> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92645 >> --- >> src/mesa/main/vdpau.c | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/src/mesa/main/vdpau.c b/src/mesa/main/vdpau.c >> index 0efa56e..44be3a3 100644 >> --- a/src/mesa/main/vdpau.c >> +++ b/src/mesa/main/vdpau.c >> @@ -163,9 +163,10 @@ register_surface(struct gl_context *ctx, GLboolean >> isOutput, >>return (GLintptr)NULL; >> } >> >> - if (tex->Target == 0) >> + if (tex->Target == 0) { >>tex->Target = target; >> - else if (tex->Target != target) { >> + tex->TargetIndex = _mesa_tex_target_to_index(ctx, target); >> + } else if (tex->Target != target) { >>_mesa_unlock_texture(ctx, tex); >>free(surf); >>_mesa_error(ctx, GL_INVALID_OPERATION, >> > > That looks good. > > Reviewed-by: Brian Paul > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: set the texture target in VDPAUMapSurfacesNV (v2)
On 10/27/2015 02:17 PM, Marek Olšák wrote: From: Marek OlšákWe initialized Target, but not TargetIndex. This is required since 7d7dd1871174905dfdd3ca874a09d9. v2: do it in the right place. Noticed by Brian Paul. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92645 --- src/mesa/main/vdpau.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/vdpau.c b/src/mesa/main/vdpau.c index 0efa56e..44be3a3 100644 --- a/src/mesa/main/vdpau.c +++ b/src/mesa/main/vdpau.c @@ -163,9 +163,10 @@ register_surface(struct gl_context *ctx, GLboolean isOutput, return (GLintptr)NULL; } - if (tex->Target == 0) + if (tex->Target == 0) { tex->Target = target; - else if (tex->Target != target) { + tex->TargetIndex = _mesa_tex_target_to_index(ctx, target); + } else if (tex->Target != target) { _mesa_unlock_texture(ctx, tex); free(surf); _mesa_error(ctx, GL_INVALID_OPERATION, That looks good. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: set the texture target in VDPAUMapSurfacesNV (v2)
From: Marek OlšákWe initialized Target, but not TargetIndex. This is required since 7d7dd1871174905dfdd3ca874a09d9. v2: do it in the right place. Noticed by Brian Paul. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92645 --- src/mesa/main/vdpau.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/vdpau.c b/src/mesa/main/vdpau.c index 0efa56e..44be3a3 100644 --- a/src/mesa/main/vdpau.c +++ b/src/mesa/main/vdpau.c @@ -163,9 +163,10 @@ register_surface(struct gl_context *ctx, GLboolean isOutput, return (GLintptr)NULL; } - if (tex->Target == 0) + if (tex->Target == 0) { tex->Target = target; - else if (tex->Target != target) { + tex->TargetIndex = _mesa_tex_target_to_index(ctx, target); + } else if (tex->Target != target) { _mesa_unlock_texture(ctx, tex); free(surf); _mesa_error(ctx, GL_INVALID_OPERATION, -- 2.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] AMDGPU: add stoney support
Signed-off-by: Alex Deucher--- lib/Target/AMDGPU/Processors.td | 4 1 file changed, 4 insertions(+) diff --git a/lib/Target/AMDGPU/Processors.td b/lib/Target/AMDGPU/Processors.td index d9a0723..a1584a2 100644 --- a/lib/Target/AMDGPU/Processors.td +++ b/lib/Target/AMDGPU/Processors.td @@ -142,3 +142,7 @@ def : ProcessorModel<"carrizo", SIQuarterSpeedModel, def : ProcessorModel<"fiji", SIQuarterSpeedModel, [FeatureVolcanicIslands, FeatureISAVersion8_0_1] >; + +def : ProcessorModel<"stoney", SIQuarterSpeedModel, + [FeatureVolcanicIslands, FeatureISAVersion8_0_1] +>; -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965: Do legacy userclipping in OpenGL ES 1.x contexts.
From: Ian RomanickCommit fba4823a disabled user clipping for everything except compatibility profile. Core profile and OpenGL ES 2.0+ have all removed the classic, OpenGL 1.0 user clip planes. ES 1.x, however, still has them. Fixes OpenGL ES 1.1 conformance mustpass.c and userclip.c Signed-off-by: Ian Romanick Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92639 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92641 --- src/mesa/drivers/dri/i965/brw_vs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 5db4b3a..0b805b1 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -311,7 +311,8 @@ brw_vs_populate_key(struct brw_context *brw, key->program_string_id = vp->id; if (ctx->Transform.ClipPlanesEnabled != 0 && - ctx->API == API_OPENGL_COMPAT && + (ctx->API == API_OPENGL_COMPAT || +ctx->API == API_OPENGLES) && vp->program.Base.ClipDistanceArraySize == 0) { key->nr_userclip_plane_consts = _mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1; -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 12/11] i965: Add scalar geometry shader support.
On Mon, Oct 12, 2015 at 02:55:32PM -0700, Kenneth Graunke wrote: > Signed-off-by: Kenneth Graunke> --- > src/mesa/drivers/dri/i965/brw_fs.cpp | 174 ++ > src/mesa/drivers/dri/i965/brw_fs.h| 16 +- > src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 378 > ++ > src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 49 ++- > src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 21 ++ > 5 files changed, 628 insertions(+), 10 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp > b/src/mesa/drivers/dri/i965/brw_fs.cpp > index dde8c45..778237a 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp > @@ -43,6 +43,7 @@ > #include "brw_wm.h" > #include "brw_fs.h" > #include "brw_cs.h" > +#include "brw_vec4_gs_visitor.h" > #include "brw_cfg.h" > #include "brw_dead_control_flow.h" > #include "main/uniforms.h" > @@ -1347,6 +1348,47 @@ fs_visitor::emit_discard_jump() > } > > void > +fs_visitor::emit_gs_thread_end() > +{ > + assert(stage == MESA_SHADER_GEOMETRY); > + > + if (gs_compile->control_data_header_size_bits > 0) { > + emit_gs_control_data_bits(this->final_gs_vertex_count); > + } > + > + const fs_builder abld = bld.annotate("thread end"); > + fs_inst *inst; > + > + if (gs_compile->prog_data.static_vertex_count != -1) { > + foreach_in_list_reverse(fs_inst, prev, >instructions) { > + if (prev->opcode == SHADER_OPCODE_URB_WRITE_SIMD8 || > + prev->opcode == SHADER_OPCODE_URB_WRITE_SIMD8_MASKED || > + prev->opcode == SHADER_OPCODE_URB_WRITE_SIMD8_PER_SLOT || > + prev->opcode == SHADER_OPCODE_URB_WRITE_SIMD8_MASKED_PER_SLOT) { > +prev->eot = true; > +return; > + } else if (prev->is_control_flow() || prev->has_side_effects()) { > +break; > + } > + } > + fs_reg hdr = abld.vgrf(BRW_REGISTER_TYPE_UD, 1); > + abld.MOV(hdr, fs_reg(retype(brw_vec8_grf(1, 0), > BRW_REGISTER_TYPE_UD))); > + inst = abld.emit(SHADER_OPCODE_URB_WRITE_SIMD8, reg_undef, hdr); > + inst->mlen = 1; > + } else { > + fs_reg payload = abld.vgrf(BRW_REGISTER_TYPE_UD, 2); > + fs_reg *sources = ralloc_array(mem_ctx, fs_reg, 2); > + sources[0] = fs_reg(retype(brw_vec8_grf(1, 0), BRW_REGISTER_TYPE_UD)); > + sources[1] = this->final_gs_vertex_count; > + abld.LOAD_PAYLOAD(payload, sources, 2, 2); > + inst = abld.emit(SHADER_OPCODE_URB_WRITE_SIMD8, reg_undef, payload); > + inst->mlen = 2; > + } > + inst->eot = true; > + inst->offset = 0; > +} > + > +void > fs_visitor::assign_curb_setup() > { > if (dispatch_width == 8) { > @@ -1550,6 +1592,53 @@ fs_visitor::assign_vs_urb_setup() > } > } > > +void > +fs_visitor::assign_gs_urb_setup() > +{ > + assert(stage == MESA_SHADER_GEOMETRY); > + > + const gl_geometry_program *gp = _compile->gp->program; > + brw_vue_prog_data *vue_prog_data = (brw_vue_prog_data *) prog_data; > + > + first_non_payload_grf += > + 8 * vue_prog_data->urb_read_length * gp->VerticesIn; Where does the 8 * come from here? > + > + const unsigned first_icp_handle = payload.num_regs - > + (vue_prog_data->include_vue_handles ? gp->VerticesIn : 0); > + > + foreach_block_and_inst(block, fs_inst, inst, cfg) { > + /* Lower URB_READ_SIMD8 opcodes into real messages. */ > + if (inst->opcode == SHADER_OPCODE_URB_READ_SIMD8) { > + assert(inst->src[0].file == IMM); > + inst->src[0] = retype(brw_vec8_grf(first_icp_handle + > +inst->src[0].fixed_hw_reg.dw1.ud, > +0), BRW_REGISTER_TYPE_UD); > + /* for now, assume constant - we can do per-slot offsets later */ > + assert(inst->src[1].file == IMM); > + inst->offset = inst->src[1].fixed_hw_reg.dw1.ud; > + inst->src[1] = fs_reg(); > + inst->mlen = 1; > + inst->base_mrf = -1; > + } > + > + /* Rewrite all ATTR file references to a real HW_REG. */ > + for (int i = 0; i < inst->sources; i++) { > + if (inst->src[i].file != ATTR) > +continue; > + > + int grf = payload.num_regs + > + prog_data->curb_read_length + > + inst->src[i].reg + > + inst->src[i].reg_offset; > + > + inst->src[i].file = HW_REG; > + inst->src[i].fixed_hw_reg = > +retype(brw_vec8_grf(grf, 0), inst->src[i].type); > + } > + } > +} > + > + > /** > * Split large virtual GRFs into separate components if we can. > * > @@ -4733,6 +4822,46 @@ fs_visitor::setup_vs_payload() > * > */ > void > +fs_visitor::setup_gs_payload() > +{ > + assert(stage == MESA_SHADER_GEOMETRY); > + > + const gl_geometry_program *gp = _compile->gp->program; > + struct brw_gs_prog_data *gs_prog_data = > +
[Mesa-dev] [Bug 92278] Black screen in War Thunder
https://bugs.freedesktop.org/show_bug.cgi?id=92278 --- Comment #7 from Ian Romanick--- (In reply to Tapani Pälli from comment #4) > Created attachment 119200 [details] [review] > hack that fixes issue > > This is slightly cleaner but still just a hack, it looks like we would need > full GL_EXT_direct_state_access and also GL_EXT_depth_bounds_test extension. Why do you think GL_EXT_depth_bounds_test is necessary? Either way... we're absolutely not going to do EXT_dsa. We have ARB_dsa in core profile, and that's what applications should use. Spending a bunch of time to implement the backward-looking extension, at the expense of other features, when we already support the forward-looking functionality doesn't help anyone in the long run. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Do legacy userclipping in OpenGL ES 1.x contexts.
On Tuesday, October 27, 2015 02:56:24 PM Ian Romanick wrote: > From: Ian Romanick> > Commit fba4823a disabled user clipping for everything except > compatibility profile. Core profile and OpenGL ES 2.0+ have all removed > the classic, OpenGL 1.0 user clip planes. ES 1.x, however, still has > them. > > Fixes OpenGL ES 1.1 conformance mustpass.c and userclip.c > > Signed-off-by: Ian Romanick > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92639 > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92641 > --- > src/mesa/drivers/dri/i965/brw_vs.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_vs.c > b/src/mesa/drivers/dri/i965/brw_vs.c > index 5db4b3a..0b805b1 100644 > --- a/src/mesa/drivers/dri/i965/brw_vs.c > +++ b/src/mesa/drivers/dri/i965/brw_vs.c > @@ -311,7 +311,8 @@ brw_vs_populate_key(struct brw_context *brw, > key->program_string_id = vp->id; > > if (ctx->Transform.ClipPlanesEnabled != 0 && > - ctx->API == API_OPENGL_COMPAT && > + (ctx->API == API_OPENGL_COMPAT || > +ctx->API == API_OPENGLES) && > vp->program.Base.ClipDistanceArraySize == 0) { >key->nr_userclip_plane_consts = > _mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1; > Thanks for fixing this, Ian...I looked at ES2 and ES3 but totally forgot about ES1... Reviewed-by: Kenneth Graunke signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 92278] Black screen in War Thunder
https://bugs.freedesktop.org/show_bug.cgi?id=92278 --- Comment #6 from Ian Romanick--- (In reply to Sven Arvidsson from comment #5) > The patch works fine here, awesome work! Fantastic to have it fixed so > quickly! > > The developer of the game is Gaijin Entertainment, http://gaijinent.com > > I could probably open a support ticket with them, but chances are they're > not interested. The FAQ for Linux only mentions "install proprietary > drivers" which is quite hard to do on Intel. I will attempt to make contact with the developer. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 92278] Black screen in War Thunder
https://bugs.freedesktop.org/show_bug.cgi?id=92278 --- Comment #8 from Tapani Pälli--- (In reply to Ian Romanick from comment #7) > (In reply to Tapani Pälli from comment #4) > > Created attachment 119200 [details] [review] [review] > > hack that fixes issue > > > > This is slightly cleaner but still just a hack, it looks like we would need > > full GL_EXT_direct_state_access and also GL_EXT_depth_bounds_test extension. > > Why do you think GL_EXT_depth_bounds_test is necessary? There's calls to glEnable and glDisable with DEPTH_BOUNDS_TEST_EXT, not sure if it is really needed as I haven't spotted any graphical glitches during those scenes. > Either way... we're absolutely not going to do EXT_dsa. We have ARB_dsa in > core profile, and that's what applications should use. Spending a bunch of > time to implement the backward-looking extension, at the expense of other > features, when we already support the forward-looking functionality doesn't > help anyone in the long run. Yep I agree. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] mesa: rename UniformBlockStageIndex to InterfaceBlockStageIndex
Signed-off-by: Jordan JustenCc: Samuel Iglesias Gonsálvez Cc: Iago Toral Quiroga --- src/glsl/link_uniform_initializers.cpp | 2 +- src/glsl/linker.cpp| 16 src/glsl/standalone_scaffolding.cpp| 4 ++-- src/mesa/main/mtypes.h | 11 ++- src/mesa/main/shader_query.cpp | 2 +- src/mesa/main/shaderobj.c | 4 ++-- src/mesa/main/uniforms.c | 4 ++-- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/glsl/link_uniform_initializers.cpp b/src/glsl/link_uniform_initializers.cpp index 682a4ee..58d21e5 100644 --- a/src/glsl/link_uniform_initializers.cpp +++ b/src/glsl/link_uniform_initializers.cpp @@ -178,7 +178,7 @@ set_block_binding(gl_shader_program *prog, const char *block_name, int binding) /* This is a field of a UBO. val is the binding index. */ for (int i = 0; i < MESA_SHADER_STAGES; i++) { - int stage_index = prog->UniformBlockStageIndex[i][block_index]; + int stage_index = prog->InterfaceBlockStageIndex[i][block_index]; if (stage_index != -1) { struct gl_shader *sh = prog->_LinkedShaders[i]; diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index cfd8f81..3db2fd3 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1174,10 +1174,10 @@ interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog) for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) { struct gl_shader *sh = prog->_LinkedShaders[i]; - prog->UniformBlockStageIndex[i] = ralloc_array(prog, int, -max_num_uniform_blocks); + prog->InterfaceBlockStageIndex[i] = ralloc_array(prog, int, + max_num_uniform_blocks); for (unsigned int j = 0; j < max_num_uniform_blocks; j++) -prog->UniformBlockStageIndex[i][j] = -1; +prog->InterfaceBlockStageIndex[i][j] = -1; if (sh == NULL) continue; @@ -1194,7 +1194,7 @@ interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog) return false; } -prog->UniformBlockStageIndex[i][index] = j; +prog->InterfaceBlockStageIndex[i][index] = j; } } @@ -2836,9 +2836,9 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog) } for (unsigned j = 0; j < MESA_SHADER_STAGES; j++) { -if (prog->UniformBlockStageIndex[j][i] != -1) { +if (prog->InterfaceBlockStageIndex[j][i] != -1) { struct gl_shader *sh = prog->_LinkedShaders[j]; -int stage_index = prog->UniformBlockStageIndex[j][i]; +int stage_index = prog->InterfaceBlockStageIndex[j][i]; if (sh && sh->BufferInterfaceBlocks[stage_index].IsShaderStorage) { shader_blocks[j]++; total_shader_storage_blocks++; @@ -2955,7 +2955,7 @@ check_image_resources(struct gl_context *ctx, struct gl_shader_program *prog) total_image_units += sh->NumImages; for (unsigned j = 0; j < prog->NumBufferInterfaceBlocks; j++) { -int stage_index = prog->UniformBlockStageIndex[i][j]; +int stage_index = prog->InterfaceBlockStageIndex[i][j]; if (stage_index != -1 && sh->BufferInterfaceBlocks[stage_index].IsShaderStorage) total_shader_storage_blocks++; } @@ -3734,7 +3734,7 @@ build_program_resource_list(struct gl_shader_program *shProg) int block_index = shProg->UniformStorage[i].block_index; if (block_index != -1) { for (unsigned j = 0; j < MESA_SHADER_STAGES; j++) { - if (shProg->UniformBlockStageIndex[j][block_index] != -1) + if (shProg->InterfaceBlockStageIndex[j][block_index] != -1) stageref |= (1 << j); } } diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp index eccf094..fe1d820 100644 --- a/src/glsl/standalone_scaffolding.cpp +++ b/src/glsl/standalone_scaffolding.cpp @@ -120,8 +120,8 @@ _mesa_clear_shader_program_data(struct gl_shader_program *shProg) shProg->NumShaderStorageBlocks = 0; for (i = 0; i < MESA_SHADER_STAGES; i++) { - ralloc_free(shProg->UniformBlockStageIndex[i]); - shProg->UniformBlockStageIndex[i] = NULL; + ralloc_free(shProg->InterfaceBlockStageIndex[i]); + shProg->InterfaceBlockStageIndex[i] = NULL; } ralloc_free(shProg->AtomicBuffers); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 34120cf..cce959e 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2715,13 +2715,14 @@ struct gl_shader_program struct gl_uniform_block **ShaderStorageBlocks; /** -* Indices into the _LinkedShaders's UniformBlocks[] array for each stage -* they're used in, or -1. +* Indices
[Mesa-dev] [PATCH 3/3] mesa: Use UBO/SSBO indices during binding
Previously we were treating the binding index for Uniform Buffer Objects and Shader Storage Buffer Objects as being part of the combined BufferInterfaceBlocks array. Fixes ES31-CTS.compute_shader.resource-ubo on i965. Signed-off-by: Jordan JustenCc: Samuel Iglesias Gonsálvez Cc: Iago Toral Quiroga --- src/mesa/main/uniforms.c | 30 -- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index 758ca24..47f80ce 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -1002,10 +1002,10 @@ _mesa_UniformBlockBinding(GLuint program, if (!shProg) return; - if (uniformBlockIndex >= shProg->NumBufferInterfaceBlocks) { + if (uniformBlockIndex >= shProg->NumUniformBlocks) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniformBlockBinding(block index %u >= %u)", - uniformBlockIndex, shProg->NumBufferInterfaceBlocks); + uniformBlockIndex, shProg->NumUniformBlocks); return; } @@ -1016,17 +1016,22 @@ _mesa_UniformBlockBinding(GLuint program, return; } - if (shProg->BufferInterfaceBlocks[uniformBlockIndex].Binding != + if (shProg->UniformBlocks[uniformBlockIndex]->Binding != uniformBlockBinding) { int i; FLUSH_VERTICES(ctx, 0); ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer; - shProg->BufferInterfaceBlocks[uniformBlockIndex].Binding = uniformBlockBinding; + const int interface_block_index = + shProg->UboInterfaceBlockIndex[uniformBlockIndex]; + + shProg->BufferInterfaceBlocks[interface_block_index].Binding = + uniformBlockBinding; for (i = 0; i < MESA_SHADER_STAGES; i++) { -int stage_index = shProg->InterfaceBlockStageIndex[i][uniformBlockIndex]; +int stage_index = +shProg->InterfaceBlockStageIndex[i][interface_block_index]; if (stage_index != -1) { struct gl_shader *sh = shProg->_LinkedShaders[i]; @@ -1054,10 +1059,10 @@ _mesa_ShaderStorageBlockBinding(GLuint program, if (!shProg) return; - if (shaderStorageBlockIndex >= shProg->NumBufferInterfaceBlocks) { + if (shaderStorageBlockIndex >= shProg->NumShaderStorageBlocks) { _mesa_error(ctx, GL_INVALID_VALUE, "glShaderStorageBlockBinding(block index %u >= %u)", - shaderStorageBlockIndex, shProg->NumBufferInterfaceBlocks); + shaderStorageBlockIndex, shProg->NumShaderStorageBlocks); return; } @@ -1069,17 +1074,22 @@ _mesa_ShaderStorageBlockBinding(GLuint program, return; } - if (shProg->BufferInterfaceBlocks[shaderStorageBlockIndex].Binding != + if (shProg->ShaderStorageBlocks[shaderStorageBlockIndex]->Binding != shaderStorageBlockBinding) { int i; FLUSH_VERTICES(ctx, 0); ctx->NewDriverState |= ctx->DriverFlags.NewShaderStorageBuffer; - shProg->BufferInterfaceBlocks[shaderStorageBlockIndex].Binding = shaderStorageBlockBinding; + const int interface_block_index = + shProg->SsboInterfaceBlockIndex[shaderStorageBlockIndex]; + + shProg->BufferInterfaceBlocks[interface_block_index].Binding = + shaderStorageBlockBinding; for (i = 0; i < MESA_SHADER_STAGES; i++) { -int stage_index = shProg->InterfaceBlockStageIndex[i][shaderStorageBlockIndex]; +int stage_index = +shProg->InterfaceBlockStageIndex[i][interface_block_index]; if (stage_index != -1) { struct gl_shader *sh = shProg->_LinkedShaders[i]; -- 2.5.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] texgetimage: fix regression with shadow 1d array
On Tue, Oct 27, 2015 at 10:26 PM, Dave Airliewrote: > From: Dave Airlie > > since 1ad305b612f389fb04c6d51847427d5ec72fae03 > Brian Paul > Date: Tue Jul 21 18:35:38 2015 -0600 > > mesa: plumb offset/size parameters through GetTexSubImage code > > I found this testing virgl which exercises a bunch of these > in it's fallbacks. > > Signed-off-by: Dave Airlie > --- > src/mesa/main/texgetimage.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c > index 682b727..b4321fb 100644 > --- a/src/mesa/main/texgetimage.c > +++ b/src/mesa/main/texgetimage.c > @@ -91,9 +91,10 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions, > if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) { >depth = height; >height = 1; > - } > + assert(zoffset + depth <= texImage->Height); > + } else > + assert(zoffset + depth <= texImage->Depth); I would very much prefer if this read } else { ... } Not a big fan of having half of the expr one way, half the other. Either way though, Reviewed-by: Ilia Mirkin > > - assert(zoffset + depth <= texImage->Depth); > for (img = 0; img < depth; img++) { >GLubyte *srcMap; >GLint srcRowStride; > -- > 2.4.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] texgetimage: fix regression with shadow 1d array
From: Dave Airliesince 1ad305b612f389fb04c6d51847427d5ec72fae03 Brian Paul Date: Tue Jul 21 18:35:38 2015 -0600 mesa: plumb offset/size parameters through GetTexSubImage code I found this testing virgl which exercises a bunch of these in it's fallbacks. Signed-off-by: Dave Airlie --- src/mesa/main/texgetimage.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 682b727..b4321fb 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -91,9 +91,10 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions, if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) { depth = height; height = 1; - } + assert(zoffset + depth <= texImage->Height); + } else + assert(zoffset + depth <= texImage->Depth); - assert(zoffset + depth <= texImage->Depth); for (img = 0; img < depth; img++) { GLubyte *srcMap; GLint srcRowStride; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] mesa: Map program UBOs and SSBOs to Interface Blocks
Signed-off-by: Jordan JustenCc: Samuel Iglesias Gonsálvez Cc: Iago Toral Quiroga --- src/glsl/linker.cpp | 14 ++ src/glsl/standalone_scaffolding.cpp | 5 + src/mesa/main/mtypes.h | 7 +++ 3 files changed, 26 insertions(+) diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 3db2fd3..d925393 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -4448,6 +4448,20 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) >ShaderStorageBlocks, >NumShaderStorageBlocks); + prog->UboInterfaceBlockIndex = + ralloc_array(prog, int, prog->NumUniformBlocks); + prog->SsboInterfaceBlockIndex = + ralloc_array(prog, int, prog->NumShaderStorageBlocks); + for (unsigned i = 0, u = 0, s = 0; +i < prog->NumBufferInterfaceBlocks; +i++) { + if (prog->BufferInterfaceBlocks[i].IsShaderStorage) { + prog->SsboInterfaceBlockIndex[s++] = i; + } else { + prog->UboInterfaceBlockIndex[u++] = i; + } + } + /* FINISHME: Assign fragment shader output locations. */ done: diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp index fe1d820..5c76295 100644 --- a/src/glsl/standalone_scaffolding.cpp +++ b/src/glsl/standalone_scaffolding.cpp @@ -124,6 +124,11 @@ _mesa_clear_shader_program_data(struct gl_shader_program *shProg) shProg->InterfaceBlockStageIndex[i] = NULL; } + ralloc_free(shProg->UboInterfaceBlockIndex); + shProg->UboInterfaceBlockIndex = NULL; + ralloc_free(shProg->SsboInterfaceBlockIndex); + shProg->SsboInterfaceBlockIndex = NULL; + ralloc_free(shProg->AtomicBuffers); shProg->AtomicBuffers = NULL; shProg->NumAtomicBuffers = 0; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index cce959e..c1cbe96 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2725,6 +2725,13 @@ struct gl_shader_program int *InterfaceBlockStageIndex[MESA_SHADER_STAGES]; /** +* Indices into the BufferInterfaceBlocks[] array for Uniform Buffer +* Objects and Shader Storage Buffer Objects. +*/ + int *UboInterfaceBlockIndex; + int *SsboInterfaceBlockIndex; + + /** * Map of active uniform names to locations * * Maps any active uniform that is not an array element to a location. -- 2.5.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: join calculate_array_size() and calculate_array_stride()
I did a regression check with CTS, no failures; Tested-by: Tapani PälliOn 10/27/2015 01:55 PM, Juha-Pekka Heikkila wrote: These helpers are ran for same case the same loop. Here joined their operation so the loop is ran just once. Also fixed out-of-memory condition here. v2: Make the loop simpler to read as per Tapani's suggestion Signed-off-by: Juha-Pekka Heikkila --- src/glsl/linker.cpp | 190 ++-- 1 file changed, 80 insertions(+), 110 deletions(-) diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index cfd8f81..5404faf 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -3504,80 +3504,78 @@ is_top_level_shader_storage_block_member(const char* name, return result; } -static void -calculate_array_size(struct gl_shader_program *shProg, - struct gl_uniform_storage *uni) +static int +get_array_size(struct gl_uniform_storage *uni, const glsl_struct_field *field, + char *interface_name, char *var_name) { - int block_index = uni->block_index; - int array_size = -1; - char *var_name = get_top_level_name(uni->name); - char *interface_name = - get_top_level_name(shProg->BufferInterfaceBlocks[block_index].Name); - - if (strcmp(var_name, interface_name) == 0) { - /* Deal with instanced array of SSBOs */ - char *temp_name = get_var_name(uni->name); - free(var_name); - var_name = get_top_level_name(temp_name); - free(temp_name); - } - - for (unsigned i = 0; i < shProg->NumShaders; i++) { - if (shProg->Shaders[i] == NULL) - continue; - - const gl_shader *stage = shProg->Shaders[i]; - foreach_in_list(ir_instruction, node, stage->ir) { - ir_variable *var = node->as_variable(); - if (!var || !var->get_interface_type() || - var->data.mode != ir_var_shader_storage) -continue; - - const glsl_type *interface = var->get_interface_type(); - - if (strcmp(interface_name, interface->name) != 0) -continue; - - for (unsigned i = 0; i < interface->length; i++) { -const glsl_struct_field *field = >fields.structure[i]; -if (strcmp(field->name, var_name) != 0) - continue; -/* From GL_ARB_program_interface_query spec: - * - * "For the property TOP_LEVEL_ARRAY_SIZE, a single integer - * identifying the number of active array elements of the top-level - * shader storage block member containing to the active variable is - * written to . If the top-level block member is not - * declared as an array, the value one is written to . If - * the top-level block member is an array with no declared size, - * the value zero is written to . - */ -if (is_top_level_shader_storage_block_member(uni->name, - interface_name, - var_name)) - array_size = 1; -else if (field->type->is_unsized_array()) - array_size = 0; -else if (field->type->is_array()) - array_size = field->type->length; -else - array_size = 1; + /* From GL_ARB_program_interface_query spec: +* +* "For the property TOP_LEVEL_ARRAY_SIZE, a single integer +* identifying the number of active array elements of the top-level +* shader storage block member containing to the active variable is +* written to . If the top-level block member is not +* declared as an array, the value one is written to . If +* the top-level block member is an array with no declared size, +* the value zero is written to . +*/ + if (is_top_level_shader_storage_block_member(uni->name, +interface_name, +var_name)) + return 1; + else if (field->type->is_unsized_array()) + return 0; + else if (field->type->is_array()) + return field->type->length; + + return 1; +} -goto found_top_level_array_size; - } +static int +get_array_stride(struct gl_uniform_storage *uni, const glsl_type *interface, + const glsl_struct_field *field, char *interface_name, + char *var_name) +{ + /* From GL_ARB_program_interface_query: +* +* "For the property TOP_LEVEL_ARRAY_STRIDE, a single integer +* identifying the stride between array elements of the top-level +* shader storage block member containing the active variable is +* written to . For top-level block members declared as +* arrays, the value written is the difference, in basic machine +* units, between the offsets of the active variable for +* consecutive
Re: [Mesa-dev] [PATCH] main: fix basename match's check if it's an array or struct
On 10/27/2015 04:04 PM, Samuel Iglesias Gonsalvez wrote: Commit 4565b6f did not update the basename match's check for the case that string would exactly match the name of the variable if the suffix "[0]" were appended to it. Fixes two dEQP-GLES31 tests: dEQP-GLES31.functional.program_interface_query.shader_storage_block.resource_list.block_array dEQP-GLES31.functional.program_interface_query.shader_storage_block.resource_list.block_array_single_element These tests are passing already with commit 4565b6f right? I think the 'found' boolean already takes care of this, I need to step through again to make sure though. This function is becoming a bit of a pain because different resources have different naming schemes, I'll have to see if it could be somehow refactored simpler. Signed-off-by: Samuel Iglesias Gonsalvez--- src/mesa/main/shader_query.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index 59ec3d7..6cc91de 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -592,7 +592,8 @@ _mesa_program_resource_find_name(struct gl_shader_program *shProg, /* Basename match, check if array or struct. */ if (name[baselen] == '\0' || name[baselen] == '[' || -name[baselen] == '.') { +name[baselen] == '.' || +rname_has_array_index_zero) { return res; } break; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] main: fix basename match's check if it's an array or struct
Commit 4565b6f did not update the basename match's check for the case that string would exactly match the name of the variable if the suffix "[0]" were appended to it. Fixes two dEQP-GLES31 tests: dEQP-GLES31.functional.program_interface_query.shader_storage_block.resource_list.block_array dEQP-GLES31.functional.program_interface_query.shader_storage_block.resource_list.block_array_single_element Signed-off-by: Samuel Iglesias Gonsalvez--- src/mesa/main/shader_query.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index 59ec3d7..6cc91de 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -592,7 +592,8 @@ _mesa_program_resource_find_name(struct gl_shader_program *shProg, /* Basename match, check if array or struct. */ if (name[baselen] == '\0' || name[baselen] == '[' || -name[baselen] == '.') { +name[baselen] == '.' || +rname_has_array_index_zero) { return res; } break; -- 2.5.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev