D23669: Generate mipmaps for image down-scaling

Roman Gilg <[email protected]>
Newsgroups gmane.comp.kde.devel.kwin
Message-ID <[email protected]>
romangg added inline comments.

INLINE COMMENTS

> davidedmundson wrote in scene_opengl.cpp:1383
> That's a bit lazy.
> 
> Always using GL_LINEAR AFAIK is fine, but always generating mipmaps has a cost.
> 
> We should be able to do some sort of
> 
> if (windowPixmap->surface()->scale() != output->scale())
> 
> We also probably only want to generate mipmaps if the contents have changed.
> 
> GLTexture has a dirty() flag which signifes this.

> if (windowPixmap->surface()->scale() != output->scale())

One would need to loop through all surface-entered outputs and check if logical size and mode size don't have a common divisor. I can't say if that would be worth it or if we should create mipmaps just all the time. After all they are generated on the GPU and that very fast.

> We also probably only want to generate mipmaps if the contents have changed.
> 
> GLTexture has a dirty() flag which signifes this.

This makes sense. But can you explain to me how the dirty() flag actually works? I see that it gets set at some point but I don't see where it gets unset again.

> zzag wrote in scene_opengl.cpp:1495-1497
> I don't understand this part. Window contents is rendered and after that mipmaps are generated. I think it should be vice versa.

Why do you think it should be vice versa?

Mipmaps are scaled down copies of a texture such that arbitrary down-scaling can be done quickly and without artifacts. That means the original must have been rendered already so it can be duplicated.

Maybe in the end it doesn't make a difference because it's a Gl command on the GPU.

REPOSITORY
  R108 KWin

REVISION DETAIL
  https://phabricator.kde.org/D23669

To: romangg, #kwin, zzag
Cc: zzag, davidedmundson, kwin, LeGast00n, The-Feren-OS-Dev, sbergeron, jraleigh, fbampaloukas, GB_2, mkulinski, ragreen, jackyalcine, Pitel, iodelay, crozbo, bwowk, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, hardening, romangg, jensreuterberg, abetts, sebas, apol, mart
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.