[Glamor] [PATCH 1/2] Fixup For list.h change in xorg

He Junyan junyan.he at linux.intel.com
Mon Mar 5 00:39:00 PST 2012


Hi Zhigang:

New patch add
  #include <list.h>
+/* The list.h rename all the function to add xorg_ prefix.
+   We add hack here to avoid the compile error when using
+   old version xserver header file.
+   These will be removed in future. */
+#ifndef xorg_list_entry
+#define xorg_list list
+#define xorg_list_for_each_entry list_for_each_entry
+#define xorg_list_for_each_entry_safe list_for_each_entry_safe
+#define xorg_list_del list_del
+#define xorg_list_add list_add
+#define xorg_list_append list_append
+#define xorg_list_init list_init
+#endif
+
to hack and handle what you said.

Junyan


> On Wed, Feb 29, 2012 at 07:23:45AM +0800, junyan.he at linux.intel.com wrote:
>> From: Junyan He<junyan.he at linux.intel.com>
>>
>>   Because the file list.h in xorg/include has changed the
>>   functions and struct names, adding xorg_ prefix before
>>   the original name. So Modify glamor_screen_private
>>   struct and the code which use list's functions in
>>   glamor_fbo.c
>
> Just as we discussed, would you refine this patch and copy the xog_list related
> macros to here from the latest xserver, and check whether xorg_list_for_each_entry
> is defined, if it is not defined, we use ourself's.
>
> Then we can also build with the old xserver header file.
>
>>
>>
>> Signed-off-by: Junyan He<junyan.he at linux.intel.com>
>> ---
>>   src/glamor_fbo.c  |   50 +++++++++++++++++++++++++-------------------------
>>   src/glamor_priv.h |    6 +++---
>>   2 files changed, 28 insertions(+), 28 deletions(-)
>>
>> diff --git a/src/glamor_fbo.c b/src/glamor_fbo.c
>> index b4e4af7..3ae6562 100644
>> --- a/src/glamor_fbo.c
>> +++ b/src/glamor_fbo.c
>> @@ -9,13 +9,13 @@
>>   #define GLAMOR_CACHE_TEXTURE	2
>>
>>   /* Loop from the tail to the head. */
>> -#define list_for_each_entry_reverse(pos, head, member)                  \
>> +#define xorg_list_for_each_entry_reverse(pos, head, member)             \
>>       for (pos = __container_of((head)->prev, pos, member);               \
>>            &pos->member != (head);                                        \
>>            pos = __container_of(pos->member.prev, pos, member))
>>
>>
>> -#define list_for_each_entry_safe_reverse(pos, tmp, head, member)        \
>> +#define xorg_list_for_each_entry_safe_reverse(pos, tmp, head, member)   \
>>       for (pos = __container_of((head)->prev, pos, member),               \
>>            tmp = __container_of(pos->member.prev, pos, member);           \
>>            &pos->member != (head);                                        \
>> @@ -77,7 +77,7 @@ glamor_pixmap_fbo *
>>   glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
>>   			    int w, int h, GLenum format, int flag)
>>   {
>> -	struct list *cache;
>> +	struct xorg_list *cache;
>>   	glamor_pixmap_fbo *fbo_entry;
>>   	int size;
>>
>> @@ -90,27 +90,27 @@ glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
>>   					       [cache_wbucket(w)]
>>   					       [cache_hbucket(h)];
>>   	if (!(flag&  GLAMOR_CACHE_EXACT_SIZE)) {
>> -		list_for_each_entry(fbo_entry, cache, list) {
>> +		xorg_list_for_each_entry(fbo_entry, cache, list) {
>>   			if (fbo_entry->width>= w&&  fbo_entry->height>= h) {
>>
>>   				DEBUGF("Request w %d h %d \n", w, h);
>>   				DEBUGF("got cache entry %p w %d h %d fbo %d tex %d\n",
>>   					fbo_entry, fbo_entry->width, fbo_entry->height,
>>   					fbo_entry->fb, fbo_entry->tex);
>> -				list_del(&fbo_entry->list);
>> +				xorg_list_del(&fbo_entry->list);
>>   				return fbo_entry;
>>   			}
>>   		}
>>   	}
>>   	else {
>> -		list_for_each_entry(fbo_entry, cache, list) {
>> +		xorg_list_for_each_entry(fbo_entry, cache, list) {
>>   			if (fbo_entry->width == w&&  fbo_entry->height == h) {
>>
>>   				DEBUGF("Request w %d h %d \n", w, h);
>>   				DEBUGF("got cache entry %p w %d h %d fbo %d tex %d\n",
>>   					fbo_entry, fbo_entry->width, fbo_entry->height,
>>   					fbo_entry->fb, fbo_entry->tex);
>> -				list_del(&fbo_entry->list);
>> +				xorg_list_del(&fbo_entry->list);
>>   				return fbo_entry;
>>   			}
>>   		}
>> @@ -138,7 +138,7 @@ glamor_purge_fbo(glamor_pixmap_fbo *fbo)
>>   void
>>   glamor_pixmap_fbo_cache_put(glamor_pixmap_fbo *fbo)
>>   {
>> -	struct list *cache;
>> +	struct xorg_list *cache;
>>
>>   	if (fbo->fb == 0) {
>>   		glamor_purge_fbo(fbo);
>> @@ -155,7 +155,7 @@ glamor_pixmap_fbo_cache_put(glamor_pixmap_fbo *fbo)
>>   						    [cache_hbucket(fbo->height)];
>>   	DEBUGF("Put cache entry %p to cache %p w %d h %d format %x fbo %d tex %d \n", fbo, cache,
>>   		fbo->width, fbo->height, fbo->format, fbo->fb, fbo->tex);
>> -	list_add(&fbo->list, cache);
>> +	xorg_list_add(&fbo->list, cache);
>>   	fbo->expire = fbo->glamor_priv->tick + GLAMOR_CACHE_EXPIRE_MAX;
>>   }
>>
>> @@ -170,7 +170,7 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
>>   	if (fbo == NULL)
>>   		return NULL;
>>
>> -	list_init(&fbo->list);
>> +	xorg_list_init(&fbo->list);
>>   	gl_iformat_for_depth(depth,&format);
>>
>>   	fbo->tex = tex;
>> @@ -189,7 +189,7 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
>>   void
>>   glamor_fbo_expire(glamor_screen_private *glamor_priv)
>>   {
>> -	struct list *cache;
>> +	struct xorg_list *cache;
>>   	glamor_pixmap_fbo *fbo_entry, *tmp;
>>   	int i,j,k;
>>   	int empty_cache = TRUE;
>> @@ -198,24 +198,24 @@ glamor_fbo_expire(glamor_screen_private *glamor_priv)
>>   		for(j = 0; j<  CACHE_BUCKET_WCOUNT; j++)
>>   			for(k = 0; k<  CACHE_BUCKET_HCOUNT; k++) {
>>   				cache =&glamor_priv->fbo_cache[i][j][k];
>> -				list_for_each_entry_safe_reverse(fbo_entry, tmp, cache, list) {
>> +				xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache, list) {
>>   					if (GLAMOR_TICK_AFTER(fbo_entry->expire, glamor_priv->tick)) {
>>   						empty_cache = FALSE;
>>   						break;
>>   					}
>> -					list_del(&fbo_entry->list);
>> +					xorg_list_del(&fbo_entry->list);
>>   					DEBUGF("cache %p fbo %p expired %d current %d \n", cache, fbo_entry,
>>   						fbo_entry->expire, glamor_priv->tick);
>>   					glamor_purge_fbo(fbo_entry);
>>   				}
>>   #if 0
>>   				cache =&glamor_priv->tex_cache[i][j][k];
>> -				list_for_each_entry_safe_reverse(fbo_entry, tmp, cache, list) {
>> +				xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache, list) {
>>   					if (GLAMOR_TICK_AFTER(fbo_entry->expire, glamor_priv->tick)) {
>>   						empty_cache = FALSE;
>>   						break;
>>   					}
>> -					list_del(&fbo_entry->list);
>> +					xorg_list_del(&fbo_entry->list);
>>   					DEBUGF("cache %p fbo %p expired %d current %d \n", cache, fbo_entry,
>>   						fbo_entry->expire, glamor_priv->tick);
>>   					glamor_purge_fbo(fbo_entry);
>> @@ -236,15 +236,15 @@ glamor_init_pixmap_fbo(ScreenPtr screen)
>>   		for(j = 0; j<  CACHE_BUCKET_WCOUNT; j++)
>>   			for(k = 0; k<  CACHE_BUCKET_HCOUNT; k++)
>>   			{
>> -				list_init(&glamor_priv->fbo_cache[i][j][k]);
>> -				list_init(&glamor_priv->tex_cache[i][j][k]);
>> +				xorg_list_init(&glamor_priv->fbo_cache[i][j][k]);
>> +				xorg_list_init(&glamor_priv->tex_cache[i][j][k]);
>>   			}
>>   }
>>
>>   void
>>   glamor_fini_pixmap_fbo(ScreenPtr screen)
>>   {
>> -	struct list *cache;
>> +	struct xorg_list *cache;
>>   	glamor_screen_private *glamor_priv;
>>   	glamor_pixmap_fbo *fbo_entry, *tmp;
>>   	int i,j,k;
>> @@ -255,14 +255,14 @@ glamor_fini_pixmap_fbo(ScreenPtr screen)
>>   			for(k = 0; k<  CACHE_BUCKET_HCOUNT; k++)
>>   			{
>>   				cache =&glamor_priv->fbo_cache[i][j][k];
>> -				list_for_each_entry_safe_reverse(fbo_entry, tmp, cache, list) {
>> -					list_del(&fbo_entry->list);
>> +				xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache, list) {
>> +					xorg_list_del(&fbo_entry->list);
>>   					glamor_purge_fbo(fbo_entry);
>>   				}
>>   #if 0
>>   				cache =&glamor_priv->tex_cache[i][j][k];
>> -				list_for_each_entry_safe_reverse(fbo_entry, tmp, cache, list) {
>> -					list_del(&fbo_entry->list);
>> +				xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache, list) {
>> +					xorg_list_del(&fbo_entry->list);
>>   					glamor_purge_fbo(fbo_entry);
>>   				}
>>   #endif
>> @@ -272,7 +272,7 @@ glamor_fini_pixmap_fbo(ScreenPtr screen)
>>   void
>>   glamor_destroy_fbo(glamor_pixmap_fbo *fbo)
>>   {
>> -	list_del(&fbo->list);
>> +	xorg_list_del(&fbo->list);
>>   	glamor_pixmap_fbo_cache_put(fbo);
>>
>>   }
>> @@ -297,7 +297,7 @@ glamor_create_tex_obj(glamor_screen_private *glamor_priv,
>>   	if (fbo == NULL)
>>   		return NULL;
>>
>> -	list_init(&fbo->list);
>> +	xorg_list_init(&fbo->list);
>>
>>   	dispatch = glamor_get_dispatch(glamor_priv);
>>   	dispatch->glGenTextures(1,&tex);
>> @@ -323,7 +323,7 @@ void
>>   glamor_destroy_tex_obj(glamor_pixmap_fbo * tex_obj)
>>   {
>>   	assert(tex_obj->fb == 0);
>> -	list_del(&tex_obj->list);
>> +	xorg_list_del(&tex_obj->list);
>>   	glamor_pixmap_fbo_cache_put(tex_obj);
>>   }
>>
>> diff --git a/src/glamor_priv.h b/src/glamor_priv.h
>> index b9670a3..84aef97 100644
>> --- a/src/glamor_priv.h
>> +++ b/src/glamor_priv.h
>> @@ -177,8 +177,8 @@ typedef struct glamor_screen_private {
>>   	int has_fbo_blit;
>>   	int max_fbo_size;
>>
>> -	struct list fbo_cache[CACHE_FORMAT_COUNT][CACHE_BUCKET_WCOUNT][CACHE_BUCKET_HCOUNT];
>> -	struct list tex_cache[CACHE_FORMAT_COUNT][CACHE_BUCKET_WCOUNT][CACHE_BUCKET_HCOUNT];
>> +	struct xorg_list fbo_cache[CACHE_FORMAT_COUNT][CACHE_BUCKET_WCOUNT][CACHE_BUCKET_HCOUNT];
>> +	struct xorg_list tex_cache[CACHE_FORMAT_COUNT][CACHE_BUCKET_WCOUNT][CACHE_BUCKET_HCOUNT];
>>
>>   	/* glamor_solid */
>>   	GLint solid_prog;
>> @@ -262,7 +262,7 @@ typedef union _glamor_pending_op {
>>    * @glamor_priv: point to glamor private data.
>>    */
>>   typedef struct glamor_pixmap_fbo {
>> -	struct list list;
>> +	struct xorg_list list;
>>   	unsigned int expire;
>>   	unsigned char pbo_valid;
>>   	GLuint tex;
>> --
>> 1.7.7.6
>>
>> _______________________________________________
>> Glamor mailing list
>> Glamor at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/glamor
> _______________________________________________
> Glamor mailing list
> Glamor at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/glamor
>


More information about the Glamor mailing list