Re: [Mesa-dev] [PATCH 6/6] st/dri: implement createImageFromRenderbuffer(2)

2017-10-10 Thread Nicolai Hähnle

On 10.10.2017 18:30, Emil Velikov wrote:

On 6 October 2017 at 21:16, Nicolai Hähnle  wrote:

From: Nicolai Hähnle 

Tested with dEQP-EGL tests.



+.createImageWithModifiers = NULL,
+.createImageFromDmaBufs2  = NULL,
+.queryDmaBufFormats   = NULL,
+.queryDmaBufModifiers = NULL,
+.queryDmaBufFormatModifierAttribs = NULL,


One of the nice things about C99 initializers is that you don't need
these lines ;-)


I added them because it highlights things that are not supported. I'll 
admit that that's a matter of taste.


Cheers,
Nicolai


Eric's got a good point through - please mention the set of tests and
flip the order of 5 and 6.

With the small nitpick with in 4/6 patches 1-4 are
Reviewed-by: Emil Velikov 

I'll send some patches for the i965/!Gallium drivers as a follow-up.

Thanks
Emil



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 6/6] st/dri: implement createImageFromRenderbuffer(2)

2017-10-10 Thread Emil Velikov
On 6 October 2017 at 21:16, Nicolai Hähnle  wrote:
> From: Nicolai Hähnle 
>
> Tested with dEQP-EGL tests.

> +.createImageWithModifiers = NULL,
> +.createImageFromDmaBufs2  = NULL,
> +.queryDmaBufFormats   = NULL,
> +.queryDmaBufModifiers = NULL,
> +.queryDmaBufFormatModifierAttribs = NULL,

One of the nice things about C99 initializers is that you don't need
these lines ;-)
Eric's got a good point through - please mention the set of tests and
flip the order of 5 and 6.

With the small nitpick with in 4/6 patches 1-4 are
Reviewed-by: Emil Velikov 

I'll send some patches for the i965/!Gallium drivers as a follow-up.

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 6/6] st/dri: implement createImageFromRenderbuffer(2)

2017-10-09 Thread Eric Anholt
Nicolai Hähnle  writes:

> From: Nicolai Hähnle 
>
> Tested with dEQP-EGL tests.

The image struct setup and error list all appear to be complete.

Reviewed-by: Eric Anholt 


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 6/6] st/dri: implement createImageFromRenderbuffer(2)

2017-10-06 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Tested with dEQP-EGL tests.
---
 src/gallium/state_trackers/dri/dri2.c|  8 +++-
 src/gallium/state_trackers/dri/dri_helpers.c | 65 +---
 src/gallium/state_trackers/dri/dri_helpers.h |  5 +++
 src/mesa/state_tracker/st_cb_fbo.h   |  5 +++
 4 files changed, 76 insertions(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri2.c 
b/src/gallium/state_trackers/dri/dri2.c
index 86721747878..324e357c358 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1554,38 +1554,44 @@ dri2_unmap_image(__DRIcontext *context, __DRIimage 
*image, void *data)
 static int
 dri2_get_capabilities(__DRIscreen *_screen)
 {
struct dri_screen *screen = dri_screen(_screen);
 
return (screen->can_share_buffer ? __DRI_IMAGE_CAP_GLOBAL_NAMES : 0);
 }
 
 /* The extension is modified during runtime if DRI_PRIME is detected */
 static __DRIimageExtension dri2ImageExtension = {
-.base = { __DRI_IMAGE, 15 },
+.base = { __DRI_IMAGE, 17 },
 
 .createImageFromName  = dri2_create_image_from_name,
 .createImageFromRenderbuffer  = dri2_create_image_from_renderbuffer,
 .destroyImage = dri2_destroy_image,
 .createImage  = dri2_create_image,
 .queryImage   = dri2_query_image,
 .dupImage = dri2_dup_image,
 .validateUsage= dri2_validate_usage,
 .createImageFromNames = dri2_from_names,
 .fromPlanar   = dri2_from_planar,
 .createImageFromTexture   = dri2_create_from_texture,
 .createImageFromFds   = NULL,
 .createImageFromDmaBufs   = NULL,
 .blitImage= dri2_blit_image,
 .getCapabilities  = dri2_get_capabilities,
 .mapImage = dri2_map_image,
 .unmapImage   = dri2_unmap_image,
+.createImageWithModifiers = NULL,
+.createImageFromDmaBufs2  = NULL,
+.queryDmaBufFormats   = NULL,
+.queryDmaBufModifiers = NULL,
+.queryDmaBufFormatModifierAttribs = NULL,
+.createImageFromRenderbuffer2 = dri2_create_image_from_renderbuffer2,
 };
 
 static const __DRIrobustnessExtension dri2Robustness = {
.base = { __DRI2_ROBUSTNESS, 1 }
 };
 
 static int
 dri2_interop_query_device_info(__DRIcontext *_ctx,
struct mesa_glinterop_device_info *out)
 {
diff --git a/src/gallium/state_trackers/dri/dri_helpers.c 
b/src/gallium/state_trackers/dri/dri_helpers.c
index 07c4086310d..06309d8f0ce 100644
--- a/src/gallium/state_trackers/dri/dri_helpers.c
+++ b/src/gallium/state_trackers/dri/dri_helpers.c
@@ -18,20 +18,21 @@
  * 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.
  */
 
 #include 
 #include "util/u_memory.h"
 #include "pipe/p_screen.h"
 #include "state_tracker/st_texture.h"
 #include "state_tracker/st_context.h"
+#include "state_tracker/st_cb_fbo.h"
 #include "main/texobj.h"
 
 #include "dri_helpers.h"
 
 static bool
 dri2_is_opencl_interop_loaded_locked(struct dri_screen *screen)
 {
return screen->opencl_dri_event_add_ref &&
   screen->opencl_dri_event_release &&
   screen->opencl_dri_event_wait &&
@@ -239,30 +240,82 @@ dri2_lookup_egl_image(struct dri_screen *screen, void 
*handle)
if (!loader->lookupEGLImage)
   return NULL;
 
img = loader->lookupEGLImage(screen->sPriv,
handle, screen->sPriv->loaderPrivate);
 
return img;
 }
 
 __DRIimage *
-dri2_create_image_from_renderbuffer(__DRIcontext *context,
-   int renderbuffer, void *loaderPrivate)
+dri2_create_image_from_renderbuffer2(__DRIcontext *context,
+int renderbuffer, void *loaderPrivate,
+ unsigned *error)
 {
-   struct dri_context *ctx = dri_context(context);
+   struct gl_context *ctx = ((struct st_context 
*)dri_context(context)->st)->ctx;
+   struct gl_renderbuffer *rb;
+   struct pipe_resource *tex;
+   __DRIimage *img;
+
+   /* Section 3.9 (EGLImage Specification and Management) of the EGL 1.5
+* specification says:
+*
+*   "If target is EGL_GL_RENDERBUFFER and buffer is not the name of a
+*renderbuffer object, or if buffer is the name of a multisampled
+*renderbuffer object, the error EGL_BAD_PARAMETER is generated."
+*
+*   "If target is EGL_GL_TEXTURE_2D , EGL_GL_TEXTURE_CUBE_MAP_*,
+*EGL_GL_RENDERBUFFER or EGL_GL_TEXTURE_3D and buffer refers to the
+*default GL texture object (0) for the corresponding GL target, the
+*error EGL_BAD_PARAMETER is generated."
+*   (rely on _mesa_lookup_renderbuffer returning NULL in this case)
+*/
+   rb =