1
0
Dominique Leuenberger 2016-07-27 14:08:38 +00:00 committed by Git OBS Bridge
commit 10eb91f0b5
7 changed files with 439 additions and 92 deletions

View File

@ -0,0 +1,413 @@
From: Eric Anholt <eric@anholt.net>
Date: Fri Nov 6 12:27:42 2015 -0800
Subject: [PATCH]glamor: Remove the FBO cache.
Patch-mainline: Upstream
Git-repo: git://anongit.freedesktop.org/xorg/xserver
Git-commit: 950ffb8d6fd1480f305e38c571bda44f247f1de2
References: bsc#983743
Signed-off-by: Max Staudt <mstaudt@suse.de>
It is a modest performance improvement (2.7% on Intel), with the
significant downside that it keeps extra pixmap contents laying around
for 1000 BlockHandlers without the ability for the system to purge
them when under memory pressure, and tiled renderers don't know that
we could avoid reading their current contents when beginning to render
again. We could use the FB invalidate functions, but they aren't
always available, aren't hooked up well in Mesa, and would eat into
the performance gains of having the cache.
[ajax: rebased to master]
Reviewed-by: Adam Jackson <ajax@redhat.com>
---
glamor/glamor.c | 5 --
glamor/glamor_fbo.c | 237 ++-------------------------------------------------
glamor/glamor_priv.h | 27 ------
3 files changed, 6 insertions(+), 263 deletions(-)
diff --git a/glamor/glamor.c b/glamor/glamor.c
index 9c6a0d1..93c94b9 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -110,7 +110,6 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex)
ErrorF("XXX fail to create fbo.\n");
return;
}
- fbo->external = TRUE;
glamor_pixmap_attach_fbo(pixmap, fbo);
}
@@ -226,9 +225,7 @@ glamor_block_handler(ScreenPtr screen)
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
glamor_make_current(glamor_priv);
- glamor_priv->tick++;
glFlush();
- glamor_fbo_expire(glamor_priv);
}
static void
@@ -675,7 +672,6 @@ glamor_init(ScreenPtr screen, unsigned int flags)
ps->Glyphs = glamor_composite_glyphs;
glamor_init_vbo(screen);
- glamor_init_pixmap_fbo(screen);
glamor_init_finish_access_shaders(screen);
#ifdef GLAMOR_GRADIENT_SHADER
@@ -701,7 +697,6 @@ glamor_release_screen_priv(ScreenPtr screen)
glamor_priv = glamor_get_screen_private(screen);
glamor_fini_vbo(screen);
- glamor_fini_pixmap_fbo(screen);
glamor_pixmap_fini(screen);
free(glamor_priv);
diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c
index c6ba095..58f7dc4 100644
--- a/glamor/glamor_fbo.c
+++ b/glamor/glamor_fbo.c
@@ -30,107 +30,9 @@
#include "glamor_priv.h"
-#define GLAMOR_CACHE_EXPIRE_MAX 100
-
-#define GLAMOR_CACHE_DEFAULT 0
-#define GLAMOR_CACHE_EXACT_SIZE 1
-
-//#define NO_FBO_CACHE 1
-#define FBO_CACHE_THRESHOLD (256*1024*1024)
-
-/* Loop from the tail to the head. */
-#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 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); \
- pos = tmp, tmp = __container_of(pos->member.prev, tmp, member))
-
-inline static int
-cache_wbucket(int size)
-{
- int order = __fls(size / 32);
-
- if (order >= CACHE_BUCKET_WCOUNT)
- order = CACHE_BUCKET_WCOUNT - 1;
- return order;
-}
-
-inline static int
-cache_hbucket(int size)
-{
- int order = __fls(size / 32);
-
- if (order >= CACHE_BUCKET_HCOUNT)
- order = CACHE_BUCKET_HCOUNT - 1;
- return order;
-}
-
-static int
-cache_format(GLenum format)
-{
- switch (format) {
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_RED:
- return 2;
- case GL_RGB:
- return 1;
- case GL_RGBA:
- return 0;
- default:
- return -1;
- }
-}
-
-static glamor_pixmap_fbo *
-glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
- int w, int h, GLenum format)
-{
- struct xorg_list *cache;
- glamor_pixmap_fbo *fbo_entry, *ret_fbo = NULL;
- int n_format;
-
-#ifdef NO_FBO_CACHE
- return NULL;
-#else
- n_format = cache_format(format);
- if (n_format == -1)
- return NULL;
- cache = &glamor_priv->fbo_cache[n_format]
- [cache_wbucket(w)]
- [cache_hbucket(h)];
-
- xorg_list_for_each_entry(fbo_entry, cache, list) {
- if (fbo_entry->width == w && fbo_entry->height == h) {
-
- DEBUGF("Request w %d h %d format %x \n", w, h, format);
- DEBUGF("got cache entry %p w %d h %d fbo %d tex %d format %x\n",
- fbo_entry, fbo_entry->width, fbo_entry->height,
- fbo_entry->fb, fbo_entry->tex, fbo_entry->format);
- assert(format == fbo_entry->format);
- xorg_list_del(&fbo_entry->list);
- ret_fbo = fbo_entry;
- break;
- }
- }
-
- if (ret_fbo)
- glamor_priv->fbo_cache_watermark -= ret_fbo->width * ret_fbo->height;
-
- assert(glamor_priv->fbo_cache_watermark >= 0);
-
- return ret_fbo;
-#endif
-}
-
-static void
-glamor_purge_fbo(glamor_screen_private *glamor_priv,
- glamor_pixmap_fbo *fbo)
+void
+glamor_destroy_fbo(glamor_screen_private *glamor_priv,
+ glamor_pixmap_fbo *fbo)
{
glamor_make_current(glamor_priv);
@@ -142,40 +44,6 @@ glamor_purge_fbo(glamor_screen_private *glamor_priv,
free(fbo);
}
-static void
-glamor_pixmap_fbo_cache_put(glamor_screen_private *glamor_priv,
- glamor_pixmap_fbo *fbo)
-{
- struct xorg_list *cache;
- int n_format;
-
-#ifdef NO_FBO_CACHE
- glamor_purge_fbo(fbo);
- return;
-#else
- n_format = cache_format(fbo->format);
-
- if (fbo->fb == 0 || fbo->external || n_format == -1
- || glamor_priv->fbo_cache_watermark >= FBO_CACHE_THRESHOLD) {
- glamor_priv->tick += GLAMOR_CACHE_EXPIRE_MAX;
- glamor_fbo_expire(glamor_priv);
- glamor_purge_fbo(glamor_priv, fbo);
- return;
- }
-
- cache = &glamor_priv->fbo_cache[n_format]
- [cache_wbucket(fbo->width)]
- [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);
-
- glamor_priv->fbo_cache_watermark += fbo->width * fbo->height;
- xorg_list_add(&fbo->list, cache);
- fbo->expire = glamor_priv->tick + GLAMOR_CACHE_EXPIRE_MAX;
-#endif
-}
-
static int
glamor_pixmap_ensure_fb(glamor_screen_private *glamor_priv,
glamor_pixmap_fbo *fbo)
@@ -235,20 +103,14 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
if (fbo == NULL)
return NULL;
- xorg_list_init(&fbo->list);
-
fbo->tex = tex;
fbo->width = w;
fbo->height = h;
- fbo->external = FALSE;
fbo->format = format;
- if (flag == CREATE_PIXMAP_USAGE_SHARED)
- fbo->external = TRUE;
-
if (flag != GLAMOR_CREATE_FBO_NO_FBO) {
if (glamor_pixmap_ensure_fb(glamor_priv, fbo) != 0) {
- glamor_purge_fbo(glamor_priv, fbo);
+ glamor_destroy_fbo(glamor_priv, fbo);
fbo = NULL;
}
}
@@ -256,79 +118,6 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
return fbo;
}
-void
-glamor_fbo_expire(glamor_screen_private *glamor_priv)
-{
- struct xorg_list *cache;
- glamor_pixmap_fbo *fbo_entry, *tmp;
- int i, j, k;
-
- for (i = 0; i < CACHE_FORMAT_COUNT; i++)
- for (j = 0; j < CACHE_BUCKET_WCOUNT; j++)
- for (k = 0; k < CACHE_BUCKET_HCOUNT; k++) {
- cache = &glamor_priv->fbo_cache[i][j][k];
- xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache,
- list) {
- if (GLAMOR_TICK_AFTER(fbo_entry->expire, glamor_priv->tick)) {
- break;
- }
-
- glamor_priv->fbo_cache_watermark -=
- fbo_entry->width * fbo_entry->height;
- 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(glamor_priv, fbo_entry);
- }
- }
-
-}
-
-void
-glamor_init_pixmap_fbo(ScreenPtr screen)
-{
- glamor_screen_private *glamor_priv;
- int i, j, k;
-
- glamor_priv = glamor_get_screen_private(screen);
- for (i = 0; i < CACHE_FORMAT_COUNT; i++)
- for (j = 0; j < CACHE_BUCKET_WCOUNT; j++)
- for (k = 0; k < CACHE_BUCKET_HCOUNT; k++) {
- xorg_list_init(&glamor_priv->fbo_cache[i][j][k]);
- }
- glamor_priv->fbo_cache_watermark = 0;
-}
-
-void
-glamor_fini_pixmap_fbo(ScreenPtr screen)
-{
- struct xorg_list *cache;
- glamor_screen_private *glamor_priv;
- glamor_pixmap_fbo *fbo_entry, *tmp;
- int i, j, k;
-
- glamor_priv = glamor_get_screen_private(screen);
- for (i = 0; i < CACHE_FORMAT_COUNT; i++)
- for (j = 0; j < CACHE_BUCKET_WCOUNT; j++)
- for (k = 0; k < CACHE_BUCKET_HCOUNT; k++) {
- cache = &glamor_priv->fbo_cache[i][j][k];
- xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache,
- list) {
- xorg_list_del(&fbo_entry->list);
- glamor_purge_fbo(glamor_priv, fbo_entry);
- }
- }
-}
-
-void
-glamor_destroy_fbo(glamor_screen_private *glamor_priv,
- glamor_pixmap_fbo *fbo)
-{
- xorg_list_del(&fbo->list);
- glamor_pixmap_fbo_cache_put(glamor_priv, fbo);
-
-}
-
static int
_glamor_create_tex(glamor_screen_private *glamor_priv,
int w, int h, GLenum format)
@@ -368,22 +157,8 @@ glamor_pixmap_fbo *
glamor_create_fbo(glamor_screen_private *glamor_priv,
int w, int h, GLenum format, int flag)
{
- glamor_pixmap_fbo *fbo;
- GLint tex = 0;
-
- if (flag == GLAMOR_CREATE_FBO_NO_FBO || flag == CREATE_PIXMAP_USAGE_SHARED)
- goto new_fbo;
-
- fbo = glamor_pixmap_fbo_cache_get(glamor_priv, w, h, format);
- if (fbo)
- return fbo;
- new_fbo:
- tex = _glamor_create_tex(glamor_priv, w, h, format);
- if (!tex)
- return NULL;
- fbo = glamor_create_fbo_from_tex(glamor_priv, w, h, format, tex, flag);
-
- return fbo;
+ GLint tex = _glamor_create_tex(glamor_priv, w, h, format);
+ return glamor_create_fbo_from_tex(glamor_priv, w, h, format, tex, flag);
}
/**
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index a70f10e..78346bf 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -184,16 +184,7 @@ struct glamor_saved_procs {
ScreenBlockHandlerProcPtr block_handler;
};
-#define CACHE_FORMAT_COUNT 3
-
-#define CACHE_BUCKET_WCOUNT 4
-#define CACHE_BUCKET_HCOUNT 4
-
-#define GLAMOR_TICK_AFTER(t0, t1) \
- (((int)(t1) - (int)(t0)) < 0)
-
typedef struct glamor_screen_private {
- unsigned int tick;
enum glamor_gl_flavor gl_flavor;
int glsl_version;
Bool has_pack_invert;
@@ -213,10 +204,6 @@ typedef struct glamor_screen_private {
GLuint one_channel_format;
- struct xorg_list
- fbo_cache[CACHE_FORMAT_COUNT][CACHE_BUCKET_WCOUNT][CACHE_BUCKET_HCOUNT];
- unsigned long fbo_cache_watermark;
-
/* glamor point shader */
glamor_program point_prog;
@@ -330,21 +317,10 @@ enum glamor_fbo_state {
};
typedef struct glamor_pixmap_fbo {
- struct xorg_list list; /**< linked list pointers when in the fbo cache */
- /** glamor_priv->tick number when this FBO will be expired from the cache. */
- unsigned int expire;
GLuint tex; /**< GL texture name */
GLuint fb; /**< GL FBO name */
int width; /**< width in pixels */
int height; /**< height in pixels */
- /**
- * Flag for when texture contents might be shared with a
- * non-glamor user.
- *
- * This is used to avoid putting textures used by other clients
- * into the FBO cache.
- */
- Bool external;
GLenum format; /**< GL format used to create the texture. */
GLenum type; /**< GL type used to create the texture. */
} glamor_pixmap_fbo;
@@ -588,10 +564,7 @@ glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w,
void glamor_destroy_fbo(glamor_screen_private *glamor_priv,
glamor_pixmap_fbo *fbo);
void glamor_pixmap_destroy_fbo(PixmapPtr pixmap);
-void glamor_init_pixmap_fbo(ScreenPtr screen);
-void glamor_fini_pixmap_fbo(ScreenPtr screen);
Bool glamor_pixmap_fbo_fixup(ScreenPtr screen, PixmapPtr pixmap);
-void glamor_fbo_expire(glamor_screen_private *glamor_priv);
/* Return whether 'picture' is alpha-only */
static inline Bool glamor_picture_is_alpha(PicturePtr picture)

View File

@ -1,37 +0,0 @@
From: Dave Airlie <airlied@gmail.com>
Date: Fri Apr 29 14:01:31 2016 +1000
Subject: [PATCH]modesetting: set driverPrivate to NULL after closing fd.
Patch-mainline: Upstream
Git-repo: git://anongit.freedesktop.org/git/xorg/xserver
Git-commit: a41a171bcbae9aeafac2865faa904f15d9b59925
References: boo#981268
Signed-off-by: Egbert Eich <eich@suse.com>
Otherwise ms_ent_priv will return NULL and things will fall apart.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
hw/xfree86/drivers/modesetting/driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index c97f33a..abf7e1a 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -635,7 +635,6 @@ FreeRec(ScrnInfoPtr pScrn)
ms = modesettingPTR(pScrn);
if (!ms)
return;
- pScrn->driverPrivate = NULL;
if (ms->fd > 0) {
modesettingEntPtr ms_ent;
@@ -656,6 +655,7 @@ FreeRec(ScrnInfoPtr pScrn)
ms_ent->fd = 0;
}
}
+ pScrn->driverPrivate = NULL;
free(ms->drmmode.Options);
free(ms);

View File

@ -1,47 +0,0 @@
Subject: [PATCH] Change include order to avoid conflict with system header
From: Andreas Schwab <schwab@suse.de>
R_SP is also defined in <sys/ucontext.h> on m68k.
Also remove duplicate definitions.
Signed-off-by: Andreas Schwab <schwab@suse.de>
Index: xorg-server-1.14.3/hw/xfree86/int10/xf86x86emu.c
===================================================================
--- xorg-server-1.14.3.orig/hw/xfree86/int10/xf86x86emu.c
+++ xorg-server-1.14.3/hw/xfree86/int10/xf86x86emu.c
@@ -7,7 +7,6 @@
#include <xorg-config.h>
#endif
-#include <x86emu.h>
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86Pci.h"
@@ -15,6 +14,7 @@
#define _INT10_PRIVATE
#include "xf86int10.h"
#include "int10Defines.h"
+#include <x86emu.h>
#define M _X86EMU_env
Index: xorg-server-1.14.3/hw/xfree86/x86emu/x86emu/regs.h
===================================================================
--- xorg-server-1.14.3.orig/hw/xfree86/x86emu/x86emu/regs.h
+++ xorg-server-1.14.3/hw/xfree86/x86emu/x86emu/regs.h
@@ -147,14 +147,6 @@ struct i386_segment_regs {
#define R_FLG spc.FLAGS
/* special registers */
-#define R_SP spc.SP.I16_reg.x_reg
-#define R_BP spc.BP.I16_reg.x_reg
-#define R_SI spc.SI.I16_reg.x_reg
-#define R_DI spc.DI.I16_reg.x_reg
-#define R_IP spc.IP.I16_reg.x_reg
-#define R_FLG spc.FLAGS
-
-/* special registers */
#define R_ESP spc.SP.I32_reg.e_reg
#define R_EBP spc.BP.I32_reg.e_reg
#define R_ESI spc.SI.I32_reg.e_reg

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ea739c22517cdbe2b5f7c0a5fd05fe8a10ac0629003e71c0c7862f4bb60142cd
size 5867330

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:278459b2c31d61a15655d95a72fb79930c480a6bb8cf9226e48a07df8b1d31c8
size 6009508

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Tue Jul 19 22:44:59 UTC 2016 - tobias.johannes.klausmann@mni.thm.de
- Update to version 1.18.4:
Another pile of backports from the devel branch, primarily in glamor,
xwayland, and the modesetting driver.
- Remove included patches:
+ u_x86emu-include-order.patch
+ U_modesetting-set-driverPrivate-to-NULL-after-closing-fd.patch
- Update patches to reflect upstream changes:
+ U_glamor-Remove-the-FBO-cache.patch
-------------------------------------------------------------------
Tue Jul 19 12:01:14 UTC 2016 - mstaudt@suse.com
- U_glamor-Remove-the-FBO-cache.patch
Fixes (bsc#983743) by not keeping >1 GB of VRAM busy.
-------------------------------------------------------------------
Tue May 24 06:20:16 UTC 2016 - eich@suse.com

View File

@ -42,7 +42,7 @@
Name: xorg-x11-server
%define dirsuffix 1.18.3
%define dirsuffix 1.18.4
Summary: X
License: MIT
@ -186,7 +186,6 @@ Patch9: u_xorg-wrapper-build-Build-position-independent-code.patch
Patch100: u_01-Improved-ConfineToShape.patch
Patch101: u_02-DIX-ConfineTo-Don-t-bother-about-the-bounding-box-when-grabbing-a-shaped-window.patch
# PATCH-FIX-UPSTREAM u_x86emu-include-order.patch schwab@suse.de -- Change include order to avoid conflict with system header, remove duplicate definitions
Patch102: u_x86emu-include-order.patch
Patch104: u_xorg-server-xdmcp.patch
Patch112: u_render-Cast-color-masks-to-unsigned-long-before-shifting-them.patch
@ -201,6 +200,8 @@ Patch208: u_Panning-Set-panning-state-in-xf86RandR12ScreenSetSize.patch
Patch209: u_pci-primary-Fix-up-primary-PCI-device-detection-for-the-platfrom-bus.patch
Patch210: u_os-connections-Check-for-stale-FDs.patch
Patch600: U_glamor-Remove-the-FBO-cache.patch
Patch1000: n_xserver-optimus-autoconfig-hack.patch
Patch1162: b_cache-xkbcomp-output-for-fast-start-up.patch
@ -216,7 +217,6 @@ Patch1228: U_ephyr-enable-option-sw-cursor-by-default-in-multi-se.patch
Patch1229: U_kdrive-introduce-input-hot-plugging-support-for-udev.patch
Patch1230: U_kdrive-add-options-to-set-default-XKB-properties.patch
Patch1232: U_config-udev-distinguish-between-real-keyboards-and-o.patch
Patch1233: U_modesetting-set-driverPrivate-to-NULL-after-closing-fd.patch
%description
This package contains the X.Org Server.
@ -322,7 +322,6 @@ sh %{SOURCE92} --verify . %{SOURCE91}
#
%patch100 -p1
#%patch101 -p1
%patch102 -p1
%patch104 -p1
%patch112 -p1
@ -338,6 +337,8 @@ sh %{SOURCE92} --verify . %{SOURCE91}
%patch209 -p1
%patch210 -p1
%patch600 -p1
%patch1000 -p1
### disabled for now
@ -357,7 +358,6 @@ sh %{SOURCE92} --verify . %{SOURCE91}
%patch1230 -p1
%patch1232 -p1
%patch1233 -p1
%build
test -e source-file-list || \