Re: [Mesa-dev] [PATCH 05/18] egl/wayland: Add format enums to visual map

2018-02-14 Thread Emil Velikov
On 9 February 2018 at 16:02, Daniel Stone  wrote:
> Hi Emil,
>
> On 8 February 2018 at 21:56, Emil Velikov  wrote:
>> On 8 February 2018 at 14:05, Daniel Stone  wrote:
>>> Extend the visual map from only containing names and bitmasks, to also
>>> carrying the three format enums we need. These are the DRIImage format
>>> tokens for internal allocation, FourCC codes for wl_drm and dmabuf
>>> protocol, and wl_shm codes for swrast drivers.
>>>
>>> We will later use these formats to eliminate a bunch of open-coded
>>> conversions.
>>
>> At some point i was drawing some plans about making the (2?) odd
>> wl_shm format like their WL_DRM/DRI_IMAGE/drm_fourcc brethren.
>> Until (if even since it's fiddly) that happens having all the bits in
>> one place is a great step.
>
> That would be a protocol break for all software-rendered clients, so
> even though it would be really great, I just don't see it happening.
> Oh well.
>
I think it shouldn't break if we do something like the following:
 - wl_shm v2, introduces .format2 (deprecates .format)
 - update mesa to wl_registry_bind wl_shm v2 or later (as we do for dmabuf)
 - ???
 - profit

To avoid the crazy/partial DRM/SHM/DMABUF format enums, one could even:
 - throw a single formats enum, keeping some compat. defines
 - which the extensions to the new format - a no-op

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


Re: [Mesa-dev] [PATCH 05/18] egl/wayland: Add format enums to visual map

2018-02-09 Thread Daniel Stone
Hi Emil,

On 8 February 2018 at 21:56, Emil Velikov  wrote:
> On 8 February 2018 at 14:05, Daniel Stone  wrote:
>> Extend the visual map from only containing names and bitmasks, to also
>> carrying the three format enums we need. These are the DRIImage format
>> tokens for internal allocation, FourCC codes for wl_drm and dmabuf
>> protocol, and wl_shm codes for swrast drivers.
>>
>> We will later use these formats to eliminate a bunch of open-coded
>> conversions.
>
> At some point i was drawing some plans about making the (2?) odd
> wl_shm format like their WL_DRM/DRI_IMAGE/drm_fourcc brethren.
> Until (if even since it's fiddly) that happens having all the bits in
> one place is a great step.

That would be a protocol break for all software-rendered clients, so
even though it would be really great, I just don't see it happening.
Oh well.

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


Re: [Mesa-dev] [PATCH 05/18] egl/wayland: Add format enums to visual map

2018-02-08 Thread Emil Velikov
On 8 February 2018 at 14:05, Daniel Stone  wrote:
> Extend the visual map from only containing names and bitmasks, to also
> carrying the three format enums we need. These are the DRIImage format
> tokens for internal allocation, FourCC codes for wl_drm and dmabuf
> protocol, and wl_shm codes for swrast drivers.
>
> We will later use these formats to eliminate a bunch of open-coded
> conversions.
>
At some point i was drawing some plans about making the (2?) odd
wl_shm format like their WL_DRM/DRI_IMAGE/drm_fourcc brethren.
Until (if even since it's fiddly) that happens having all the bits in
one place is a great step.

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


[Mesa-dev] [PATCH 05/18] egl/wayland: Add format enums to visual map

2018-02-08 Thread Daniel Stone
Extend the visual map from only containing names and bitmasks, to also
carrying the three format enums we need. These are the DRIImage format
tokens for internal allocation, FourCC codes for wl_drm and dmabuf
protocol, and wl_shm codes for swrast drivers.

We will later use these formats to eliminate a bunch of open-coded
conversions.

Signed-off-by: Daniel Stone 
---
 src/egl/drivers/dri2/platform_wayland.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index fac66c8c2e2..d08664e87af 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -68,26 +68,39 @@ enum wl_drm_format_flags {
 static const struct {
const char *format_name;
enum wl_drm_format_flags has_format;
+   uint32_t wl_drm_format;
+   uint32_t wl_shm_format;
+   int dri_image_format;
unsigned int rgba_masks[4];
 } dri2_wl_visuals[] = {
{
  "XRGB2101010", HAS_XRGB2101010,
+ WL_DRM_FORMAT_XRGB2101010, WL_SHM_FORMAT_XRGB2101010,
+ __DRI_IMAGE_FORMAT_XRGB2101010,
  { 0x3ff0, 0x000ffc00, 0x03ff, 0x }
},
{
  "ARGB2101010", HAS_ARGB2101010,
+ WL_DRM_FORMAT_ARGB2101010, WL_SHM_FORMAT_ARGB2101010,
+ __DRI_IMAGE_FORMAT_ARGB2101010,
  { 0x3ff0, 0x000ffc00, 0x03ff, 0xc000 }
},
{
  "XRGB", HAS_XRGB,
+ WL_DRM_FORMAT_XRGB, WL_SHM_FORMAT_XRGB,
+ __DRI_IMAGE_FORMAT_XRGB,
  { 0x00ff, 0xff00, 0x00ff, 0x }
},
{
  "ARGB", HAS_ARGB,
+ WL_DRM_FORMAT_ARGB, WL_SHM_FORMAT_ARGB,
+ __DRI_IMAGE_FORMAT_ARGB,
  { 0x00ff, 0xff00, 0x00ff, 0xff00 }
},
{
  "RGB565", HAS_RGB565,
+ WL_DRM_FORMAT_RGB565, WL_SHM_FORMAT_RGB565,
+ __DRI_IMAGE_FORMAT_RGB565,
  { 0xf800, 0x07e0, 0x001f, 0x }
},
 };
-- 
2.14.3

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


[Mesa-dev] [PATCH 05/18] egl/wayland: Add format enums to visual map

2018-02-08 Thread Daniel Stone
Extend the visual map from only containing names and bitmasks, to also
carrying the three format enums we need. These are the DRIImage format
tokens for internal allocation, FourCC codes for wl_drm and dmabuf
protocol, and wl_shm codes for swrast drivers.

We will later use these formats to eliminate a bunch of open-coded
conversions.

Signed-off-by: Daniel Stone 
---
 src/egl/drivers/dri2/platform_wayland.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index fac66c8c2e2..d08664e87af 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -68,26 +68,39 @@ enum wl_drm_format_flags {
 static const struct {
const char *format_name;
enum wl_drm_format_flags has_format;
+   uint32_t wl_drm_format;
+   uint32_t wl_shm_format;
+   int dri_image_format;
unsigned int rgba_masks[4];
 } dri2_wl_visuals[] = {
{
  "XRGB2101010", HAS_XRGB2101010,
+ WL_DRM_FORMAT_XRGB2101010, WL_SHM_FORMAT_XRGB2101010,
+ __DRI_IMAGE_FORMAT_XRGB2101010,
  { 0x3ff0, 0x000ffc00, 0x03ff, 0x }
},
{
  "ARGB2101010", HAS_ARGB2101010,
+ WL_DRM_FORMAT_ARGB2101010, WL_SHM_FORMAT_ARGB2101010,
+ __DRI_IMAGE_FORMAT_ARGB2101010,
  { 0x3ff0, 0x000ffc00, 0x03ff, 0xc000 }
},
{
  "XRGB", HAS_XRGB,
+ WL_DRM_FORMAT_XRGB, WL_SHM_FORMAT_XRGB,
+ __DRI_IMAGE_FORMAT_XRGB,
  { 0x00ff, 0xff00, 0x00ff, 0x }
},
{
  "ARGB", HAS_ARGB,
+ WL_DRM_FORMAT_ARGB, WL_SHM_FORMAT_ARGB,
+ __DRI_IMAGE_FORMAT_ARGB,
  { 0x00ff, 0xff00, 0x00ff, 0xff00 }
},
{
  "RGB565", HAS_RGB565,
+ WL_DRM_FORMAT_RGB565, WL_SHM_FORMAT_RGB565,
+ __DRI_IMAGE_FORMAT_RGB565,
  { 0xf800, 0x07e0, 0x001f, 0x }
},
 };
-- 
2.14.3

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