From 61e1720715598622318c7763f22f5d0e10fbca74 Mon Sep 17 00:00:00 2001
From: brendan King <Brendan.King@imgtec.com>
Date: Thu, 16 Sep 2021 17:46:28 +0100
Subject: [PATCH] mesa: partially revert pbuffer attribute removal

This partially reverts commit 5ffd1ebe6b3c8c7dd316dd47fac088044222e6ef
("mesa: Remove misc pbuffer attributes from struct gl_config").

The IMG PowerVR driver sets meaningful values for the maximum
pbuffer width, height and pixels.

---
 src/mesa/drivers/dri/common/utils.c | 7 ++++---
 src/mesa/main/mtypes.h              | 5 +++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index df5f8cb..28debe4 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -480,6 +480,7 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a,
     return all;
 }
 
+/* careful, lack of trailing semicolon */
 #define __ATTRIB(attrib, field) case attrib: *value = config->modes.field; break
 
 /**
@@ -555,9 +556,9 @@ driGetConfigAttribIndex(const __DRIconfig *config,
     __ATTRIB(__DRI_ATTRIB_GREEN_MASK,			greenMask);
     __ATTRIB(__DRI_ATTRIB_BLUE_MASK,			blueMask);
     __ATTRIB(__DRI_ATTRIB_ALPHA_MASK,			alphaMask);
-    case __DRI_ATTRIB_MAX_PBUFFER_WIDTH:
-    case __DRI_ATTRIB_MAX_PBUFFER_HEIGHT:
-    case __DRI_ATTRIB_MAX_PBUFFER_PIXELS:
+    __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH,		maxPbufferWidth);
+    __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT,		maxPbufferHeight);
+    __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS,		maxPbufferPixels);
     case __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH:
     case __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT:
     case __DRI_ATTRIB_VISUAL_SELECT_GROUP:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8f77d4c..e37c61d 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -175,6 +175,11 @@ struct gl_config
    /* ARB_multisample / SGIS_multisample */
    GLuint samples;
 
+   /* GLX 1.3 */
+   GLint maxPbufferWidth;
+   GLint maxPbufferHeight;
+   GLint maxPbufferPixels;
+
    /* OML_swap_method */
    GLint swapMethod;
 
