Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 17704 Details for
Bug 28712
Patches to reduce 3ddeskd's memory-footprint dramatically and fix a minor bug
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
The patch to fix the bug, cut down mem-consumption and make the use of compressed textures possible
3ddeskMEM+Compression+Fix (text/plain), 8.33 KB, created by
Christoph Richter
on 2003-09-14 10:06:37 UTC
(
hide
)
Description:
The patch to fix the bug, cut down mem-consumption and make the use of compressed textures possible
Filename:
MIME Type:
Creator:
Christoph Richter
Created:
2003-09-14 10:06:37 UTC
Size:
8.33 KB
patch
obsolete
>## This patch reduces the memory-consumption, especially if texture-compression gets activated >## activate compression by putting "compression 1" into your 3ddesktop.conf >## It also fixes a little problem with the acquiry-timing. >## config->options->acquire was assigned 1 bit only, but it needs to be at least int to be useable > >diff -u 3ddesktop-0.2.5/3ddeskd.cpp 3ddesktop-0.2.5.1/3ddeskd.cpp >--- 3ddesktop-0.2.5/3ddeskd.cpp 2003-03-15 04:08:31.000000000 +0100 >+++ 3ddesktop-0.2.5.1/3ddeskd.cpp 2003-09-14 18:07:05.794179264 +0200 >@@ -1392,7 +1392,7 @@ > > if (msgmgr.msg.reload) > cfg->reload(); >- >+ > if (GLWin.grab_screenshot_data() < 0) { > msgout (ERROR, "couldn't grab screen image\n"); > end_program(-1); >@@ -1401,7 +1401,6 @@ > face_set->load_texture_data(current_col + (current_row * col_count), > cfg->texture_size, > GLWin.get_screenshot_data_ptr() ); >- > continue; // don't activate > > break; >@@ -1421,7 +1420,7 @@ > msgout (DEBUG, "acquire sleep is %d\n", msgmgr.msg.acquire_sleep); > sleep_ms (msgmgr.msg.acquire_sleep); > } >- >+ > if (GLWin.grab_screenshot_data() < 0) { > msgout (ERROR, "couldn't grab screen image\n"); > end_program(-1); >@@ -1984,8 +1983,10 @@ > > vdesks.set_vdesktop (j, i); > >- if (cfg->options->acquire > 1) >+ if (cfg->options->acquire > 1) { >+ msgout (DEBUG, "sleeping", cfg->options->acquire); > sleep_ms (cfg->options->acquire); >+ } > > if (GLWin.grab_screenshot_data() < 0) { > msgout (ERROR, "couldn't grab screen image\n"); >@@ -1995,19 +1996,18 @@ > face_set->load_texture_data(j + (i * col_count), > cfg->texture_size, > GLWin.get_screenshot_data_ptr() ); >+ > } > } >- > // go back to current > vdesks.set_vdesktop (current_col, current_row); > > } >- >+ > load_digits(); > > em.add_event (ENTRY_MOVEMENT_START, entry_move_start_hook, NULL, 1); >- em.add_event (EXIT_MOVEMENT_START, exit_move_start_hook, NULL, 1); >- >+ em.add_event (EXIT_MOVEMENT_START, exit_move_start_hook, NULL, 1); > } // END initialize_3ddesktop > > >diff -u 3ddesktop-0.2.5/3ddesktop.conf 3ddesktop-0.2.5.1/3ddesktop.conf >--- 3ddesktop-0.2.5/3ddesktop.conf 2003-03-21 18:19:00.000000000 +0100 >+++ 3ddesktop-0.2.5.1/3ddesktop.conf 2003-09-14 18:06:47.669934568 +0200 >@@ -33,13 +33,17 @@ > # (for debuggin: not really usable at this time) > # early_desktop_switch - When desktop is switched (default true) > # disable_keys_in_goto - Disable keys while in an automated "goto" (default true) >- >+# compression - enables texture compression, which saves about >+# 16MB of resident memory at the default >+# texturesize > # > # Examples (uncomment to use) > # > > #texturesize 512 > >+#compression 1 >+ > #wm kde2 > > >diff -u 3ddesktop-0.2.5/config.hpp 3ddesktop-0.2.5.1/config.hpp >--- 3ddesktop-0.2.5/config.hpp 2003-03-21 18:09:24.000000000 +0100 >+++ 3ddesktop-0.2.5.1/config.hpp 2003-09-14 18:07:02.174729504 +0200 >@@ -72,7 +72,8 @@ > char name[50]; > > // bits/bools on/off >- int acquire : 1; >+ int compression : 1; // texture compression >+// int acquire : 1; //acquire needs more than 1 bit (10<acquire<3000). initialised as int below. > int show_fps : 1; > int show_digits : 1; > int do_fullscreen : 1; >@@ -99,7 +100,7 @@ > #else > char base_dir[PATH_MAX]; > #endif >- >+ int acquire; > int random_fun_delay; // 15 > > float animation_speed; // ms between animations >@@ -147,6 +148,7 @@ > __early_desktop_switch = 1; > __disable_keys_in_goto = 1; > >+ compression = 0; //disable texture-compression by default, could be slow on older boxen > acquire = 0; > show_fps = 0; > show_digits = 1; >@@ -325,6 +327,9 @@ > end_program(-1); // should I ignore this error? > break; > } >+ } else if (strcmp(option, "compression") == 0) { >+ compression = get_boolean (value); //could be nice to be able to select the type of compression >+ //(COMPRESSED_RGBA_S3TC_DXT1_EXT, DXT3, DXT5,...) > > } else if (strcmp(option, "fastest") == 0) { > use_context_switch = get_boolean (value); >@@ -441,7 +446,6 @@ > > } else if (strcmp(option, "disable_keys_in_goto") == 0) { > __disable_keys_in_goto = get_boolean (value); >- > } > > return 0; // success > >diff -u 3ddesktop-0.2.5/face.hpp 3ddesktop-0.2.5.1/face.hpp >--- 3ddesktop-0.2.5/face.hpp 2003-02-17 02:55:29.000000000 +0100 >+++ 3ddesktop-0.2.5.1/face.hpp 2003-09-14 18:06:47.675933656 +0200 >@@ -238,8 +238,9 @@ > > glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, MIN_FILTER); > glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, MAX_FILTER); >- >- gluBuild2DMipmaps(GL_TEXTURE_2D, 3, texture_size, texture_size, GL_RGBA, GL_UNSIGNED_BYTE, data); >+ if (cfg->options->compression == 0) >+ gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, texture_size, texture_size, GL_RGBA, GL_UNSIGNED_BYTE, data); >+ else gluBuild2DMipmaps(GL_TEXTURE_2D, GL_COMPRESSED_RGBA, texture_size, texture_size, GL_RGBA, GL_UNSIGNED_BYTE, data); > } > > }; > >diff -u 3ddesktop-0.2.5/win.cpp 3ddesktop-0.2.5.1/win.cpp >--- 3ddesktop-0.2.5/win.cpp 2003-02-17 02:53:35.000000000 +0100 >+++ 3ddesktop-0.2.5.1/win.cpp 2003-09-14 18:06:58.426299352 +0200 >@@ -91,7 +91,7 @@ > > GLWindow::~GLWindow() { > if (screenshot_data) >- delete screenshot_data; >+ delete screenshot_data; > } > > int GLWindow::open_display() >@@ -129,7 +129,7 @@ > imlib_context_set_anti_alias(1); > imlib_context_set_blend(0); > >- img = imlib_create_image(screen_width, screen_height); >+ // img = imlib_create_image(screen_width, screen_height); > > XSetErrorHandler(X_errors_handler); > >@@ -501,7 +501,7 @@ > msgout (ERROR, "out of memory\n"); > end_program(-1); > } >- >+ img = imlib_create_image(screen_width, screen_height); > imgfinal = imlib_create_image(cfg->texture_size, cfg->texture_size); > > } >@@ -554,7 +554,9 @@ > > } > } >- >+ imlib_free_image(); >+ imlib_context_set_image(img); >+ imlib_free_image(); > return 0; > } > >@@ -569,25 +571,13 @@ > end_program(-1); > } > >- imgfinal = imlib_create_image(cfg->texture_size, cfg->texture_size); >+ // imgfinal = imlib_create_image(cfg->texture_size, cfg->texture_size); > } >- >- /* set the display , visual, colormap and drawable we are using */ >+ img = imlib_create_image_from_drawable((Pixmap)0,0,0,screen_width,screen_height,1); >+ > imlib_context_set_image(img); >- imlib_copy_drawable_to_image((Pixmap)0, //Pixmap mask, >- 0, 0, //int x, int y, >- screen_width, //int width, int height, >- screen_height, >- 0, 0, //int destination_x, int destination_y, >- 1 ); //char need_to_grab_x); >- >- imlib_context_set_image(imgfinal); >- imlib_image_clear(); >- >- imlib_blend_image_onto_image(img, 0, >- 0, 0, screen_width, screen_height, >- 0, 0, cfg->texture_size, cfg->texture_size); >- >+ imgfinal = imlib_create_cropped_scaled_image(0,0,screen_width,screen_height,cfg->texture_size,cfg->texture_size); >+ imlib_context_set_image(imgfinal); > unsigned int *tmp = imlib_image_get_data(); > > int w = imlib_image_get_width(); >@@ -610,11 +600,13 @@ > screenshot_data[offset + 1] = (tmp[img_offset] >> 8) & 0xff; > screenshot_data[offset + 2] = tmp[img_offset] & 0xff; > screenshot_data[offset + 3] = (tmp[img_offset] >> 24) & 0xff; >- >- >+ > } > } > >+ imlib_free_image(); // saves ~ 10MB of res. Mem @1024x1024 texture_size >+ imlib_context_set_image(img); >+ imlib_free_image(); > return 0; > } > > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 28712
: 17704 |
23494