[Mesa-dev] [PATCH 0/5] add wayland-drm test with gbm/intel-driver update

2012-07-17 Thread Zhao Halley
I had tried to add YUYV support to dri image(to support overlay), 
however Kristian enabled YUYV as a special planar YUV for wayland 
(two planes which are overlaped).
so I try to follow it and pick up the useful part in my previous patches.
- add tiling support for bo update (from user data)
- add shared_handle (global region name) in gbm
- add YUYV support in gbm
- test case to render XRGB or YUYV buffer to weston

my understanding of current YUV buffer support in mesa is: it can interpret a 
YUV buffer, 
not how to create such buffer. it make me a little nervous to add YUYV to 
gbm since there is no such format in dri image yet (though there is 
WL_DRM_FORMAT_YUYV
for wayland buffer); I just try to use __DRI_IMAGE_FORMAT_GR88 instead to make 
sure it
create buffer with same size.
so, one point I want to seek your comments are:
should we consider YUYV buffer allocation in mesa/gbm?
should we still need a YUYV format for dri image?

thanks.

Zhao Halley (5):
  intel driver: dri image write update
  gbm: add shared_handle(drm buffer region name)
  gbm dri backend: add YUYV support
  wayland: add YUYV to wayland-drm
  test: test case drm-test-client in src/egl/wayland/wayland-drm

 src/egl/wayland/wayland-drm/Makefile.am   |   16 +-
 src/egl/wayland/wayland-drm/drm-test-client.c |  478 +
 src/egl/wayland/wayland-drm/wayland-drm.c |3 +-
 src/gbm/backends/dri/gbm_dri.c|   26 ++
 src/gbm/main/gbm.c|   18 +
 src/gbm/main/gbm.h|8 +-
 src/gbm/main/gbmint.h |2 +
 src/mesa/drivers/dri/intel/intel_screen.c |   17 +-
 8 files changed, 563 insertions(+), 5 deletions(-)
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/Makefile.am
 create mode 100755 src/egl/wayland/wayland-drm/drm-test-client.c
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/wayland-drm.c
 mode change 100644 = 100755 src/gbm/backends/dri/gbm_dri.c
 mode change 100644 = 100755 src/gbm/main/gbm.c
 mode change 100644 = 100755 src/gbm/main/gbm.h
 mode change 100644 = 100755 src/gbm/main/gbmint.h

-- 
1.7.5.4

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


[Mesa-dev] [PATCH 1/5] intel driver: dri image write update

2012-07-17 Thread Zhao Halley
add tiling support for intel_image_write()
all drm image can be written from app
---
 src/mesa/drivers/dri/intel/intel_screen.c |   17 +++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 6daeb05..3ce9a46 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -324,10 +324,13 @@ intel_create_image(__DRIscreen *screen,
   tiling = I915_TILING_NONE;
}
 
+#if 0
+   // add tiling support in intel_image_write(), so all drm images are ok 
for write
/* We only support write for cursor drm images */
if ((use  __DRI_IMAGE_USE_WRITE) 
use != (__DRI_IMAGE_USE_WRITE | __DRI_IMAGE_USE_CURSOR))
   return NULL;
+#endif
 
image = intel_allocate_image(format, loaderPrivate);
image-usage = use;
@@ -417,9 +420,19 @@ intel_image_write(__DRIimage *image, const void *buf, 
size_t count)
if (!(image-usage  __DRI_IMAGE_USE_WRITE))
   return -1;
 
-   drm_intel_bo_map(image-region-bo, true);
+   int tiling, swizzle;
+   dri_bo_get_tiling(image-region-bo, tiling, swizzle);
+   if (tiling != I915_TILING_NONE)
+   drm_intel_gem_bo_map_gtt(image-region-bo);
+   else
+   drm_intel_bo_map(image-region-bo, true);
+   
memcpy(image-region-bo-virtual, buf, count);
-   drm_intel_bo_unmap(image-region-bo);
+
+   if (tiling != I915_TILING_NONE)
+   drm_intel_gem_bo_unmap_gtt(image-region-bo);
+   else
+   drm_intel_bo_unmap(image-region-bo);
 
return 0;
 }
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 2/5] gbm: add shared_handle(drm buffer region name)

2012-07-17 Thread Zhao Halley
---
 src/gbm/backends/dri/gbm_dri.c |   13 +
 src/gbm/main/gbm.c |   18 ++
 src/gbm/main/gbm.h |3 +++
 src/gbm/main/gbmint.h  |2 ++
 4 files changed, 36 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/gbm/backends/dri/gbm_dri.c
 mode change 100644 = 100755 src/gbm/main/gbm.c
 mode change 100644 = 100755 src/gbm/main/gbm.h
 mode change 100644 = 100755 src/gbm/main/gbmint.h

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
old mode 100644
new mode 100755
index f09f6ef..fef9d47
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -344,6 +344,18 @@ gbm_dri_to_gbm_format(uint32_t dri_format)
return ret;
 }
 
+static union gbm_bo_handle
+gbm_dri_bo_get_shared_handle(struct gbm_bo *_bo)
+{
+   struct gbm_dri_device *dri = gbm_dri_device(_bo-gbm);
+   struct gbm_dri_bo *bo = gbm_dri_bo(_bo);
+
+   dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_NAME,
+  (uint32_t *) bo-base.base.shared_handle.u32);
+
+   return bo-base.base.shared_handle;
+}
+
 static struct gbm_bo *
 gbm_dri_bo_import(struct gbm_device *gbm,
   uint32_t type, void *buffer, uint32_t usage)
@@ -557,6 +569,7 @@ dri_device_create(int fd)
dri-base.base.destroy = dri_destroy;
dri-base.base.surface_create = gbm_dri_surface_create;
dri-base.base.surface_destroy = gbm_dri_surface_destroy;
+   dri-base.base.bo_get_shared_handle = gbm_dri_bo_get_shared_handle;
 
dri-base.type = GBM_DRM_DRIVER_TYPE_DRI;
dri-base.base.name = drm;
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
old mode 100644
new mode 100755
index c58576d..317962b
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -231,6 +231,24 @@ gbm_bo_get_handle(struct gbm_bo *bo)
return bo-handle;
 }
 
+/** Get shared handle(global buffer region name) of the buffer object, 
+ * this handle can be shared among processes
+ *
+ * This is stored in the platform generic union gbm_bo_handle type. However
+ * the format of this handle is platform specific.
+ *
+ * \param bo The buffer object
+ * \return Returns the handle of the allocated buffer object
+ */
+GBM_EXPORT union gbm_bo_handle
+gbm_bo_get_shared_handle(struct gbm_bo *bo)
+{
+   if (bo-shared_handle.u32) return bo-shared_handle;
+   
+   return bo-gbm-bo_get_shared_handle(bo);
+   
+}
+
 /** Write data into the buffer object
  *
  * If the buffer object was created with the GBM_BO_USE_WRITE flag,
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
old mode 100644
new mode 100755
index 9d2a030..55f012a
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -255,6 +255,9 @@ gbm_bo_get_device(struct gbm_bo *bo);
 union gbm_bo_handle
 gbm_bo_get_handle(struct gbm_bo *bo);
 
+union gbm_bo_handle
+gbm_bo_get_shared_handle(struct gbm_bo *bo);
+
 int
 gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
 
diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h
old mode 100644
new mode 100755
index a467bea..01c55ec
--- a/src/gbm/main/gbmint.h
+++ b/src/gbm/main/gbmint.h
@@ -68,6 +68,7 @@ struct gbm_device {
uint32_t usage);
struct gbm_bo *(*bo_import)(struct gbm_device *gbm, uint32_t type,
void *buffer, uint32_t usage);
+   union gbm_bo_handle (*bo_get_shared_handle)(struct gbm_bo *bo);
int (*bo_write)(struct gbm_bo *bo, const void *buf, size_t data);
void (*bo_destroy)(struct gbm_bo *bo);
 
@@ -93,6 +94,7 @@ struct gbm_bo {
uint32_t stride;
uint32_t format;
union gbm_bo_handle  handle;
+   union gbm_bo_handle  shared_handle; // global handle can be shared among 
processes
void *user_data;
void (*destroy_user_data)(struct gbm_bo *, void *);
 };
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 3/5] gbm dri backend: add YUYV support

2012-07-17 Thread Zhao Halley
---
 src/gbm/backends/dri/gbm_dri.c |   13 +
 src/gbm/main/gbm.h |5 -
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index fef9d47..4812e6b 100755
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -285,6 +285,9 @@ gbm_dri_is_format_supported(struct gbm_device *gbm,
   if (usage  GBM_BO_USE_SCANOUT)
  return 0;
   break;
+  case GBM_BO_FORMAT_YUYV:
+  case GBM_FORMAT_YUYV:
+ break;
default:
   return 0;
}
@@ -336,6 +339,9 @@ gbm_dri_to_gbm_format(uint32_t dri_format)
case __DRI_IMAGE_FORMAT_ABGR:
   ret = GBM_FORMAT_ABGR;
   break;
+  case __DRI_IMAGE_FORMAT_GR88:
+ ret = GBM_FORMAT_YUYV;
+ break;
default:
   ret = 0;
   break;
@@ -484,6 +490,13 @@ gbm_dri_bo_create(struct gbm_device *gbm,
case GBM_FORMAT_ABGR:
   dri_format = __DRI_IMAGE_FORMAT_ABGR;
   break;
+  /* wayland/driimage doesn't have a specific format for YUYV, but 
+ * treat it as a special case of planar YUV: two overlaped planes
+ * so we use GR88 for YUYV dirimage allocation
+ */
+  case GBM_FORMAT_YUYV:
+ dri_format = __DRI_IMAGE_FORMAT_GR88;
+ break;
default:
   return NULL;
}
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
index 55f012a..50ccb43 100755
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -73,7 +73,10 @@ enum gbm_bo_format {
/** RGB with 8 bits per channel in a 32 bit value */
GBM_BO_FORMAT_XRGB, 
/** ARGB with 8 bits per channel in a 32 bit value */
-   GBM_BO_FORMAT_ARGB
+   GBM_BO_FORMAT_ARGB, 
+   /** YUYV: packed YUV format with 422 subsampling*/
+   GBM_BO_FORMAT_YUYV,
+   
 };
 
 #define __gbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b)  8) | \
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 4/5] wayland: add YUYV to wayland-drm

2012-07-17 Thread Zhao Halley
---
 src/egl/wayland/wayland-drm/wayland-drm.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/wayland-drm.c

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c 
b/src/egl/wayland/wayland-drm/wayland-drm.c
old mode 100644
new mode 100755
index 45b307f..0b3287d
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -176,7 +176,8 @@ drm_create_planar_buffer(struct wl_client *client,
case WL_DRM_FORMAT_YUV422:
case WL_DRM_FORMAT_YUV444:
case WL_DRM_FORMAT_NV12:
-case WL_DRM_FORMAT_NV16:
+case WL_DRM_FORMAT_NV16:
+case WL_DRM_FORMAT_YUYV:
 break;
 default:
 wl_resource_post_error(resource,
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 5/5] test: test case drm-test-client in src/egl/wayland/wayland-drm

2012-07-17 Thread Zhao Halley
 - it shows how wayland-drm protocol works between server and client
buffer are shared basing on dri image
 - XRGB and YUYV format are supported,
it can render to overlay plane potentially
---
 src/egl/wayland/wayland-drm/Makefile.am   |   16 +-
 src/egl/wayland/wayland-drm/drm-test-client.c |  478 +
 2 files changed, 493 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/Makefile.am
 create mode 100755 src/egl/wayland/wayland-drm/drm-test-client.c

diff --git a/src/egl/wayland/wayland-drm/Makefile.am 
b/src/egl/wayland/wayland-drm/Makefile.am
old mode 100644
new mode 100755
index 4b2aeb3..e2cffe0
--- a/src/egl/wayland/wayland-drm/Makefile.am
+++ b/src/egl/wayland/wayland-drm/Makefile.am
@@ -10,7 +10,21 @@ noinst_HEADERS = wayland-drm.h
 BUILT_SOURCES = wayland-drm-protocol.c \
wayland-drm-client-protocol.h \
wayland-drm-server-protocol.h
-CLEANFILES = $(BUILT_SOURCES)
+
+noinst_PROGRAMS = drm_test_client
+drm_test_client_CFLAGS = $(DEFINES) \
+   -I$(top_srcdir)/src/gbm/main \
+   $(WAYLAND_CFLAGS) \
+   $(LIBDRM_CFLAGS)
+
+drm_test_client_LDADD = $(WAYLAND_LIBS) $(LIBDRM_LIBS) 
+drm_test_client_LDADD += $(top_srcdir)/src/gbm/libgbm.la
+
+drm_test_client_SOURCES = drm-test-client.c wayland-drm-protocol.c \
+ wayland-drm-client-protocol.h
+
+CLEANFILES = $(BUILT_SOURCES) $(drm_test_client_SOURCES)
+
 
 %-protocol.c : %.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) code  $  $@
diff --git a/src/egl/wayland/wayland-drm/drm-test-client.c 
b/src/egl/wayland/wayland-drm/drm-test-client.c
new file mode 100755
index 000..771aa33
--- /dev/null
+++ b/src/egl/wayland/wayland-drm/drm-test-client.c
@@ -0,0 +1,478 @@
+/*
+ * Copyright © 2012 Halley Zhao
+ *
+ * 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:
+ *Halley Zhao halley.z...@intel.com
+ */
+
+
+#include stdlib.h
+#include stdio.h
+#include unistd.h
+#include errno.h
+#include fcntl.h
+#include sys/stat.h
+#include string.h
+#include assert.h
+#include xf86drm.h
+#include gbm.h
+#include wayland-client.h
+#include wayland-client-protocol.h
+#include wayland-drm-client-protocol.h
+
+int win_width = 256, win_height = 256;
+int drm_fd = -1;
+int wayland_server_support_yuyv = 0;
+struct wl_drm *wl_drm;
+
+struct display {
+   struct wl_display *display;
+   struct wl_compositor *compositor;
+   struct wl_shell *shell;
+   struct wl_input_device *input;
+   uint32_t mask;
+struct gbm_device *gbm;
+};
+
+struct window {
+   struct display *display;
+   struct wl_surface *surface;
+   struct wl_shell_surface *shell_surface;
+   struct wl_callback *callback;
+   struct {
+   int width, height;
+   } geometry;
+unsigned int format;
+struct wl_buffer *buffer;
+struct gbm_bo *gbm_bo;
+unsigned int bo_stride;
+};
+
+void fill_window_XRGB(struct window *win);
+void fill_window_YUYV(struct window *win);
+int wayland_drm_init(struct wl_display *wl_dpy);
+void wayland_drm_destroy(void);
+void redraw(void *data, struct wl_callback *callback, uint32_t time);
+
+void fill_window_XRGB(struct window *win)
+{
+unsigned char *mem = malloc (win-bo_stride* win_height);
+static int color_index = 0;
+static unsigned int color_arr[4] = {0xff00, 0x00ff, 0xff00, 
0x00ff};
+unsigned int color; 
+int i;
+unsigned int *i_ptr;
+unsigned char *c_ptr;
+
+color = color_arr[color_index];
+i_ptr = (unsigned int *)mem;
+for (i=0; iwin_width/2; i++) {
+*(i_ptr+i) = color;
+}
+color = color_arr[(color_index+1)%4];
+for (i=win_width/2+1; iwin_width; i++) {
+*(i_ptr+i) = color;
+}
+
+c_ptr = mem + win-bo_stride;
+for (i = 1; iwin_height/2; i++) {
+   

Re: [Mesa-dev] [PATCH 00/11] Add YUYV format support of dri image

2012-07-17 Thread Zhao, Halley
Thanks Gwenole.
I found kristian had checked in YUV support to mea, he treated YUYV as a 
special case of planar YUV.
It addressed my initial requirement.

So I rebased other features in these patch set and resent it


 -Original Message-
 From: Gwenole Beauchesne [mailto:gb.de...@gmail.com]
 Sent: Thursday, July 12, 2012 3:27 PM
 To: Zhao, Halley
 Cc: Ian Romanick; mesa-dev@lists.freedesktop.org
 Subject: Re: [Mesa-dev] [PATCH 00/11] Add YUYV format support of dri image
 
 Hi Halley,
 
 2012/7/12 Zhao, Halley halley.z...@intel.com:
 
  There is no other comments for these patches, could you help me commit it
 to git tree?
 
 Please rebase against current git master tree. YUV support, including YUYV
 was added. The remaining patchset should reduce to the GBM bits.
 
 Thanks,
 Gwenole.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/11] Add YUYV format support of dri image

2012-07-12 Thread Zhao, Halley
Hi Ian:
There is no other comments for these patches, could you help me commit it to 
git tree?

Thanks.


 -Original Message-
 From: Zhao, Halley
 Sent: Monday, July 09, 2012 1:55 PM
 To: mesa-dev@lists.freedesktop.org
 Cc: Zhao, Halley
 Subject: [PATCH 00/11] Add YUYV format support of dri image
 
 Intel SNB/IVB platform supports rendering YUYV buffer to overlay plane,
 however YUYV is missing support from mesa/dri-image yet.
 so I go ahead to add it; basing on it, libva can send YUYV buffer directly to
 wayland/weston, then weston output it to overlay plane.
 
 v2 update:
 - set internal_format to GL_YCBCR_MESA
 - improve gbm/intel-driver to support YUYV bo generation,
   add handle2 (intel buffer name) in gbm
   buffer data update (intel_image_write with tiling support)
 - update test case to depend on gbm instead of intel driver directly
 
 v3 update:
 - move wayland-drm-test to
 $mesa/src/egl/wayland/wayland-drm/drm-test-client
 - add YUYV support to
 eglCreateDRMImageMesa/eglExportDRMImageMesa
   and eglCreateImageKHR
 - add egl-create-drm-image test to piglit
 
 v4 update:
 - gbm: change gbm_bo_get_handle2() to gbm_bo_get_shared_handle(),
 - gbm: allocate region name only when it is asked
 - drm-test-client update according to above change:
 gbm_bo_get_shared_handle
 
 v5 update:
 - rebase to latest git tree for check in, 0002/0003 patches are updated.
 
 
 Zhao Halley (10):
   GL: add YUYV to dri image format
   intel: add YUYV format for dri images
   egl wayland: add YUYV support
   gallium egl wayland: add YUYV support
   gbm dri backend: add YUYV support
   wayland-drm: add YUYV support
   gbm: add shared_handle(drm buffer region name)
   intel driver: dri image write update
   test: test case drm-test-client in src/egl/wayland/wayland-drm
   EGL: add YUYV support to eglCreateImageKHR and
 eglCreateDRMImageMESA
 
  include/EGL/eglmesaext.h   |3 +
  include/GL/internal/dri_interface.h|1 +
  src/egl/drivers/dri2/egl_dri2.c|9 +-
  src/egl/drivers/dri2/platform_wayland.c|7 +-
  src/egl/wayland/wayland-drm/Makefile.am|   15 +-
  src/egl/wayland/wayland-drm/drm-test-client.c  |  456
 
  src/egl/wayland/wayland-drm/wayland-drm.c  |3 +
  .../state_trackers/egl/wayland/native_drm.c|3 +
  .../state_trackers/egl/wayland/native_wayland.h|3 +-
  src/gbm/backends/dri/gbm_dri.c |   22 +
  src/gbm/main/gbm.c |   18 +
  src/gbm/main/gbm.h |8 +-
  src/gbm/main/gbmint.h  |2 +
  src/mesa/drivers/dri/intel/intel_screen.c  |   20 +-
  src/mesa/drivers/dri/intel/intel_tex_image.c   |6 +
  15 files changed, 569 insertions(+), 7 deletions(-)  mode change 100644 =
 100755 include/EGL/eglext.h  mode change 100644 = 100755
 include/EGL/eglmesaext.h  mode change 100644 = 100755
 include/GL/internal/dri_interface.h
  mode change 100644 = 100755 src/egl/drivers/dri2/platform_wayland.c
  create mode 100755 src/egl/wayland/wayland-drm/drm-test-client.c
  mode change 100644 = 100755
 src/egl/wayland/wayland-drm/wayland-drm.c
  mode change 100644 = 100755
 src/gallium/state_trackers/egl/wayland/native_drm.c
  mode change 100644 = 100755
 src/gallium/state_trackers/egl/wayland/native_wayland.h
  mode change 100644 = 100755 src/gbm/backends/dri/gbm_dri.c  mode
 change 100644 = 100755 src/gbm/main/gbm.c  mode change 100644 =
 100755 src/gbm/main/gbm.h  mode change 100644 = 100755
 src/gbm/main/gbmint.h  mode change 100644 = 100755
 src/mesa/drivers/dri/intel/intel_screen.c
  mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_tex_image.c
 
 --
 1.7.4.1

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


[Mesa-dev] [PATCH 00/11] Add YUYV format support of dri image

2012-07-09 Thread Zhao Halley
Intel SNB/IVB platform supports rendering YUYV buffer to overlay plane, however 
YUYV is missing support from mesa/dri-image yet.
so I go ahead to add it; basing on it, libva can send YUYV buffer directly to 
wayland/weston, then weston output it to overlay plane.

v2 update:
- set internal_format to GL_YCBCR_MESA
- improve gbm/intel-driver to support YUYV bo generation, 
  add handle2 (intel buffer name) in gbm
  buffer data update (intel_image_write with tiling support)
- update test case to depend on gbm instead of intel driver directly

v3 update:
- move wayland-drm-test to $mesa/src/egl/wayland/wayland-drm/drm-test-client
- add YUYV support to eglCreateDRMImageMesa/eglExportDRMImageMesa 
  and eglCreateImageKHR
- add egl-create-drm-image test to piglit

v4 update:
- gbm: change gbm_bo_get_handle2() to gbm_bo_get_shared_handle(), 
- gbm: allocate region name only when it is asked
- drm-test-client update according to above change: gbm_bo_get_shared_handle

v5 update:
- rebase to latest git tree for check in, 0002/0003 patches are updated.


Zhao Halley (10):
  GL: add YUYV to dri image format
  intel: add YUYV format for dri images
  egl wayland: add YUYV support
  gallium egl wayland: add YUYV support
  gbm dri backend: add YUYV support
  wayland-drm: add YUYV support
  gbm: add shared_handle(drm buffer region name)
  intel driver: dri image write update
  test: test case drm-test-client in src/egl/wayland/wayland-drm
  EGL: add YUYV support to eglCreateImageKHR and eglCreateDRMImageMESA

 include/EGL/eglmesaext.h   |3 +
 include/GL/internal/dri_interface.h|1 +
 src/egl/drivers/dri2/egl_dri2.c|9 +-
 src/egl/drivers/dri2/platform_wayland.c|7 +-
 src/egl/wayland/wayland-drm/Makefile.am|   15 +-
 src/egl/wayland/wayland-drm/drm-test-client.c  |  456 
 src/egl/wayland/wayland-drm/wayland-drm.c  |3 +
 .../state_trackers/egl/wayland/native_drm.c|3 +
 .../state_trackers/egl/wayland/native_wayland.h|3 +-
 src/gbm/backends/dri/gbm_dri.c |   22 +
 src/gbm/main/gbm.c |   18 +
 src/gbm/main/gbm.h |8 +-
 src/gbm/main/gbmint.h  |2 +
 src/mesa/drivers/dri/intel/intel_screen.c  |   20 +-
 src/mesa/drivers/dri/intel/intel_tex_image.c   |6 +
 15 files changed, 569 insertions(+), 7 deletions(-)
 mode change 100644 = 100755 include/EGL/eglext.h
 mode change 100644 = 100755 include/EGL/eglmesaext.h
 mode change 100644 = 100755 include/GL/internal/dri_interface.h
 mode change 100644 = 100755 src/egl/drivers/dri2/platform_wayland.c
 create mode 100755 src/egl/wayland/wayland-drm/drm-test-client.c
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/wayland-drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_wayland.h
 mode change 100644 = 100755 src/gbm/backends/dri/gbm_dri.c
 mode change 100644 = 100755 src/gbm/main/gbm.c
 mode change 100644 = 100755 src/gbm/main/gbm.h
 mode change 100644 = 100755 src/gbm/main/gbmint.h
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_screen.c
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_tex_image.c

-- 
1.7.4.1

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


[Mesa-dev] [PATCH 01/11 v5] GL: add YUYV to dri image format

2012-07-09 Thread Zhao Halley
---
 include/GL/internal/dri_interface.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 include/GL/internal/dri_interface.h

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
old mode 100644
new mode 100755
index e37917e..5e325cf
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -907,6 +907,7 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_FORMAT_ARGB 0x1003
 #define __DRI_IMAGE_FORMAT_ABGR 0x1004
 #define __DRI_IMAGE_FORMAT_XBGR 0x1005
+#define __DRI_IMAGE_FORMAT_YUYV 0x1006
 
 #define __DRI_IMAGE_USE_SHARE  0x0001
 #define __DRI_IMAGE_USE_SCANOUT0x0002
-- 
1.7.4.1

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


[Mesa-dev] [PATCH 04/11 v5] gallium egl wayland: add YUYV support

2012-07-09 Thread Zhao Halley
---
 .../state_trackers/egl/wayland/native_drm.c|3 +++
 .../state_trackers/egl/wayland/native_wayland.h|3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_wayland.h

diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c 
b/src/gallium/state_trackers/egl/wayland/native_drm.c
old mode 100644
new mode 100755
index e3bd628..f2d2e74
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -164,6 +164,9 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t 
format)
case WL_DRM_FORMAT_XRGB:
   drmdpy-base.formats |= HAS_XRGB;
   break;
+  case WL_DRM_FORMAT_YUYV:
+ drmdpy-base.formats |= HAS_YUYV;
+ break;
}
 }
 
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.h 
b/src/gallium/state_trackers/egl/wayland/native_wayland.h
old mode 100644
new mode 100755
index e6a914f..bd26bf0
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.h
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.h
@@ -38,7 +38,8 @@ struct wayland_surface;
 
 enum wayland_format_flag {
HAS_ARGB= (1  0),
-   HAS_XRGB= (1  1)
+   HAS_XRGB= (1  1),
+   HAS_YUYV= (1  2)
 };
 
 struct wayland_display {
-- 
1.7.4.1

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


[Mesa-dev] [PATCH 02/11 v5] intel: add YUYV format for dri images

2012-07-09 Thread Zhao Halley
YUYV image works for overlay now
YUYV image works for texture will come soon
---
 src/mesa/drivers/dri/intel/intel_screen.c|3 +++
 src/mesa/drivers/dri/intel/intel_tex_image.c |6 ++
 2 files changed, 9 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_screen.c
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_tex_image.c

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
old mode 100644
new mode 100755
index 2b70aa4..644ec5b
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -202,6 +202,9 @@ intel_allocate_image(int dri_format, void *loaderPrivate)
 case __DRI_IMAGE_FORMAT_XBGR:
image-format = MESA_FORMAT_RGBX_REV;
break;
+case __DRI_IMAGE_FORMAT_YUYV:
+   image-format = MESA_FORMAT_YCBCR;
+   break;
 default:
free(image);
return NULL;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c 
b/src/mesa/drivers/dri/intel/intel_tex_image.c
old mode 100644
new mode 100755
index 6e7e7018..ee9b857
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -346,6 +346,12 @@ intel_image_target_texture_2d(struct gl_context *ctx, 
GLenum target,
if (image == NULL)
   return;
 
+   if (image-format == MESA_FORMAT_YCBCR) {
+  _mesa_error(intel-ctx, GL_INVALID_OPERATION, 
+glEGLImageTargetTexture2DOES, YUYV format isn't supported yet);
+  return;
+}
+
intel_set_texture_image_region(ctx, texImage, image-region,
  target, image-internal_format, 
image-format);
 }
-- 
1.7.4.1

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


[Mesa-dev] [PATCH 05/11 v5] gbm dri backend: add YUYV support

2012-07-09 Thread Zhao Halley
---
 src/gbm/backends/dri/gbm_dri.c |9 +
 src/gbm/main/gbm.h |5 -
 2 files changed, 13 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 src/gbm/backends/dri/gbm_dri.c
 mode change 100644 = 100755 src/gbm/main/gbm.h

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
old mode 100644
new mode 100755
index e5ddfb6..9e2bd83
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -280,6 +280,9 @@ gbm_dri_is_format_supported(struct gbm_device *gbm,
   if (usage  GBM_BO_USE_SCANOUT)
  return 0;
   break;
+  case GBM_BO_FORMAT_YUYV:
+  case GBM_FORMAT_YUYV:
+ break;
default:
   return 0;
}
@@ -331,6 +334,9 @@ gbm_dri_to_gbm_format(uint32_t dri_format)
case __DRI_IMAGE_FORMAT_ABGR:
   ret = GBM_FORMAT_ABGR;
   break;
+  case __DRI_IMAGE_FORMAT_YUYV:
+ ret = GBM_FORMAT_YUYV;
+ break;
default:
   ret = 0;
   break;
@@ -428,6 +434,9 @@ gbm_dri_bo_create(struct gbm_device *gbm,
case GBM_FORMAT_ABGR:
   dri_format = __DRI_IMAGE_FORMAT_ABGR;
   break;
+  case GBM_FORMAT_YUYV:
+ dri_format = __DRI_IMAGE_FORMAT_YUYV;
+ break;
default:
   return NULL;
}
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
old mode 100644
new mode 100755
index af5dc5a..b2a0aa3
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -73,7 +73,10 @@ enum gbm_bo_format {
/** RGB with 8 bits per channel in a 32 bit value */
GBM_BO_FORMAT_XRGB, 
/** ARGB with 8 bits per channel in a 32 bit value */
-   GBM_BO_FORMAT_ARGB
+   GBM_BO_FORMAT_ARGB, 
+   /** YUYV: packed YUV format with 422 subsampling*/
+   GBM_BO_FORMAT_YUYV,
+   
 };
 
 #define __gbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b)  8) | \
-- 
1.7.4.1

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


[Mesa-dev] [PATCH 03/11 v5] egl wayland: add YUYV support

2012-07-09 Thread Zhao Halley
---
 src/egl/drivers/dri2/platform_wayland.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 src/egl/drivers/dri2/platform_wayland.c

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
old mode 100644
new mode 100755
index d291f0f..962ee7f
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -42,7 +42,9 @@
 
 enum wl_drm_format_flags {
HAS_ARGB = 1,
-   HAS_XRGB = 2
+   HAS_XRGB = (1  1),
+   HAS_YUYV = (1  2)
+   
 };
 
 static void
@@ -778,6 +780,9 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t 
format)
case WL_DRM_FORMAT_XRGB:
   dri2_dpy-formats |= HAS_XRGB;
   break;
+   case WL_DRM_FORMAT_YUYV:
+  dri2_dpy-formats |= HAS_YUYV;
+  break;
}
 }
 
-- 
1.7.4.1

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


[Mesa-dev] [PATCH 07/11 v5] gbm: add shared_handle(drm buffer region name)

2012-07-09 Thread Zhao Halley
  it can be shared among processed
---
 src/gbm/backends/dri/gbm_dri.c |   13 +
 src/gbm/main/gbm.c |   18 ++
 src/gbm/main/gbm.h |3 +++
 src/gbm/main/gbmint.h  |2 ++
 4 files changed, 36 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/gbm/main/gbm.c
 mode change 100644 = 100755 src/gbm/main/gbmint.h

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 9e2bd83..0646b47 100755
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -345,6 +345,18 @@ gbm_dri_to_gbm_format(uint32_t dri_format)
return ret;
 }
 
+static union gbm_bo_handle
+gbm_dri_bo_get_shared_handle(struct gbm_bo *_bo)
+{
+   struct gbm_dri_device *dri = gbm_dri_device(_bo-gbm);
+   struct gbm_dri_bo *bo = gbm_dri_bo(_bo);
+
+   dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_NAME,
+  (uint32_t *) bo-base.base.shared_handle.u32);
+
+   return bo-base.base.shared_handle;
+}
+
 static struct gbm_bo *
 gbm_dri_bo_create_from_egl_image(struct gbm_device *gbm,
  void *egl_dpy, void *egl_img,
@@ -522,6 +534,7 @@ dri_device_create(int fd)
dri-base.base.destroy = dri_destroy;
dri-base.base.surface_create = gbm_dri_surface_create;
dri-base.base.surface_destroy = gbm_dri_surface_destroy;
+   dri-base.base.bo_get_shared_handle = gbm_dri_bo_get_shared_handle;
 
dri-base.type = GBM_DRM_DRIVER_TYPE_DRI;
dri-base.base.name = drm;
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
old mode 100644
new mode 100755
index 3994f86..017cb2d
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -231,6 +231,24 @@ gbm_bo_get_handle(struct gbm_bo *bo)
return bo-handle;
 }
 
+/** Get shared handle(global buffer region name) of the buffer object, 
+ * this handle can be shared among processes
+ *
+ * This is stored in the platform generic union gbm_bo_handle type. However
+ * the format of this handle is platform specific.
+ *
+ * \param bo The buffer object
+ * \return Returns the handle of the allocated buffer object
+ */
+GBM_EXPORT union gbm_bo_handle
+gbm_bo_get_shared_handle(struct gbm_bo *bo)
+{
+   if (bo-shared_handle.u32) return bo-shared_handle;
+   
+   return bo-gbm-bo_get_shared_handle(bo);
+   
+}
+
 /** Write data into the buffer object
  *
  * If the buffer object was created with the GBM_BO_USE_WRITE flag,
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
index b2a0aa3..68309fb 100755
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -257,6 +257,9 @@ gbm_bo_get_device(struct gbm_bo *bo);
 union gbm_bo_handle
 gbm_bo_get_handle(struct gbm_bo *bo);
 
+union gbm_bo_handle
+gbm_bo_get_shared_handle(struct gbm_bo *bo);
+
 int
 gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
 
diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h
old mode 100644
new mode 100755
index 8eb8671..6327f94
--- a/src/gbm/main/gbmint.h
+++ b/src/gbm/main/gbmint.h
@@ -70,6 +70,7 @@ struct gbm_device {
   void *egl_dpy, void *egl_img,
   uint32_t width, uint32_t height,
   uint32_t usage);
+   union gbm_bo_handle (*bo_get_shared_handle)(struct gbm_bo *bo);
int (*bo_write)(struct gbm_bo *bo, const void *buf, size_t data);
void (*bo_destroy)(struct gbm_bo *bo);
 
@@ -95,6 +96,7 @@ struct gbm_bo {
uint32_t pitch;
uint32_t format;
union gbm_bo_handle  handle;
+   union gbm_bo_handle  shared_handle; // global handle can be shared among 
processes
void *user_data;
void (*destroy_user_data)(struct gbm_bo *, void *);
 };
-- 
1.7.4.1

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


[Mesa-dev] [PATCH 06/11 v5] wayland-drm: add YUYV support

2012-07-09 Thread Zhao Halley
---
 src/egl/wayland/wayland-drm/wayland-drm.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/wayland-drm.c

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c 
b/src/egl/wayland/wayland-drm/wayland-drm.c
old mode 100644
new mode 100755
index 5f831b3..d9cfe09
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -111,6 +111,7 @@ drm_create_buffer(struct wl_client *client, struct 
wl_resource *resource,
switch (format) {
case WL_DRM_FORMAT_ARGB:
case WL_DRM_FORMAT_XRGB:
+case WL_DRM_FORMAT_YUYV:
break;
default:
wl_resource_post_error(resource,
@@ -186,6 +187,8 @@ bind_drm(struct wl_client *client, void *data, uint32_t 
version, uint32_t id)
   WL_DRM_FORMAT_ARGB);
wl_resource_post_event(resource, WL_DRM_FORMAT,
   WL_DRM_FORMAT_XRGB);
+   wl_resource_post_event(resource, WL_DRM_FORMAT,
+  WL_DRM_FORMAT_YUYV);
 }
 
 struct wl_drm *
-- 
1.7.4.1

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


[Mesa-dev] [PATCH 08/11 v5] intel driver: dri image write update

2012-07-09 Thread Zhao Halley
add tiling support for intel_image_write()
all drm image can be written from app
---
 src/mesa/drivers/dri/intel/intel_screen.c |   17 +++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 644ec5b..fa36a3f 100755
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -307,10 +307,13 @@ intel_create_image(__DRIscreen *screen,
   tiling = I915_TILING_NONE;
}
 
+#if 0
+   // add tiling support in intel_image_write(), so all drm images are ok 
for write
/* We only support write for cursor drm images */
if ((use  __DRI_IMAGE_USE_WRITE) 
use != (__DRI_IMAGE_USE_WRITE | __DRI_IMAGE_USE_CURSOR))
   return NULL;
+#endif
 
image = intel_allocate_image(format, loaderPrivate);
image-usage = use;
@@ -393,9 +396,19 @@ intel_image_write(__DRIimage *image, const void *buf, 
size_t count)
if (!(image-usage  __DRI_IMAGE_USE_WRITE))
   return -1;
 
-   drm_intel_bo_map(image-region-bo, true);
+   int tiling, swizzle;
+   dri_bo_get_tiling(image-region-bo, tiling, swizzle);
+   if (tiling != I915_TILING_NONE)
+   drm_intel_gem_bo_map_gtt(image-region-bo);
+   else
+   drm_intel_bo_map(image-region-bo, true);
+   
memcpy(image-region-bo-virtual, buf, count);
-   drm_intel_bo_unmap(image-region-bo);
+
+   if (tiling != I915_TILING_NONE)
+   drm_intel_gem_bo_unmap_gtt(image-region-bo);
+   else
+   drm_intel_bo_unmap(image-region-bo);
 
return 0;
 }
-- 
1.7.4.1

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


[Mesa-dev] [PATCH 10/11 v5] EGL: add YUYV support to eglCreateImageKHR and eglCreateDRMImageMESA

2012-07-09 Thread Zhao Halley
---
 include/EGL/eglmesaext.h|3 +++
 src/egl/drivers/dri2/egl_dri2.c |9 -
 2 files changed, 11 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 include/EGL/eglext.h
 mode change 100644 = 100755 include/EGL/eglmesaext.h

diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
old mode 100644
new mode 100755
diff --git a/include/EGL/eglmesaext.h b/include/EGL/eglmesaext.h
old mode 100644
new mode 100755
index 52dd5b1..cb251fd
--- a/include/EGL/eglmesaext.h
+++ b/include/EGL/eglmesaext.h
@@ -107,6 +107,9 @@ typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDRMDISPLAYMESA) 
(int fd);
 #ifndef EGL_DRM_BUFFER_USE_CURSOR_MESA
 #define EGL_DRM_BUFFER_USE_CURSOR_MESA 0x0004
 #endif
+#ifndef EGL_DRM_BUFFER_FORMAT_YUYV_MESA
+#define EGL_DRM_BUFFER_FORMAT_YUYV_MESA0x31D6  /* 
EGL_DRM_BUFFER_FORMAT_MESA attribute value */
+#endif
 #endif
 
 #ifndef EGL_WL_bind_wayland_display
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index e2dee79..3638fec 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1031,8 +1031,12 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, 
_EGLContext *ctx,
switch (attrs.DRMBufferFormatMESA) {
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA:
   format = __DRI_IMAGE_FORMAT_ARGB;
-  pitch = attrs.DRMBufferStrideMESA;
+  pitch = attrs.DRMBufferStrideMESA/4;
   break;
+   case EGL_DRM_BUFFER_FORMAT_YUYV_MESA:
+  format = __DRI_IMAGE_FORMAT_YUYV;
+  pitch = attrs.DRMBufferStrideMESA/2;
+ break;
default:
   _eglError(EGL_BAD_PARAMETER,
dri2_create_image_khr: unsupported pixmap depth);
@@ -1150,6 +1154,9 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay 
*disp,
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA:
   format = __DRI_IMAGE_FORMAT_ARGB;
   break;
+   case EGL_DRM_BUFFER_FORMAT_YUYV_MESA:
+  format = __DRI_IMAGE_FORMAT_YUYV;
+  break;
default:
   _eglLog(_EGL_WARNING, bad image format value 0x%04x,
 attrs.DRMBufferFormatMESA);
-- 
1.7.4.1

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


[Mesa-dev] [PATCH 11/11 v5] [piglit] add egl-create-drm-image test

2012-07-09 Thread Zhao Halley
---
 tests/egl/CMakeLists.gl.txt  |2 +
 tests/egl/egl-create-drm-image.c |  145 ++
 2 files changed, 147 insertions(+), 0 deletions(-)
 create mode 100755 tests/egl/egl-create-drm-image.c

diff --git a/tests/egl/CMakeLists.gl.txt b/tests/egl/CMakeLists.gl.txt
index ddfbbef..1e8865c 100644
--- a/tests/egl/CMakeLists.gl.txt
+++ b/tests/egl/CMakeLists.gl.txt
@@ -20,6 +20,8 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES Linux)
target_link_libraries(egl-create-surface pthread ${X11_X11_LIB})
piglit_add_executable (egl-query-surface egl-util.c egl-query-surface.c)
target_link_libraries(egl-query-surface pthread ${X11_X11_LIB})
+   piglit_add_executable (egl-create-drm-image egl-util.c 
egl-create-drm-image.c)
+   target_link_libraries(egl-create-drm-image pthread ${X11_X11_LIB})
 ENDIF(${CMAKE_SYSTEM_NAME} MATCHES Linux)
 
 # vim: ft=cmake:
diff --git a/tests/egl/egl-create-drm-image.c b/tests/egl/egl-create-drm-image.c
new file mode 100755
index 000..d20d27e
--- /dev/null
+++ b/tests/egl/egl-create-drm-image.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright © 2012 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.
+ *
+ * Author: Halley Zhao halley.z...@intel.com
+ */
+
+/** @file egl-create-drm-image.c
+ *
+ * Test EGL_MESA_drm_image.
+ */
+
+#include piglit-util.h
+#include egl-util.h
+
+#ifdef EGL_MESA_drm_image
+
+const char *extensions[] = { EGL_MESA_drm_image, NULL }; 
+
+static enum piglit_result
+draw(struct egl_state *state)
+{
+PFNEGLCREATEDRMIMAGEMESAPROC create_drm_image;
+PFNEGLEXPORTDRMIMAGEMESAPROC export_drm_image;
+PFNEGLCREATEIMAGEKHRPROCcreate_image;
+PFNEGLDESTROYIMAGEKHRPROC   destroy_image;
+
+EGLImageKHR image1 = EGL_NO_IMAGE_KHR;
+EGLImageKHR image2 = EGL_NO_IMAGE_KHR;
+
+EGLint attr_list1[] = {
+EGL_WIDTH, 256, EGL_HEIGHT, 256, 
+EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_YUYV_MESA, 
+// EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
+EGL_NONE
+};
+
+EGLint name, handle, stride;
+EGLint attr_list2[] = {
+EGL_DRM_BUFFER_STRIDE_MESA, 0, 
+EGL_WIDTH, 256, EGL_HEIGHT, 256, 
+EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_YUYV_MESA, 
+// EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
+EGL_NONE
+};
+#define STRIDE_INDEX1
+
+   create_drm_image = 
(PFNEGLCREATEDRMIMAGEMESAPROC)eglGetProcAddress(eglCreateDRMImageMESA);
+   if (create_drm_image == NULL ) {
+   fprintf(stderr, could not getproc eglCreateDRMImageMESA);
+   piglit_report_result(PIGLIT_PASS);
+   }
+
+   export_drm_image = 
(PFNEGLEXPORTDRMIMAGEMESAPROC)eglGetProcAddress(eglExportDRMImageMESA);
+   if (export_drm_image == NULL ) {
+   fprintf(stderr, could not getproc eglExportDRMImageMESA);
+   piglit_report_result(PIGLIT_PASS);
+   }
+
+   create_image = 
(PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress(eglCreateImageKHR);
+   if (create_image == NULL ) {
+   fprintf(stderr, could not getproc eglCreateImageKHR);
+   piglit_report_result(PIGLIT_PASS);
+   }
+
+   destroy_image = 
(PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress(eglDestroyImageKHR);
+   if (destroy_image == NULL ) {
+   fprintf(stderr, could not getproc eglDestroyImageKHR);
+   piglit_report_result(PIGLIT_PASS);
+   }
+
+image1 = create_drm_image(state-egl_dpy, attr_list1);
+if(image1 == EGL_NO_IMAGE_KHR) {
+   fprintf(stderr, fail to create YUYV EGLImageKHR from 
eglCreateDRMImageMESA);
+   piglit_report_result(PIGLIT_FAIL);
+}
+
+if (export_drm_image(state-egl_dpy, image1, name, handle, stride) == 
EGL_FALSE) {
+   fprintf(stderr, fail to create export YUYV EGLImageKHR 

[Mesa-dev] [PATCH 00/11] Add YUYV format support of dri image

2012-06-27 Thread Zhao Halley
Intel SNB/IVB platform supports rendering YUYV buffer to overlay plane, however 
YUYV is missing support from mesa/dri-image yet.
so I go ahead to add it; basing on it, libva can send YUYV buffer directly to 
wayland/weston, then weston output it to overlay plane.

v2 update:
- set internal_format to GL_YCBCR_MESA
- improve gbm/intel-driver to support YUYV bo generation, 
  add handle2 (intel buffer name) in gbm
  buffer data update (intel_image_write with tiling support)
- update test case to depend on gbm instead of intel driver directly

v3 update:
- move wayland-drm-test to $mesa/src/egl/wayland/wayland-drm/drm-test-client
- add YUYV support to eglCreateDRMImageMesa/eglExportDRMImageMesa 
  and eglCreateImageKHR
- add egl-create-drm-image test to piglit

v4 update:
- gbm: change gbm_bo_get_handle2() to gbm_bo_get_shared_handle(), 
- gbm: allocate region name only when it is asked
- drm-test-client update according to above change: gbm_bo_get_shared_handle

Zhao Halley (10):
  GL: add YUYV to dri image format
  intel: add YUYV format for dri images
  egl wayland: add YUYV support
  gallium egl wayland: add YUYV support
  gbm dri backend: add YUYV support
  wayland-drm: add YUYV support
  gbm: add shared_handle(drm buffer region name)
  intel driver: dri image write update
  test: test case drm-test-client in src/egl/wayland/wayland-drm
  EGL: add YUYV support to eglCreateImageKHR and eglCreateDRMImageMESA

 configure.ac   |3 +-
 include/EGL/eglmesaext.h   |3 +
 include/GL/internal/dri_interface.h|1 +
 src/egl/drivers/dri2/egl_dri2.c|   26 +-
 src/egl/drivers/dri2/platform_wayland.c|8 +-
 src/egl/wayland/wayland-drm/Makefile.am|   15 +-
 src/egl/wayland/wayland-drm/drm-test-client.c  |  456 
 src/egl/wayland/wayland-drm/wayland-drm.c  |3 +
 .../state_trackers/egl/wayland/native_drm.c|3 +
 .../state_trackers/egl/wayland/native_wayland.h|3 +-
 src/gbm/backends/dri/gbm_dri.c |   22 +
 src/gbm/main/gbm.c |   18 +
 src/gbm/main/gbm.h |8 +-
 src/gbm/main/gbmint.h  |2 +
 src/mesa/drivers/dri/intel/intel_screen.c  |   27 ++-
 src/mesa/drivers/dri/intel/intel_tex_image.c   |6 +
 16 files changed, 593 insertions(+), 11 deletions(-)
 mode change 100644 = 100755 configure.ac
 mode change 100644 = 100755 include/EGL/eglext.h
 mode change 100644 = 100755 include/EGL/eglmesaext.h
 mode change 100644 = 100755 include/GL/internal/dri_interface.h
 mode change 100644 = 100755 src/egl/drivers/dri2/egl_dri2.c
 mode change 100644 = 100755 src/egl/drivers/dri2/platform_wayland.c
 create mode 100755 src/egl/wayland/wayland-drm/drm-test-client.c
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/wayland-drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_wayland.h
 mode change 100644 = 100755 src/gbm/backends/dri/gbm_dri.c
 mode change 100644 = 100755 src/gbm/main/gbm.c
 mode change 100644 = 100755 src/gbm/main/gbm.h
 mode change 100644 = 100755 src/gbm/main/gbmint.h
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_screen.c
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_tex_image.c
 mode change 100644 = 100755 tests/Makefile.am

-- 
1.7.5.4

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


[Mesa-dev] [PATCH 01/11 v4] GL: add YUYV to dri image format

2012-06-27 Thread Zhao Halley
---
 include/GL/internal/dri_interface.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 include/GL/internal/dri_interface.h

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
old mode 100644
new mode 100755
index e37917e..5e325cf
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -907,6 +907,7 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_FORMAT_ARGB 0x1003
 #define __DRI_IMAGE_FORMAT_ABGR 0x1004
 #define __DRI_IMAGE_FORMAT_XBGR 0x1005
+#define __DRI_IMAGE_FORMAT_YUYV 0x1006
 
 #define __DRI_IMAGE_USE_SHARE  0x0001
 #define __DRI_IMAGE_USE_SCANOUT0x0002
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 02/11 v4] intel: add YUYV format for dri images

2012-06-27 Thread Zhao Halley
 YUYV image works for overlay now
 YUYV image works for texture will come soon
---
 src/mesa/drivers/dri/intel/intel_screen.c|   10 ++
 src/mesa/drivers/dri/intel/intel_tex_image.c |6 ++
 2 files changed, 16 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_screen.c
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_tex_image.c

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
old mode 100644
new mode 100755
index 458178f..3b8f81e
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -216,6 +216,11 @@ intel_create_image_from_name(__DRIscreen *screen,
image-internal_format = GL_RGB;
image-data_type = GL_UNSIGNED_BYTE;
break;
+case __DRI_IMAGE_FORMAT_YUYV:
+   image-format = MESA_FORMAT_YCBCR;
+   image-internal_format = GL_YCBCR_MESA;
+   image-data_type = GL_UNSIGNED_BYTE;
+  break;
 default:
free(image);
return NULL;
@@ -343,6 +348,11 @@ intel_create_image(__DRIscreen *screen,
image-internal_format = GL_RGB;
image-data_type = GL_UNSIGNED_BYTE;
break;
+   case __DRI_IMAGE_FORMAT_YUYV:
+  image-format = MESA_FORMAT_YCBCR;
+  image-internal_format = GL_YCBCR_MESA;
+  image-data_type = GL_UNSIGNED_BYTE;
+  break;
default:
   free(image);
   return NULL;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c 
b/src/mesa/drivers/dri/intel/intel_tex_image.c
old mode 100644
new mode 100755
index 094d3cd..643e688
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -388,6 +388,12 @@ intel_image_target_texture_2d(struct gl_context *ctx, 
GLenum target,
if (image == NULL)
   return;
 
+   if (image-format == MESA_FORMAT_YCBCR) {
+  _mesa_error(intel-ctx, GL_INVALID_OPERATION, 
+glEGLImageTargetTexture2DOES, YUYV format isn't supported yet);
+  return;
+}
+
intel_set_texture_image_region(ctx, texImage, image-region,
  target, image-internal_format, 
image-format);
 }
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 03/11 v4] egl wayland: add YUYV support

2012-06-27 Thread Zhao Halley
---
 src/egl/drivers/dri2/egl_dri2.c |   17 ++---
 src/egl/drivers/dri2/platform_wayland.c |8 +++-
 2 files changed, 21 insertions(+), 4 deletions(-)
 mode change 100644 = 100755 src/egl/drivers/dri2/egl_dri2.c
 mode change 100644 = 100755 src/egl/drivers/dri2/platform_wayland.c

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
old mode 100644
new mode 100755
index 4a02838..a058046
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1096,9 +1096,15 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, 
_EGLContext *ctx,
switch (wayland_drm_buffer_get_format(buffer)) {
case WL_DRM_FORMAT_ARGB:
   format = __DRI_IMAGE_FORMAT_ARGB;
+  pitch = stride / 4;
   break;
case WL_DRM_FORMAT_XRGB:
   format = __DRI_IMAGE_FORMAT_XRGB;
+  pitch = stride / 4;
+  break;
+   case WL_DRM_FORMAT_YUYV:
+  format = __DRI_IMAGE_FORMAT_YUYV;
+  pitch = stride / 2;
   break;
default:
   _eglError(EGL_BAD_PARAMETER,
@@ -1106,8 +1112,6 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, 
_EGLContext *ctx,
   return NULL;
}
 
-   pitch = stride / 4;
-
return dri2_create_image_drm_name(disp, ctx, name, attrs, format, pitch);
 }
 #endif
@@ -1270,21 +1274,28 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
__DRIimage *image;
int dri_format;
+   int pitch = 0;
 
switch (format) {
case WL_DRM_FORMAT_ARGB:
   dri_format =__DRI_IMAGE_FORMAT_ARGB;
+  pitch = stride/4;
   break;
case WL_DRM_FORMAT_XRGB:
   dri_format = __DRI_IMAGE_FORMAT_XRGB;
+  pitch = stride/4;
   break;
+  case WL_DRM_FORMAT_YUYV:
+ dri_format = __DRI_IMAGE_FORMAT_YUYV;
+ pitch = stride/2;
+ break;
default:
   return NULL;
}
 
image = dri2_dpy-image-createImageFromName(dri2_dpy-dri_screen,
width, height, 
-   dri_format, name, stride / 4,
+   dri_format, name, pitch,
NULL);
 
return image;
diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
old mode 100644
new mode 100755
index d291f0f..6d330b7
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -42,7 +42,9 @@
 
 enum wl_drm_format_flags {
HAS_ARGB = 1,
-   HAS_XRGB = 2
+   HAS_XRGB = (1  1),
+   HAS_YUYV = (1  2)
+   
 };
 
 static void
@@ -778,6 +780,9 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t 
format)
case WL_DRM_FORMAT_XRGB:
   dri2_dpy-formats |= HAS_XRGB;
   break;
+   case WL_DRM_FORMAT_YUYV:
+  dri2_dpy-formats |= HAS_YUYV;
+  break;
}
 }
 
@@ -878,6 +883,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
 dri2_add_config(disp, config, i + 1, 0, types, NULL, rgb_masks);
   if (dri2_dpy-formats  HAS_ARGB)
 dri2_add_config(disp, config, i + 1, 0, types, NULL, argb_masks);
+  // , should we do something for YUYV here?
}
 
disp-Extensions.KHR_image_pixmap = EGL_TRUE;
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 04/11 v4] gallium egl wayland: add YUYV support

2012-06-27 Thread Zhao Halley
---
 .../state_trackers/egl/wayland/native_drm.c|3 +++
 .../state_trackers/egl/wayland/native_wayland.h|3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_wayland.h

diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c 
b/src/gallium/state_trackers/egl/wayland/native_drm.c
old mode 100644
new mode 100755
index e3bd628..f2d2e74
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -164,6 +164,9 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t 
format)
case WL_DRM_FORMAT_XRGB:
   drmdpy-base.formats |= HAS_XRGB;
   break;
+  case WL_DRM_FORMAT_YUYV:
+ drmdpy-base.formats |= HAS_YUYV;
+ break;
}
 }
 
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.h 
b/src/gallium/state_trackers/egl/wayland/native_wayland.h
old mode 100644
new mode 100755
index e6a914f..bd26bf0
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.h
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.h
@@ -38,7 +38,8 @@ struct wayland_surface;
 
 enum wayland_format_flag {
HAS_ARGB= (1  0),
-   HAS_XRGB= (1  1)
+   HAS_XRGB= (1  1),
+   HAS_YUYV= (1  2)
 };
 
 struct wayland_display {
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 05/11 v4] gbm dri backend: add YUYV support

2012-06-27 Thread Zhao Halley
---
 src/gbm/backends/dri/gbm_dri.c |9 +
 src/gbm/main/gbm.h |5 -
 2 files changed, 13 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 src/gbm/backends/dri/gbm_dri.c
 mode change 100644 = 100755 src/gbm/main/gbm.h

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
old mode 100644
new mode 100755
index e5ddfb6..9e2bd83
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -280,6 +280,9 @@ gbm_dri_is_format_supported(struct gbm_device *gbm,
   if (usage  GBM_BO_USE_SCANOUT)
  return 0;
   break;
+  case GBM_BO_FORMAT_YUYV:
+  case GBM_FORMAT_YUYV:
+ break;
default:
   return 0;
}
@@ -331,6 +334,9 @@ gbm_dri_to_gbm_format(uint32_t dri_format)
case __DRI_IMAGE_FORMAT_ABGR:
   ret = GBM_FORMAT_ABGR;
   break;
+  case __DRI_IMAGE_FORMAT_YUYV:
+ ret = GBM_FORMAT_YUYV;
+ break;
default:
   ret = 0;
   break;
@@ -428,6 +434,9 @@ gbm_dri_bo_create(struct gbm_device *gbm,
case GBM_FORMAT_ABGR:
   dri_format = __DRI_IMAGE_FORMAT_ABGR;
   break;
+  case GBM_FORMAT_YUYV:
+ dri_format = __DRI_IMAGE_FORMAT_YUYV;
+ break;
default:
   return NULL;
}
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
old mode 100644
new mode 100755
index af5dc5a..b2a0aa3
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -73,7 +73,10 @@ enum gbm_bo_format {
/** RGB with 8 bits per channel in a 32 bit value */
GBM_BO_FORMAT_XRGB, 
/** ARGB with 8 bits per channel in a 32 bit value */
-   GBM_BO_FORMAT_ARGB
+   GBM_BO_FORMAT_ARGB, 
+   /** YUYV: packed YUV format with 422 subsampling*/
+   GBM_BO_FORMAT_YUYV,
+   
 };
 
 #define __gbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b)  8) | \
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 06/11 v4] wayland-drm: add YUYV support

2012-06-27 Thread Zhao Halley
---
 src/egl/wayland/wayland-drm/wayland-drm.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/wayland-drm.c

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c 
b/src/egl/wayland/wayland-drm/wayland-drm.c
old mode 100644
new mode 100755
index 5f831b3..d9cfe09
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -111,6 +111,7 @@ drm_create_buffer(struct wl_client *client, struct 
wl_resource *resource,
switch (format) {
case WL_DRM_FORMAT_ARGB:
case WL_DRM_FORMAT_XRGB:
+case WL_DRM_FORMAT_YUYV:
break;
default:
wl_resource_post_error(resource,
@@ -186,6 +187,8 @@ bind_drm(struct wl_client *client, void *data, uint32_t 
version, uint32_t id)
   WL_DRM_FORMAT_ARGB);
wl_resource_post_event(resource, WL_DRM_FORMAT,
   WL_DRM_FORMAT_XRGB);
+   wl_resource_post_event(resource, WL_DRM_FORMAT,
+  WL_DRM_FORMAT_YUYV);
 }
 
 struct wl_drm *
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 07/11 v4] gbm: add shared_handle(drm buffer region name)

2012-06-27 Thread Zhao Halley
  it can be shared among processed
---
 src/gbm/backends/dri/gbm_dri.c |   13 +
 src/gbm/main/gbm.c |   18 ++
 src/gbm/main/gbm.h |3 +++
 src/gbm/main/gbmint.h  |2 ++
 4 files changed, 36 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/gbm/main/gbm.c
 mode change 100644 = 100755 src/gbm/main/gbmint.h

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 9e2bd83..0646b47 100755
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -345,6 +345,18 @@ gbm_dri_to_gbm_format(uint32_t dri_format)
return ret;
 }
 
+static union gbm_bo_handle
+gbm_dri_bo_get_shared_handle(struct gbm_bo *_bo)
+{
+   struct gbm_dri_device *dri = gbm_dri_device(_bo-gbm);
+   struct gbm_dri_bo *bo = gbm_dri_bo(_bo);
+
+   dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_NAME,
+  (uint32_t *) bo-base.base.shared_handle.u32);
+
+   return bo-base.base.shared_handle;
+}
+
 static struct gbm_bo *
 gbm_dri_bo_create_from_egl_image(struct gbm_device *gbm,
  void *egl_dpy, void *egl_img,
@@ -522,6 +534,7 @@ dri_device_create(int fd)
dri-base.base.destroy = dri_destroy;
dri-base.base.surface_create = gbm_dri_surface_create;
dri-base.base.surface_destroy = gbm_dri_surface_destroy;
+   dri-base.base.bo_get_shared_handle = gbm_dri_bo_get_shared_handle;
 
dri-base.type = GBM_DRM_DRIVER_TYPE_DRI;
dri-base.base.name = drm;
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
old mode 100644
new mode 100755
index 3994f86..017cb2d
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -231,6 +231,24 @@ gbm_bo_get_handle(struct gbm_bo *bo)
return bo-handle;
 }
 
+/** Get shared handle(global buffer region name) of the buffer object, 
+ * this handle can be shared among processes
+ *
+ * This is stored in the platform generic union gbm_bo_handle type. However
+ * the format of this handle is platform specific.
+ *
+ * \param bo The buffer object
+ * \return Returns the handle of the allocated buffer object
+ */
+GBM_EXPORT union gbm_bo_handle
+gbm_bo_get_shared_handle(struct gbm_bo *bo)
+{
+   if (bo-shared_handle.u32) return bo-shared_handle;
+   
+   return bo-gbm-bo_get_shared_handle(bo);
+   
+}
+
 /** Write data into the buffer object
  *
  * If the buffer object was created with the GBM_BO_USE_WRITE flag,
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
index b2a0aa3..68309fb 100755
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -257,6 +257,9 @@ gbm_bo_get_device(struct gbm_bo *bo);
 union gbm_bo_handle
 gbm_bo_get_handle(struct gbm_bo *bo);
 
+union gbm_bo_handle
+gbm_bo_get_shared_handle(struct gbm_bo *bo);
+
 int
 gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
 
diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h
old mode 100644
new mode 100755
index 8eb8671..6327f94
--- a/src/gbm/main/gbmint.h
+++ b/src/gbm/main/gbmint.h
@@ -70,6 +70,7 @@ struct gbm_device {
   void *egl_dpy, void *egl_img,
   uint32_t width, uint32_t height,
   uint32_t usage);
+   union gbm_bo_handle (*bo_get_shared_handle)(struct gbm_bo *bo);
int (*bo_write)(struct gbm_bo *bo, const void *buf, size_t data);
void (*bo_destroy)(struct gbm_bo *bo);
 
@@ -95,6 +96,7 @@ struct gbm_bo {
uint32_t pitch;
uint32_t format;
union gbm_bo_handle  handle;
+   union gbm_bo_handle  shared_handle; // global handle can be shared among 
processes
void *user_data;
void (*destroy_user_data)(struct gbm_bo *, void *);
 };
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 08/11 v4] intel driver: dri image write update

2012-06-27 Thread Zhao Halley
add tiling support for intel_image_write()
all drm image can be written from app
---
 src/mesa/drivers/dri/intel/intel_screen.c |   17 +++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 3b8f81e..63b6b24 100755
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -310,10 +310,13 @@ intel_create_image(__DRIscreen *screen,
   tiling = I915_TILING_NONE;
}
 
+#if 0
+   // add tiling support in intel_image_write(), so all drm images are ok 
for write
/* We only support write for cursor drm images */
if ((use  __DRI_IMAGE_USE_WRITE) 
use != (__DRI_IMAGE_USE_WRITE | __DRI_IMAGE_USE_CURSOR))
   return NULL;
+#endif
 
image = CALLOC(sizeof *image);
if (image == NULL)
@@ -441,9 +444,19 @@ intel_image_write(__DRIimage *image, const void *buf, 
size_t count)
if (!(image-usage  __DRI_IMAGE_USE_WRITE))
   return -1;
 
-   drm_intel_bo_map(image-region-bo, true);
+   int tiling, swizzle;
+   dri_bo_get_tiling(image-region-bo, tiling, swizzle);
+   if (tiling != I915_TILING_NONE)
+   drm_intel_gem_bo_map_gtt(image-region-bo);
+   else
+   dri_bo_map(image-region-bo, 1);
+   
memcpy(image-region-bo-virtual, buf, count);
-   drm_intel_bo_unmap(image-region-bo);
+
+   if (tiling != I915_TILING_NONE)
+   drm_intel_gem_bo_unmap_gtt(image-region-bo);
+   else
+   dri_bo_unmap(image-region-bo);
 
return 0;
 }
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 10/11 v4] EGL: add YUYV support to eglCreateImageKHR and eglCreateDRMImageMESA

2012-06-27 Thread Zhao Halley
---
 include/EGL/eglmesaext.h|3 +++
 src/egl/drivers/dri2/egl_dri2.c |9 -
 2 files changed, 11 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 include/EGL/eglext.h
 mode change 100644 = 100755 include/EGL/eglmesaext.h

diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
old mode 100644
new mode 100755
diff --git a/include/EGL/eglmesaext.h b/include/EGL/eglmesaext.h
old mode 100644
new mode 100755
index 52dd5b1..cb251fd
--- a/include/EGL/eglmesaext.h
+++ b/include/EGL/eglmesaext.h
@@ -107,6 +107,9 @@ typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDRMDISPLAYMESA) 
(int fd);
 #ifndef EGL_DRM_BUFFER_USE_CURSOR_MESA
 #define EGL_DRM_BUFFER_USE_CURSOR_MESA 0x0004
 #endif
+#ifndef EGL_DRM_BUFFER_FORMAT_YUYV_MESA
+#define EGL_DRM_BUFFER_FORMAT_YUYV_MESA0x31D6  /* 
EGL_DRM_BUFFER_FORMAT_MESA attribute value */
+#endif
 #endif
 
 #ifndef EGL_WL_bind_wayland_display
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index a058046..02eeafb 100755
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1055,8 +1055,12 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, 
_EGLContext *ctx,
switch (attrs.DRMBufferFormatMESA) {
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA:
   format = __DRI_IMAGE_FORMAT_ARGB;
-  pitch = attrs.DRMBufferStrideMESA;
+  pitch = attrs.DRMBufferStrideMESA/4;
   break;
+   case EGL_DRM_BUFFER_FORMAT_YUYV_MESA:
+  format = __DRI_IMAGE_FORMAT_YUYV;
+  pitch = attrs.DRMBufferStrideMESA/2;
+ break;
default:
   _eglError(EGL_BAD_PARAMETER,
dri2_create_image_khr: unsupported pixmap depth);
@@ -1195,6 +1199,9 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay 
*disp,
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA:
   format = __DRI_IMAGE_FORMAT_ARGB;
   break;
+   case EGL_DRM_BUFFER_FORMAT_YUYV_MESA:
+  format = __DRI_IMAGE_FORMAT_YUYV;
+  break;
default:
   _eglLog(_EGL_WARNING, bad image format value 0x%04x,
 attrs.DRMBufferFormatMESA);
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 09/11 v4] test: test case drm-test-client in src/egl/wayland/wayland-drm

2012-06-27 Thread Zhao Halley
 - it shows how wayland-drm protocol works between server and client
   buffer are shared basing on dri image
 - XRGB and YUYV format are supported,
   it can render to overlay plane potentially
---
 configure.ac  |3 +-
 src/egl/wayland/wayland-drm/Makefile.am   |   15 +-
 src/egl/wayland/wayland-drm/drm-test-client.c |  456 +
 3 files changed, 472 insertions(+), 2 deletions(-)
 mode change 100644 = 100755 configure.ac
 create mode 100755 src/egl/wayland/wayland-drm/drm-test-client.c
 mode change 100644 = 100755 tests/Makefile.am

diff --git a/configure.ac b/configure.ac
old mode 100644
new mode 100755
index 3bc59ca..044d19e
--- a/configure.ac
+++ b/configure.ac
@@ -2033,7 +2033,8 @@ AC_CONFIG_FILES([configs/autoconf
src/mesa/drivers/dri/radeon/Makefile
src/mesa/drivers/dri/swrast/Makefile
tests/Makefile
-   tests/glx/Makefile])
+   tests/glx/Makefile
+])
 
 dnl Replace the configs/current symlink
 AC_CONFIG_COMMANDS([configs],[
diff --git a/src/egl/wayland/wayland-drm/Makefile.am 
b/src/egl/wayland/wayland-drm/Makefile.am
index cf15eda..dce9184 100644
--- a/src/egl/wayland/wayland-drm/Makefile.am
+++ b/src/egl/wayland/wayland-drm/Makefile.am
@@ -10,6 +10,19 @@ noinst_HEADERS = wayland-drm.h
 BUILT_SOURCES = wayland-drm-protocol.c \
wayland-drm-client-protocol.h \
wayland-drm-server-protocol.h
-CLEANFILES = $(BUILT_SOURCES)
+
+noinst_PROGRAMS = drm_test_client
+drm_test_client_CFLAGS = $(DEFINES) \
+   -I$(top_srcdir)/src/gbm/main \
+   $(WAYLAND_CFLAGS) \
+   $(LIBDRM_CFLAGS)
+
+drm_test_client_LDADD = $(WAYLAND_LIBS) $(LIBDRM_LIBS) 
+drm_test_client_LDADD += $(top_srcdir)/src/gbm/libgbm.la
+
+drm_test_client_SOURCES = drm-test-client.c wayland-drm-protocol.c \
+ wayland-drm-client-protocol.h
+
+CLEANFILES = $(BUILT_SOURCES) $(drm_test_client_SOURCES)
 
 @wayland_scanner_rules@
diff --git a/src/egl/wayland/wayland-drm/drm-test-client.c 
b/src/egl/wayland/wayland-drm/drm-test-client.c
new file mode 100755
index 000..d396aee
--- /dev/null
+++ b/src/egl/wayland/wayland-drm/drm-test-client.c
@@ -0,0 +1,456 @@
+/*
+ * Copyright © 2012 Halley Zhao
+ *
+ * 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:
+ *Halley Zhao halley.z...@intel.com
+ */
+
+
+#include stdlib.h
+#include stdio.h
+#include unistd.h
+#include errno.h
+#include fcntl.h
+#include sys/stat.h
+#include string.h
+#include assert.h
+#include xf86drm.h
+#include gbm.h
+#include wayland-client.h
+#include wayland-client-protocol.h
+#include wayland-drm-client-protocol.h
+
+int win_width = 256, win_height = 256;
+int drm_fd = -1;
+int wayland_server_support_yuyv = 0;
+struct wl_drm *wl_drm;
+
+struct display {
+   struct wl_display *display;
+   struct wl_compositor *compositor;
+   struct wl_shell *shell;
+   struct wl_input_device *input;
+   uint32_t mask;
+struct gbm_device *gbm;
+};
+
+struct window {
+   struct display *display;
+   struct wl_surface *surface;
+   struct wl_shell_surface *shell_surface;
+   struct wl_callback *callback;
+   struct {
+   int width, height;
+   } geometry;
+unsigned int format;
+struct wl_buffer *buffer;
+struct gbm_bo *gbm_bo;
+unsigned int bo_pitch;
+};
+
+void fill_window_XRGB(struct window *win);
+void fill_window_YUYV(struct window *win);
+int wayland_drm_init(struct wl_display *wl_dpy);
+void wayland_drm_destroy(void);
+void redraw(void *data, struct wl_callback *callback, uint32_t time);
+
+void fill_window_XRGB(struct window *win)
+{
+unsigned char *mem = malloc (win-bo_pitch * win_height);
+static int color_index = 0;
+static unsigned int color_arr[4] = 

[Mesa-dev] [PATCH 11/11 v4] [piglit] add egl-create-drm-image test

2012-06-27 Thread Zhao Halley
---
 tests/egl/CMakeLists.gl.txt  |2 +
 tests/egl/egl-create-drm-image.c |  145 ++
 2 files changed, 147 insertions(+), 0 deletions(-)
 create mode 100755 tests/egl/egl-create-drm-image.c

diff --git a/tests/egl/CMakeLists.gl.txt b/tests/egl/CMakeLists.gl.txt
index ddfbbef..1e8865c 100644
--- a/tests/egl/CMakeLists.gl.txt
+++ b/tests/egl/CMakeLists.gl.txt
@@ -20,6 +20,8 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES Linux)
target_link_libraries(egl-create-surface pthread ${X11_X11_LIB})
piglit_add_executable (egl-query-surface egl-util.c egl-query-surface.c)
target_link_libraries(egl-query-surface pthread ${X11_X11_LIB})
+   piglit_add_executable (egl-create-drm-image egl-util.c 
egl-create-drm-image.c)
+   target_link_libraries(egl-create-drm-image pthread ${X11_X11_LIB})
 ENDIF(${CMAKE_SYSTEM_NAME} MATCHES Linux)
 
 # vim: ft=cmake:
diff --git a/tests/egl/egl-create-drm-image.c b/tests/egl/egl-create-drm-image.c
new file mode 100755
index 000..d20d27e
--- /dev/null
+++ b/tests/egl/egl-create-drm-image.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright © 2012 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.
+ *
+ * Author: Halley Zhao halley.z...@intel.com
+ */
+
+/** @file egl-create-drm-image.c
+ *
+ * Test EGL_MESA_drm_image.
+ */
+
+#include piglit-util.h
+#include egl-util.h
+
+#ifdef EGL_MESA_drm_image
+
+const char *extensions[] = { EGL_MESA_drm_image, NULL }; 
+
+static enum piglit_result
+draw(struct egl_state *state)
+{
+PFNEGLCREATEDRMIMAGEMESAPROC create_drm_image;
+PFNEGLEXPORTDRMIMAGEMESAPROC export_drm_image;
+PFNEGLCREATEIMAGEKHRPROCcreate_image;
+PFNEGLDESTROYIMAGEKHRPROC   destroy_image;
+
+EGLImageKHR image1 = EGL_NO_IMAGE_KHR;
+EGLImageKHR image2 = EGL_NO_IMAGE_KHR;
+
+EGLint attr_list1[] = {
+EGL_WIDTH, 256, EGL_HEIGHT, 256, 
+EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_YUYV_MESA, 
+// EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
+EGL_NONE
+};
+
+EGLint name, handle, stride;
+EGLint attr_list2[] = {
+EGL_DRM_BUFFER_STRIDE_MESA, 0, 
+EGL_WIDTH, 256, EGL_HEIGHT, 256, 
+EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_YUYV_MESA, 
+// EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
+EGL_NONE
+};
+#define STRIDE_INDEX1
+
+   create_drm_image = 
(PFNEGLCREATEDRMIMAGEMESAPROC)eglGetProcAddress(eglCreateDRMImageMESA);
+   if (create_drm_image == NULL ) {
+   fprintf(stderr, could not getproc eglCreateDRMImageMESA);
+   piglit_report_result(PIGLIT_PASS);
+   }
+
+   export_drm_image = 
(PFNEGLEXPORTDRMIMAGEMESAPROC)eglGetProcAddress(eglExportDRMImageMESA);
+   if (export_drm_image == NULL ) {
+   fprintf(stderr, could not getproc eglExportDRMImageMESA);
+   piglit_report_result(PIGLIT_PASS);
+   }
+
+   create_image = 
(PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress(eglCreateImageKHR);
+   if (create_image == NULL ) {
+   fprintf(stderr, could not getproc eglCreateImageKHR);
+   piglit_report_result(PIGLIT_PASS);
+   }
+
+   destroy_image = 
(PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress(eglDestroyImageKHR);
+   if (destroy_image == NULL ) {
+   fprintf(stderr, could not getproc eglDestroyImageKHR);
+   piglit_report_result(PIGLIT_PASS);
+   }
+
+image1 = create_drm_image(state-egl_dpy, attr_list1);
+if(image1 == EGL_NO_IMAGE_KHR) {
+   fprintf(stderr, fail to create YUYV EGLImageKHR from 
eglCreateDRMImageMESA);
+   piglit_report_result(PIGLIT_FAIL);
+}
+
+if (export_drm_image(state-egl_dpy, image1, name, handle, stride) == 
EGL_FALSE) {
+   fprintf(stderr, fail to create export YUYV EGLImageKHR 

Re: [Mesa-dev] [PATCH 07/11 v3] gbm: add handle2(drm buffer region name)

2012-06-21 Thread Zhao, Halley
Thanks Ander. I updated the patch following your advice:


From 6110f8c5ed0dc326e85d07a3c5408be5810db245 Mon Sep 17 00:00:00 2001
From: Zhao Halley halley.z...@intel.com
Date: Thu, 14 Jun 2012 18:19:12 +0800
Subject: [PATCH 07/10] gbm: add shared_handle(drm buffer region name)

  it can be shared among processed
---
 src/gbm/backends/dri/gbm_dri.c |   13 +
 src/gbm/main/gbm.c |   18 ++
 src/gbm/main/gbm.h |3 +++
 src/gbm/main/gbmint.h  |2 ++
 4 files changed, 36 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/gbm/main/gbm.c
 mode change 100644 = 100755 src/gbm/main/gbmint.h

diff --git a/src/gbm/backends/dri/gbm_dri.c
b/src/gbm/backends/dri/gbm_dri.c
index 9e2bd83..0646b47 100755
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -345,6 +345,18 @@ gbm_dri_to_gbm_format(uint32_t dri_format)
return ret;
 }
 
+static union gbm_bo_handle
+gbm_dri_bo_get_shared_handle(struct gbm_bo *_bo)
+{
+   struct gbm_dri_device *dri = gbm_dri_device(_bo-gbm);
+   struct gbm_dri_bo *bo = gbm_dri_bo(_bo);
+
+   dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_NAME,
+  (uint32_t *)
bo-base.base.shared_handle.u32);
+
+   return bo-base.base.shared_handle;
+}
+
 static struct gbm_bo *
 gbm_dri_bo_create_from_egl_image(struct gbm_device *gbm,
  void *egl_dpy, void *egl_img,
@@ -522,6 +534,7 @@ dri_device_create(int fd)
dri-base.base.destroy = dri_destroy;
dri-base.base.surface_create = gbm_dri_surface_create;
dri-base.base.surface_destroy = gbm_dri_surface_destroy;
+   dri-base.base.bo_get_shared_handle = gbm_dri_bo_get_shared_handle;
 
dri-base.type = GBM_DRM_DRIVER_TYPE_DRI;
dri-base.base.name = drm;
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
old mode 100644
new mode 100755
index 3994f86..017cb2d
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -231,6 +231,24 @@ gbm_bo_get_handle(struct gbm_bo *bo)
return bo-handle;
 }
 
+/** Get shared handle(global buffer region name) of the buffer object, 
+ * this handle can be shared among processes
+ *
+ * This is stored in the platform generic union gbm_bo_handle type.
However
+ * the format of this handle is platform specific.
+ *
+ * \param bo The buffer object
+ * \return Returns the handle of the allocated buffer object
+ */
+GBM_EXPORT union gbm_bo_handle
+gbm_bo_get_shared_handle(struct gbm_bo *bo)
+{
+   if (bo-shared_handle.u32) return bo-shared_handle;
+   
+   return bo-gbm-bo_get_shared_handle(bo);
+   
+}
+
 /** Write data into the buffer object
  *
  * If the buffer object was created with the GBM_BO_USE_WRITE flag,
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
index b2a0aa3..68309fb 100755
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -257,6 +257,9 @@ gbm_bo_get_device(struct gbm_bo *bo);
 union gbm_bo_handle
 gbm_bo_get_handle(struct gbm_bo *bo);
 
+union gbm_bo_handle
+gbm_bo_get_shared_handle(struct gbm_bo *bo);
+
 int
 gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
 
diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h
old mode 100644
new mode 100755
index 8eb8671..6327f94
--- a/src/gbm/main/gbmint.h
+++ b/src/gbm/main/gbmint.h
@@ -70,6 +70,7 @@ struct gbm_device {
   void *egl_dpy, void
*egl_img,
   uint32_t width, uint32_t
height,
   uint32_t usage);
+   union gbm_bo_handle (*bo_get_shared_handle)(struct gbm_bo *bo);
int (*bo_write)(struct gbm_bo *bo, const void *buf, size_t data);
void (*bo_destroy)(struct gbm_bo *bo);
 
@@ -95,6 +96,7 @@ struct gbm_bo {
uint32_t pitch;
uint32_t format;
union gbm_bo_handle  handle;
+   union gbm_bo_handle  shared_handle; // global handle can be shared
among processes
void *user_data;
void (*destroy_user_data)(struct gbm_bo *, void *);
 };
-- 
1.7.5.4


On Tue, 2012-06-19 at 15:47 +0300, Ander Conselvan de Oliveira wrote:
 On 06/14/2012 01:32 PM, Zhao Halley wrote:
  ---
src/gbm/backends/dri/gbm_dri.c |6 +-
src/gbm/main/gbm.c |   14 ++
src/gbm/main/gbm.h |3 +++
src/gbm/main/gbmint.h  |1 +
4 files changed, 23 insertions(+), 1 deletions(-)
mode change 100644 =  100755 src/gbm/main/gbm.c
mode change 100644 =  100755 src/gbm/main/gbmint.h
 
  diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
  index 9e2bd83..a71815f 100755
  --- a/src/gbm/backends/dri/gbm_dri.c
  +++ b/src/gbm/backends/dri/gbm_dri.c
  @@ -392,6 +392,8 @@ gbm_dri_bo_create_from_egl_image(struct gbm_device *gbm,
  (int *)bo-base.base.pitch);
   dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_FORMAT,
  dri_format);
  +   dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_NAME

Re: [Mesa-dev] [PATCH 09/11 v3] test: test case drm-test-client in src/egl/wayland/wayland-drm

2012-06-21 Thread Zhao, Halley
small update following gbm change: gbm_bo_get_shared_handle()


From fb0e0eec5064f8af3e126a457fc23173a8bb6d49 Mon Sep 17 00:00:00 2001
From: Zhao Halley halley.z...@intel.com
Date: Tue, 5 Jun 2012 14:59:56 +0800
Subject: [PATCH 09/10] test: test case drm-test-client in
 src/egl/wayland/wayland-drm

 - it shows how wayland-drm protocol works between server and client
   buffer are shared basing on dri image
 - XRGB and YUYV format are supported,
   it can render to overlay plane potentially
---
 configure.ac  |3 +-
 src/egl/wayland/wayland-drm/Makefile.am   |   15 +-
 src/egl/wayland/wayland-drm/drm-test-client.c |  456
+
 3 files changed, 472 insertions(+), 2 deletions(-)
 mode change 100644 = 100755 configure.ac
 create mode 100755 src/egl/wayland/wayland-drm/drm-test-client.c
 mode change 100644 = 100755 tests/Makefile.am

diff --git a/configure.ac b/configure.ac
old mode 100644
new mode 100755
index 3bc59ca..044d19e
--- a/configure.ac
+++ b/configure.ac
@@ -2033,7 +2033,8 @@ AC_CONFIG_FILES([configs/autoconf
src/mesa/drivers/dri/radeon/Makefile
src/mesa/drivers/dri/swrast/Makefile
tests/Makefile
-   tests/glx/Makefile])
+   tests/glx/Makefile
+])
 
 dnl Replace the configs/current symlink
 AC_CONFIG_COMMANDS([configs],[
diff --git a/src/egl/wayland/wayland-drm/Makefile.am
b/src/egl/wayland/wayland-drm/Makefile.am
index cf15eda..dce9184 100644
--- a/src/egl/wayland/wayland-drm/Makefile.am
+++ b/src/egl/wayland/wayland-drm/Makefile.am
@@ -10,6 +10,19 @@ noinst_HEADERS = wayland-drm.h
 BUILT_SOURCES = wayland-drm-protocol.c \
wayland-drm-client-protocol.h \
wayland-drm-server-protocol.h
-CLEANFILES = $(BUILT_SOURCES)
+
+noinst_PROGRAMS = drm_test_client
+drm_test_client_CFLAGS = $(DEFINES) \
+   -I$(top_srcdir)/src/gbm/main \
+   $(WAYLAND_CFLAGS) \
+   $(LIBDRM_CFLAGS)
+
+drm_test_client_LDADD = $(WAYLAND_LIBS) $(LIBDRM_LIBS) 
+drm_test_client_LDADD += $(top_srcdir)/src/gbm/libgbm.la
+
+drm_test_client_SOURCES = drm-test-client.c wayland-drm-protocol.c \
+ wayland-drm-client-protocol.h
+
+CLEANFILES = $(BUILT_SOURCES) $(drm_test_client_SOURCES)
 
 @wayland_scanner_rules@
diff --git a/src/egl/wayland/wayland-drm/drm-test-client.c
b/src/egl/wayland/wayland-drm/drm-test-client.c
new file mode 100755
index 000..d396aee
--- /dev/null
+++ b/src/egl/wayland/wayland-drm/drm-test-client.c
@@ -0,0 +1,456 @@
+/*
+ * Copyright © 2012 Halley Zhao
+ *
+ * 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:
+ *Halley Zhao halley.z...@intel.com
+ */
+
+
+#include stdlib.h
+#include stdio.h
+#include unistd.h
+#include errno.h
+#include fcntl.h
+#include sys/stat.h
+#include string.h
+#include assert.h
+#include xf86drm.h
+#include gbm.h
+#include wayland-client.h
+#include wayland-client-protocol.h
+#include wayland-drm-client-protocol.h
+
+int win_width = 256, win_height = 256;
+int drm_fd = -1;
+int wayland_server_support_yuyv = 0;
+struct wl_drm *wl_drm;
+
+struct display {
+   struct wl_display *display;
+   struct wl_compositor *compositor;
+   struct wl_shell *shell;
+   struct wl_input_device *input;
+   uint32_t mask;
+struct gbm_device *gbm;
+};
+
+struct window {
+   struct display *display;
+   struct wl_surface *surface;
+   struct wl_shell_surface *shell_surface;
+   struct wl_callback *callback;
+   struct {
+   int width, height;
+   } geometry;
+unsigned int format;
+struct wl_buffer *buffer;
+struct gbm_bo *gbm_bo;
+unsigned int bo_pitch;
+};
+
+void fill_window_XRGB(struct window *win);
+void fill_window_YUYV(struct window *win);
+int wayland_drm_init(struct wl_display *wl_dpy

Re: [Mesa-dev] [PATCH 02/11 v3] mesa intel driver:

2012-06-18 Thread Zhao, Halley
Thanks Paul, I have updated the patch as following.

Another colleague is working on texture support of YUYV format,
patches will come soon.


From c036437ab676f26f8f1b788cbfafaca4b4b6005a Mon Sep 17 00:00:00 2001
From: Zhao Halley halley.z...@intel.com
Date: Fri, 25 May 2012 11:36:48 +0800
Subject: [PATCH 02/10] intel: add YUYV format for dri images

 YUYV image works for overlay now
 YUYV image works for texture will come soon
---
 src/mesa/drivers/dri/intel/intel_screen.c|   10 ++
 src/mesa/drivers/dri/intel/intel_tex_image.c |6 ++
 2 files changed, 16 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_screen.c
 mode change 100644 = 100755
src/mesa/drivers/dri/intel/intel_tex_image.c

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c
b/src/mesa/drivers/dri/intel/intel_screen.c
old mode 100644
new mode 100755
index 458178f..3b8f81e
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -216,6 +216,11 @@ intel_create_image_from_name(__DRIscreen *screen,
image-internal_format = GL_RGB;
image-data_type = GL_UNSIGNED_BYTE;
break;
+case __DRI_IMAGE_FORMAT_YUYV:
+   image-format = MESA_FORMAT_YCBCR;
+   image-internal_format = GL_YCBCR_MESA;
+   image-data_type = GL_UNSIGNED_BYTE;
+  break;
 default:
free(image);
return NULL;
@@ -343,6 +348,11 @@ intel_create_image(__DRIscreen *screen,
image-internal_format = GL_RGB;
image-data_type = GL_UNSIGNED_BYTE;
break;
+   case __DRI_IMAGE_FORMAT_YUYV:
+  image-format = MESA_FORMAT_YCBCR;
+  image-internal_format = GL_YCBCR_MESA;
+  image-data_type = GL_UNSIGNED_BYTE;
+  break;
default:
   free(image);
   return NULL;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c
b/src/mesa/drivers/dri/intel/intel_tex_image.c
old mode 100644
new mode 100755
index 094d3cd..643e688
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -388,6 +388,12 @@ intel_image_target_texture_2d(struct gl_context
*ctx, GLenum target,
if (image == NULL)
   return;
 
+   if (image-format == MESA_FORMAT_YCBCR) {
+  _mesa_error(intel-ctx, GL_INVALID_OPERATION, 
+glEGLImageTargetTexture2DOES, YUYV format isn't supported
yet);
+  return;
+}
+
intel_set_texture_image_region(ctx, texImage, image-region,
  target, image-internal_format, 
image-format);
 }
-- 
1.7.5.4

On Thu, 2012-06-14 at 08:37 -0600, Brian Paul wrote:
 On 06/14/2012 04:32 AM, Zhao Halley wrote:
add YUYV format for dri image
 
 Minor nit: the first line of the patch comment should be something 
 like: intel: add YUYV format for dri images
 
 YUYV image doesn't use for texture
 
 ??  Can you rewrite/clarify that?
 
 
  ---
src/mesa/drivers/dri/intel/intel_screen.c|   10 ++
src/mesa/drivers/dri/intel/intel_tex_image.c |6 ++
2 files changed, 16 insertions(+), 0 deletions(-)
mode change 100644 =  100755 src/mesa/drivers/dri/intel/intel_screen.c
mode change 100644 =  100755 src/mesa/drivers/dri/intel/intel_tex_image.c
 
  diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
  b/src/mesa/drivers/dri/intel/intel_screen.c
  old mode 100644
  new mode 100755
  index 458178f..3b8f81e
  --- a/src/mesa/drivers/dri/intel/intel_screen.c
  +++ b/src/mesa/drivers/dri/intel/intel_screen.c
  @@ -216,6 +216,11 @@ intel_create_image_from_name(__DRIscreen *screen,
   image-internal_format = GL_RGB;
   image-data_type = GL_UNSIGNED_BYTE;
   break;
  +case __DRI_IMAGE_FORMAT_YUYV:
  +   image-format = MESA_FORMAT_YCBCR;
  +   image-internal_format = GL_YCBCR_MESA;
  +   image-data_type = GL_UNSIGNED_BYTE;
  +  break;
default:
   free(image);
   return NULL;
  @@ -343,6 +348,11 @@ intel_create_image(__DRIscreen *screen,
   image-internal_format = GL_RGB;
   image-data_type = GL_UNSIGNED_BYTE;
   break;
  +   case __DRI_IMAGE_FORMAT_YUYV:
  +  image-format = MESA_FORMAT_YCBCR;
  +  image-internal_format = GL_YCBCR_MESA;
  +  image-data_type = GL_UNSIGNED_BYTE;
  +  break;
   default:
  free(image);
  return NULL;
  diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c 
  b/src/mesa/drivers/dri/intel/intel_tex_image.c
  old mode 100644
  new mode 100755
  index 094d3cd..8b94cb1
  --- a/src/mesa/drivers/dri/intel/intel_tex_image.c
  +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
  @@ -388,6 +388,12 @@ intel_image_target_texture_2d(struct gl_context *ctx, 
  GLenum target,
   if (image == NULL)
  return;
 
  +   if (image-format == MESA_FORMAT_YCBCR) {
  +  _mesa_error(intel-ctx,
  + GL_INVALID_OPERATION, glEGLImageTargetTexture2DOES, attach 
  YUYV region to texture is not supported);
 
 Can you wrap that call

[Mesa-dev] [PATCH 00/11 v3] Add YUYV format support of dri image

2012-06-14 Thread Zhao Halley
Intel SNB/IVB platform supports rendering YUYV buffer to overlay plane, however 
YUYV is missing support from mesa/dri-image yet.
so I go ahead to add it; basing on it, libva can send YUYV buffer directly to 
wayland/weston, then weston output it to overlay plane.

v2 update:
- set internal_format to GL_YCBCR_MESA
- improve gbm/intel-driver to support YUYV bo generation, 
  add handle2 (intel buffer name) in gbm
  buffer data update (intel_image_write with tiling support)
- update test case to depend on gbm instead of intel driver directly

v3 update:
- move wayland-drm-test to $mesa/src/egl/wayland/wayland-drm/drm-test-client
- add YUYV support to eglCreateDRMImageMesa/eglExportDRMImageMesa 
  and eglCreateImageKHR
- add egl-create-drm-image test to piglit

Zhao Halley (10):
  GL: add YUYV to dri image format
  mesa intel driver:
  egl wayland: add YUYV support
  gallium egl wayland: add YUYV support
  gbm dri backend: add YUYV support
  wayland-drm: add YUYV support
  gbm: add handle2(buffer region name)
  intel driver: add tiling support for intel_image_write() all drm
image are supported for write
  test: test case drm-test-client in src/egl/wayland/wayland-drm
  add YUYV support to eglCreateImageKHR and eglCreateDRMImageMESA

 configure.ac   |3 +-
 include/EGL/eglmesaext.h   |3 +
 include/GL/internal/dri_interface.h|1 +
 src/egl/drivers/dri2/egl_dri2.c|   26 +-
 src/egl/drivers/dri2/platform_wayland.c|8 +-
 src/egl/wayland/wayland-drm/Makefile.am|   14 +-
 src/egl/wayland/wayland-drm/drm-test-client.c  |  456 
 src/egl/wayland/wayland-drm/wayland-drm.c  |3 +
 .../state_trackers/egl/wayland/native_drm.c|3 +
 .../state_trackers/egl/wayland/native_wayland.h|3 +-
 src/gbm/backends/dri/gbm_dri.c |   15 +-
 src/gbm/main/gbm.c |   14 +
 src/gbm/main/gbm.h |8 +-
 src/gbm/main/gbmint.h  |1 +
 src/mesa/drivers/dri/intel/intel_screen.c  |   27 ++-
 src/mesa/drivers/dri/intel/intel_tex_image.c   |6 +
 16 files changed, 579 insertions(+), 12 deletions(-)
 mode change 100644 = 100755 configure.ac
 mode change 100644 = 100755 include/EGL/eglext.h
 mode change 100644 = 100755 include/EGL/eglmesaext.h
 mode change 100644 = 100755 include/GL/internal/dri_interface.h
 mode change 100644 = 100755 src/egl/drivers/dri2/egl_dri2.c
 mode change 100644 = 100755 src/egl/drivers/dri2/platform_wayland.c
 create mode 100755 src/egl/wayland/wayland-drm/drm-test-client.c
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/wayland-drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_wayland.h
 mode change 100644 = 100755 src/gbm/backends/dri/gbm_dri.c
 mode change 100644 = 100755 src/gbm/main/gbm.c
 mode change 100644 = 100755 src/gbm/main/gbm.h
 mode change 100644 = 100755 src/gbm/main/gbmint.h
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_screen.c
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_tex_image.c
 mode change 100644 = 100755 tests/Makefile.am

-- 
1.7.5.4

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


[Mesa-dev] [PATCH 01/11 v3] GL: add YUYV to dri image format

2012-06-14 Thread Zhao Halley
---
 include/GL/internal/dri_interface.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 include/GL/internal/dri_interface.h

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
old mode 100644
new mode 100755
index e37917e..5e325cf
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -907,6 +907,7 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_FORMAT_ARGB 0x1003
 #define __DRI_IMAGE_FORMAT_ABGR 0x1004
 #define __DRI_IMAGE_FORMAT_XBGR 0x1005
+#define __DRI_IMAGE_FORMAT_YUYV 0x1006
 
 #define __DRI_IMAGE_USE_SHARE  0x0001
 #define __DRI_IMAGE_USE_SCANOUT0x0002
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 02/11 v3] mesa intel driver:

2012-06-14 Thread Zhao Halley
 add YUYV format for dri image
 YUYV image doesn't use for texture
---
 src/mesa/drivers/dri/intel/intel_screen.c|   10 ++
 src/mesa/drivers/dri/intel/intel_tex_image.c |6 ++
 2 files changed, 16 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_screen.c
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_tex_image.c

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
old mode 100644
new mode 100755
index 458178f..3b8f81e
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -216,6 +216,11 @@ intel_create_image_from_name(__DRIscreen *screen,
image-internal_format = GL_RGB;
image-data_type = GL_UNSIGNED_BYTE;
break;
+case __DRI_IMAGE_FORMAT_YUYV:
+   image-format = MESA_FORMAT_YCBCR;
+   image-internal_format = GL_YCBCR_MESA;
+   image-data_type = GL_UNSIGNED_BYTE;
+  break;
 default:
free(image);
return NULL;
@@ -343,6 +348,11 @@ intel_create_image(__DRIscreen *screen,
image-internal_format = GL_RGB;
image-data_type = GL_UNSIGNED_BYTE;
break;
+   case __DRI_IMAGE_FORMAT_YUYV:
+  image-format = MESA_FORMAT_YCBCR;
+  image-internal_format = GL_YCBCR_MESA;
+  image-data_type = GL_UNSIGNED_BYTE;
+  break;
default:
   free(image);
   return NULL;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c 
b/src/mesa/drivers/dri/intel/intel_tex_image.c
old mode 100644
new mode 100755
index 094d3cd..8b94cb1
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -388,6 +388,12 @@ intel_image_target_texture_2d(struct gl_context *ctx, 
GLenum target,
if (image == NULL)
   return;
 
+   if (image-format == MESA_FORMAT_YCBCR) {
+  _mesa_error(intel-ctx,
+ GL_INVALID_OPERATION, glEGLImageTargetTexture2DOES, attach 
YUYV region to texture is not supported);
+  return;
+}
+
intel_set_texture_image_region(ctx, texImage, image-region,
  target, image-internal_format, 
image-format);
 }
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 03/11 v3] egl wayland: add YUYV support

2012-06-14 Thread Zhao Halley
---
 src/egl/drivers/dri2/egl_dri2.c |   17 ++---
 src/egl/drivers/dri2/platform_wayland.c |8 +++-
 2 files changed, 21 insertions(+), 4 deletions(-)
 mode change 100644 = 100755 src/egl/drivers/dri2/egl_dri2.c
 mode change 100644 = 100755 src/egl/drivers/dri2/platform_wayland.c

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
old mode 100644
new mode 100755
index 4a02838..a058046
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1096,9 +1096,15 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, 
_EGLContext *ctx,
switch (wayland_drm_buffer_get_format(buffer)) {
case WL_DRM_FORMAT_ARGB:
   format = __DRI_IMAGE_FORMAT_ARGB;
+  pitch = stride / 4;
   break;
case WL_DRM_FORMAT_XRGB:
   format = __DRI_IMAGE_FORMAT_XRGB;
+  pitch = stride / 4;
+  break;
+   case WL_DRM_FORMAT_YUYV:
+  format = __DRI_IMAGE_FORMAT_YUYV;
+  pitch = stride / 2;
   break;
default:
   _eglError(EGL_BAD_PARAMETER,
@@ -1106,8 +1112,6 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, 
_EGLContext *ctx,
   return NULL;
}
 
-   pitch = stride / 4;
-
return dri2_create_image_drm_name(disp, ctx, name, attrs, format, pitch);
 }
 #endif
@@ -1270,21 +1274,28 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
__DRIimage *image;
int dri_format;
+   int pitch = 0;
 
switch (format) {
case WL_DRM_FORMAT_ARGB:
   dri_format =__DRI_IMAGE_FORMAT_ARGB;
+  pitch = stride/4;
   break;
case WL_DRM_FORMAT_XRGB:
   dri_format = __DRI_IMAGE_FORMAT_XRGB;
+  pitch = stride/4;
   break;
+  case WL_DRM_FORMAT_YUYV:
+ dri_format = __DRI_IMAGE_FORMAT_YUYV;
+ pitch = stride/2;
+ break;
default:
   return NULL;
}
 
image = dri2_dpy-image-createImageFromName(dri2_dpy-dri_screen,
width, height, 
-   dri_format, name, stride / 4,
+   dri_format, name, pitch,
NULL);
 
return image;
diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
old mode 100644
new mode 100755
index d291f0f..6d330b7
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -42,7 +42,9 @@
 
 enum wl_drm_format_flags {
HAS_ARGB = 1,
-   HAS_XRGB = 2
+   HAS_XRGB = (1  1),
+   HAS_YUYV = (1  2)
+   
 };
 
 static void
@@ -778,6 +780,9 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t 
format)
case WL_DRM_FORMAT_XRGB:
   dri2_dpy-formats |= HAS_XRGB;
   break;
+   case WL_DRM_FORMAT_YUYV:
+  dri2_dpy-formats |= HAS_YUYV;
+  break;
}
 }
 
@@ -878,6 +883,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
 dri2_add_config(disp, config, i + 1, 0, types, NULL, rgb_masks);
   if (dri2_dpy-formats  HAS_ARGB)
 dri2_add_config(disp, config, i + 1, 0, types, NULL, argb_masks);
+  // , should we do something for YUYV here?
}
 
disp-Extensions.KHR_image_pixmap = EGL_TRUE;
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 04/11 v3] gallium egl wayland: add YUYV support

2012-06-14 Thread Zhao Halley
---
 .../state_trackers/egl/wayland/native_drm.c|3 +++
 .../state_trackers/egl/wayland/native_wayland.h|3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_wayland.h

diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c 
b/src/gallium/state_trackers/egl/wayland/native_drm.c
old mode 100644
new mode 100755
index e3bd628..f2d2e74
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -164,6 +164,9 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t 
format)
case WL_DRM_FORMAT_XRGB:
   drmdpy-base.formats |= HAS_XRGB;
   break;
+  case WL_DRM_FORMAT_YUYV:
+ drmdpy-base.formats |= HAS_YUYV;
+ break;
}
 }
 
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.h 
b/src/gallium/state_trackers/egl/wayland/native_wayland.h
old mode 100644
new mode 100755
index e6a914f..bd26bf0
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.h
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.h
@@ -38,7 +38,8 @@ struct wayland_surface;
 
 enum wayland_format_flag {
HAS_ARGB= (1  0),
-   HAS_XRGB= (1  1)
+   HAS_XRGB= (1  1),
+   HAS_YUYV= (1  2)
 };
 
 struct wayland_display {
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 05/11 v3] gbm dri backend: add YUYV support

2012-06-14 Thread Zhao Halley
---
 src/gbm/backends/dri/gbm_dri.c |9 +
 src/gbm/main/gbm.h |5 -
 2 files changed, 13 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 src/gbm/backends/dri/gbm_dri.c
 mode change 100644 = 100755 src/gbm/main/gbm.h

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
old mode 100644
new mode 100755
index e5ddfb6..9e2bd83
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -280,6 +280,9 @@ gbm_dri_is_format_supported(struct gbm_device *gbm,
   if (usage  GBM_BO_USE_SCANOUT)
  return 0;
   break;
+  case GBM_BO_FORMAT_YUYV:
+  case GBM_FORMAT_YUYV:
+ break;
default:
   return 0;
}
@@ -331,6 +334,9 @@ gbm_dri_to_gbm_format(uint32_t dri_format)
case __DRI_IMAGE_FORMAT_ABGR:
   ret = GBM_FORMAT_ABGR;
   break;
+  case __DRI_IMAGE_FORMAT_YUYV:
+ ret = GBM_FORMAT_YUYV;
+ break;
default:
   ret = 0;
   break;
@@ -428,6 +434,9 @@ gbm_dri_bo_create(struct gbm_device *gbm,
case GBM_FORMAT_ABGR:
   dri_format = __DRI_IMAGE_FORMAT_ABGR;
   break;
+  case GBM_FORMAT_YUYV:
+ dri_format = __DRI_IMAGE_FORMAT_YUYV;
+ break;
default:
   return NULL;
}
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
old mode 100644
new mode 100755
index af5dc5a..b2a0aa3
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -73,7 +73,10 @@ enum gbm_bo_format {
/** RGB with 8 bits per channel in a 32 bit value */
GBM_BO_FORMAT_XRGB, 
/** ARGB with 8 bits per channel in a 32 bit value */
-   GBM_BO_FORMAT_ARGB
+   GBM_BO_FORMAT_ARGB, 
+   /** YUYV: packed YUV format with 422 subsampling*/
+   GBM_BO_FORMAT_YUYV,
+   
 };
 
 #define __gbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b)  8) | \
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 06/11 v3] wayland-drm: add YUYV support

2012-06-14 Thread Zhao Halley
---
 src/egl/wayland/wayland-drm/wayland-drm.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/wayland-drm.c

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c 
b/src/egl/wayland/wayland-drm/wayland-drm.c
old mode 100644
new mode 100755
index 5f831b3..d9cfe09
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -111,6 +111,7 @@ drm_create_buffer(struct wl_client *client, struct 
wl_resource *resource,
switch (format) {
case WL_DRM_FORMAT_ARGB:
case WL_DRM_FORMAT_XRGB:
+case WL_DRM_FORMAT_YUYV:
break;
default:
wl_resource_post_error(resource,
@@ -186,6 +187,8 @@ bind_drm(struct wl_client *client, void *data, uint32_t 
version, uint32_t id)
   WL_DRM_FORMAT_ARGB);
wl_resource_post_event(resource, WL_DRM_FORMAT,
   WL_DRM_FORMAT_XRGB);
+   wl_resource_post_event(resource, WL_DRM_FORMAT,
+  WL_DRM_FORMAT_YUYV);
 }
 
 struct wl_drm *
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 07/11 v3] gbm: add handle2(drm buffer region name)

2012-06-14 Thread Zhao Halley
---
 src/gbm/backends/dri/gbm_dri.c |6 +-
 src/gbm/main/gbm.c |   14 ++
 src/gbm/main/gbm.h |3 +++
 src/gbm/main/gbmint.h  |1 +
 4 files changed, 23 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 src/gbm/main/gbm.c
 mode change 100644 = 100755 src/gbm/main/gbmint.h

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 9e2bd83..a71815f 100755
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -392,6 +392,8 @@ gbm_dri_bo_create_from_egl_image(struct gbm_device *gbm,
   (int *) bo-base.base.pitch);
dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_FORMAT,
  dri_format);
+   dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_NAME,
+  (uint32_t *) bo-base.base.handle2.u32);
 
bo-base.base.format = gbm_dri_to_gbm_format(dri_format);
 
@@ -460,7 +462,9 @@ gbm_dri_bo_create(struct gbm_device *gbm,
   bo-base.base.handle.s32);
dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_STRIDE,
   (int *) bo-base.base.pitch);
-
+   dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_NAME,
+  (uint32_t *) bo-base.base.handle2.u32);
+   
return bo-base.base;
 }
 
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
old mode 100644
new mode 100755
index 3994f86..f445bb1
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -231,6 +231,20 @@ gbm_bo_get_handle(struct gbm_bo *bo)
return bo-handle;
 }
 
+/** Get handle2 (buffer region name) of the buffer object
+ *
+ * This is stored in the platform generic union gbm_bo_handle type. However
+ * the format of this handle is platform specific.
+ *
+ * \param bo The buffer object
+ * \return Returns the handle of the allocated buffer object
+ */
+GBM_EXPORT union gbm_bo_handle
+gbm_bo_get_handle2(struct gbm_bo *bo)
+{
+   return bo-handle2;
+}
+
 /** Write data into the buffer object
  *
  * If the buffer object was created with the GBM_BO_USE_WRITE flag,
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
index b2a0aa3..25c9d37 100755
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -257,6 +257,9 @@ gbm_bo_get_device(struct gbm_bo *bo);
 union gbm_bo_handle
 gbm_bo_get_handle(struct gbm_bo *bo);
 
+union gbm_bo_handle
+gbm_bo_get_handle2(struct gbm_bo *bo);
+
 int
 gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
 
diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h
old mode 100644
new mode 100755
index 8eb8671..5e48e89
--- a/src/gbm/main/gbmint.h
+++ b/src/gbm/main/gbmint.h
@@ -95,6 +95,7 @@ struct gbm_bo {
uint32_t pitch;
uint32_t format;
union gbm_bo_handle  handle;
+   union gbm_bo_handle  handle2;
void *user_data;
void (*destroy_user_data)(struct gbm_bo *, void *);
 };
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 08/11 v3] intel driver: add tiling support for intel_image_write() all drm image are supported for write

2012-06-14 Thread Zhao Halley
---
 src/mesa/drivers/dri/intel/intel_screen.c |   17 +++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 3b8f81e..63b6b24 100755
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -310,10 +310,13 @@ intel_create_image(__DRIscreen *screen,
   tiling = I915_TILING_NONE;
}
 
+#if 0
+   // add tiling support in intel_image_write(), so all drm images are ok 
for write
/* We only support write for cursor drm images */
if ((use  __DRI_IMAGE_USE_WRITE) 
use != (__DRI_IMAGE_USE_WRITE | __DRI_IMAGE_USE_CURSOR))
   return NULL;
+#endif
 
image = CALLOC(sizeof *image);
if (image == NULL)
@@ -441,9 +444,19 @@ intel_image_write(__DRIimage *image, const void *buf, 
size_t count)
if (!(image-usage  __DRI_IMAGE_USE_WRITE))
   return -1;
 
-   drm_intel_bo_map(image-region-bo, true);
+   int tiling, swizzle;
+   dri_bo_get_tiling(image-region-bo, tiling, swizzle);
+   if (tiling != I915_TILING_NONE)
+   drm_intel_gem_bo_map_gtt(image-region-bo);
+   else
+   dri_bo_map(image-region-bo, 1);
+   
memcpy(image-region-bo-virtual, buf, count);
-   drm_intel_bo_unmap(image-region-bo);
+
+   if (tiling != I915_TILING_NONE)
+   drm_intel_gem_bo_unmap_gtt(image-region-bo);
+   else
+   dri_bo_unmap(image-region-bo);
 
return 0;
 }
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 09/11 v3] test: test case drm-test-client in src/egl/wayland/wayland-drm

2012-06-14 Thread Zhao Halley
 - it shows how wayland-drm protocol works between server and client
   buffer are shared basing on dri image
 - XRGB and YUYV format are supported,
   it can render to overlay plane potentially
---
 configure.ac  |3 +-
 src/egl/wayland/wayland-drm/Makefile.am   |   14 +-
 src/egl/wayland/wayland-drm/drm-test-client.c |  456 +
 3 files changed, 471 insertions(+), 2 deletions(-)
 mode change 100644 = 100755 configure.ac
 create mode 100755 src/egl/wayland/wayland-drm/drm-test-client.c
 mode change 100644 = 100755 tests/Makefile.am

diff --git a/configure.ac b/configure.ac
old mode 100644
new mode 100755
index 3bc59ca..044d19e
--- a/configure.ac
+++ b/configure.ac
@@ -2033,7 +2033,8 @@ AC_CONFIG_FILES([configs/autoconf
src/mesa/drivers/dri/radeon/Makefile
src/mesa/drivers/dri/swrast/Makefile
tests/Makefile
-   tests/glx/Makefile])
+   tests/glx/Makefile
+])
 
 dnl Replace the configs/current symlink
 AC_CONFIG_COMMANDS([configs],[
diff --git a/src/egl/wayland/wayland-drm/Makefile.am 
b/src/egl/wayland/wayland-drm/Makefile.am
index cf15eda..55ef063 100644
--- a/src/egl/wayland/wayland-drm/Makefile.am
+++ b/src/egl/wayland/wayland-drm/Makefile.am
@@ -10,6 +10,18 @@ noinst_HEADERS = wayland-drm.h
 BUILT_SOURCES = wayland-drm-protocol.c \
wayland-drm-client-protocol.h \
wayland-drm-server-protocol.h
-CLEANFILES = $(BUILT_SOURCES)
+
+noinst_PROGRAMS = drm_test_client
+drm_test_client_CFLAGS = $(DEFINES) \
+   $(WAYLAND_CFLAGS) \
+   $(LIBDRM_CFLAGS)
+
+drm_test_client_LDADD = $(WAYLAND_LIBS) $(LIBDRM_LIBS) 
+drm_test_client_LDADD += $(top_srcdir)/src/gbm/libgbm.la
+
+drm_test_client_SOURCES = drm-test-client.c wayland-drm-protocol.c \
+ wayland-drm-client-protocol.h
+
+CLEANFILES = $(BUILT_SOURCES) $(drm_test_client_SOURCES)
 
 @wayland_scanner_rules@
diff --git a/src/egl/wayland/wayland-drm/drm-test-client.c 
b/src/egl/wayland/wayland-drm/drm-test-client.c
new file mode 100755
index 000..05893ad
--- /dev/null
+++ b/src/egl/wayland/wayland-drm/drm-test-client.c
@@ -0,0 +1,456 @@
+/*
+ * Copyright © 2012 Halley Zhao
+ *
+ * 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:
+ *Halley Zhao halley.z...@intel.com
+ */
+
+
+#include stdlib.h
+#include stdio.h
+#include unistd.h
+#include errno.h
+#include fcntl.h
+#include sys/stat.h
+#include string.h
+#include assert.h
+#include xf86drm.h
+#include gbm.h
+#include wayland-client.h
+#include wayland-client-protocol.h
+#include wayland-drm-client-protocol.h
+
+int win_width = 256, win_height = 256;
+int drm_fd = -1;
+int wayland_server_support_yuyv = 0;
+struct wl_drm *wl_drm;
+
+struct display {
+   struct wl_display *display;
+   struct wl_compositor *compositor;
+   struct wl_shell *shell;
+   struct wl_input_device *input;
+   uint32_t mask;
+struct gbm_device *gbm;
+};
+
+struct window {
+   struct display *display;
+   struct wl_surface *surface;
+   struct wl_shell_surface *shell_surface;
+   struct wl_callback *callback;
+   struct {
+   int width, height;
+   } geometry;
+unsigned int format;
+struct wl_buffer *buffer;
+struct gbm_bo *gbm_bo;
+unsigned int bo_pitch;
+};
+
+void fill_window_XRGB(struct window *win);
+void fill_window_YUYV(struct window *win);
+int wayland_drm_init(struct wl_display *wl_dpy);
+void wayland_drm_destroy(void);
+void redraw(void *data, struct wl_callback *callback, uint32_t time);
+
+void fill_window_XRGB(struct window *win)
+{
+unsigned char *mem = malloc (win-bo_pitch * win_height);
+static int color_index = 0;
+static unsigned int color_arr[4] = {0xff00, 0x00ff, 0xff00, 
0x00ff};
+unsigned int 

[Mesa-dev] [PATCH 10/11 v3] add YUYV support to eglCreateImageKHR and eglCreateDRMImageMESA

2012-06-14 Thread Zhao Halley
---
 include/EGL/eglmesaext.h|3 +++
 src/egl/drivers/dri2/egl_dri2.c |9 -
 2 files changed, 11 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 include/EGL/eglext.h
 mode change 100644 = 100755 include/EGL/eglmesaext.h

diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
old mode 100644
new mode 100755
diff --git a/include/EGL/eglmesaext.h b/include/EGL/eglmesaext.h
old mode 100644
new mode 100755
index 52dd5b1..cb251fd
--- a/include/EGL/eglmesaext.h
+++ b/include/EGL/eglmesaext.h
@@ -107,6 +107,9 @@ typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDRMDISPLAYMESA) 
(int fd);
 #ifndef EGL_DRM_BUFFER_USE_CURSOR_MESA
 #define EGL_DRM_BUFFER_USE_CURSOR_MESA 0x0004
 #endif
+#ifndef EGL_DRM_BUFFER_FORMAT_YUYV_MESA
+#define EGL_DRM_BUFFER_FORMAT_YUYV_MESA0x31D6  /* 
EGL_DRM_BUFFER_FORMAT_MESA attribute value */
+#endif
 #endif
 
 #ifndef EGL_WL_bind_wayland_display
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index a058046..02eeafb 100755
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1055,8 +1055,12 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, 
_EGLContext *ctx,
switch (attrs.DRMBufferFormatMESA) {
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA:
   format = __DRI_IMAGE_FORMAT_ARGB;
-  pitch = attrs.DRMBufferStrideMESA;
+  pitch = attrs.DRMBufferStrideMESA/4;
   break;
+   case EGL_DRM_BUFFER_FORMAT_YUYV_MESA:
+  format = __DRI_IMAGE_FORMAT_YUYV;
+  pitch = attrs.DRMBufferStrideMESA/2;
+ break;
default:
   _eglError(EGL_BAD_PARAMETER,
dri2_create_image_khr: unsupported pixmap depth);
@@ -1195,6 +1199,9 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay 
*disp,
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA:
   format = __DRI_IMAGE_FORMAT_ARGB;
   break;
+   case EGL_DRM_BUFFER_FORMAT_YUYV_MESA:
+  format = __DRI_IMAGE_FORMAT_YUYV;
+  break;
default:
   _eglLog(_EGL_WARNING, bad image format value 0x%04x,
 attrs.DRMBufferFormatMESA);
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 11/11 v3] [piglit] add egl-create-drm-image test

2012-06-14 Thread Zhao Halley
---
 tests/egl/CMakeLists.gl.txt  |2 +
 tests/egl/egl-create-drm-image.c |  145 ++
 2 files changed, 147 insertions(+), 0 deletions(-)
 create mode 100755 tests/egl/egl-create-drm-image.c

diff --git a/tests/egl/CMakeLists.gl.txt b/tests/egl/CMakeLists.gl.txt
index ddfbbef..1e8865c 100644
--- a/tests/egl/CMakeLists.gl.txt
+++ b/tests/egl/CMakeLists.gl.txt
@@ -20,6 +20,8 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES Linux)
target_link_libraries(egl-create-surface pthread ${X11_X11_LIB})
piglit_add_executable (egl-query-surface egl-util.c egl-query-surface.c)
target_link_libraries(egl-query-surface pthread ${X11_X11_LIB})
+   piglit_add_executable (egl-create-drm-image egl-util.c 
egl-create-drm-image.c)
+   target_link_libraries(egl-create-drm-image pthread ${X11_X11_LIB})
 ENDIF(${CMAKE_SYSTEM_NAME} MATCHES Linux)
 
 # vim: ft=cmake:
diff --git a/tests/egl/egl-create-drm-image.c b/tests/egl/egl-create-drm-image.c
new file mode 100755
index 000..d20d27e
--- /dev/null
+++ b/tests/egl/egl-create-drm-image.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright © 2012 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.
+ *
+ * Author: Halley Zhao halley.z...@intel.com
+ */
+
+/** @file egl-create-drm-image.c
+ *
+ * Test EGL_MESA_drm_image.
+ */
+
+#include piglit-util.h
+#include egl-util.h
+
+#ifdef EGL_MESA_drm_image
+
+const char *extensions[] = { EGL_MESA_drm_image, NULL }; 
+
+static enum piglit_result
+draw(struct egl_state *state)
+{
+PFNEGLCREATEDRMIMAGEMESAPROC create_drm_image;
+PFNEGLEXPORTDRMIMAGEMESAPROC export_drm_image;
+PFNEGLCREATEIMAGEKHRPROCcreate_image;
+PFNEGLDESTROYIMAGEKHRPROC   destroy_image;
+
+EGLImageKHR image1 = EGL_NO_IMAGE_KHR;
+EGLImageKHR image2 = EGL_NO_IMAGE_KHR;
+
+EGLint attr_list1[] = {
+EGL_WIDTH, 256, EGL_HEIGHT, 256, 
+EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_YUYV_MESA, 
+// EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
+EGL_NONE
+};
+
+EGLint name, handle, stride;
+EGLint attr_list2[] = {
+EGL_DRM_BUFFER_STRIDE_MESA, 0, 
+EGL_WIDTH, 256, EGL_HEIGHT, 256, 
+EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_YUYV_MESA, 
+// EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
+EGL_NONE
+};
+#define STRIDE_INDEX1
+
+   create_drm_image = 
(PFNEGLCREATEDRMIMAGEMESAPROC)eglGetProcAddress(eglCreateDRMImageMESA);
+   if (create_drm_image == NULL ) {
+   fprintf(stderr, could not getproc eglCreateDRMImageMESA);
+   piglit_report_result(PIGLIT_PASS);
+   }
+
+   export_drm_image = 
(PFNEGLEXPORTDRMIMAGEMESAPROC)eglGetProcAddress(eglExportDRMImageMESA);
+   if (export_drm_image == NULL ) {
+   fprintf(stderr, could not getproc eglExportDRMImageMESA);
+   piglit_report_result(PIGLIT_PASS);
+   }
+
+   create_image = 
(PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress(eglCreateImageKHR);
+   if (create_image == NULL ) {
+   fprintf(stderr, could not getproc eglCreateImageKHR);
+   piglit_report_result(PIGLIT_PASS);
+   }
+
+   destroy_image = 
(PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress(eglDestroyImageKHR);
+   if (destroy_image == NULL ) {
+   fprintf(stderr, could not getproc eglDestroyImageKHR);
+   piglit_report_result(PIGLIT_PASS);
+   }
+
+image1 = create_drm_image(state-egl_dpy, attr_list1);
+if(image1 == EGL_NO_IMAGE_KHR) {
+   fprintf(stderr, fail to create YUYV EGLImageKHR from 
eglCreateDRMImageMESA);
+   piglit_report_result(PIGLIT_FAIL);
+}
+
+if (export_drm_image(state-egl_dpy, image1, name, handle, stride) == 
EGL_FALSE) {
+   fprintf(stderr, fail to create export YUYV EGLImageKHR 

Re: [Mesa-dev] [PATCH] add test for wayland drm, XRGB/YUYV is supported

2012-06-12 Thread Zhao, Halley
Hi Kristian:
update the test case to src/egl/wayland/wayland-drm:


From f2ab9c439ba7158b6e978a9d214a9b9e80ec8c6e Mon Sep 17 00:00:00 2001
From: Zhao Halley halley.z...@intel.com
Date: Tue, 5 Jun 2012 14:59:56 +0800
Subject: [PATCH 9/9] test: test case drm-test-client in
 src/egl/wayland/wayland-drm

 - it shows how wayland-drm protocol works between server and client
   buffer are shared basing on dri image
 - XRGB and YUYV format are supported,
   it can render to overlay plane potentially
---
 src/egl/wayland/wayland-drm/Makefile.am   |   14 +-
 src/egl/wayland/wayland-drm/drm-test-client.c |  456
+
 2 files changed, 469 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 configure.ac
 create mode 100755 src/egl/wayland/wayland-drm/drm-test-client.c
 mode change 100644 = 100755 tests/Makefile.am

diff --git a/configure.ac b/configure.ac
old mode 100644
new mode 100755
diff --git a/src/egl/wayland/wayland-drm/Makefile.am
b/src/egl/wayland/wayland-drm/Makefile.am
index cf15eda..55ef063 100644
--- a/src/egl/wayland/wayland-drm/Makefile.am
+++ b/src/egl/wayland/wayland-drm/Makefile.am
@@ -10,6 +10,18 @@ noinst_HEADERS = wayland-drm.h
 BUILT_SOURCES = wayland-drm-protocol.c \
wayland-drm-client-protocol.h \
wayland-drm-server-protocol.h
-CLEANFILES = $(BUILT_SOURCES)
+
+noinst_PROGRAMS = drm_test_client
+drm_test_client_CFLAGS = $(DEFINES) \
+   $(WAYLAND_CFLAGS) \
+   $(LIBDRM_CFLAGS)
+
+drm_test_client_LDADD = $(WAYLAND_LIBS) $(LIBDRM_LIBS) 
+drm_test_client_LDADD += $(top_srcdir)/src/gbm/libgbm.la
+
+drm_test_client_SOURCES = drm-test-client.c wayland-drm-protocol.c \
+ wayland-drm-client-protocol.h
+
+CLEANFILES = $(BUILT_SOURCES) $(drm_test_client_SOURCES)
 
 @wayland_scanner_rules@
diff --git a/src/egl/wayland/wayland-drm/drm-test-client.c
b/src/egl/wayland/wayland-drm/drm-test-client.c
new file mode 100755
index 000..05893ad
--- /dev/null
+++ b/src/egl/wayland/wayland-drm/drm-test-client.c
@@ -0,0 +1,456 @@
+/*
+ * Copyright © 2012 Halley Zhao
+ *
+ * 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:
+ *Halley Zhao halley.z...@intel.com
+ */
+
+
+#include stdlib.h
+#include stdio.h
+#include unistd.h
+#include errno.h
+#include fcntl.h
+#include sys/stat.h
+#include string.h
+#include assert.h
+#include xf86drm.h
+#include gbm.h
+#include wayland-client.h
+#include wayland-client-protocol.h
+#include wayland-drm-client-protocol.h
+
+int win_width = 256, win_height = 256;
+int drm_fd = -1;
+int wayland_server_support_yuyv = 0;
+struct wl_drm *wl_drm;
+
+struct display {
+   struct wl_display *display;
+   struct wl_compositor *compositor;
+   struct wl_shell *shell;
+   struct wl_input_device *input;
+   uint32_t mask;
+struct gbm_device *gbm;
+};
+
+struct window {
+   struct display *display;
+   struct wl_surface *surface;
+   struct wl_shell_surface *shell_surface;
+   struct wl_callback *callback;
+   struct {
+   int width, height;
+   } geometry;
+unsigned int format;
+struct wl_buffer *buffer;
+struct gbm_bo *gbm_bo;
+unsigned int bo_pitch;
+};
+
+void fill_window_XRGB(struct window *win);
+void fill_window_YUYV(struct window *win);
+int wayland_drm_init(struct wl_display *wl_dpy);
+void wayland_drm_destroy(void);
+void redraw(void *data, struct wl_callback *callback, uint32_t time);
+
+void fill_window_XRGB(struct window *win)
+{
+unsigned char *mem = malloc (win-bo_pitch * win_height);
+static int color_index = 0;
+static unsigned int color_arr[4] = {0xff00, 0x00ff,
0xff00, 0x00ff};
+unsigned int color; 
+int i;
+unsigned int *i_ptr;
+unsigned char *c_ptr;
+
+color = color_arr[color_index];
+i_ptr = (unsigned int *)mem;
+for (i=0; iwin_width/2

Re: [Mesa-dev] [PATCH] add test for wayland drm, XRGB/YUYV is supported

2012-06-07 Thread Zhao, Halley
You are right Eric, it just draws some visual blocks on overlay plane.
Now, I sent the patch to wayland/Weston.
Since YUY2 buffer renders to overlay; I don't have a way to read it back. So 
conformance test is not available.

In this case, EGL is used but hidden by weston and wayland-drm; 
wl_drm_create_buffer() will invoke Weston function, and finally goes to 
dri2_wl_reference_buffer in $mesa/egl/drivers/dri2/egl_dri2.c.

I can't create a case in X11 environments, because:
1. in X11, XV use XvShm instead of depends on EGL.
2. app/client can't render to overlay plane directly, because overlay related 
ioctls are defined with DRM_MASTER (no DRM_AUTH). So in X11, only xv driver can 
render to overlay.




 -Original Message-
 From: Eric Anholt [mailto:e...@anholt.net]
 Sent: Friday, June 08, 2012 4:24 AM
 To: Zhao, Halley; Zhao, Halley; mesa-dev@lists.freedesktop.org
 Cc: Barnes, Jesse
 Subject: RE: [PATCH] add test for wayland drm, XRGB/YUYV is supported
 
 On Mon, 4 Jun 2012 09:43:06 +, Zhao, Halley halley.z...@intel.com
 wrote:
  diff --git a/tests/wayland-drm/Makefile.am
  b/tests/wayland-drm/Makefile.am new file mode 100644 index
  000..526acde
  --- /dev/null
  +++ b/tests/wayland-drm/Makefile.am
  @@ -0,0 +1,12 @@
  +bin_PROGRAMS = wayland_drm_test
 
 This definitely shouldn't be an installed binary.
 
 If I'm understanding it right, this is something you run that draws a couple 
 of
 images into a wayland window?  It doesn't do any tests on the results?  If so,
 it might be interesting for some wayland demos repository, but it probably 
 isn't
 Mesa code.
 
 When I was asking about tests, I was hoping for something we could put in
 piglit using EGL that would make sure that the changes worked.  I don't even
 see any calls to EGL here.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/6] mesa intel driver:

2012-06-05 Thread Zhao, Halley
Thanks Paul, Thanks Ian as well for the comments on it.
I will update internal_format to GL_YCBCR_MESA. 
(I didn't notice glext.h before, but gl2.h only)

As to the error in intel_image_target_texture_2d(), it isn't caused by wrong 
internal format, but hw limitation since we don't support packed YUV as texture.

 -Original Message-
 From: Pauli Nieminen [mailto:pauli.niemi...@linux.intel.com]
 Sent: Monday, June 04, 2012 9:11 PM
 To: Zhao, Halley
 Cc: Eric Anholt; mesa-dev@lists.freedesktop.org; Barnes, Jesse
 Subject: Re: [Mesa-dev] [PATCH 2/6] mesa intel driver:
 
 On Mon, Jun 04, 2012 at 10:00:47AM +, Zhao, Halley wrote:
  Thanks for careful review.
 
  1. My mistake for the s, we can remove it.
  There is MESA_FORMAT_YCBCR_REV for UYVY, so
 MESA_FORMAT_YCBCR is exactly for YUYV format.
  GL_LUMINANCE should be ok since YUYV is an luminance format.
 
 internal_format should be GL_YCBCR_MESA that is supposed to be working
 texture format with GL.
 
  2. as to intel_image_target_texture_2d(), an error is added for YUYV region.
  Updated patch see below.
 
 
 Could it be because of wrong internal format?
 
  3. A test case is added to demonstrate the usage:
 http://lists.freedesktop.org/archives/mesa-dev/2012-June/022487.html
  As to the case when hw overlay is not available, it is considered in
 following way:
  3.1) when client connect to wayland-server, it gets which formats are
 supported from server in drm_handle_format(). Client sends YUYV buffer to
 server only when the server supports it.
  Client can convert a YUYV/NV12 buffer to XRGB format through 
  libva:
 http://lists.freedesktop.org/archives/libva/2012-May/000845.html
 (YUYV--NV12/YV12 are supported)
  3.2) if Weston want to support YUYV internally, it can depend on libva's
 color conversion or some special shader to do it.
 
  From 5356270a25a300bbe7e0d36a79b031d2fb108a88 Mon Sep 17 00:00:00
 2001
  From: Zhao halley halley.z...@intel.com
  Date: Fri, 25 May 2012 11:36:48 +0800
  Subject: [PATCH 2/7] mesa intel driver:
 
   add YUYV format for dri image
   YUYV image doesn't use for texture
  ---
   src/mesa/drivers/dri/intel/intel_screen.c|5 +
   src/mesa/drivers/dri/intel/intel_tex_image.c |6 ++
   2 files changed, 11 insertions(+), 0 deletions(-)  mode change 100644
  = 100755 src/mesa/drivers/dri/intel/intel_screen.c
   mode change 100644 = 100755
  src/mesa/drivers/dri/intel/intel_tex_image.c
 
  diff --git a/src/mesa/drivers/dri/intel/intel_screen.c
  b/src/mesa/drivers/dri/intel/intel_screen.c
  old mode 100644
  new mode 100755
  index 458178f..b8d44ba
  --- a/src/mesa/drivers/dri/intel/intel_screen.c
  +++ b/src/mesa/drivers/dri/intel/intel_screen.c
  @@ -216,6 +216,11 @@ intel_create_image_from_name(__DRIscreen
 *screen,
  image-internal_format = GL_RGB;
  image-data_type = GL_UNSIGNED_BYTE;
  break;
  +case __DRI_IMAGE_FORMAT_YUYV:
  +   image-format = MESA_FORMAT_YCBCR;
  +   image-internal_format = GL_LUMINANCE;
  +   image-data_type = GL_UNSIGNED_BYTE;
  +  break;
   default:
  free(image);
  return NULL;
  diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c
  b/src/mesa/drivers/dri/intel/intel_tex_image.c
  old mode 100644
  new mode 100755
  index 094d3cd..8b94cb1
  --- a/src/mesa/drivers/dri/intel/intel_tex_image.c
  +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
  @@ -388,6 +388,12 @@ intel_image_target_texture_2d(struct gl_context
 *ctx, GLenum target,
  if (image == NULL)
 return;
 
  +   if (image-format == MESA_FORMAT_YCBCR) {
  +  _mesa_error(intel-ctx,
  + GL_INVALID_OPERATION, glEGLImageTargetTexture2DOES,
 attach YUYV region to texture is not supported);
  +  return;
  +}
  +
  intel_set_texture_image_region(ctx, texImage, image-region,
target, image-internal_format, 
  image-format);  }
  --
  1.7.5.4
 
   -Original Message-
   From: Eric Anholt [mailto:e...@anholt.net]
   Sent: Saturday, June 02, 2012 5:33 AM
   To: Zhao, Halley; mesa-dev@lists.freedesktop.org
   Cc: Barnes, Jesse; Zhao, Halley
   Subject: Re: [PATCH 2/6] mesa intel driver:
  
   On Thu, 31 May 2012 17:23:59 +0800, Zhao halley
   halley.z...@intel.com
   wrote:
 add YUYV format for dri image
 YUYV image doesn't use for texture
---
 src/mesa/drivers/dri/intel/intel_screen.c|5 +
 src/mesa/drivers/dri/intel/intel_tex_image.c |3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)  mode change
100644 = 100755 src/mesa/drivers/dri/intel/intel_screen.c
 mode change 100644 = 100755
src/mesa/drivers/dri/intel/intel_tex_image.c
   
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c
b/src/mesa/drivers/dri/intel/intel_screen.c
old mode 100644
new mode 100755
index 458178f..5ff2e49
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers

Re: [Mesa-dev] [PATCH] add test for wayland drm, XRGB/YUYV is supported

2012-06-05 Thread Zhao, Halley
Hi Pauli:
Thanks for your suggestion.

gbm doesn't support:
- Buffer name which is used by wayland-drm protocol (since buffer is 
shared across processes)
- tiling (overlay required I915_TILING_X, though intel 3D use TILING_X 
as default, media pipeline uses TILING_Y as default)
- buffer update: intel_image_write() (only cursor image is supported 
now)

anyway, I will update gbm/intel-driver to fill the above gaps, and make the 
test case basing on gbm.



 -Original Message-
 From: Pauli Nieminen [mailto:pauli.niemi...@linux.intel.com]
 Sent: Monday, June 04, 2012 8:55 PM
 To: Zhao, Halley
 Cc: mesa-dev@lists.freedesktop.org; Barnes, Jesse
 Subject: Re: [Mesa-dev] [PATCH] add test for wayland drm, XRGB/YUYV is
 supported
 
 This test is using intel specific interfaces. Is there something missing from
 libgbm that prevents you from using it?
 
 In any case I think this test should be using gdm for memory management. see
 src/gbm/main/gbm.h
 
 On Mon, Jun 04, 2012 at 09:43:06AM +, Zhao, Halley wrote:
  Move the test case to $mesa/test/wayland-drm.
 
 
  From f8843a118e9d7f41b5acedcb396c82adae36841d Mon Sep 17 00:00:00
 2001
  From: Zhao halley halley.z...@intel.com
  Date: Mon, 4 Jun 2012 15:58:24 +0800
  Subject: [PATCH] add test for wayland drm, XRGB/YUYV is supported
 
  when I sent patches for YUYV support of dri image, a test case is
  required to make sure the patches can work well. so it is created.
 
  it also shows how wayland-drm protocol works between wayland client
  and server -- they communicate data in buffer/drm level.
  ---
   configure.ac |4 +-
   src/egl/wayland/Makefile.am  |2 +-
   tests/Makefile.am|2 +-
   tests/wayland-drm/Makefile.am|   12 +
   tests/wayland-drm/wayland-drm-test.c |  462
  ++
   5 files changed, 479 insertions(+), 3 deletions(-)  create mode
  100644 tests/wayland-drm/Makefile.am  create mode 100644
  tests/wayland-drm/wayland-drm-test.c
 
  diff --git a/configure.ac b/configure.ac index 3bc59ca..58c05bc 100644
  --- a/configure.ac
  +++ b/configure.ac
  @@ -2033,7 +2033,9 @@ AC_CONFIG_FILES([configs/autoconf
  src/mesa/drivers/dri/radeon/Makefile
  src/mesa/drivers/dri/swrast/Makefile
  tests/Makefile
  -   tests/glx/Makefile])
  +   tests/glx/Makefile
  +   tests/wayland-drm/Makefile
  +])
 
   dnl Replace the configs/current symlink
  AC_CONFIG_COMMANDS([configs],[ diff --git
  a/src/egl/wayland/Makefile.am b/src/egl/wayland/Makefile.am index
  ca7207c..526d64f 100644
  --- a/src/egl/wayland/Makefile.am
  +++ b/src/egl/wayland/Makefile.am
  @@ -1 +1 @@
  -SUBDIRS = wayland-drm wayland-egl
  +SUBDIRS = wayland-drm wayland-egl
  diff --git a/tests/Makefile.am b/tests/Makefile.am index
  4079bb9..f6125f1 100644
  --- a/tests/Makefile.am
  +++ b/tests/Makefile.am
  @@ -1 +1 @@
  -SUBDIRS=glx
  +SUBDIRS=glx wayland-drm
  diff --git a/tests/wayland-drm/Makefile.am
  b/tests/wayland-drm/Makefile.am new file mode 100644 index
  000..526acde
  --- /dev/null
  +++ b/tests/wayland-drm/Makefile.am
  @@ -0,0 +1,12 @@
  +bin_PROGRAMS = wayland_drm_test
  +wayland_drm_test_CFLAGS = -I$(top_srcdir)/src/egl/main \
  +   -I$(top_srcdir)/include \
  +   $(DEFINES) \
  +   $(WAYLAND_CFLAGS) \
  +   $(LIBDRM_CFLAGS)
  +
  +wayland_drm_test_LDADD = $(WAYLAND_LIBS) $(LIBDRM_LIBS) -ldrm_intel
  +wayland_drm_test_LDADD += $(top_srcdir)/src/egl/main/libEGL.la
  +
  +wayland_drm_test_SOURCES = wayland-drm-test.c \
  +
  +$(top_srcdir)/src/egl/wayland/wayland-drm//wayland-drm-client-protoco
  +l.h
  diff --git a/tests/wayland-drm/wayland-drm-test.c
  b/tests/wayland-drm/wayland-drm-test.c
  new file mode 100644
  index 000..ea2e230
  --- /dev/null
  +++ b/tests/wayland-drm/wayland-drm-test.c
  @@ -0,0 +1,462 @@
  +/*
  + * Copyright (c) 2012 Halley Zhao
  + *
  + * 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

[Mesa-dev] [PATCH 0/9 v2] Add YUYV format support of dri image

2012-06-05 Thread Zhao Halley
Intel SNB/IVB platform supports rendering YUYV buffer to overlay plane, however 
YUYV is missing support from mesa/dri-image yet.
so I go ahead to add it; basing on it, libva can send YUYV buffer directly to 
wayland/weston, then weston output it to overlay plane.

I notice that there are some patches from Gwenole for YUV planar texture 
support. these patches have little to do with that. because:
YUYV is packed format, it doesn't require additional attribute like 
   buffer layout (introduced by Gwenole)
YUYV is introduced for overlay support, no shaders for texture is required.

update:
- set internal_format to GL_YCBCR_MESA
- improve gbm/intel-driver to support YUYV bo generation, 
  add handle2 (intel buffer name) in gbm
  buffer data update (intel_image_write with tiling support)
- update test case to depend on gbm instead of intel driver directly

Zhao Halley (9):
  GL: add YUYV to dri image format
  mesa intel driver:
  egl wayland: add YUYV support
  gallium egl wayland: add YUYV support
  gbm dri backend: add YUYV support
  wayland-drm: add YUYV support
  gbm: add handle2(buffer region name)
  intel driver: add tiling support for intel_image_write() 
 all drm image are supported for write
  test: test case for wayland-drm in tests/wayland-drm

 configure.ac   |4 +-
 include/GL/internal/dri_interface.h|1 +
 src/egl/drivers/dri2/egl_dri2.c|   17 +-
 src/egl/drivers/dri2/platform_wayland.c|8 +-
 src/egl/wayland/wayland-drm/wayland-drm.c  |3 +
 .../state_trackers/egl/wayland/native_drm.c|3 +
 .../state_trackers/egl/wayland/native_wayland.h|3 +-
 src/gbm/backends/dri/gbm_dri.c |   12 +-
 src/gbm/main/gbm.c |   14 +
 src/gbm/main/gbm.h |3 +
 src/gbm/main/gbmint.h  |1 +
 src/mesa/drivers/dri/intel/intel_screen.c  |   27 ++-
 src/mesa/drivers/dri/intel/intel_tex_image.c   |6 +
 tests/Makefile.am  |2 +-
 tests/wayland-drm/Makefile.am  |   12 +
 tests/wayland-drm/wayland-drm-test.c   |  456 
 16 files changed, 562 insertions(+), 10 deletions(-)
 mode change 100644 = 100755 configure.ac
 mode change 100644 = 100755 include/GL/internal/dri_interface.h
 mode change 100644 = 100755 src/egl/drivers/dri2/egl_dri2.c
 mode change 100644 = 100755 src/egl/drivers/dri2/platform_wayland.c
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/wayland-drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_wayland.h
 mode change 100644 = 100755 src/gbm/backends/dri/gbm_dri.c
 mode change 100644 = 100755 src/gbm/main/gbm.c
 mode change 100644 = 100755 src/gbm/main/gbm.h
 mode change 100644 = 100755 src/gbm/main/gbmint.h
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_screen.c
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_tex_image.c
 mode change 100644 = 100755 tests/Makefile.am
 create mode 100755 tests/wayland-drm/Makefile.am
 create mode 100755 tests/wayland-drm/wayland-drm-test.c

-- 
1.7.5.4

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


[Mesa-dev] [PATCH 1/9 v2] GL: add YUYV to dri image format

2012-06-05 Thread Zhao Halley
---
 include/GL/internal/dri_interface.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 include/GL/internal/dri_interface.h

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
old mode 100644
new mode 100755
index e37917e..5e325cf
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -907,6 +907,7 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_FORMAT_ARGB 0x1003
 #define __DRI_IMAGE_FORMAT_ABGR 0x1004
 #define __DRI_IMAGE_FORMAT_XBGR 0x1005
+#define __DRI_IMAGE_FORMAT_YUYV 0x1006
 
 #define __DRI_IMAGE_USE_SHARE  0x0001
 #define __DRI_IMAGE_USE_SCANOUT0x0002
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 2/9 v2] mesa intel driver:

2012-06-05 Thread Zhao Halley
 add YUYV format for dri image
 YUYV image doesn't use for texture
---
 src/mesa/drivers/dri/intel/intel_screen.c|   10 ++
 src/mesa/drivers/dri/intel/intel_tex_image.c |6 ++
 2 files changed, 16 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_screen.c
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_tex_image.c

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
old mode 100644
new mode 100755
index 458178f..3b8f81e
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -216,6 +216,11 @@ intel_create_image_from_name(__DRIscreen *screen,
image-internal_format = GL_RGB;
image-data_type = GL_UNSIGNED_BYTE;
break;
+case __DRI_IMAGE_FORMAT_YUYV:
+   image-format = MESA_FORMAT_YCBCR;
+   image-internal_format = GL_YCBCR_MESA;
+   image-data_type = GL_UNSIGNED_BYTE;
+  break;
 default:
free(image);
return NULL;
@@ -343,6 +348,11 @@ intel_create_image(__DRIscreen *screen,
image-internal_format = GL_RGB;
image-data_type = GL_UNSIGNED_BYTE;
break;
+   case __DRI_IMAGE_FORMAT_YUYV:
+  image-format = MESA_FORMAT_YCBCR;
+  image-internal_format = GL_YCBCR_MESA;
+  image-data_type = GL_UNSIGNED_BYTE;
+  break;
default:
   free(image);
   return NULL;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c 
b/src/mesa/drivers/dri/intel/intel_tex_image.c
old mode 100644
new mode 100755
index 094d3cd..8b94cb1
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -388,6 +388,12 @@ intel_image_target_texture_2d(struct gl_context *ctx, 
GLenum target,
if (image == NULL)
   return;
 
+   if (image-format == MESA_FORMAT_YCBCR) {
+  _mesa_error(intel-ctx,
+ GL_INVALID_OPERATION, glEGLImageTargetTexture2DOES, attach 
YUYV region to texture is not supported);
+  return;
+}
+
intel_set_texture_image_region(ctx, texImage, image-region,
  target, image-internal_format, 
image-format);
 }
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 3/9 v2] egl wayland: add YUYV support

2012-06-05 Thread Zhao Halley
---
 src/egl/drivers/dri2/egl_dri2.c |   17 ++---
 src/egl/drivers/dri2/platform_wayland.c |8 +++-
 2 files changed, 21 insertions(+), 4 deletions(-)
 mode change 100644 = 100755 src/egl/drivers/dri2/egl_dri2.c
 mode change 100644 = 100755 src/egl/drivers/dri2/platform_wayland.c

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
old mode 100644
new mode 100755
index 4a02838..a058046
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1096,9 +1096,15 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, 
_EGLContext *ctx,
switch (wayland_drm_buffer_get_format(buffer)) {
case WL_DRM_FORMAT_ARGB:
   format = __DRI_IMAGE_FORMAT_ARGB;
+  pitch = stride / 4;
   break;
case WL_DRM_FORMAT_XRGB:
   format = __DRI_IMAGE_FORMAT_XRGB;
+  pitch = stride / 4;
+  break;
+   case WL_DRM_FORMAT_YUYV:
+  format = __DRI_IMAGE_FORMAT_YUYV;
+  pitch = stride / 2;
   break;
default:
   _eglError(EGL_BAD_PARAMETER,
@@ -1106,8 +1112,6 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, 
_EGLContext *ctx,
   return NULL;
}
 
-   pitch = stride / 4;
-
return dri2_create_image_drm_name(disp, ctx, name, attrs, format, pitch);
 }
 #endif
@@ -1270,21 +1274,28 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
__DRIimage *image;
int dri_format;
+   int pitch = 0;
 
switch (format) {
case WL_DRM_FORMAT_ARGB:
   dri_format =__DRI_IMAGE_FORMAT_ARGB;
+  pitch = stride/4;
   break;
case WL_DRM_FORMAT_XRGB:
   dri_format = __DRI_IMAGE_FORMAT_XRGB;
+  pitch = stride/4;
   break;
+  case WL_DRM_FORMAT_YUYV:
+ dri_format = __DRI_IMAGE_FORMAT_YUYV;
+ pitch = stride/2;
+ break;
default:
   return NULL;
}
 
image = dri2_dpy-image-createImageFromName(dri2_dpy-dri_screen,
width, height, 
-   dri_format, name, stride / 4,
+   dri_format, name, pitch,
NULL);
 
return image;
diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
old mode 100644
new mode 100755
index d291f0f..6d330b7
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -42,7 +42,9 @@
 
 enum wl_drm_format_flags {
HAS_ARGB = 1,
-   HAS_XRGB = 2
+   HAS_XRGB = (1  1),
+   HAS_YUYV = (1  2)
+   
 };
 
 static void
@@ -778,6 +780,9 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t 
format)
case WL_DRM_FORMAT_XRGB:
   dri2_dpy-formats |= HAS_XRGB;
   break;
+   case WL_DRM_FORMAT_YUYV:
+  dri2_dpy-formats |= HAS_YUYV;
+  break;
}
 }
 
@@ -878,6 +883,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
 dri2_add_config(disp, config, i + 1, 0, types, NULL, rgb_masks);
   if (dri2_dpy-formats  HAS_ARGB)
 dri2_add_config(disp, config, i + 1, 0, types, NULL, argb_masks);
+  // , should we do something for YUYV here?
}
 
disp-Extensions.KHR_image_pixmap = EGL_TRUE;
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 4/9 v2] gallium egl wayland: add YUYV support

2012-06-05 Thread Zhao Halley
---
 .../state_trackers/egl/wayland/native_drm.c|3 +++
 .../state_trackers/egl/wayland/native_wayland.h|3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_wayland.h

diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c 
b/src/gallium/state_trackers/egl/wayland/native_drm.c
old mode 100644
new mode 100755
index e3bd628..f2d2e74
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -164,6 +164,9 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t 
format)
case WL_DRM_FORMAT_XRGB:
   drmdpy-base.formats |= HAS_XRGB;
   break;
+  case WL_DRM_FORMAT_YUYV:
+ drmdpy-base.formats |= HAS_YUYV;
+ break;
}
 }
 
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.h 
b/src/gallium/state_trackers/egl/wayland/native_wayland.h
old mode 100644
new mode 100755
index e6a914f..bd26bf0
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.h
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.h
@@ -38,7 +38,8 @@ struct wayland_surface;
 
 enum wayland_format_flag {
HAS_ARGB= (1  0),
-   HAS_XRGB= (1  1)
+   HAS_XRGB= (1  1),
+   HAS_YUYV= (1  2)
 };
 
 struct wayland_display {
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 5/9 v2] gbm dri backend: add YUYV support

2012-06-05 Thread Zhao Halley
---
 src/gbm/backends/dri/gbm_dri.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/gbm/backends/dri/gbm_dri.c

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
old mode 100644
new mode 100755
index e5ddfb6..32cde66
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -331,6 +331,9 @@ gbm_dri_to_gbm_format(uint32_t dri_format)
case __DRI_IMAGE_FORMAT_ABGR:
   ret = GBM_FORMAT_ABGR;
   break;
+  case __DRI_IMAGE_FORMAT_YUYV:
+ ret = GBM_FORMAT_YUYV;
+ break;
default:
   ret = 0;
   break;
@@ -428,6 +431,9 @@ gbm_dri_bo_create(struct gbm_device *gbm,
case GBM_FORMAT_ABGR:
   dri_format = __DRI_IMAGE_FORMAT_ABGR;
   break;
+  case GBM_FORMAT_YUYV:
+ dri_format = __DRI_IMAGE_FORMAT_YUYV;
+ break;
default:
   return NULL;
}
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 6/9 v2] wayland-drm: add YUYV support

2012-06-05 Thread Zhao Halley
---
 src/egl/wayland/wayland-drm/wayland-drm.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/wayland-drm.c

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c 
b/src/egl/wayland/wayland-drm/wayland-drm.c
old mode 100644
new mode 100755
index 5f831b3..d9cfe09
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -111,6 +111,7 @@ drm_create_buffer(struct wl_client *client, struct 
wl_resource *resource,
switch (format) {
case WL_DRM_FORMAT_ARGB:
case WL_DRM_FORMAT_XRGB:
+case WL_DRM_FORMAT_YUYV:
break;
default:
wl_resource_post_error(resource,
@@ -186,6 +187,8 @@ bind_drm(struct wl_client *client, void *data, uint32_t 
version, uint32_t id)
   WL_DRM_FORMAT_ARGB);
wl_resource_post_event(resource, WL_DRM_FORMAT,
   WL_DRM_FORMAT_XRGB);
+   wl_resource_post_event(resource, WL_DRM_FORMAT,
+  WL_DRM_FORMAT_YUYV);
 }
 
 struct wl_drm *
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 7/9 v2] gbm: add handle2(buffer region name)

2012-06-05 Thread Zhao Halley
---
 src/gbm/backends/dri/gbm_dri.c |6 +-
 src/gbm/main/gbm.c |   14 ++
 src/gbm/main/gbm.h |3 +++
 src/gbm/main/gbmint.h  |1 +
 4 files changed, 23 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 src/gbm/main/gbm.c
 mode change 100644 = 100755 src/gbm/main/gbm.h
 mode change 100644 = 100755 src/gbm/main/gbmint.h

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 32cde66..383a5a5 100755
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -389,6 +389,8 @@ gbm_dri_bo_create_from_egl_image(struct gbm_device *gbm,
   (int *) bo-base.base.pitch);
dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_FORMAT,
  dri_format);
+   dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_NAME,
+  (uint32_t *) bo-base.base.handle2.u32);
 
bo-base.base.format = gbm_dri_to_gbm_format(dri_format);
 
@@ -457,7 +459,9 @@ gbm_dri_bo_create(struct gbm_device *gbm,
   bo-base.base.handle.s32);
dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_STRIDE,
   (int *) bo-base.base.pitch);
-
+   dri-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_NAME,
+  (uint32_t *) bo-base.base.handle2.u32);
+   
return bo-base.base;
 }
 
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
old mode 100644
new mode 100755
index 3994f86..f445bb1
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -231,6 +231,20 @@ gbm_bo_get_handle(struct gbm_bo *bo)
return bo-handle;
 }
 
+/** Get handle2 (buffer region name) of the buffer object
+ *
+ * This is stored in the platform generic union gbm_bo_handle type. However
+ * the format of this handle is platform specific.
+ *
+ * \param bo The buffer object
+ * \return Returns the handle of the allocated buffer object
+ */
+GBM_EXPORT union gbm_bo_handle
+gbm_bo_get_handle2(struct gbm_bo *bo)
+{
+   return bo-handle2;
+}
+
 /** Write data into the buffer object
  *
  * If the buffer object was created with the GBM_BO_USE_WRITE flag,
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
old mode 100644
new mode 100755
index af5dc5a..b7a2ffa
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -254,6 +254,9 @@ gbm_bo_get_device(struct gbm_bo *bo);
 union gbm_bo_handle
 gbm_bo_get_handle(struct gbm_bo *bo);
 
+union gbm_bo_handle
+gbm_bo_get_handle2(struct gbm_bo *bo);
+
 int
 gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
 
diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h
old mode 100644
new mode 100755
index 8eb8671..5e48e89
--- a/src/gbm/main/gbmint.h
+++ b/src/gbm/main/gbmint.h
@@ -95,6 +95,7 @@ struct gbm_bo {
uint32_t pitch;
uint32_t format;
union gbm_bo_handle  handle;
+   union gbm_bo_handle  handle2;
void *user_data;
void (*destroy_user_data)(struct gbm_bo *, void *);
 };
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 8/9 v2] intel driver: add tiling support for intel_image_write() all drm image are supported for write

2012-06-05 Thread Zhao Halley
---
 src/mesa/drivers/dri/intel/intel_screen.c |   17 +++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 3b8f81e..63b6b24 100755
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -310,10 +310,13 @@ intel_create_image(__DRIscreen *screen,
   tiling = I915_TILING_NONE;
}
 
+#if 0
+   // add tiling support in intel_image_write(), so all drm images are ok 
for write
/* We only support write for cursor drm images */
if ((use  __DRI_IMAGE_USE_WRITE) 
use != (__DRI_IMAGE_USE_WRITE | __DRI_IMAGE_USE_CURSOR))
   return NULL;
+#endif
 
image = CALLOC(sizeof *image);
if (image == NULL)
@@ -441,9 +444,19 @@ intel_image_write(__DRIimage *image, const void *buf, 
size_t count)
if (!(image-usage  __DRI_IMAGE_USE_WRITE))
   return -1;
 
-   drm_intel_bo_map(image-region-bo, true);
+   int tiling, swizzle;
+   dri_bo_get_tiling(image-region-bo, tiling, swizzle);
+   if (tiling != I915_TILING_NONE)
+   drm_intel_gem_bo_map_gtt(image-region-bo);
+   else
+   dri_bo_map(image-region-bo, 1);
+   
memcpy(image-region-bo-virtual, buf, count);
-   drm_intel_bo_unmap(image-region-bo);
+
+   if (tiling != I915_TILING_NONE)
+   drm_intel_gem_bo_unmap_gtt(image-region-bo);
+   else
+   dri_bo_unmap(image-region-bo);
 
return 0;
 }
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 9/9 v2] test: test case for wayland-drm in tests/wayland-drm

2012-06-05 Thread Zhao Halley
 - it shows how wayland-drm protocol works between server and client
   buffer are shared basing on dri image
 - XRGB and YUYV format are supported,
   it can render to overlay plane potentially
---
 configure.ac |4 +-
 tests/Makefile.am|2 +-
 tests/wayland-drm/Makefile.am|   12 +
 tests/wayland-drm/wayland-drm-test.c |  456 ++
 4 files changed, 472 insertions(+), 2 deletions(-)
 mode change 100644 = 100755 configure.ac
 mode change 100644 = 100755 tests/Makefile.am
 create mode 100755 tests/wayland-drm/Makefile.am
 create mode 100755 tests/wayland-drm/wayland-drm-test.c

diff --git a/configure.ac b/configure.ac
old mode 100644
new mode 100755
index 3bc59ca..58c05bc
--- a/configure.ac
+++ b/configure.ac
@@ -2033,7 +2033,9 @@ AC_CONFIG_FILES([configs/autoconf
src/mesa/drivers/dri/radeon/Makefile
src/mesa/drivers/dri/swrast/Makefile
tests/Makefile
-   tests/glx/Makefile])
+   tests/glx/Makefile
+   tests/wayland-drm/Makefile
+])
 
 dnl Replace the configs/current symlink
 AC_CONFIG_COMMANDS([configs],[
diff --git a/tests/Makefile.am b/tests/Makefile.am
old mode 100644
new mode 100755
index 4079bb9..f6125f1
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1 +1 @@
-SUBDIRS=glx
+SUBDIRS=glx wayland-drm
diff --git a/tests/wayland-drm/Makefile.am b/tests/wayland-drm/Makefile.am
new file mode 100755
index 000..7673368
--- /dev/null
+++ b/tests/wayland-drm/Makefile.am
@@ -0,0 +1,12 @@
+bin_PROGRAMS = wayland_drm_test
+wayland_drm_test_CFLAGS = -I$(top_srcdir)/src/egl/main \
+   -I$(top_srcdir)/include \
+   $(DEFINES) \
+   $(WAYLAND_CFLAGS) \
+   $(LIBDRM_CFLAGS)
+
+wayland_drm_test_LDADD = $(WAYLAND_LIBS) $(LIBDRM_LIBS) 
+wayland_drm_test_LDADD += $(top_srcdir)/src/egl/main/libEGL.la 
$(top_srcdir)/src/gbm/libgbm.la
+
+wayland_drm_test_SOURCES = wayland-drm-test.c \
+   
$(top_srcdir)/src/egl/wayland/wayland-drm//wayland-drm-client-protocol.h
diff --git a/tests/wayland-drm/wayland-drm-test.c 
b/tests/wayland-drm/wayland-drm-test.c
new file mode 100755
index 000..aa6f001
--- /dev/null
+++ b/tests/wayland-drm/wayland-drm-test.c
@@ -0,0 +1,456 @@
+/*
+ * Copyright © 2012 Halley Zhao
+ *
+ * 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:
+ *Halley Zhao halley.z...@intel.com
+ */
+
+
+#include stdlib.h
+#include unistd.h
+#include errno.h
+#include fcntl.h
+#include sys/stat.h
+#include string.h
+#include assert.h
+#include xf86drm.h
+#include i915_drm.h
+#include libdrm/intel_bufmgr.h
+#include drm.h
+#include ../../src/gbm/main/gbm.h
+#include wayland-client.h
+#include wayland-client-protocol.h
+#include ../../src/egl/wayland/wayland-drm/wayland-drm-client-protocol.h
+
+int win_width = 1024, win_height = 512;
+int drm_fd = -1;
+int wayland_server_support_yuyv = 0;
+struct wl_drm *wl_drm;
+
+struct display {
+   struct wl_display *display;
+   struct wl_compositor *compositor;
+   struct wl_shell *shell;
+   struct wl_input_device *input;
+   uint32_t mask;
+struct gbm_device *gbm;
+};
+
+struct window {
+   struct display *display;
+   struct wl_surface *surface;
+   struct wl_shell_surface *shell_surface;
+   struct wl_callback *callback;
+   struct {
+   int width, height;
+   } geometry;
+unsigned int format;
+struct wl_buffer *buffer;
+struct gbm_bo *gbm_bo;
+unsigned int bo_pitch;
+};
+
+void fill_window_XRGB(struct window *win);
+void fill_window_YUYV(struct window *win);
+int wayland_drm_init(struct wl_display *wl_dpy);
+
+void fill_window_XRGB(struct window *win)
+{
+unsigned char *mem = malloc (win-bo_pitch * win_height);
+static int color_index = 0;
+static unsigned int 

[Mesa-dev] [PATCH] add test for wayland drm, XRGB/YUYV is supported

2012-06-04 Thread Zhao halley
when I sent patches for YUYV support of dri image, a test case is
required to make sure the patches can work well. so it is created.

it also shows how wayland-drm protocol works between wayland client 
and server -- they communicate data in buffer/drm level.

---
 configure.ac   |1 +
 src/egl/wayland/Makefile.am|2 +-
 src/egl/wayland/wayland-drm/Makefile.am|1 +
 src/egl/wayland/wayland-drm/tests/Makefile.am  |   12 +
 .../wayland/wayland-drm/tests/wayland-drm-test.c   |  463 
 5 files changed, 478 insertions(+), 1 deletions(-)
 create mode 100644 src/egl/wayland/wayland-drm/tests/Makefile.am
 create mode 100644 src/egl/wayland/wayland-drm/tests/wayland-drm-test.c

diff --git a/configure.ac b/configure.ac
index 3bc59ca..83bf637 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2019,6 +2019,7 @@ AC_CONFIG_FILES([configs/autoconf
src/egl/wayland/wayland-egl/Makefile
src/egl/wayland/wayland-egl/wayland-egl.pc
src/egl/wayland/wayland-drm/Makefile
+   src/egl/wayland/wayland-drm/tests/Makefile
src/glsl/tests/Makefile
src/glx/Makefile
src/mapi/shared-glapi/Makefile
diff --git a/src/egl/wayland/Makefile.am b/src/egl/wayland/Makefile.am
index ca7207c..526d64f 100644
--- a/src/egl/wayland/Makefile.am
+++ b/src/egl/wayland/Makefile.am
@@ -1 +1 @@
-SUBDIRS = wayland-drm wayland-egl
+SUBDIRS = wayland-drm wayland-egl 
diff --git a/src/egl/wayland/wayland-drm/Makefile.am 
b/src/egl/wayland/wayland-drm/Makefile.am
index cf15eda..4a7c6eb 100644
--- a/src/egl/wayland/wayland-drm/Makefile.am
+++ b/src/egl/wayland/wayland-drm/Makefile.am
@@ -1,3 +1,4 @@
+SUBDIRS = tests
 AM_CFLAGS = -I$(top_srcdir)/src/egl/main \
-I$(top_srcdir)/include \
$(DEFINES) \
diff --git a/src/egl/wayland/wayland-drm/tests/Makefile.am 
b/src/egl/wayland/wayland-drm/tests/Makefile.am
new file mode 100644
index 000..d489c74
--- /dev/null
+++ b/src/egl/wayland/wayland-drm/tests/Makefile.am
@@ -0,0 +1,12 @@
+bin_PROGRAMS = wayland_drm_test
+wayland_drm_test_CFLAGS = -I$(top_srcdir)/src/egl/main \
+   -I$(top_srcdir)/include \
+   $(DEFINES) \
+   $(WAYLAND_CFLAGS) \
+   $(LIBDRM_CFLAGS)
+
+wayland_drm_test_LDADD = $(WAYLAND_LIBS) $(LIBDRM_LIBS) -ldrm_intel
+wayland_drm_test_LDADD += $(top_srcdir)/src/egl/main/libEGL.la
+
+wayland_drm_test_SOURCES = wayland-drm-test.c \
+   ../wayland-drm-client-protocol.h
diff --git a/src/egl/wayland/wayland-drm/tests/wayland-drm-test.c 
b/src/egl/wayland/wayland-drm/tests/wayland-drm-test.c
new file mode 100644
index 000..04c23d4
--- /dev/null
+++ b/src/egl/wayland/wayland-drm/tests/wayland-drm-test.c
@@ -0,0 +1,463 @@
+/*
+ * Copyright © 2012 Halley Zhao
+ *
+ * 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:
+ *Halley Zhao halley.z...@intel.com
+ */
+
+
+#include stdlib.h
+#include unistd.h
+#include errno.h
+#include fcntl.h
+#include sys/stat.h
+#include string.h
+#include assert.h
+#include xf86drm.h
+#include i915_drm.h
+#include libdrm/intel_bufmgr.h
+#include drm.h
+#include gbm.h
+#include wayland-client.h
+#include wayland-client-protocol.h
+#include ../wayland-drm-client-protocol.h
+
+void fill_bo_XRGB(dri_bo *bo, int width, int height, int pitch);
+void fill_bo_YUYV(dri_bo *bo, int width, int height, int pitch);
+int wayland_drm_init(struct wl_display *wl_dpy);
+
+int win_width = 1024, win_height = 512;
+int drm_fd = -1;
+struct wl_drm *wl_drm;
+
+struct display {
+   struct wl_display *display;
+   struct wl_compositor *compositor;
+   struct wl_shell *shell;
+   struct wl_input_device *input;
+   uint32_t mask;
+};
+
+struct window {
+   struct display *display;
+   struct wl_surface 

[Mesa-dev] [PATCH] add test for wayland drm, XRGB/YUYV is supported

2012-06-04 Thread Zhao halley
when I sent patches for YUYV support of dri image, a test case is
required to make sure the patches can work well. so it is created.

it also shows how wayland-drm protocol works between wayland client 
and server -- they communicate data in buffer/drm level.

---
 configure.ac   |1 +
 src/egl/wayland/Makefile.am|2 +-
 src/egl/wayland/wayland-drm/Makefile.am|1 +
 src/egl/wayland/wayland-drm/tests/Makefile.am  |   12 +
 .../wayland/wayland-drm/tests/wayland-drm-test.c   |  463 
 5 files changed, 478 insertions(+), 1 deletions(-)
 create mode 100644 src/egl/wayland/wayland-drm/tests/Makefile.am
 create mode 100644 src/egl/wayland/wayland-drm/tests/wayland-drm-test.c

diff --git a/configure.ac b/configure.ac
index 3bc59ca..83bf637 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2019,6 +2019,7 @@ AC_CONFIG_FILES([configs/autoconf
src/egl/wayland/wayland-egl/Makefile
src/egl/wayland/wayland-egl/wayland-egl.pc
src/egl/wayland/wayland-drm/Makefile
+   src/egl/wayland/wayland-drm/tests/Makefile
src/glsl/tests/Makefile
src/glx/Makefile
src/mapi/shared-glapi/Makefile
diff --git a/src/egl/wayland/Makefile.am b/src/egl/wayland/Makefile.am
index ca7207c..526d64f 100644
--- a/src/egl/wayland/Makefile.am
+++ b/src/egl/wayland/Makefile.am
@@ -1 +1 @@
-SUBDIRS = wayland-drm wayland-egl
+SUBDIRS = wayland-drm wayland-egl 
diff --git a/src/egl/wayland/wayland-drm/Makefile.am 
b/src/egl/wayland/wayland-drm/Makefile.am
index cf15eda..4a7c6eb 100644
--- a/src/egl/wayland/wayland-drm/Makefile.am
+++ b/src/egl/wayland/wayland-drm/Makefile.am
@@ -1,3 +1,4 @@
+SUBDIRS = tests
 AM_CFLAGS = -I$(top_srcdir)/src/egl/main \
-I$(top_srcdir)/include \
$(DEFINES) \
diff --git a/src/egl/wayland/wayland-drm/tests/Makefile.am 
b/src/egl/wayland/wayland-drm/tests/Makefile.am
new file mode 100644
index 000..d489c74
--- /dev/null
+++ b/src/egl/wayland/wayland-drm/tests/Makefile.am
@@ -0,0 +1,12 @@
+bin_PROGRAMS = wayland_drm_test
+wayland_drm_test_CFLAGS = -I$(top_srcdir)/src/egl/main \
+   -I$(top_srcdir)/include \
+   $(DEFINES) \
+   $(WAYLAND_CFLAGS) \
+   $(LIBDRM_CFLAGS)
+
+wayland_drm_test_LDADD = $(WAYLAND_LIBS) $(LIBDRM_LIBS) -ldrm_intel
+wayland_drm_test_LDADD += $(top_srcdir)/src/egl/main/libEGL.la
+
+wayland_drm_test_SOURCES = wayland-drm-test.c \
+   ../wayland-drm-client-protocol.h
diff --git a/src/egl/wayland/wayland-drm/tests/wayland-drm-test.c 
b/src/egl/wayland/wayland-drm/tests/wayland-drm-test.c
new file mode 100644
index 000..04c23d4
--- /dev/null
+++ b/src/egl/wayland/wayland-drm/tests/wayland-drm-test.c
@@ -0,0 +1,463 @@
+/*
+ * Copyright © 2012 Halley Zhao
+ *
+ * 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:
+ *Halley Zhao halley.z...@intel.com
+ */
+
+
+#include stdlib.h
+#include unistd.h
+#include errno.h
+#include fcntl.h
+#include sys/stat.h
+#include string.h
+#include assert.h
+#include xf86drm.h
+#include i915_drm.h
+#include libdrm/intel_bufmgr.h
+#include drm.h
+#include gbm.h
+#include wayland-client.h
+#include wayland-client-protocol.h
+#include ../wayland-drm-client-protocol.h
+
+void fill_bo_XRGB(dri_bo *bo, int width, int height, int pitch);
+void fill_bo_YUYV(dri_bo *bo, int width, int height, int pitch);
+int wayland_drm_init(struct wl_display *wl_dpy);
+
+int win_width = 1024, win_height = 512;
+int drm_fd = -1;
+struct wl_drm *wl_drm;
+
+struct display {
+   struct wl_display *display;
+   struct wl_compositor *compositor;
+   struct wl_shell *shell;
+   struct wl_input_device *input;
+   uint32_t mask;
+};
+
+struct window {
+   struct display *display;
+   struct wl_surface 

Re: [Mesa-dev] [PATCH] add test for wayland drm, XRGB/YUYV is supported

2012-06-04 Thread Zhao, Halley
Some ^M in copyright section, resend it.
Thanks.

 -Original Message-
 From: Zhao, Halley
 Sent: Monday, June 04, 2012 4:29 PM
 To: mesa-dev@lists.freedesktop.org
 Cc: e...@anholt.net; Barnes, Jesse; Zhao, Halley
 Subject: [PATCH] add test for wayland drm, XRGB/YUYV is supported
 
 when I sent patches for YUYV support of dri image, a test case is
 required to make sure the patches can work well. so it is created.
 
 it also shows how wayland-drm protocol works between wayland client and
 server -- they communicate data in buffer/drm level.
 
 ---
  configure.ac   |1 +
  src/egl/wayland/Makefile.am|2 +-
  src/egl/wayland/wayland-drm/Makefile.am|1 +
  src/egl/wayland/wayland-drm/tests/Makefile.am  |   12 +
  .../wayland/wayland-drm/tests/wayland-drm-test.c   |  463
 
  5 files changed, 478 insertions(+), 1 deletions(-)  create mode 100644
 src/egl/wayland/wayland-drm/tests/Makefile.am
  create mode 100644 src/egl/wayland/wayland-drm/tests/wayland-drm-
 test.c
 
 diff --git a/configure.ac b/configure.ac index 3bc59ca..83bf637 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -2019,6 +2019,7 @@ AC_CONFIG_FILES([configs/autoconf
   src/egl/wayland/wayland-egl/Makefile
   src/egl/wayland/wayland-egl/wayland-egl.pc
   src/egl/wayland/wayland-drm/Makefile
 + src/egl/wayland/wayland-drm/tests/Makefile
   src/glsl/tests/Makefile
   src/glx/Makefile
   src/mapi/shared-glapi/Makefile
 diff --git a/src/egl/wayland/Makefile.am b/src/egl/wayland/Makefile.am
 index ca7207c..526d64f 100644
 --- a/src/egl/wayland/Makefile.am
 +++ b/src/egl/wayland/Makefile.am
 @@ -1 +1 @@
 -SUBDIRS = wayland-drm wayland-egl
 +SUBDIRS = wayland-drm wayland-egl
 diff --git a/src/egl/wayland/wayland-drm/Makefile.am
 b/src/egl/wayland/wayland-drm/Makefile.am
 index cf15eda..4a7c6eb 100644
 --- a/src/egl/wayland/wayland-drm/Makefile.am
 +++ b/src/egl/wayland/wayland-drm/Makefile.am
 @@ -1,3 +1,4 @@
 +SUBDIRS = tests
  AM_CFLAGS = -I$(top_srcdir)/src/egl/main \
   -I$(top_srcdir)/include \
   $(DEFINES) \
 diff --git a/src/egl/wayland/wayland-drm/tests/Makefile.am
 b/src/egl/wayland/wayland-drm/tests/Makefile.am
 new file mode 100644
 index 000..d489c74
 --- /dev/null
 +++ b/src/egl/wayland/wayland-drm/tests/Makefile.am
 @@ -0,0 +1,12 @@
 +bin_PROGRAMS = wayland_drm_test
 +wayland_drm_test_CFLAGS = -I$(top_srcdir)/src/egl/main \
 + -I$(top_srcdir)/include \
 + $(DEFINES) \
 + $(WAYLAND_CFLAGS) \
 + $(LIBDRM_CFLAGS)
 +
 +wayland_drm_test_LDADD = $(WAYLAND_LIBS) $(LIBDRM_LIBS) -ldrm_intel
 +wayland_drm_test_LDADD += $(top_srcdir)/src/egl/main/libEGL.la
 +
 +wayland_drm_test_SOURCES = wayland-drm-test.c \
 + ../wayland-drm-client-protocol.h
 diff --git a/src/egl/wayland/wayland-drm/tests/wayland-drm-test.c
 b/src/egl/wayland/wayland-drm/tests/wayland-drm-test.c
 new file mode 100644
 index 000..04c23d4
 --- /dev/null
 +++ b/src/egl/wayland/wayland-drm/tests/wayland-drm-test.c
 @@ -0,0 +1,463 @@
 +/*
 + * Copyright © 2012 Halley Zhao
 + *
 + * 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:
 + *Halley Zhao halley.z...@intel.com
 + */
 +
 +
 +#include stdlib.h
 +#include unistd.h
 +#include errno.h
 +#include fcntl.h
 +#include sys/stat.h
 +#include string.h
 +#include assert.h
 +#include xf86drm.h
 +#include i915_drm.h
 +#include libdrm/intel_bufmgr.h
 +#include drm.h
 +#include gbm.h
 +#include wayland-client.h
 +#include wayland-client-protocol.h
 +#include ../wayland-drm-client-protocol.h
 +
 +void fill_bo_XRGB(dri_bo *bo, int width, int height, int pitch); void
 +fill_bo_YUYV(dri_bo *bo, int width, int height, int pitch); int

Re: [Mesa-dev] [PATCH] add test for wayland drm, XRGB/YUYV is supported

2012-06-04 Thread Zhao, Halley
Move the test case to $mesa/test/wayland-drm.


From f8843a118e9d7f41b5acedcb396c82adae36841d Mon Sep 17 00:00:00 2001
From: Zhao halley halley.z...@intel.com
Date: Mon, 4 Jun 2012 15:58:24 +0800
Subject: [PATCH] add test for wayland drm, XRGB/YUYV is supported

when I sent patches for YUYV support of dri image, a test case is
required to make sure the patches can work well. so it is created.

it also shows how wayland-drm protocol works between wayland client
and server -- they communicate data in buffer/drm level.
---
 configure.ac |4 +-
 src/egl/wayland/Makefile.am  |2 +-
 tests/Makefile.am|2 +-
 tests/wayland-drm/Makefile.am|   12 +
 tests/wayland-drm/wayland-drm-test.c |  462 ++
 5 files changed, 479 insertions(+), 3 deletions(-)
 create mode 100644 tests/wayland-drm/Makefile.am
 create mode 100644 tests/wayland-drm/wayland-drm-test.c

diff --git a/configure.ac b/configure.ac
index 3bc59ca..58c05bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2033,7 +2033,9 @@ AC_CONFIG_FILES([configs/autoconf
src/mesa/drivers/dri/radeon/Makefile
src/mesa/drivers/dri/swrast/Makefile
tests/Makefile
-   tests/glx/Makefile])
+   tests/glx/Makefile
+   tests/wayland-drm/Makefile
+])
 
 dnl Replace the configs/current symlink
 AC_CONFIG_COMMANDS([configs],[
diff --git a/src/egl/wayland/Makefile.am b/src/egl/wayland/Makefile.am
index ca7207c..526d64f 100644
--- a/src/egl/wayland/Makefile.am
+++ b/src/egl/wayland/Makefile.am
@@ -1 +1 @@
-SUBDIRS = wayland-drm wayland-egl
+SUBDIRS = wayland-drm wayland-egl 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4079bb9..f6125f1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1 +1 @@
-SUBDIRS=glx
+SUBDIRS=glx wayland-drm
diff --git a/tests/wayland-drm/Makefile.am b/tests/wayland-drm/Makefile.am
new file mode 100644
index 000..526acde
--- /dev/null
+++ b/tests/wayland-drm/Makefile.am
@@ -0,0 +1,12 @@
+bin_PROGRAMS = wayland_drm_test
+wayland_drm_test_CFLAGS = -I$(top_srcdir)/src/egl/main \
+   -I$(top_srcdir)/include \
+   $(DEFINES) \
+   $(WAYLAND_CFLAGS) \
+   $(LIBDRM_CFLAGS)
+
+wayland_drm_test_LDADD = $(WAYLAND_LIBS) $(LIBDRM_LIBS) -ldrm_intel
+wayland_drm_test_LDADD += $(top_srcdir)/src/egl/main/libEGL.la
+
+wayland_drm_test_SOURCES = wayland-drm-test.c \
+   
$(top_srcdir)/src/egl/wayland/wayland-drm//wayland-drm-client-protocol.h
diff --git a/tests/wayland-drm/wayland-drm-test.c 
b/tests/wayland-drm/wayland-drm-test.c
new file mode 100644
index 000..ea2e230
--- /dev/null
+++ b/tests/wayland-drm/wayland-drm-test.c
@@ -0,0 +1,462 @@
+/*
+ * Copyright © 2012 Halley Zhao
+ *
+ * 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:
+ *Halley Zhao halley.z...@intel.com
+ */
+
+
+#include stdlib.h
+#include unistd.h
+#include errno.h
+#include fcntl.h
+#include sys/stat.h
+#include string.h
+#include assert.h
+#include xf86drm.h
+#include i915_drm.h
+#include libdrm/intel_bufmgr.h
+#include drm.h
+#include gbm.h
+#include wayland-client.h
+#include wayland-client-protocol.h
+#include ../../src/egl/wayland/wayland-drm/wayland-drm-client-protocol.h
+
+void fill_bo_XRGB(dri_bo *bo, int width, int height, int pitch);
+void fill_bo_YUYV(dri_bo *bo, int width, int height, int pitch);
+int wayland_drm_init(struct wl_display *wl_dpy);
+
+int win_width = 1024, win_height = 512;
+int drm_fd = -1;
+struct wl_drm *wl_drm;
+
+struct display {
+   struct wl_display *display;
+   struct wl_compositor *compositor;
+   struct wl_shell *shell;
+   struct wl_input_device *input;
+   uint32_t mask;
+};
+
+struct window {
+   struct display *display;
+   struct wl_surface *surface;
+   struct

Re: [Mesa-dev] [PATCH 2/6] mesa intel driver:

2012-06-04 Thread Zhao, Halley
Thanks for careful review.

1. My mistake for the s, we can remove it.
There is MESA_FORMAT_YCBCR_REV for UYVY, so MESA_FORMAT_YCBCR is 
exactly for YUYV format.
GL_LUMINANCE should be ok since YUYV is an luminance format.
2. as to intel_image_target_texture_2d(), an error is added for YUYV region.
Updated patch see below.

3. A test case is added to demonstrate the usage: 
http://lists.freedesktop.org/archives/mesa-dev/2012-June/022487.html 
As to the case when hw overlay is not available, it is considered in 
following way:
3.1) when client connect to wayland-server, it gets which formats are 
supported from server in drm_handle_format(). Client sends YUYV buffer to 
server only when the server supports it.
Client can convert a YUYV/NV12 buffer to XRGB format through 
libva: http://lists.freedesktop.org/archives/libva/2012-May/000845.html 
(YUYV--NV12/YV12 are supported) 
3.2) if Weston want to support YUYV internally, it can depend on 
libva's color conversion or some special shader to do it. 

From 5356270a25a300bbe7e0d36a79b031d2fb108a88 Mon Sep 17 00:00:00 2001
From: Zhao halley halley.z...@intel.com
Date: Fri, 25 May 2012 11:36:48 +0800
Subject: [PATCH 2/7] mesa intel driver:

 add YUYV format for dri image
 YUYV image doesn't use for texture
---
 src/mesa/drivers/dri/intel/intel_screen.c|5 +
 src/mesa/drivers/dri/intel/intel_tex_image.c |6 ++
 2 files changed, 11 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_screen.c
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_tex_image.c

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
old mode 100644
new mode 100755
index 458178f..b8d44ba
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -216,6 +216,11 @@ intel_create_image_from_name(__DRIscreen *screen,
image-internal_format = GL_RGB;
image-data_type = GL_UNSIGNED_BYTE;
break;
+case __DRI_IMAGE_FORMAT_YUYV:
+   image-format = MESA_FORMAT_YCBCR;
+   image-internal_format = GL_LUMINANCE;
+   image-data_type = GL_UNSIGNED_BYTE;
+  break;
 default:
free(image);
return NULL;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c 
b/src/mesa/drivers/dri/intel/intel_tex_image.c
old mode 100644
new mode 100755
index 094d3cd..8b94cb1
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -388,6 +388,12 @@ intel_image_target_texture_2d(struct gl_context *ctx, 
GLenum target,
if (image == NULL)
   return;
 
+   if (image-format == MESA_FORMAT_YCBCR) {
+  _mesa_error(intel-ctx,
+ GL_INVALID_OPERATION, glEGLImageTargetTexture2DOES, attach 
YUYV region to texture is not supported);
+  return;
+}
+
intel_set_texture_image_region(ctx, texImage, image-region,
  target, image-internal_format, 
image-format);
 }
-- 
1.7.5.4

 -Original Message-
 From: Eric Anholt [mailto:e...@anholt.net]
 Sent: Saturday, June 02, 2012 5:33 AM
 To: Zhao, Halley; mesa-dev@lists.freedesktop.org
 Cc: Barnes, Jesse; Zhao, Halley
 Subject: Re: [PATCH 2/6] mesa intel driver:
 
 On Thu, 31 May 2012 17:23:59 +0800, Zhao halley halley.z...@intel.com
 wrote:
   add YUYV format for dri image
   YUYV image doesn't use for texture
  ---
   src/mesa/drivers/dri/intel/intel_screen.c|5 +
   src/mesa/drivers/dri/intel/intel_tex_image.c |3 +++
   2 files changed, 8 insertions(+), 0 deletions(-)  mode change 100644
  = 100755 src/mesa/drivers/dri/intel/intel_screen.c
   mode change 100644 = 100755
  src/mesa/drivers/dri/intel/intel_tex_image.c
 
  diff --git a/src/mesa/drivers/dri/intel/intel_screen.c
  b/src/mesa/drivers/dri/intel/intel_screen.c
  old mode 100644
  new mode 100755
  index 458178f..5ff2e49
  --- a/src/mesa/drivers/dri/intel/intel_screen.c
  +++ b/src/mesa/drivers/dri/intel/intel_screen.c
  @@ -216,6 +216,11 @@ intel_create_image_from_name(__DRIscreen
 *screen,
  image-internal_format = GL_RGB;
  image-data_type = GL_UNSIGNED_BYTE;
  break;
  +case __DRI_IMAGE_FORMAT_YUYV:
  +   image-format = MESA_FORMAT_YCBCR; //  no detailed
 YUV format in mesa yet
  +   image-internal_format = GL_LUMINANCE; //  no detailed
 YUV format in gles2 yet
  +   image-data_type = GL_UNSIGNED_BYTE;
  +  break;
   default:
  free(image);
  return NULL;
 
 I don't like seeing these XXXs added that suggest that this commit isn't 
 ready.
 
  diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c
  b/src/mesa/drivers/dri/intel/intel_tex_image.c old mode 100644 new
  mode 100755 index 094d3cd..e5c3bdc ---
  a/src/mesa/drivers/dri/intel/intel_tex_image.c +++
  b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -388,6 +388,9

[Mesa-dev] [PATCH 0/6] add YUYV format for dri image support

2012-05-31 Thread Zhao halley
Intel SNB/IVB platform supports rendering YUYV buffer to overlay plane,
however YUYV is missing support from mesa/dri-image yet.
so I go ahead to add it; basing on it, libva can send YUYV buffer directly
to wayland/weston, then weston output it to overlay plane.

I notice that there are some patches from Gwenole for YUV planar texture 
support. these patches have little to do with that. because:
YUYV is packed format, it doesn't require additional attribute like 
   buffer layout (introduced by Gwenole)
YUYV is introduced for overlay support, no shaders for texture is required.

Zhao halley (6):
  GL: add YUYV to dri image format
  mesa intel driver:
  egl wayland: add YUYV support
  gallium egl wayland: add YUYV support
  gbm dri backend: add YUYV support
  wayland-drm: add YUYV support

 include/GL/internal/dri_interface.h|1 +
 src/egl/drivers/dri2/egl_dri2.c|   17 ++---
 src/egl/drivers/dri2/platform_wayland.c|8 +++-
 src/egl/wayland/wayland-drm/wayland-drm.c  |1 +
 .../state_trackers/egl/wayland/native_drm.c|3 +++
 .../state_trackers/egl/wayland/native_wayland.h|3 ++-
 src/gbm/backends/dri/gbm_dri.c |3 +++
 src/mesa/drivers/dri/intel/intel_screen.c  |5 +
 src/mesa/drivers/dri/intel/intel_tex_image.c   |3 +++
 9 files changed, 39 insertions(+), 5 deletions(-)
 mode change 100644 = 100755 include/GL/internal/dri_interface.h
 mode change 100644 = 100755 src/egl/drivers/dri2/egl_dri2.c
 mode change 100644 = 100755 src/egl/drivers/dri2/platform_wayland.c
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/wayland-drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_wayland.h
 mode change 100644 = 100755 src/gbm/backends/dri/gbm_dri.c
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_screen.c
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_tex_image.c

-- 
1.7.5.4

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


[Mesa-dev] [PATCH 1/6] GL: add YUYV to dri image format

2012-05-31 Thread Zhao halley
---
 include/GL/internal/dri_interface.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 include/GL/internal/dri_interface.h

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
old mode 100644
new mode 100755
index e37917e..5e325cf
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -907,6 +907,7 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_FORMAT_ARGB 0x1003
 #define __DRI_IMAGE_FORMAT_ABGR 0x1004
 #define __DRI_IMAGE_FORMAT_XBGR 0x1005
+#define __DRI_IMAGE_FORMAT_YUYV 0x1006
 
 #define __DRI_IMAGE_USE_SHARE  0x0001
 #define __DRI_IMAGE_USE_SCANOUT0x0002
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 2/6] mesa intel driver:

2012-05-31 Thread Zhao halley
 add YUYV format for dri image
 YUYV image doesn't use for texture
---
 src/mesa/drivers/dri/intel/intel_screen.c|5 +
 src/mesa/drivers/dri/intel/intel_tex_image.c |3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_screen.c
 mode change 100644 = 100755 src/mesa/drivers/dri/intel/intel_tex_image.c

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
old mode 100644
new mode 100755
index 458178f..5ff2e49
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -216,6 +216,11 @@ intel_create_image_from_name(__DRIscreen *screen,
image-internal_format = GL_RGB;
image-data_type = GL_UNSIGNED_BYTE;
break;
+case __DRI_IMAGE_FORMAT_YUYV:
+   image-format = MESA_FORMAT_YCBCR; //  no detailed YUV format 
in mesa yet
+   image-internal_format = GL_LUMINANCE; //  no detailed YUV format 
in gles2 yet
+   image-data_type = GL_UNSIGNED_BYTE;
+  break;
 default:
free(image);
return NULL;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c 
b/src/mesa/drivers/dri/intel/intel_tex_image.c
old mode 100644
new mode 100755
index 094d3cd..e5c3bdc
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -388,6 +388,9 @@ intel_image_target_texture_2d(struct gl_context *ctx, 
GLenum target,
if (image == NULL)
   return;
 
+   if (image-format == MESA_FORMAT_YCBCR)
+return;
+
intel_set_texture_image_region(ctx, texImage, image-region,
  target, image-internal_format, 
image-format);
 }
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 3/6] egl wayland: add YUYV support

2012-05-31 Thread Zhao halley
---
 src/egl/drivers/dri2/egl_dri2.c |   17 ++---
 src/egl/drivers/dri2/platform_wayland.c |8 +++-
 2 files changed, 21 insertions(+), 4 deletions(-)
 mode change 100644 = 100755 src/egl/drivers/dri2/egl_dri2.c
 mode change 100644 = 100755 src/egl/drivers/dri2/platform_wayland.c

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
old mode 100644
new mode 100755
index 4a02838..a058046
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1096,9 +1096,15 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, 
_EGLContext *ctx,
switch (wayland_drm_buffer_get_format(buffer)) {
case WL_DRM_FORMAT_ARGB:
   format = __DRI_IMAGE_FORMAT_ARGB;
+  pitch = stride / 4;
   break;
case WL_DRM_FORMAT_XRGB:
   format = __DRI_IMAGE_FORMAT_XRGB;
+  pitch = stride / 4;
+  break;
+   case WL_DRM_FORMAT_YUYV:
+  format = __DRI_IMAGE_FORMAT_YUYV;
+  pitch = stride / 2;
   break;
default:
   _eglError(EGL_BAD_PARAMETER,
@@ -1106,8 +1112,6 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, 
_EGLContext *ctx,
   return NULL;
}
 
-   pitch = stride / 4;
-
return dri2_create_image_drm_name(disp, ctx, name, attrs, format, pitch);
 }
 #endif
@@ -1270,21 +1274,28 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
__DRIimage *image;
int dri_format;
+   int pitch = 0;
 
switch (format) {
case WL_DRM_FORMAT_ARGB:
   dri_format =__DRI_IMAGE_FORMAT_ARGB;
+  pitch = stride/4;
   break;
case WL_DRM_FORMAT_XRGB:
   dri_format = __DRI_IMAGE_FORMAT_XRGB;
+  pitch = stride/4;
   break;
+  case WL_DRM_FORMAT_YUYV:
+ dri_format = __DRI_IMAGE_FORMAT_YUYV;
+ pitch = stride/2;
+ break;
default:
   return NULL;
}
 
image = dri2_dpy-image-createImageFromName(dri2_dpy-dri_screen,
width, height, 
-   dri_format, name, stride / 4,
+   dri_format, name, pitch,
NULL);
 
return image;
diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
old mode 100644
new mode 100755
index d291f0f..6d330b7
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -42,7 +42,9 @@
 
 enum wl_drm_format_flags {
HAS_ARGB = 1,
-   HAS_XRGB = 2
+   HAS_XRGB = (1  1),
+   HAS_YUYV = (1  2)
+   
 };
 
 static void
@@ -778,6 +780,9 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t 
format)
case WL_DRM_FORMAT_XRGB:
   dri2_dpy-formats |= HAS_XRGB;
   break;
+   case WL_DRM_FORMAT_YUYV:
+  dri2_dpy-formats |= HAS_YUYV;
+  break;
}
 }
 
@@ -878,6 +883,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
 dri2_add_config(disp, config, i + 1, 0, types, NULL, rgb_masks);
   if (dri2_dpy-formats  HAS_ARGB)
 dri2_add_config(disp, config, i + 1, 0, types, NULL, argb_masks);
+  // , should we do something for YUYV here?
}
 
disp-Extensions.KHR_image_pixmap = EGL_TRUE;
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 4/6] gallium egl wayland: add YUYV support

2012-05-31 Thread Zhao halley
---
 .../state_trackers/egl/wayland/native_drm.c|3 +++
 .../state_trackers/egl/wayland/native_wayland.h|3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_drm.c
 mode change 100644 = 100755 
src/gallium/state_trackers/egl/wayland/native_wayland.h

diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c 
b/src/gallium/state_trackers/egl/wayland/native_drm.c
old mode 100644
new mode 100755
index e3bd628..f2d2e74
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -164,6 +164,9 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t 
format)
case WL_DRM_FORMAT_XRGB:
   drmdpy-base.formats |= HAS_XRGB;
   break;
+  case WL_DRM_FORMAT_YUYV:
+ drmdpy-base.formats |= HAS_YUYV;
+ break;
}
 }
 
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.h 
b/src/gallium/state_trackers/egl/wayland/native_wayland.h
old mode 100644
new mode 100755
index e6a914f..bd26bf0
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.h
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.h
@@ -38,7 +38,8 @@ struct wayland_surface;
 
 enum wayland_format_flag {
HAS_ARGB= (1  0),
-   HAS_XRGB= (1  1)
+   HAS_XRGB= (1  1),
+   HAS_YUYV= (1  2)
 };
 
 struct wayland_display {
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 5/6] gbm dri backend: add YUYV support

2012-05-31 Thread Zhao halley
---
 src/gbm/backends/dri/gbm_dri.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/gbm/backends/dri/gbm_dri.c

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
old mode 100644
new mode 100755
index e5ddfb6..cefcc1a
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -331,6 +331,9 @@ gbm_dri_to_gbm_format(uint32_t dri_format)
case __DRI_IMAGE_FORMAT_ABGR:
   ret = GBM_FORMAT_ABGR;
   break;
+  case __DRI_IMAGE_FORMAT_YUYV:
+ ret = GBM_FORMAT_YUYV;
+ break;
default:
   ret = 0;
   break;
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 6/6] wayland-drm: add YUYV support

2012-05-31 Thread Zhao halley
---
 src/egl/wayland/wayland-drm/wayland-drm.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 src/egl/wayland/wayland-drm/wayland-drm.c

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c 
b/src/egl/wayland/wayland-drm/wayland-drm.c
old mode 100644
new mode 100755
index 5f831b3..eea3610
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -111,6 +111,7 @@ drm_create_buffer(struct wl_client *client, struct 
wl_resource *resource,
switch (format) {
case WL_DRM_FORMAT_ARGB:
case WL_DRM_FORMAT_XRGB:
+case WL_DRM_FORMAT_YUYV:
break;
default:
wl_resource_post_error(resource,
-- 
1.7.5.4

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


Re: [Mesa-dev] [Patch 1/4] Improve wayland-drm basing on gbm to act as generic buffer manager for wayland

2012-04-23 Thread Zhao, Halley
Thanks Gwenole, your comments are helpful.
I did the following changes:
 - replace wayland_gbm_ to wl_gbm_ 
 - replace gbm_bo_create_from_handle to gbm_bo_create_from_native_handle with 
gbm_bo_handle as parameter 
patches are updated to the mail list.

as to mark wl_drm interface as deprecated
I haven't found any client uses wl_drm interface yet (except inside mesa), 
vaapi is the first one trying to use it :)
So I think it is safe to remove wayland-drm, do you agree?


 -Original Message-
 From: Gwenole Beauchesne [mailto:gb.de...@gmail.com]
 Sent: Monday, April 23, 2012 1:48 PM
 To: Zhao, Halley
 Cc: Benjamin Franzke; Kristian H?gsberg; Fu, Michael;
 mesa-dev@lists.freedesktop.org
 Subject: Re: [Mesa-dev] [Patch 1/4] Improve wayland-drm basing on gbm to act
 as generic buffer manager for wayland
 
 Hi Halley,
 
 2012/4/23 Zhao, Halley halley.z...@intel.com:
 
  Could you give us some comments on this new proposal by using gbm?
 
 It seems your patches 3/4 and 4/4 did not reach the list, according the 
 archives.
 Could you please repost them?
 
 Moving wayland-*.xml to Weston is a bad idea IMHO. Other compositors could
 also use the same interface. I believe the following could be done instead:
 
 1. Mark wl_drm interfaces as deprecated at the linker level, for mesa
 next-release. Then, remove it for next.next-release or next^3-release.
 
 2. Create a new wl_gbm interface (and directory), derived from the current
 wayland-drm/. I think gbm/frontends/wayland/ could be appropriate for it.
 Exported prefix for this API would be wl_gbm_ and not wayland_gbm_, in order
 to align with naming conventions for e.g.
 wl_shm buffer interface.
   
 Prerequisite for (2) would be the addition of a
 gbm_bo_create_from_native_handle() API + vfunc? You almost had it in your
 former patch 2/3. A gbm_bo_handle arg would be better IMHO.
 
 Regards,
 Gwenole.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Patch 1/4] Improve wayland-drm basing on gbm to act as generic buffer manager for wayland

2012-04-22 Thread Zhao, Halley
Hi Benjamin/Kristian:
Sorry to push, but vaapi/wayland integration is blocked by wayland-drm for 
months.
Could you give us some comments on this new proposal by using gbm?

Thanks.



From: Zhao, Halley
Sent: Thursday, April 19, 2012 6:15 PM
To: Zhao, Halley; 'Benjamin Franzke'; 'Kristian H?gsberg'
Cc: Fu, Michael; Zou, Nanhai; mesa-dev@lists.freedesktop.org
Subject: [Patch 1/4] Improve wayland-drm basing on gbm to act as generic buffer 
manager for wayland

(resend, the patch is blocked since it is big)

Hi bnf/krh:
EGL implements wayland-drm protocol, however, it hasn't been used by vappi yet 
since EGL doesn't export wl_drm(you think it is bad style).
After some thought, I improve wayland-drm to base on gbm instead.
The module name can change to wayland-gbm as well, gbm is platform independent, 
do you think it's ok to export wl_gbm through libEGL?

Todo: change file names from *_drm* to *_gbm*
Additional proposal: could we move wayland-drm.xml from mesa/egl to Weston? I 
think Weston is the better place to define protocol, while egl is one backend 
to implement it.

First half of patch 1 since it is a little big
This patch is just term change from drm to gbm in source files.

From 04aba58c8e942abb373e356e684d96b9c5de5dbf Mon Sep 17 00:00:00 2001
From: Halley Zhao halley.z...@intel.commailto:halley.z...@intel.com
Date: Thu, 19 Apr 2012 16:33:21 +0800
Subject: [PATCH 1/3] change drm term to gbm

---
src/egl/drivers/dri2/egl_dri2.c|   34 +++---
src/egl/drivers/dri2/egl_dri2.h|6 +-
src/egl/drivers/dri2/platform_wayland.c|   72 +++---
.../wayland/wayland-drm/protocol/wayland-drm.xml   |8 +-
src/egl/wayland/wayland-drm/wayland-drm.c  |  110 ++--
src/egl/wayland/wayland-drm/wayland-drm.h  |   22 ++--
.../egl/common/native_wayland_drm_bufmgr_helper.c  |   12 +-
.../egl/common/native_wayland_drm_bufmgr_helper.h  |   12 +-
src/gallium/state_trackers/egl/drm/native_drm.c|   22 ++--
src/gallium/state_trackers/egl/drm/native_drm.h|2 +-
.../state_trackers/egl/wayland/native_drm.c|   66 ++--
src/gallium/state_trackers/egl/x11/native_dri2.c   |   24 ++--
12 files changed, 195 insertions(+), 195 deletions(-)
mode change 100644 = 100755 
src/egl/wayland/wayland-drm/protocol/wayland-drm.xml
mode change 100644 = 100755 src/egl/wayland/wayland-drm/wayland-drm.h
mode change 100644 = 100755 src/gallium/state_trackers/egl/wayland/native_drm.c
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Patch 2/4] Improve wayland-drm basing on gbm to act as generic buffer manager for wayland

2012-04-19 Thread Zhao, Halley
Send half of the first patch.
This patch is just term change from drm to gbm in source files.

By the way:
I still got the message of Message body is too big: 164397 bytes with a limit 
of 128 KB, though the total size of my patch is 38K.
Anyway, try to send it first.


diff --git a/src/gallium/state_trackers/egl/drm/native_drm.h 
b/src/gallium/state_trackers/egl/drm/native_drm.h
index 18cebf4..2ef98db 100644
--- a/src/gallium/state_trackers/egl/drm/native_drm.h
+++ b/src/gallium/state_trackers/egl/drm/native_drm.h
@@ -70,7 +70,7 @@ struct drm_display {
struct drm_crtc *saved_crtcs;
 #ifdef HAVE_WAYLAND_BACKEND
-   struct wl_drm *wl_server_drm; /* for EGL_WL_bind_wayland_display */
+   struct wl_gbm *wl_server_gbm; /* for EGL_WL_bind_wayland_display */
#endif
};
diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c 
b/src/gallium/state_trackers/egl/wayland/native_drm.c
old mode 100644
new mode 100755
index e3bd628..6b011ce
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -53,8 +53,8 @@ struct wayland_drm_display {
const struct native_event_handler *event_handler;
-   struct wl_drm *wl_drm;
-   struct wl_drm *wl_server_drm; /* for EGL_WL_bind_wayland_display */
+   struct wl_gbm *wl_gbm;
+   struct wl_gbm *wl_server_gbm; /* for EGL_WL_bind_wayland_display */
int fd;
char *device_name;
boolean authenticated;
@@ -73,8 +73,8 @@ wayland_drm_display_destroy(struct native_display *ndpy)
if (drmdpy-fd)
   close(drmdpy-fd);
-   if (drmdpy-wl_drm)
-  wl_drm_destroy(drmdpy-wl_drm);
+   if (drmdpy-wl_gbm)
+  wl_gbm_destroy(drmdpy-wl_gbm);
if (drmdpy-device_name)
  FREE(drmdpy-device_name);
if (drmdpy-base.configs)
@@ -97,7 +97,7 @@ wayland_create_drm_buffer(struct wayland_display *display,
struct pipe_resource *resource;
struct winsys_handle wsh;
uint width, height;
-   enum wl_drm_format format;
+   enum wl_gbm_format format;
resource = resource_surface_get_single_resource(surface-rsurf, attachment);
resource_surface_get_size(surface-rsurf, width, height);
@@ -109,22 +109,22 @@ wayland_create_drm_buffer(struct wayland_display *display,
switch (surface-color_format) {
case PIPE_FORMAT_B8G8R8A8_UNORM:
-  format = WL_DRM_FORMAT_ARGB;
+  format = WL_GBM_FORMAT_ARGB;
   break;
case PIPE_FORMAT_B8G8R8X8_UNORM:
-  format = WL_DRM_FORMAT_XRGB;
+  format = WL_GBM_FORMAT_XRGB;
   break;
default:
   return NULL;
   break;
}
-   return wl_drm_create_buffer(drmdpy-wl_drm, wsh.handle,
+   return wl_gbm_create_buffer(drmdpy-wl_gbm, wsh.handle,
width, height, wsh.stride, format);
}
 static void
-drm_handle_device(void *data, struct wl_drm *drm, const char *device)
+drm_handle_device(void *data, struct wl_gbm *drm, const char *device)
{
struct wayland_drm_display *drmdpy = data;
drm_magic_t magic;
@@ -149,33 +149,33 @@ drm_handle_device(void *data, struct wl_drm *drm, const 
char *device)
}
drmGetMagic(drmdpy-fd, magic);
-   wl_drm_authenticate(drmdpy-wl_drm, magic);
+   wl_gbm_authenticate(drmdpy-wl_gbm, magic);
}
 static void
-drm_handle_format(void *data, struct wl_drm *drm, uint32_t format)
+drm_handle_format(void *data, struct wl_gbm *drm, uint32_t format)
{
struct wayland_drm_display *drmdpy = data;
switch (format) {
-   case WL_DRM_FORMAT_ARGB:
+   case WL_GBM_FORMAT_ARGB:
   drmdpy-base.formats |= HAS_ARGB;
   break;
-   case WL_DRM_FORMAT_XRGB:
+   case WL_GBM_FORMAT_XRGB:
   drmdpy-base.formats |= HAS_XRGB;
   break;
}
}
 static void
-drm_handle_authenticated(void *data, struct wl_drm *drm)
+drm_handle_authenticated(void *data, struct wl_gbm *drm)
{
struct wayland_drm_display *drmdpy = data;
drmdpy-authenticated = true;
}
-static const struct wl_drm_listener drm_listener = {
+static const struct wl_gbm_listener drm_listener = {
drm_handle_device,
drm_handle_format,
drm_handle_authenticated
@@ -187,18 +187,18 @@ wayland_drm_display_init_screen(struct native_display 
*ndpy)
struct wayland_drm_display *drmdpy = wayland_drm_display(ndpy);
uint32_t id;
-   id = wl_display_get_global(drmdpy-base.dpy, wl_drm, 1);
+   id = wl_display_get_global(drmdpy-base.dpy, wl_gbm, 1);
if (id == 0)
   wl_display_roundtrip(drmdpy-base.dpy);
-   id = wl_display_get_global(drmdpy-base.dpy, wl_drm, 1);
+   id = wl_display_get_global(drmdpy-base.dpy, wl_gbm, 1);
if (id == 0)
   return FALSE;
-   drmdpy-wl_drm = wl_display_bind(drmdpy-base.dpy, id, wl_drm_interface);
-   if (!drmdpy-wl_drm)
+   drmdpy-wl_gbm = wl_display_bind(drmdpy-base.dpy, id, wl_gbm_interface);
+   if (!drmdpy-wl_gbm)
   return FALSE;
-   wl_drm_add_listener(drmdpy-wl_drm, drm_listener, drmdpy);
+   wl_gbm_add_listener(drmdpy-wl_gbm, drm_listener, drmdpy);
wl_display_roundtrip(drmdpy-base.dpy);
if (drmdpy-fd == 

[Mesa-dev] [Patch 4/4] Improve wayland-drm basing on gbm to act as generic buffer manager for wayland

2012-04-19 Thread Zhao, Halley
Wayland-drm depends on callback functions of backend to create/destroy 
wl_buffer before, remove them now.


From a1bbad6760af4d1c5237a2318a2e5f6f91a823fa Mon Sep 17 00:00:00 2001
From: Halley Zhao halley.z...@intel.com
Date: Thu, 19 Apr 2012 17:35:27 +0800
Subject: [PATCH 3/3] remove previous craete/release_buffer implementation
from dri

---
src/egl/drivers/dri2/egl_dri2.c|   42 -
src/egl/wayland/wayland-drm/wayland-drm.h  |6 ---
.../egl/common/native_wayland_drm_bufmgr_helper.c  |   48 
.../egl/common/native_wayland_drm_bufmgr_helper.h  |9 
src/gallium/state_trackers/egl/drm/native_drm.c|2 -
.../state_trackers/egl/wayland/native_drm.c|2 -
src/gallium/state_trackers/egl/x11/native_dri2.c   |2 -
7 files changed, 0 insertions(+), 111 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index c6de687..98d4f42 100755
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1260,50 +1260,8 @@ dri2_export_drm_image_mesa(_EGLDriver *drv, _EGLDisplay 
*disp, _EGLImage *img,
}
 #ifdef HAVE_WAYLAND_PLATFORM
-
-static void *
-dri2_wl_reference_buffer(void *user_data, uint32_t name,
-  int32_t width, int32_t height,
-  uint32_t stride, uint32_t format)
-{
-   _EGLDisplay *disp = user_data;
-   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
-   __DRIimage *image;
-   int dri_format;
-
-   switch (format) {
-   case WL_GBM_FORMAT_ARGB:
-  dri_format =__DRI_IMAGE_FORMAT_ARGB;
-  break;
-   case WL_GBM_FORMAT_XRGB:
-  dri_format = __DRI_IMAGE_FORMAT_XRGB;
-  break;
-   default:
-  return NULL;
-   }
-
-   image = dri2_dpy-image-createImageFromName(dri2_dpy-dri_screen,
-   
   width, height,
-   
   dri_format, name, stride / 4,
-   
   NULL);
-
-   return image;
-}
-
-static void
-dri2_wl_release_buffer(void *user_data, void *buffer)
-{
-   _EGLDisplay *disp = user_data;
-   __DRIimage *image = buffer;
-   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
-
-   dri2_dpy-image-destroyImage(image);
-}
-
static struct wayland_gbm_callbacks wl_gbm_callbacks = {
   .authenticate = NULL,
-  .reference_buffer = dri2_wl_reference_buffer,
-  .release_buffer = dri2_wl_release_buffer
};
 static EGLBoolean
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.h 
b/src/egl/wayland/wayland-drm/wayland-drm.h
index 0904245..8bcd5aa 100755
--- a/src/egl/wayland/wayland-drm/wayland-drm.h
+++ b/src/egl/wayland/wayland-drm/wayland-drm.h
@@ -8,12 +8,6 @@ struct wl_gbm;
 struct wayland_gbm_callbacks {
   int (*authenticate)(void *user_data, uint32_t id);
-
-  void *(*reference_buffer)(void *user_data, uint32_t name,
-int32_t width, 
int32_t height,
-uint32_t 
stride, uint32_t format);
-
-  void (*release_buffer)(void *user_data, void *buffer);
};
 struct wl_gbm *
diff --git 
a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c 
b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
index d35cf47..e7f963f 100644
--- a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
+++ b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
@@ -12,54 +12,6 @@
 #include native_wayland_drm_bufmgr_helper.h
-void *
-egl_g3d_wl_gbm_helper_reference_buffer(void *user_data, uint32_t name,
-   int32_t width, int32_t height,
-   uint32_t stride, uint32_t format)
-{
-   struct native_display *ndpy = user_data;
-   struct pipe_resource templ;
-   struct winsys_handle wsh;
-   enum pipe_format pf;
-
-   switch (format) {
-   case WL_GBM_FORMAT_ARGB:
-  pf = PIPE_FORMAT_B8G8R8A8_UNORM;
-  break;
-   case WL_GBM_FORMAT_XRGB:
-  pf = PIPE_FORMAT_B8G8R8X8_UNORM;
-  break;
-   default:
-  pf = PIPE_FORMAT_NONE;
-  break;
-   }
-
-   if (pf == PIPE_FORMAT_NONE)
-  return NULL;
-
-   memset(templ, 0, sizeof(templ));
-   templ.target = PIPE_TEXTURE_2D;
-   templ.format = pf;
-   templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
-   templ.width0 = width;
-   templ.height0 = height;
-   templ.depth0 = 1;
-   templ.array_size = 1;
-
-   memset(wsh, 0, sizeof(wsh));
-   wsh.handle = name;
-   wsh.stride = stride;
-
-   return ndpy-screen-resource_from_handle(ndpy-screen, templ, wsh);
-}
-
-void

[Mesa-dev] [PATCH 1] wayland-egl: Add api to get window/pixmap attributes (enable libva over wayland)

2012-02-22 Thread Zhao, Halley
Resend the patch, it is required to enable libva over wayland.

Ian/Eric:
Could you help to review this patch?

== patch description ==:
wl_egl_window/wl_egl_pixmap are implemented in mesa, however these drawables 
can also be update in video/camera modules.
An example is that libva also manage buffer object for it, so the attributes of 
the drawable should be accessed outside of mesa.
With this patch, we can remove the hack to copy wayland-egl-priv.h from mesa to 
libva.

Libva related changes are here for your reference: 
https://gitorious.org/libva-wayland/libva-wayland/commits/wayland
It bases on Benjamin's work to enable libva for wayland: 
http://cgit.freedesktop.org/~bnf/libva/log/?h=wayland

== patch details ==:

src/egl/wayland/wayland-egl/wayland-egl.c |   29 +
1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/egl/wayland/wayland-egl/wayland-egl.c 
b/src/egl/wayland/wayland-egl/wayland-egl.c
index e950b4a..b7efab8 100644
--- a/src/egl/wayland/wayland-egl/wayland-egl.c
+++ b/src/egl/wayland/wayland-egl/wayland-egl.c
@@ -81,3 +81,32 @@ wl_egl_pixmap_create_buffer(struct wl_egl_pixmap *egl_pixmap)
{
   return egl_pixmap-buffer;
}
+
+WL_EGL_EXPORT void
+wl_egl_window_get_size(struct wl_egl_window *egl_window,
+   int *width, int *height)
+{
+   if (width)
+*width = egl_window-width;
+   if (height)
+*height = egl_window-height;
+}
+
+WL_EGL_EXPORT struct wl_surface*
+wl_egl_window_get_surface(struct wl_egl_window *win)
+{
+if (win)
+return win-surface;
+else
+return NULL;
+}
+
+WL_EGL_EXPORT void
+wl_egl_pixmap_get_size(struct wl_egl_pixmap *egl_pixmap,
+   int *width, int *height)
+{
+   if (width)
+*width = egl_pixmap-width;
+   if (height)
+*height = egl_pixmap-height;
+}
--
1.7.5.4
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Patch 2] wayland-drm: export wayland-drm-client-protocol.h for installation (enable libva over wayland)

2012-02-22 Thread Zhao, Halley
Resend the patch, it is required to enable libva over wayland.

== patch description ==
Besides graphics, other modules (like video/camera) also depends on drm for 
buffer management.
So wayland drm protocol header file should be installed.

Libva related changes are here for your reference: 
https://gitorious.org/libva-wayland/libva-wayland/commits/wayland
It bases on Benjamin's work to enable libva for wayland: 
http://cgit.freedesktop.org/~bnf/libva/log/?h=wayland

With this patch, we can avoid the hack to copy wayland-drm.xml from mesa to 
libva.

== patch details ==
src/egl/wayland/wayland-drm/Makefile.am |3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/egl/wayland/wayland-drm/Makefile.am 
b/src/egl/wayland/wayland-drm/Makefile.am
index cf15eda..2e68ac4 100644
--- a/src/egl/wayland/wayland-drm/Makefile.am
+++ b/src/egl/wayland/wayland-drm/Makefile.am
@@ -7,8 +7,9 @@ noinst_LTLIBRARIES = libwayland-drm.la
libwayland_drm_la_SOURCES = wayland-drm.c wayland-drm-protocol.c
noinst_HEADERS = wayland-drm.h

+include_HEADERS = wayland-drm-client-protocol.h
+
BUILT_SOURCES = wayland-drm-protocol.c \
- wayland-drm-client-protocol.h \
   wayland-drm-server-protocol.h
CLEANFILES = $(BUILT_SOURCES)

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


Re: [Mesa-dev] [PATCH 1] wayland-egl: Add api to get window/pixmap attributes

2012-02-20 Thread Zhao, Halley
Hi Ian/Eric:
Could you help to review this patch?

Libva related changes are here for your reference: 
https://gitorious.org/libva-wayland/libva-wayland/commits/wayland


From: mesa-dev-bounces+halley.zhao=intel@lists.freedesktop.org 
[mailto:mesa-dev-bounces+halley.zhao=intel@lists.freedesktop.org] On Behalf 
Of Zhao, Halley
Sent: Friday, February 17, 2012 5:22 PM
To: mesa-dev@lists.freedesktop.org
Subject: [Mesa-dev] [PATCH 1] wayland-egl: Add api to get window/pixmap 
attributes

wl_egl_window/wl_egl_pixmap are implemented in mesa, however these drawables 
can also be update in video/camera modules.
An example is that libva also manage buffer object for it, so the attributes of 
the drawable should be accessed outside of mesa.
See Benjamin's work to enable libva for wayland: 
http://cgit.freedesktop.org/~bnf/libva/log/?h=wayland (I ported it to latest 
wayland api).

With this patch, we can remove the hack to copy wayland-egl-priv.h from mesa to 
libva.

src/egl/wayland/wayland-egl/wayland-egl.c |   29 +
1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/egl/wayland/wayland-egl/wayland-egl.c 
b/src/egl/wayland/wayland-egl/wayland-egl.c
index e950b4a..b7efab8 100644
--- a/src/egl/wayland/wayland-egl/wayland-egl.c
+++ b/src/egl/wayland/wayland-egl/wayland-egl.c
@@ -81,3 +81,32 @@ wl_egl_pixmap_create_buffer(struct wl_egl_pixmap *egl_pixmap)
{
   return egl_pixmap-buffer;
}
+
+WL_EGL_EXPORT void
+wl_egl_window_get_size(struct wl_egl_window *egl_window,
+   int *width, int *height)
+{
+   if (width)
+*width = egl_window-width;
+   if (height)
+*height = egl_window-height;
+}
+
+WL_EGL_EXPORT struct wl_surface*
+wl_egl_window_get_surface(struct wl_egl_window *win)
+{
+if (win)
+return win-surface;
+else
+return NULL;
+}
+
+WL_EGL_EXPORT void
+wl_egl_pixmap_get_size(struct wl_egl_pixmap *egl_pixmap,
+   int *width, int *height)
+{
+   if (width)
+*width = egl_pixmap-width;
+   if (height)
+*height = egl_pixmap-height;
+}
--
1.7.5.4
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1] wayland-egl: Add api to get window/pixmap attributes

2012-02-17 Thread Zhao, Halley
wl_egl_window/wl_egl_pixmap are implemented in mesa, however these drawables 
can also be update in video/camera modules.
An example is that libva also manage buffer object for it, so the attributes of 
the drawable should be accessed outside of mesa.
See Benjamin's work to enable libva for wayland: 
http://cgit.freedesktop.org/~bnf/libva/log/?h=wayland (I ported it to latest 
wayland api).

With this patch, we can remove the hack to copy wayland-egl-priv.h from mesa to 
libva.

src/egl/wayland/wayland-egl/wayland-egl.c |   29 +
1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/egl/wayland/wayland-egl/wayland-egl.c 
b/src/egl/wayland/wayland-egl/wayland-egl.c
index e950b4a..b7efab8 100644
--- a/src/egl/wayland/wayland-egl/wayland-egl.c
+++ b/src/egl/wayland/wayland-egl/wayland-egl.c
@@ -81,3 +81,32 @@ wl_egl_pixmap_create_buffer(struct wl_egl_pixmap *egl_pixmap)
{
   return egl_pixmap-buffer;
}
+
+WL_EGL_EXPORT void
+wl_egl_window_get_size(struct wl_egl_window *egl_window,
+   int *width, int *height)
+{
+   if (width)
+*width = egl_window-width;
+   if (height)
+*height = egl_window-height;
+}
+
+WL_EGL_EXPORT struct wl_surface*
+wl_egl_window_get_surface(struct wl_egl_window *win)
+{
+if (win)
+return win-surface;
+else
+return NULL;
+}
+
+WL_EGL_EXPORT void
+wl_egl_pixmap_get_size(struct wl_egl_pixmap *egl_pixmap,
+   int *width, int *height)
+{
+   if (width)
+*width = egl_pixmap-width;
+   if (height)
+*height = egl_pixmap-height;
+}
--
1.7.5.4
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Patch 2] wayland-drm: export wayland-drm-client-protocol.h for installation

2012-02-17 Thread Zhao, Halley
Besides graphics, other modules (like video/camera) also depends on drm for 
buffer management.
So wayland drm protocol header file should be exported.
See Benjamin's work to enable libva for wayland: 
http://cgit.freedesktop.org/~bnf/libva/log/?h=wayland (I ported it to latest 
wayland api)

With this patch, we can avoid the hack to copy wayland-drm.xml from mesa to 
libva.

src/egl/wayland/wayland-drm/Makefile.am |3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/egl/wayland/wayland-drm/Makefile.am 
b/src/egl/wayland/wayland-drm/Makefile.am
index cf15eda..2e68ac4 100644
--- a/src/egl/wayland/wayland-drm/Makefile.am
+++ b/src/egl/wayland/wayland-drm/Makefile.am
@@ -7,8 +7,9 @@ noinst_LTLIBRARIES = libwayland-drm.la
libwayland_drm_la_SOURCES = wayland-drm.c wayland-drm-protocol.c
noinst_HEADERS = wayland-drm.h
+include_HEADERS = wayland-drm-client-protocol.h
+
BUILT_SOURCES = wayland-drm-protocol.c \
- wayland-drm-client-protocol.h \
wayland-drm-server-protocol.h
CLEANFILES = $(BUILT_SOURCES)
--
1.7.5.4
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev