Re: [Mesa-dev] [PATCH] dri3, i915, i965: Add __DRI_IMAGE_FOURCC_SARGB8888

2013-12-13 Thread Kenneth Graunke
On 11/21/2013 08:12 PM, Keith Packard wrote:
 The __DRIimage createImageFromFds function takes a fourcc code, but there was
 no fourcc code that match __DRI_IMAGE_FORMAT_SARGB8. This adds a define for
 that format, adds a translation in DRI3 from __DRI_IMAGE_FORMAT_SARGB8 to
 __DRI_IMAGE_FOURCC_SARGB and then adds translations *back* to
 __IMAGE_FORMAT_SARGB8 in both the i915 and i965 drivers.
 
 I'll refrain from comments on whether I think having two separate sets of
 format defines in dri_interface.h is a good idea or not...
 
 Signed-off-by: Keith Packard kei...@keithp.com
 ---
 
 This gets iceweasel running with the GL compositor enabled.

I see a huge discussion about this patch, but it's not obvious to me
whether there were actual concerns or just people asking questions.

I see that Eric reviewed it, and that it has not landed.  Are there any
objections to merging it?

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


Re: [Mesa-dev] [PATCH] dri3, i915, i965: Add __DRI_IMAGE_FOURCC_SARGB8888

2013-12-13 Thread Keith Packard
Kenneth Graunke kenn...@whitecape.org writes:

 I see that Eric reviewed it, and that it has not landed.  Are there any
 objections to merging it?

They're on top of a series of DRI3/Present patches, not all of which
have seen review. I was hoping the rest of that series would get
reviewed so that I could merge it all at the same time.

Eric also suggested that we change the switch statements using these
defines to catch unknown values and provide some better indication than
the silent failure I was experiencing.

-- 
keith.pack...@intel.com


pgphTFkN0Tfov.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] dri3, i915, i965: Add __DRI_IMAGE_FOURCC_SARGB8888

2013-11-25 Thread Eric Anholt
Keith Packard kei...@keithp.com writes:

 The __DRIimage createImageFromFds function takes a fourcc code, but there was
 no fourcc code that match __DRI_IMAGE_FORMAT_SARGB8. This adds a define for
 that format, adds a translation in DRI3 from __DRI_IMAGE_FORMAT_SARGB8 to
 __DRI_IMAGE_FOURCC_SARGB and then adds translations *back* to
 __IMAGE_FORMAT_SARGB8 in both the i915 and i965 drivers.

 I'll refrain from comments on whether I think having two separate sets of
 format defines in dri_interface.h is a good idea or not...

 Signed-off-by: Keith Packard kei...@keithp.com

Reviewed-by: Eric Anholt e...@anholt.net

I'd love to see some debug information in whatever path it was that was
silently failing, if we can.  It's so easy to miss places to add format
support.  (I see gallium doesn't use sargb images currently, but might
want this in the future, plus we're still missing an equivalent change
for 2101010 though I don't know if anybody's made it really work
anywhere on dri2 either)


pgptFrIzDGi1W.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] dri3, i915, i965: Add __DRI_IMAGE_FOURCC_SARGB8888

2013-11-22 Thread Daniel Vetter
On Thu, Nov 21, 2013 at 08:12:04PM -0800, Keith Packard wrote:
 The __DRIimage createImageFromFds function takes a fourcc code, but there was
 no fourcc code that match __DRI_IMAGE_FORMAT_SARGB8. This adds a define for
 that format, adds a translation in DRI3 from __DRI_IMAGE_FORMAT_SARGB8 to
 __DRI_IMAGE_FOURCC_SARGB and then adds translations *back* to
 __IMAGE_FORMAT_SARGB8 in both the i915 and i965 drivers.
 
 I'll refrain from comments on whether I think having two separate sets of
 format defines in dri_interface.h is a good idea or not...
 
 Signed-off-by: Keith Packard kei...@keithp.com

Hm, where do we have the canonical source for all these fourcc codes? I'm
asking since we have our own copy in the kernel as drm_fourcc.h, and that
one is part of the userspace ABI since we use it to pass around
framebuffer formats and format lists.

Just afraid to create long-term maintainance madness here with the
kernel's iron thou-shalt-not-break-userspace-ever rule ... Not likely
we'll ever accept srgb for framebuffers though.
-Daniel

 ---
 
 This gets iceweasel running with the GL compositor enabled.
 
  include/GL/internal/dri_interface.h  | 1 +
  src/glx/dri3_glx.c   | 1 +
  src/mesa/drivers/dri/i915/intel_screen.c | 3 +++
  src/mesa/drivers/dri/i965/intel_screen.c | 3 +++
  4 files changed, 8 insertions(+)
 
 diff --git a/include/GL/internal/dri_interface.h 
 b/include/GL/internal/dri_interface.h
 index b012570..a4387c4 100644
 --- a/include/GL/internal/dri_interface.h
 +++ b/include/GL/internal/dri_interface.h
 @@ -1034,6 +1034,7 @@ struct __DRIdri2ExtensionRec {
  #define __DRI_IMAGE_FOURCC_XRGB  0x34325258
  #define __DRI_IMAGE_FOURCC_ABGR  0x34324241
  #define __DRI_IMAGE_FOURCC_XBGR  0x34324258
 +#define __DRI_IMAGE_FOURCC_SARGB0x83324258
  #define __DRI_IMAGE_FOURCC_YUV4100x39565559
  #define __DRI_IMAGE_FOURCC_YUV4110x31315559
  #define __DRI_IMAGE_FOURCC_YUV4200x32315559
 diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
 index b047cc8..5861317 100644
 --- a/src/glx/dri3_glx.c
 +++ b/src/glx/dri3_glx.c
 @@ -890,6 +890,7 @@ image_format_to_fourcc(int format)
  
 /* Convert from __DRI_IMAGE_FORMAT to __DRI_IMAGE_FOURCC (sigh) */
 switch (format) {
 +   case __DRI_IMAGE_FORMAT_SARGB8: return __DRI_IMAGE_FOURCC_SARGB;
 case __DRI_IMAGE_FORMAT_RGB565: return __DRI_IMAGE_FOURCC_RGB565;
 case __DRI_IMAGE_FORMAT_XRGB: return __DRI_IMAGE_FOURCC_XRGB;
 case __DRI_IMAGE_FORMAT_ARGB: return __DRI_IMAGE_FOURCC_ARGB;
 diff --git a/src/mesa/drivers/dri/i915/intel_screen.c 
 b/src/mesa/drivers/dri/i915/intel_screen.c
 index 7f1fc6b..2dd2bc7 100644
 --- a/src/mesa/drivers/dri/i915/intel_screen.c
 +++ b/src/mesa/drivers/dri/i915/intel_screen.c
 @@ -184,6 +184,9 @@ static struct intel_image_format intel_image_formats[] = {
 { __DRI_IMAGE_FOURCC_ARGB, __DRI_IMAGE_COMPONENTS_RGBA, 1,
   { { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB, 4 } } },
  
 +   { __DRI_IMAGE_FOURCC_SARGB, __DRI_IMAGE_COMPONENTS_RGBA, 1,
 + { { 0, 0, 0, __DRI_IMAGE_FORMAT_SARGB8, 4 } } },
 +
 { __DRI_IMAGE_FOURCC_XRGB, __DRI_IMAGE_COMPONENTS_RGB, 1,
   { { 0, 0, 0, __DRI_IMAGE_FORMAT_XRGB, 4 }, } },
  
 diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
 b/src/mesa/drivers/dri/i965/intel_screen.c
 index e44d0f6..cf8c3e2 100644
 --- a/src/mesa/drivers/dri/i965/intel_screen.c
 +++ b/src/mesa/drivers/dri/i965/intel_screen.c
 @@ -220,6 +220,9 @@ static struct intel_image_format intel_image_formats[] = {
 { __DRI_IMAGE_FOURCC_ARGB, __DRI_IMAGE_COMPONENTS_RGBA, 1,
   { { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB, 4 } } },
  
 +   { __DRI_IMAGE_FOURCC_SARGB, __DRI_IMAGE_COMPONENTS_RGBA, 1,
 + { { 0, 0, 0, __DRI_IMAGE_FORMAT_SARGB8, 4 } } },
 +
 { __DRI_IMAGE_FOURCC_XRGB, __DRI_IMAGE_COMPONENTS_RGB, 1,
   { { 0, 0, 0, __DRI_IMAGE_FORMAT_XRGB, 4 }, } },
  
 -- 
 1.8.4.2
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] dri3, i915, i965: Add __DRI_IMAGE_FOURCC_SARGB8888

2013-11-22 Thread Keith Packard
Daniel Vetter dan...@ffwll.ch writes:

 Hm, where do we have the canonical source for all these fourcc codes? I'm
 asking since we have our own copy in the kernel as drm_fourcc.h, and that
 one is part of the userspace ABI since we use it to pass around
 framebuffer formats and format lists.

I think it's the kernel? I really don't know, as the whole notion of
fourcc codes seems crazy to me...

Feel free to steal this code and stick it in the kernel if you like.

 Just afraid to create long-term maintainance madness here with the
 kernel's iron thou-shalt-not-break-userspace-ever rule ... Not likely
 we'll ever accept srgb for framebuffers though.

Would suck to collide with something we do want though.

-- 
keith.pack...@intel.com


pgpf4F9vCQb7I.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] dri3, i915, i965: Add __DRI_IMAGE_FOURCC_SARGB8888

2013-11-22 Thread Daniel Vetter
On Fri, Nov 22, 2013 at 12:01 PM, Keith Packard kei...@keithp.com wrote:
 Daniel Vetter dan...@ffwll.ch writes:

 Hm, where do we have the canonical source for all these fourcc codes? I'm
 asking since we have our own copy in the kernel as drm_fourcc.h, and that
 one is part of the userspace ABI since we use it to pass around
 framebuffer formats and format lists.

 I think it's the kernel? I really don't know, as the whole notion of
 fourcc codes seems crazy to me...

 Feel free to steal this code and stick it in the kernel if you like.

Well, I wasn't ever in favour of using fourcc codes since they're just
not standardized at all, highly redundant in some cases and also miss
lots of stuff we actually need (like all the rgb formats).

Cc'ing the heck out of this to get kernel people to hopefully notice.
Maybe someone takes charge of this ... Otherwise meh.

 Just afraid to create long-term maintainance madness here with the
 kernel's iron thou-shalt-not-break-userspace-ever rule ... Not likely
 we'll ever accept srgb for framebuffers though.

 Would suck to collide with something we do want though.

Yeah, it'd suck. But given how fourcc works we probably have that
already, just haven't noticed yet :(
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] dri3, i915, i965: Add __DRI_IMAGE_FOURCC_SARGB8888

2013-11-22 Thread Ville Syrjälä
On Fri, Nov 22, 2013 at 05:17:37PM +0100, Daniel Vetter wrote:
 On Fri, Nov 22, 2013 at 12:01 PM, Keith Packard kei...@keithp.com wrote:
  Daniel Vetter dan...@ffwll.ch writes:
 
  Hm, where do we have the canonical source for all these fourcc codes? I'm
  asking since we have our own copy in the kernel as drm_fourcc.h, and that
  one is part of the userspace ABI since we use it to pass around
  framebuffer formats and format lists.
 
  I think it's the kernel? I really don't know, as the whole notion of
  fourcc codes seems crazy to me...
 
  Feel free to steal this code and stick it in the kernel if you like.
 
 Well, I wasn't ever in favour of using fourcc codes since they're just
 not standardized at all, highly redundant in some cases and also miss
 lots of stuff we actually need (like all the rgb formats).

I also argued against them, but some people wanted them for whatever
reason. And since I didn't want to argue for several years about the
subject, I just gave in and made the drm pixel formats fourcss. But
given that I just pulled the fourccs out of my ass, we can't really
cross use them between different subsystems anyway. So if we just
consider all the different fourcc namespaces totally distinct, we're
not going to have any problems.

Personally I can promise that I will _not_ be checking Mesa/whatever
code for conflicting fourccs when I need to add a new one to drm_fourcc.h.
There, now I've given fair warning and if things explode later it won't be
my fault.

However if someone wants to emulate the drm fourcc style for whatever
reason, there is a distinct pattern how I cooked them up. Well, a few
different patterns depending whether it's RGB,YUV,packed,planar etc.

 
 Cc'ing the heck out of this to get kernel people to hopefully notice.
 Maybe someone takes charge of this ... Otherwise meh.
 
  Just afraid to create long-term maintainance madness here with the
  kernel's iron thou-shalt-not-break-userspace-ever rule ... Not likely
  we'll ever accept srgb for framebuffers though.
 
  Would suck to collide with something we do want though.
 
 Yeah, it'd suck. But given how fourcc works we probably have that
 already, just haven't noticed yet :(
 -Daniel
 -- 
 Daniel Vetter
 Software Engineer, Intel Corporation
 +41 (0) 79 365 57 48 - http://blog.ffwll.ch
 ___
 dri-devel mailing list
 dri-de...@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] dri3, i915, i965: Add __DRI_IMAGE_FOURCC_SARGB8888

2013-11-21 Thread Keith Packard
The __DRIimage createImageFromFds function takes a fourcc code, but there was
no fourcc code that match __DRI_IMAGE_FORMAT_SARGB8. This adds a define for
that format, adds a translation in DRI3 from __DRI_IMAGE_FORMAT_SARGB8 to
__DRI_IMAGE_FOURCC_SARGB and then adds translations *back* to
__IMAGE_FORMAT_SARGB8 in both the i915 and i965 drivers.

I'll refrain from comments on whether I think having two separate sets of
format defines in dri_interface.h is a good idea or not...

Signed-off-by: Keith Packard kei...@keithp.com
---

This gets iceweasel running with the GL compositor enabled.

 include/GL/internal/dri_interface.h  | 1 +
 src/glx/dri3_glx.c   | 1 +
 src/mesa/drivers/dri/i915/intel_screen.c | 3 +++
 src/mesa/drivers/dri/i965/intel_screen.c | 3 +++
 4 files changed, 8 insertions(+)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index b012570..a4387c4 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1034,6 +1034,7 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_FOURCC_XRGB0x34325258
 #define __DRI_IMAGE_FOURCC_ABGR0x34324241
 #define __DRI_IMAGE_FOURCC_XBGR0x34324258
+#define __DRI_IMAGE_FOURCC_SARGB0x83324258
 #define __DRI_IMAGE_FOURCC_YUV410  0x39565559
 #define __DRI_IMAGE_FOURCC_YUV411  0x31315559
 #define __DRI_IMAGE_FOURCC_YUV420  0x32315559
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index b047cc8..5861317 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -890,6 +890,7 @@ image_format_to_fourcc(int format)
 
/* Convert from __DRI_IMAGE_FORMAT to __DRI_IMAGE_FOURCC (sigh) */
switch (format) {
+   case __DRI_IMAGE_FORMAT_SARGB8: return __DRI_IMAGE_FOURCC_SARGB;
case __DRI_IMAGE_FORMAT_RGB565: return __DRI_IMAGE_FOURCC_RGB565;
case __DRI_IMAGE_FORMAT_XRGB: return __DRI_IMAGE_FOURCC_XRGB;
case __DRI_IMAGE_FORMAT_ARGB: return __DRI_IMAGE_FOURCC_ARGB;
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c 
b/src/mesa/drivers/dri/i915/intel_screen.c
index 7f1fc6b..2dd2bc7 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -184,6 +184,9 @@ static struct intel_image_format intel_image_formats[] = {
{ __DRI_IMAGE_FOURCC_ARGB, __DRI_IMAGE_COMPONENTS_RGBA, 1,
  { { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB, 4 } } },
 
+   { __DRI_IMAGE_FOURCC_SARGB, __DRI_IMAGE_COMPONENTS_RGBA, 1,
+ { { 0, 0, 0, __DRI_IMAGE_FORMAT_SARGB8, 4 } } },
+
{ __DRI_IMAGE_FOURCC_XRGB, __DRI_IMAGE_COMPONENTS_RGB, 1,
  { { 0, 0, 0, __DRI_IMAGE_FORMAT_XRGB, 4 }, } },
 
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
b/src/mesa/drivers/dri/i965/intel_screen.c
index e44d0f6..cf8c3e2 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -220,6 +220,9 @@ static struct intel_image_format intel_image_formats[] = {
{ __DRI_IMAGE_FOURCC_ARGB, __DRI_IMAGE_COMPONENTS_RGBA, 1,
  { { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB, 4 } } },
 
+   { __DRI_IMAGE_FOURCC_SARGB, __DRI_IMAGE_COMPONENTS_RGBA, 1,
+ { { 0, 0, 0, __DRI_IMAGE_FORMAT_SARGB8, 4 } } },
+
{ __DRI_IMAGE_FOURCC_XRGB, __DRI_IMAGE_COMPONENTS_RGB, 1,
  { { 0, 0, 0, __DRI_IMAGE_FORMAT_XRGB, 4 }, } },
 
-- 
1.8.4.2

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